页面整合

This commit is contained in:
aixianling
2022-06-24 20:50:47 +08:00
parent d979943852
commit 9292429c8c
3 changed files with 222 additions and 220 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<section class="AppMassNotification"> <section class="AppMassNotification">
<keep-alive :include="['List']"> <keep-alive :include="['List']">
<component ref="component" :is="component" :instance="instance" :params="params" :dict="dict" @change="onChange"/> <component ref="component" :is="currentPage" :instance="instance" :params="params" :dict="dict" @change="onChange"/>
</keep-alive> </keep-alive>
</section> </section>
</template> </template>
@@ -25,22 +25,18 @@ export default {
include: [], include: [],
} }
}, },
computed: {
currentPage() {
const {hash} = this.$route
return hash == "#add" ? Add : List
},
},
methods: { methods: {
onChange(data) { onChange(data) {
if (data.type === "Add") { if (data.type === "Add") {
this.component = "Add"; this.$router.push({hash: "#add", query: data.params})
this.params = data.params; } else {
} this.$router.push({})
if (data.type === "List") {
this.component = "List";
this.params = data.params;
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getTableData();
}
});
} }
}, },
}, },

View File

@@ -1,6 +1,6 @@
<template> <template>
<section class="Add"> <section class="Add">
<ai-detail v-if="!params.id"> <ai-detail v-if="!$route.query.id">
<template slot="title"> <template slot="title">
<ai-title title="群发通知" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title> <ai-title title="群发通知" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template> </template>
@@ -16,19 +16,19 @@
<template #content> <template #content>
<el-form class="ai-form" :rules="rules" ref="form" :model="form" label-width="100px" label-position="right"> <el-form class="ai-form" :rules="rules" ref="form" :model="form" label-width="100px" label-position="right">
<el-form-item label="发送方式" prop="sendType" style="width: 50%"> <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="0">居民群</el-radio>
<el-radio v-model="form.sendType" label="1">居民</el-radio> <el-radio v-model="form.sendType" label="1">居民</el-radio>
</el-form-item> </el-form-item>
<el-form-item label="地区选择" style="width: 100%"> <el-form-item label="地区选择" style="width: 100%">
<ai-area-get v-model="areaId" :root="areaRootId" :instance="instance" @select="handleAreaSelect" multiple size="small" placeholder="全部地区"/> <ai-area-get v-model="areaId" :root="areaRootId" :instance="instance" @select="handleAreaSelect" multiple size="small" placeholder="全部地区"/>
</el-form-item> </el-form-item>
<el-form-item label="用户选择" prop="name" style="width: 100%"> <el-form-item label="用户选择" prop="name" style="width: 100%">
<el-input size="small" v-model="form.name" placeholder="请选择" disabled> <el-input size="small" v-model="form.name" placeholder="请选择" disabled>
<!-- :isMultiple="true" --> <!-- :isMultiple="true" -->
<ai-wechat-selecter slot="append" refs="addTags" :instance="instance" v-model="users" @change="getSelectPerson"> <ai-wechat-selecter slot="append" refs="addTags" :instance="instance" v-model="users" @change="getSelectPerson">
<el-button size="small" type="info">选择成员</el-button> <el-button size="small" type="info">选择成员</el-button>
</ai-wechat-selecter> </ai-wechat-selecter>
</el-input> </el-input>
@@ -42,7 +42,7 @@
<el-checkbox v-for="item in items.tagList" :key="item.id" :label="item.id">{{ item.name }}</el-checkbox> <el-checkbox v-for="item in items.tagList" :key="item.id" :label="item.id">{{ item.name }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
@@ -76,15 +76,18 @@
</el-form-item> </el-form-item>
<!-- 图片 --> <!-- 图片 -->
<el-form-item label="图片" style="width: 100%" v-if="form.contentType == 'image'"> <el-form-item label="图片" style="width: 100%" v-if="form.contentType == 'image'">
<ai-uploader :instance="instance" isWechat v-model="imgList" acceptType=".jpg,.png,.jpeg" :limit="1" url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader> <ai-uploader :instance="instance" isWechat v-model="imgList" acceptType=".jpg,.png,.jpeg" :limit="1"
url="/app/wxcp/upload/uploadFile?type=image"></ai-uploader>
</el-form-item> </el-form-item>
<!-- 视频 --> <!-- 视频 -->
<el-form-item label="视频" style="width: 100%" v-if="form.contentType == 'video'"> <el-form-item label="视频" style="width: 100%" v-if="form.contentType == 'video'">
<ai-uploader :instance="instance" fileType="file" isWechat acceptType=".mp4" v-model="videoList" :limit="1" url="/app/wxcp/upload/uploadFile?type=video"></ai-uploader> <ai-uploader :instance="instance" fileType="file" isWechat acceptType=".mp4" v-model="videoList" :limit="1"
url="/app/wxcp/upload/uploadFile?type=video"></ai-uploader>
</el-form-item> </el-form-item>
<!-- 附件 --> <!-- 附件 -->
<el-form-item label="附件" style="width: 100%" v-if="form.contentType == 'file'"> <el-form-item label="附件" style="width: 100%" v-if="form.contentType == 'file'">
<ai-uploader :instance="instance" fileType="file" isWechat v-model="filesList" :limit="1" url="/app/wxcp/upload/uploadFile?type=file"></ai-uploader> <ai-uploader :instance="instance" fileType="file" isWechat v-model="filesList" :limit="1"
url="/app/wxcp/upload/uploadFile?type=file"></ai-uploader>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -99,7 +102,7 @@
</ai-detail> </ai-detail>
<ai-detail class="add" v-if="params.id"> <ai-detail class="add" v-if="$route.query.id">
<template slot="title"> <template slot="title">
<ai-title title="群发通知详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title> <ai-title title="群发通知详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template> </template>
@@ -143,17 +146,14 @@
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
import AiDvWrapper from '../../../../project/dvui/layout/AiDvWrapper/AiDvWrapper.vue';
export default { export default {
components: { AiDvWrapper },
name: 'Add', name: 'Add',
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object
params: Object
}, },
data() {
data () {
return { return {
isShow: false, isShow: false,
data: {}, data: {},
@@ -190,16 +190,16 @@ export default {
users: [], users: [],
images: [], images: [],
rules: { rules: {
content: [{ required: true, message: '请输入群发内容'}], content: [{required: true, message: '请输入群发内容'}],
sendType: [{ required: true, message: '请选择群发方式' }], sendType: [{required: true, message: '请选择群发方式'}],
sendTime: [{ required: true, message: '请选择群发时间' }], sendTime: [{required: true, message: '请选择群发时间'}],
}, },
} }
}, },
computed: { computed: {
tagsChange() { tagsChange() {
if(this.tags.length) { if (this.tags.length) {
return this.form.tag = this.tags.toString(); return this.form.tag = this.tags.toString();
} }
}, },
@@ -209,20 +209,20 @@ export default {
...mapState(['user']) ...mapState(['user'])
}, },
created () { created() {
if (this.params.id) { if (this.$route.query.id) {
this.getInfo() this.getInfo()
} else { } else {
this.getSubTags() this.getSubTags()
} }
this.areaRootId = [this.user.info.areaId.substr(0, 6),'000000'].join("") this.areaRootId = [this.user.info.areaId.substr(0, 6), '000000'].join("")
}, },
filters: { filters: {
format(value) { format(value) {
if(value == 0) { if (value == 0) {
return '立即发送' return '立即发送'
} else if(value == 1) { } else if (value == 1) {
return '定时发送' return '定时发送'
} }
} }
@@ -239,23 +239,23 @@ export default {
this.form.wxUserId = val[0].id this.form.wxUserId = val[0].id
}, },
// 标签 // 标签
getSubTags () { getSubTags() {
this.instance.post(`/app/wxcp/wxcorptag/listAll`).then(res => { this.instance.post(`/app/wxcp/wxcorptag/listAll`).then(res => {
if (res?.data) { if (res?.data) {
this.subTags = res.data.records this.subTags = res.data.records
} }
}) })
}, },
getInfo () { getInfo() {
this.instance.post(`/app/pushmessage/detail?id=${this.params.id}`).then(res => { this.instance.post(`/app/pushmessage/detail?id=${this.$route.query.id}`).then(res => {
if (res?.data) { if (res?.data) {
this.data = res.data this.data = res.data
this.images = [{ url: res.data.fileList.filter(e=> e.contentType == "image")[0]?.accessUrl }] this.images = [{url: res.data.fileList.filter(e => e.contentType == "image")[0]?.accessUrl}]
this.fileDownLoad = [{ url:res.data.fileList.filter(e=> e.contentType == "file")[0]?.accessUrl }] this.fileDownLoad = [{url: res.data.fileList.filter(e => e.contentType == "file")[0]?.accessUrl}]
} }
}) })
}, },
confirm () { confirm() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.form.fileList = [] this.form.fileList = []
@@ -265,7 +265,7 @@ export default {
} }
this.form.fileList.push(contentList) this.form.fileList.push(contentList)
if(this.imgList.length) { if (this.imgList.length) {
let item = { let item = {
contentType: 'image', contentType: 'image',
mediaId: this.imgList[0].media.mediaId, mediaId: this.imgList[0].media.mediaId,
@@ -274,7 +274,7 @@ export default {
this.form.fileList.push(item) this.form.fileList.push(item)
} }
if(this.videoList.length) { if (this.videoList.length) {
let item = { let item = {
contentType: 'video', contentType: 'video',
mediaId: this.videoList[0].media.mediaId, mediaId: this.videoList[0].media.mediaId,
@@ -283,7 +283,7 @@ export default {
this.form.fileList.push(item) this.form.fileList.push(item)
} }
if(this.filesList.length) { if (this.filesList.length) {
let item = { let item = {
contentType: 'file', contentType: 'file',
mediaId: this.filesList[0].media.mediaId, mediaId: this.filesList[0].media.mediaId,
@@ -305,7 +305,7 @@ export default {
} }
}) })
}, },
cancel (isRefresh) { cancel(isRefresh) {
this.$emit('change', { this.$emit('change', {
type: 'List', type: 'List',
isRefresh: isRefresh ? true : false isRefresh: isRefresh ? true : false
@@ -316,123 +316,126 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.Add { .Add {
height: 100%; height: 100%;
}
.ai-card__title {
display: flex;
align-items: center;
h2 {
margin-right: 20px;
color: #222222;
font-size: 16px;
font-weight: 700;
} }
.ai-card__title { span {
color: #888888;
font-size: 14px;
}
}
.appletss {
display: flex;
flex-wrap: wrap;
.applets-item {
display: flex; display: flex;
align-items: center; 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;
h2 { &:hover {
margin-right: 20px; border-color: #2266FF;
color: #222222; }
font-size: 16px;
font-weight: 700; ::v-deep {
.el-radio__label {
display: none;
}
}
img {
width: 40px;
height: 40px;
margin: 0 8px 0 13px;
} }
span { span {
color: #888888; color: #222222;
font-size: 14px; font-size: 12px;
}
.el-radio {
margin: 0;
}
&.applets-active {
border-color: #2266FF;
} }
} }
}
.appletss { .tips {
display: flex; position: relative;
flex-wrap: wrap; top: 2px;
padding-left: 8px;
color: #222222;
font-size: 14px;
}
.applets-item { .el-form-item-item__textarea {
display: flex; position: relative;
align-items: center; }
width: 400px;
height: 60px; .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; margin-right: 8px;
margin-bottom: 8px; }
padding: 0 17px;
background: #FFFFFF;
border-radius: 2px;
border: 1px solid #D0D4DC;
cursor: pointer;
&:hover { .active {
border-color: #2266FF; background: #53bcea;
} color: #FFFFFF;
::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> </style>

View File

@@ -5,9 +5,9 @@
</template> </template>
<template #content> <template #content>
<ai-search-bar> <ai-search-bar>
<template #left> <template #left>
<el-button type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button> <el-button type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template> </template>
</ai-search-bar> </ai-search-bar>
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size" <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"> @getList="getTableData" show-overflow-tooltip :col-configs="colConfigs" :dict="dict">
@@ -37,7 +37,7 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column slot="options" label="操作" align="center"> <el-table-column slot="options" label="操作" align="center">
<template slot-scope="{ row }"> <template slot-scope="{ row }">
<el-button type="text" @click="toAdd(row.id)">详情</el-button> <el-button type="text" @click="toAdd(row.id)">详情</el-button>
<!-- <el-button type="text" @click="handleDelete(row.id)">删除</el-button> --> <!-- <el-button type="text" @click="handleDelete(row.id)">删除</el-button> -->
@@ -49,7 +49,8 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex' import {mapState} from 'vuex'
export default { export default {
name: "List", name: "List",
props: { props: {
@@ -60,7 +61,7 @@ export default {
data() { data() {
return { return {
tableData: [], tableData: [],
page: {current: 1, size: 10, total: 0,pages: 0}, page: {current: 1, size: 10, total: 0, pages: 0},
id: '', id: '',
} }
}, },
@@ -76,15 +77,15 @@ export default {
file: "附件" file: "附件"
} }
return [ return [
{ prop: "fileList", label: '消息类型', align: "center", width: "250px", formart: v => v?.map(e=> conType[e.contentType]).toString() }, {prop: "fileList", label: '消息类型', align: "center", width: "250px", formart: v => v?.map(e => conType[e.contentType]).toString()},
{ prop: "fileList", label: '消息类容', align: "center", width: "250px", formart: v => v?.filter(e=> e.contentType == 'text')[0].content }, {prop: "fileList", label: '消息类容', align: "center", width: "250px", formart: v => v?.filter(e => e.contentType == 'text')[0].content},
// { prop: "fileList", label: '消息内容', align: "center", width: "250px", formart: v => v?.filter(e => e.contentType == 'text')[0].content}, // { prop: "fileList", label: '消息内容', align: "center", width: "250px", formart: v => v?.filter(e => e.contentType == 'text')[0].content},
// { slot: 'type' }, // { slot: 'type' },
{ prop: "sendType", label: '发送类型', align: "center", width: "250px", formart: v => v == 0 ? '立即发送' : '定时发送'}, {prop: "sendType", label: '发送类型', align: "center", width: "250px", formart: v => v == 0 ? '立即发送' : '定时发送'},
{ prop: "createTime", label: '创建时间', align: "center", width: "250px"}, {prop: "createTime", label: '创建时间', align: "center", width: "250px"},
{ prop: "sendTime", label: '发送时间', align: "center", width: "250px"}, {prop: "sendTime", label: '发送时间', align: "center", width: "250px"},
{ prop: "userName", label: '创建人', align: "center", width: "250px", }, {prop: "userName", label: '创建人', align: "center", width: "250px",},
{ slot: "options" ,}, {slot: "options",},
] ]
}, },
...mapState(['user']) ...mapState(['user'])
@@ -105,7 +106,7 @@ export default {
}) })
}, },
mapType (type) { mapType(type) {
return { return {
'image': '图片', 'image': '图片',
'video': '视频', 'video': '视频',
@@ -122,7 +123,7 @@ export default {
}, },
}) })
} }
}, },
} }
</script> </script>
@@ -131,6 +132,7 @@ export default {
.List { .List {
height: 100%; height: 100%;
background: #f3f4f5; background: #f3f4f5;
.count { .count {
cursor: pointer; cursor: pointer;
color: #2266FF; color: #2266FF;
@@ -142,68 +144,69 @@ export default {
} }
} }
img, video {
width: 40px; img, video {
height: 40px; width: 40px;
margin-right: 10px; height: 40px;
object-fit: cover; margin-right: 10px;
object-fit: cover;
}
.message-info {
padding: 8px;
min-height: 116px;
h2 {
color: #222222;
font-weight: 500;
font-size: 14px;
} }
.message-info { .message-info__wrapper {
padding: 8px; display: flex;
min-height: 116px; align-items: center;
width: 368px;
height: 60px;
padding: 10px;
background: #FFFFFF;
border-radius: 2px;
border: 1px solid #D0D4DC;
h2 { .message-info__wrapper--right {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
h3 {
width: 100%;
color: #222222; color: #222222;
font-weight: 500;
font-size: 14px; font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: normal;
} }
.message-info__wrapper { img, video {
display: flex; width: 40px;
align-items: center; height: 40px;
width: 368px; margin-right: 10px;
height: 60px; object-fit: cover;
padding: 10px; }
background: #FFFFFF;
border-radius: 2px;
border: 1px solid #D0D4DC;
.message-info__wrapper--right { p {
flex: 1; margin-top: 6px;
overflow: hidden; font-size: 14px;
text-overflow:ellipsis; color: #888888;
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 { .row-content {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
} }
</style> </style>