页面整合

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>
<section class="AppMassNotification">
<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>
</section>
</template>
@@ -25,22 +25,18 @@ export default {
include: [],
}
},
computed: {
currentPage() {
const {hash} = this.$route
return hash == "#add" ? Add : List
},
},
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();
}
});
this.$router.push({hash: "#add", query: data.params})
} else {
this.$router.push({})
}
},
},

View File

@@ -1,6 +1,6 @@
<template>
<section class="Add">
<ai-detail v-if="!params.id">
<ai-detail v-if="!$route.query.id">
<template slot="title">
<ai-title title="群发通知" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
@@ -16,19 +16,19 @@
<template #content>
<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="1">居民</el-radio>
</el-form-item>
<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 label="用户选择" prop="name" style="width: 100%">
<el-input size="small" v-model="form.name" placeholder="请选择" disabled>
<!-- :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>
</ai-wechat-selecter>
</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-group>
</div>
</div>
</div>
</el-form-item>
</el-form>
</template>
@@ -76,15 +76,18 @@
</el-form-item>
<!-- 图片 -->
<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 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 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>
@@ -99,7 +102,7 @@
</ai-detail>
<ai-detail class="add" v-if="params.id">
<ai-detail class="add" v-if="$route.query.id">
<template slot="title">
<ai-title title="群发通知详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
@@ -143,17 +146,14 @@
<script>
import {mapState} from "vuex";
import AiDvWrapper from '../../../../project/dvui/layout/AiDvWrapper/AiDvWrapper.vue';
export default {
components: { AiDvWrapper },
name: 'Add',
props: {
instance: Function,
dict: Object,
params: Object
dict: Object
},
data () {
data() {
return {
isShow: false,
data: {},
@@ -190,16 +190,16 @@ export default {
users: [],
images: [],
rules: {
content: [{ required: true, message: '请输入群发内容'}],
sendType: [{ required: true, message: '请选择群发方式' }],
sendTime: [{ required: true, message: '请选择群发时间' }],
content: [{required: true, message: '请输入群发内容'}],
sendType: [{required: true, message: '请选择群发方式'}],
sendTime: [{required: true, message: '请选择群发时间'}],
},
}
},
computed: {
tagsChange() {
if(this.tags.length) {
if (this.tags.length) {
return this.form.tag = this.tags.toString();
}
},
@@ -209,20 +209,20 @@ export default {
...mapState(['user'])
},
created () {
if (this.params.id) {
created() {
if (this.$route.query.id) {
this.getInfo()
} else {
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: {
format(value) {
if(value == 0) {
if (value == 0) {
return '立即发送'
} else if(value == 1) {
} else if (value == 1) {
return '定时发送'
}
}
@@ -239,23 +239,23 @@ export default {
this.form.wxUserId = val[0].id
},
// 标签
getSubTags () {
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 => {
getInfo() {
this.instance.post(`/app/pushmessage/detail?id=${this.$route.query.id}`).then(res => {
if (res?.data) {
this.data = res.data
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.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}]
}
})
},
confirm () {
confirm() {
this.$refs.form.validate((valid) => {
if (valid) {
this.form.fileList = []
@@ -265,7 +265,7 @@ export default {
}
this.form.fileList.push(contentList)
if(this.imgList.length) {
if (this.imgList.length) {
let item = {
contentType: 'image',
mediaId: this.imgList[0].media.mediaId,
@@ -274,7 +274,7 @@ export default {
this.form.fileList.push(item)
}
if(this.videoList.length) {
if (this.videoList.length) {
let item = {
contentType: 'video',
mediaId: this.videoList[0].media.mediaId,
@@ -283,7 +283,7 @@ export default {
this.form.fileList.push(item)
}
if(this.filesList.length) {
if (this.filesList.length) {
let item = {
contentType: 'file',
mediaId: this.filesList[0].media.mediaId,
@@ -305,7 +305,7 @@ export default {
}
})
},
cancel (isRefresh) {
cancel(isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: isRefresh ? true : false
@@ -316,123 +316,126 @@ export default {
</script>
<style scoped lang="scss">
.Add {
height: 100%;
.Add {
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;
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 {
margin-right: 20px;
color: #222222;
font-size: 16px;
font-weight: 700;
&:hover {
border-color: #2266FF;
}
::v-deep {
.el-radio__label {
display: none;
}
}
img {
width: 40px;
height: 40px;
margin: 0 8px 0 13px;
}
span {
color: #888888;
font-size: 14px;
color: #222222;
font-size: 12px;
}
.el-radio {
margin: 0;
}
&.applets-active {
border-color: #2266FF;
}
}
}
.appletss {
display: flex;
flex-wrap: wrap;
.tips {
position: relative;
top: 2px;
padding-left: 8px;
color: #222222;
font-size: 14px;
}
.applets-item {
display: flex;
align-items: center;
width: 400px;
height: 60px;
.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;
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;
}
.active {
background: #53bcea;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -5,9 +5,9 @@
</template>
<template #content>
<ai-search-bar>
<template #left>
<el-button type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
</template>
<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">
@@ -37,7 +37,7 @@
</el-popover>
</template>
</el-table-column> -->
<el-table-column slot="options" label="操作" align="center">
<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> -->
@@ -49,7 +49,8 @@
</template>
<script>
import { mapState } from 'vuex'
import {mapState} from 'vuex'
export default {
name: "List",
props: {
@@ -60,7 +61,7 @@ export default {
data() {
return {
tableData: [],
page: {current: 1, size: 10, total: 0,pages: 0},
page: {current: 1, size: 10, total: 0, pages: 0},
id: '',
}
},
@@ -76,15 +77,15 @@ export default {
file: "附件"
}
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?.filter(e=> e.contentType == 'text')[0].content },
{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},
// { 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" ,},
{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",},
]
},
...mapState(['user'])
@@ -105,7 +106,7 @@ export default {
})
},
mapType (type) {
mapType(type) {
return {
'image': '图片',
'video': '视频',
@@ -122,7 +123,7 @@ export default {
},
})
}
},
}
</script>
@@ -131,6 +132,7 @@ export default {
.List {
height: 100%;
background: #f3f4f5;
.count {
cursor: pointer;
color: #2266FF;
@@ -142,68 +144,69 @@ export default {
}
}
img, video {
width: 40px;
height: 40px;
margin-right: 10px;
object-fit: cover;
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 {
padding: 8px;
min-height: 116px;
.message-info__wrapper {
display: flex;
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;
font-weight: 500;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: normal;
}
.message-info__wrapper {
display: flex;
align-items: center;
width: 368px;
height: 60px;
padding: 10px;
background: #FFFFFF;
border-radius: 2px;
border: 1px solid #D0D4DC;
img, video {
width: 40px;
height: 40px;
margin-right: 10px;
object-fit: cover;
}
.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;
}
p {
margin-top: 6px;
font-size: 14px;
color: #888888;
}
}
}
.row-content {
white-space: nowrap;
overflow: hidden;
text-overflow:ellipsis;
}
</style>
.row-content {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>