群发通知
This commit is contained in:
54
core/apps/AppMassNotification/AppMassNotification.vue
Normal file
54
core/apps/AppMassNotification/AppMassNotification.vue
Normal file
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<section class="AppMassNotification">
|
||||
<keep-alive :include="['List']">
|
||||
<component ref="component" :is="component" :instance="instance" :params="params" :dict="dict" @change="onChange"/>
|
||||
</keep-alive>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import List from "./components/List.vue";
|
||||
import Add from "./components/Add.vue";
|
||||
|
||||
export default {
|
||||
name: "AppMassNotification",
|
||||
label: "群发通知",
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
},
|
||||
components: {Add, List},
|
||||
data() {
|
||||
return {
|
||||
component: "List",
|
||||
params: {},
|
||||
include: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChange(data) {
|
||||
if (data.type === "Add") {
|
||||
this.component = "Add";
|
||||
this.params = data.params;
|
||||
}
|
||||
|
||||
if (data.type === "List") {
|
||||
this.component = "List";
|
||||
this.params = data.params;
|
||||
|
||||
this.$nextTick(() => {
|
||||
if (data.isRefresh) {
|
||||
this.$refs.component.getTableData();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.AppMassNotification {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
422
core/apps/AppMassNotification/components/Add.vue
Normal file
422
core/apps/AppMassNotification/components/Add.vue
Normal file
@@ -0,0 +1,422 @@
|
||||
<template>
|
||||
<section class="Add">
|
||||
<ai-detail v-if="!params.id">
|
||||
<template slot="title">
|
||||
<ai-title title="群发通知" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
|
||||
</template>
|
||||
|
||||
<template slot="content">
|
||||
<ai-card>
|
||||
<template #title>
|
||||
<div class="ai-card__title">
|
||||
<h2>条件选择</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #content>
|
||||
<el-form class="ai-form" :rules="rules" ref="form" :model="form" label-width="100px" label-position="right">
|
||||
|
||||
<el-form-item label="地区选择" style="width: 100%">
|
||||
<ai-area-get v-model="areaId" :root="areaRootId" :instance="instance" @select="handleAreaSelect" multiple size="small" placeholder="全部地区"/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="用户选择" prop="name" style="width: 100%">
|
||||
<el-input size="small" v-model="form.name" placeholder="请选择" disabled>
|
||||
<ai-wechat-selecter slot="append" :isMultiple="false" refs="addTags" :instance="instance" v-model="users" @change="getSelectPerson">
|
||||
<el-button size="small" type="info">选择成员</el-button>
|
||||
</ai-wechat-selecter>
|
||||
</el-input>
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="标签选择" style="width: 100%">
|
||||
<div class="tags" v-for="items in subTags" :key="items.id">
|
||||
<div class="tag_title">{{ items.name }}</div>
|
||||
<div class="tag_item">
|
||||
<el-checkbox-group v-model="tags">
|
||||
<el-checkbox v-for="item in items.tagList" :key="item.id" :label="item.id">{{ item.name }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</ai-card>
|
||||
|
||||
<ai-card title="群发消息设置">
|
||||
<template #content>
|
||||
<el-form class="ai-form" ref="form" :rules="rules" :model="form" label-width="110px" label-position="right">
|
||||
<el-form-item class="el-form-item__textarea" label="群发内容" prop="content" style="width: 100%">
|
||||
<el-input type="textarea" placeholder="请输入…" v-model="form.content" maxlength="1000" :rows="5" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="群发方式" prop="sendType" style="width: 50%">
|
||||
<el-radio v-model="form.sendType" label="0">立即发送</el-radio>
|
||||
<el-radio v-model="form.sendType" label="1">定时发送</el-radio>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="群发时间" prop="sendTime" style="width: 50%" v-if="form.sendType == 1">
|
||||
<el-date-picker size="small"
|
||||
v-model="form.sendTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择日期时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他类型" style="width: 100%">
|
||||
<el-radio-group v-model="form.contentType" @change="onTypeChange">
|
||||
<el-radio label="image">图片</el-radio>
|
||||
<el-radio label="video">视频</el-radio>
|
||||
<el-radio label="file">附件</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- 图片 -->
|
||||
<el-form-item label="图片" style="width: 100%" v-if="form.contentType === 'image'">
|
||||
<ai-uploader :instance="instance" isWechat v-model="files" acceptType=".jpg,.png,.jpeg" :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader>
|
||||
</el-form-item>
|
||||
<!-- 视频 -->
|
||||
<el-form-item label="视频" style="width: 100%" v-if="form.contentType === 'video'">
|
||||
<ai-uploader :instance="instance" fileType="file" isWechat acceptType=".mp4" v-model="files" :limit="1" url="/app/wxcp/upload/uploadFile?type=video"></ai-uploader>
|
||||
</el-form-item>
|
||||
<!-- 附件 -->
|
||||
<el-form-item label="附件" style="width: 100%" v-if="form.contentType === 'file'">
|
||||
<ai-uploader :instance="instance" fileType="file" isWechat v-model="files" :limit="1" url="/app/wxcp/upload/uploadFile?type=file"></ai-uploader>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</template>
|
||||
</ai-card>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确认发送</el-button>
|
||||
</template>
|
||||
|
||||
</ai-detail>
|
||||
|
||||
<ai-detail class="add" v-if="params.id">
|
||||
<template slot="title">
|
||||
<ai-title title="群发通知详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<ai-card title="详情">
|
||||
<template #content>
|
||||
<ai-wrapper>
|
||||
<ai-info-item label="创建者" :value="data.userName" isLine></ai-info-item>
|
||||
<ai-info-item label="发送类型" :value="data.sendType" isLine>{{ data.sendType | format }}</ai-info-item>
|
||||
<ai-info-item label="发送时间" :value="data.sendTime" isLine v-if="data.sendType == 1"></ai-info-item>
|
||||
<ai-info-item label="群发内容" :value="data.content" isLine></ai-info-item>
|
||||
<ai-info-item label="图片" isLine v-if="data.contentType == 'image'">
|
||||
<ai-uploader v-model="accessUrlAll" :instance="instance" :limit="1" disabled/>
|
||||
</ai-info-item>
|
||||
<ai-info-item label="视频" isLine v-if="data.contentType == 'video'">
|
||||
<video :src="data.accessUrl"
|
||||
style="width: 100%; height:100%; object-fit: fill;" muted controls="controls"></video>
|
||||
</ai-info-item>
|
||||
<ai-info-item label="附件" isLine v-if="data.contentType == 'file'">
|
||||
<ai-file-list :fileList="accessUrlAll" ></ai-file-list>
|
||||
</ai-info-item>
|
||||
</ai-wrapper>
|
||||
</template>
|
||||
</ai-card>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'Add',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
params: Object
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
isShow: false,
|
||||
data: {},
|
||||
form: {
|
||||
areaId: '',
|
||||
tag: '',
|
||||
content: '',
|
||||
contentType: 'text',
|
||||
file: {},
|
||||
accessUrl: '',
|
||||
accessDesc: '',
|
||||
accessTitle: '',
|
||||
accessImgurl: '',
|
||||
accessAppid: '',
|
||||
sendType: '0',
|
||||
sendTime: '',
|
||||
mediaId: '',
|
||||
name: '',
|
||||
},
|
||||
tags: [],
|
||||
subTags: {},
|
||||
areaId: [],
|
||||
areaName: [],
|
||||
files: [],
|
||||
areaRootId: '',
|
||||
accessUrlAll: [],
|
||||
users: [],
|
||||
rules: {
|
||||
content: [{ required: true, message: '请输入群发内容', trigger: 'change' }],
|
||||
sendType: [{ required: true, message: '请选择群发方式' }],
|
||||
sendTime: [{ required: true, message: '请选择群发时间' }],
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
tagsChange() {
|
||||
if(this.tags.length) {
|
||||
return this.form.tag = this.tags.toString();
|
||||
}
|
||||
},
|
||||
areaid() {
|
||||
return this.form.areaId = this.areaId.toString();
|
||||
},
|
||||
...mapState(['user'])
|
||||
},
|
||||
|
||||
created () {
|
||||
if (this.params.id) {
|
||||
this.getInfo()
|
||||
} else {
|
||||
this.getSubTags()
|
||||
}
|
||||
this.areaRootId = [this.user.info.areaId.substr(0, 6),'000000'].join("")
|
||||
},
|
||||
|
||||
filters: {
|
||||
format(value) {
|
||||
if(value == 0) {
|
||||
return '立即发送'
|
||||
} else if(value == 1) {
|
||||
return '定时发送'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
handleAreaSelect(v) {
|
||||
this.areaName = v?.[0]?.label
|
||||
},
|
||||
|
||||
getSelectPerson(val) {
|
||||
this.form.name = val[0].name;
|
||||
this.form.phone = val[0].phone;
|
||||
this.form.userId = val[0].sysUserId
|
||||
this.form.wxUserId = val[0].id
|
||||
},
|
||||
|
||||
// 标签
|
||||
getSubTags () {
|
||||
this.instance.post(`/app/wxcp/wxcorptag/listAll`).then(res => {
|
||||
if (res?.data) {
|
||||
this.subTags = res.data.records
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getInfo () {
|
||||
this.instance.post(`/app/pushmessage/detail?id=${this.params.id}`).then(res => {
|
||||
if (res?.data) {
|
||||
this.data = res.data
|
||||
this.accessUrlAll = [{url: res.data.accessUrl}]
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onTypeChange () {
|
||||
this.files = []
|
||||
this.form.file.url = ''
|
||||
this.form.accessUrl = ''
|
||||
this.form.accessDesc = ''
|
||||
this.form.accessTitle = ''
|
||||
this.form.accessImgurl = ''
|
||||
this.form.accessAppid = ''
|
||||
this.$forceUpdate()
|
||||
},
|
||||
|
||||
confirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
|
||||
if(this.files.length) {
|
||||
this.form.accessUrl = this.files[0].url,
|
||||
this.form.mediaId = this.files[0].media.mediaId
|
||||
}
|
||||
if (this.form.contentType == 'text' && !this.form.content) {
|
||||
return this.$message.error('请输入消息内容')
|
||||
}
|
||||
|
||||
// if (this.form.contentType === 'image' && !this.form.accessUrl) {
|
||||
// return this.$message.error('请上传图片')
|
||||
// }
|
||||
|
||||
// if (this.form.contentType === 'video' && !this.form.accessUrl) {
|
||||
// return this.$message.error('请上传视频')
|
||||
// }
|
||||
|
||||
// if (this.form.contentType === 'file' && !this.form.accessUrl) {
|
||||
// return this.$message.error('请上传附件')
|
||||
// }
|
||||
|
||||
// if (this.form.sendType == 1) {
|
||||
// if (!this.form.sendTime) {
|
||||
// return this.$message.error('请选择时间')
|
||||
// }
|
||||
// }
|
||||
|
||||
this.instance.post(`/app/pushmessage/addOrUpdate`, {
|
||||
...this.form
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('提交成功')
|
||||
setTimeout(() => {
|
||||
this.cancel(true)
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'List',
|
||||
isRefresh: isRefresh ? true : false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.Add {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ai-card__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
h2 {
|
||||
margin-right: 20px;
|
||||
color: #222222;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #888888;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.appletss {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.applets-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 400px;
|
||||
height: 60px;
|
||||
margin-right: 8px;
|
||||
margin-bottom: 8px;
|
||||
padding: 0 17px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #D0D4DC;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
border-color: #2266FF;
|
||||
}
|
||||
|
||||
::v-deep {
|
||||
.el-radio__label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
img {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin: 0 8px 0 13px;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #222222;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.el-radio {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&.applets-active {
|
||||
border-color: #2266FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
padding-left: 8px;
|
||||
color: #222222;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.el-form-item-item__textarea {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.el-form-item__btn {
|
||||
position: absolute;
|
||||
bottom: 12px;
|
||||
left: 12px;
|
||||
line-height: 1;
|
||||
z-index: 1;
|
||||
color: #2266FF;
|
||||
font-size: 14px;
|
||||
user-select: none;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tags {
|
||||
// padding: 10px;
|
||||
.tag_title {
|
||||
font-weight: 600;
|
||||
}
|
||||
.tag_item {
|
||||
margin: 5px 0;
|
||||
span {
|
||||
display: inline-block;
|
||||
// padding: 5px 10px;
|
||||
width: 80px;
|
||||
text-align: center;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
background: #DDD;
|
||||
color: #333;
|
||||
border-radius: 4px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.active {
|
||||
background: #53bcea;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
196
core/apps/AppMassNotification/components/List.vue
Normal file
196
core/apps/AppMassNotification/components/List.vue
Normal file
@@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<ai-list class="List">
|
||||
<template #title>
|
||||
<ai-title title="群发通知" isShowBottomBorder></ai-title>
|
||||
</template>
|
||||
<template #content>
|
||||
<ai-search-bar>
|
||||
<template #left>
|
||||
<el-button type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
|
||||
@getList="getTableData" show-overflow-tooltip :col-configs="colConfigs" :dict="dict">
|
||||
<el-table-column slot="type" width="240px" label="消息内容" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
width="400"
|
||||
:visible-arrow="false"
|
||||
popper-class="wechat-message__container"
|
||||
trigger="hover">
|
||||
<div class="count row-content" slot="reference" v-if="row.content">{{ row.content }}</div>
|
||||
<div class="message-info">
|
||||
<h2 :style="{marginBottom: row.accessUrl ? '16px' : '0'}">{{ row.content }}</h2>
|
||||
<div class="message-info__wrapper" v-if="row.accessUrl">
|
||||
<img v-if="row.contentType == 'image'" :src="row.accessUrl">
|
||||
<video style="width:40px; height: 40px;" v-if="row.contentType == 'video'" :src="row.accessUrl"></video>
|
||||
<img src="../../../src/assets/file.png" v-if="row.contentType == 'file'" width="40" height="40"/>
|
||||
<div class="message-info__wrapper--right">
|
||||
<!-- <h3 v-if="row.contentType === 'image'">{{ row.media.file.name }}</h3>
|
||||
<h3 v-if="row.contentType === 'video'">{{ row.media.file.name }}</h3>
|
||||
<p v-if="row.contentType === 'image'">{{ row.media.file.fileSizeStr }}</p>
|
||||
<p v-if="row.contentType === 'video'">{{ row.media.file.fileSizeStr }}</p> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column slot="options" label="操作" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" @click="toAdd(row.id)">详情</el-button>
|
||||
<!-- <el-button type="text" @click="handleDelete(row.id)">删除</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "List",
|
||||
props: {
|
||||
dict: Object,
|
||||
instance: Function,
|
||||
params: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
page: {current: 1, size: 10, total: 0},
|
||||
id: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableData()
|
||||
},
|
||||
computed: {
|
||||
colConfigs() {
|
||||
return [
|
||||
{ prop: "contentType", label: '消息类型', align: "center", width: "250px", formart: v => this.mapType(v) },
|
||||
{ slot: 'type' },
|
||||
{ prop: "sendType", label: '发送类型', align: "center", width: "250px", formart: v => v == 0 ? '立即发送' : '定时发送'},
|
||||
{ prop: "createTime", label: '创建时间', align: "center", width: "250px"},
|
||||
{ prop: "sendTime", label: '发送时间', align: "center", width: "250px"},
|
||||
{ prop: "userName", label: '创建人', align: "center", width: "250px", },
|
||||
{ slot: "options" ,},
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getTableData() {
|
||||
this.instance.post("/app/pushmessage/list", null, {
|
||||
params: {...this.page}
|
||||
}).then(res => {
|
||||
if (res?.data) {
|
||||
this.tableData = res.data.records
|
||||
this.page.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
mapType (type) {
|
||||
return {
|
||||
'image': '图片',
|
||||
'video': '视频',
|
||||
'file': '文件',
|
||||
'text': '文本'
|
||||
}[type]
|
||||
},
|
||||
|
||||
toAdd(id) {
|
||||
this.$emit('change', {
|
||||
type: 'Add',
|
||||
params: {
|
||||
id: id || '',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.List {
|
||||
height: 100%;
|
||||
background: #f3f4f5;
|
||||
.count {
|
||||
cursor: pointer;
|
||||
color: #2266FF;
|
||||
font-size: 14px;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
img, video {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.message-info {
|
||||
padding: 8px;
|
||||
min-height: 116px;
|
||||
|
||||
h2 {
|
||||
color: #222222;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.message-info__wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 368px;
|
||||
height: 60px;
|
||||
padding: 10px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #D0D4DC;
|
||||
|
||||
.message-info__wrapper--right {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
h3 {
|
||||
width: 100%;
|
||||
color: #222222;
|
||||
font-size: 14px;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
img, video {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 6px;
|
||||
font-size: 14px;
|
||||
color: #888888;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.row-content {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user