消息发送

This commit is contained in:
liuye
2022-06-24 21:47:52 +08:00
parent 8e807e785f
commit ac3f5d2eff
5 changed files with 55 additions and 55 deletions

View File

@@ -20,6 +20,7 @@
</div>
<u-icon name="arrow-right" color="#ddd" size="32"></u-icon>
</div>
<AiEmpty description="暂无数据" v-if="!orgInfo.Organizational"/>
<!-- <p class="total">组织内共72人</p> -->
</div>
</div>

View File

@@ -23,6 +23,7 @@
</div>
</div>
</div>
<AiEmpty description="暂无数据" v-if="!list.length"/>
</div>
</template>

View File

@@ -137,25 +137,32 @@ export default {
}
},
confirm() {
// if(!this.areaIdList.length) {
// return this.$u.toast('请选择用户')
// }
this.$loading()
if(this.form.sendType == 1 && !this.form.sendTime) {
return this.$u.toast('请选择群发时间')
if(!this.deptUserTagList.length) {
return this.$u.toast('请选择部门')
}
if(!this.form.content) {
return this.$u.toast('请输入文本内容')
}
if(this.form.contentType == 'image' && !this.formData.fileList.length) {
return this.$u.toast('请上传图片')
}
if(this.form.contentType == 'video' && !this.formData.fileList.length) {
return this.$u.toast('请上传视频')
}
if(this.form.contentType == 'file' && !this.formData.fileList.length) {
return this.$u.toast('请上传文件')
let result = {}, tags = {}
this.deptUserTagList.map(e => {
let {kind, id, tagIdList} = e
result[e.corpId] = [result[e.corpId], {kind, id}].flat()
if (tagIdList) {
tags[e.corpId] = [tags[e.corpId], {tagIdList}].flat()
}
})
console.log(result, tags)
var deptList = Object.keys(result).map(corpId => ({
corpId,
objList: result[corpId],
tagId: tags[corpId]?.tagIdList
}))
console.log(deptList)
this.formData.fileList = []
var contentFile = {
content: this.form.content,
@@ -195,20 +202,15 @@ export default {
...this.form,
...this.formData,
areaId: this.areaIdList.join(','),
tag: this.tagIdList.join(','),
deptList: deptList,
messageSource: this.sendType == 1 ? '1' : '2'
}
this.$http.post("/app/pushmessage/addOrUpdate", params).then(res => {
if (res?.code == 0) {
this.$u.toast('发送成功')
this.form = {
content: '',
contentType: 'text',
sendType: '0',
sendTime: ''
}
this.areaIdList = []
this.tagIdList = []
this.formDataInit()
setTimeout(() => {
uni.navigateBack()
}, 500)
}else {
this.$u.toast(res.msg)
}
@@ -216,14 +218,6 @@ export default {
this.$u.toast(err)
})
},
formDataInit() {
for(let key in this.formData) {
this.formData[key] = ''
}
this.formData.fileListImg = []
this.formData.fileListVideo = []
this.formData.fileListFile = []
},
back() {
uni.navigateBack()
}

View File

@@ -75,18 +75,18 @@ export default {
this.treeList = this.allData.filter(e => !e.parentid)
this.selectDeptPath = [{name: "可选范围", id: ''}]
},
itemClick({id, name}) {
let index = this.selectDeptPath.findIndex(e => e.id == id)
itemClick({id, name, corpId}) {
let index = this.selectDeptPath.findIndex(e => e.id == id && e.corpId == corpId)
if (index == -1) {
this.selectDeptPath.push({name, id})
this.getDeptsAndUsersByParent(id)
this.selectDeptPath.push({name, id, corpId})
this.getDeptsAndUsersByParent(id, corpId)
}
},
getDeptsAndUsersByParent(departmentId) {
this.treeList = this.allData.filter(e => e.parentid == departmentId)
getDeptsAndUsersByParent(departmentId, corpId) {
this.treeList = this.allData.filter(e => e.parentid == departmentId && e.corpId == corpId)
this.userList = []
this.$http.post(`/app/wxcp/wxuser/listByDeptId`, null, {
params: {departmentId, status: 1}
params: {departmentId, status: 1, cid: corpId}
}).then(res => {
if (res?.data) {
this.userList = res.data.map(e => ({...e, isChecked: this.isSelected(e.id)}))

View File

@@ -1,8 +1,8 @@
<template>
<section class="selectTag">
<p class="title">已选择部门</p>
<p class="title">已选择组织</p>
<div class="list">
<div class="item" v-for="(item, index) in deptList" :key="index">
<div class="item" v-for="(item, index) in deptList" :key="index" v-if="!item.parentid">
<div class="name-flex">
<div class="name">{{ item.name }}</div>
<div class="btn" @click="chooseTag(index)">添加标签</div>
@@ -32,6 +32,7 @@
</div>
</div>
</div>
<AiEmpty description="暂无数据" v-if="!tagList.length"/>
</div>
</u-popup>
</section>
@@ -46,7 +47,7 @@ export default {
deptList: [],
userList: [],
showTagList: false,
sendType: '', //0居民 1居民
sendType: '', //0居民 1居民
tagList: [],
deptIndex: 0
}
@@ -55,17 +56,7 @@ export default {
methods: {
chooseTag(index) {
this.deptIndex = index
this.getTagList(this.deptList[index].id)
// if(this.deptList[index].tagIdList) {
// this.tagList.map((item) => {
// item.tagList.map((items) => {
// if(this.deptList[index].tagIdList.includes(items.id)) {
// items.isCheck = true
// }
// })
// })
// }
// this.showTagList = true
this.getTagList(this.deptList[index].corpId)
},
typeClick(index, indexs) {
this.tagList[index].tagList[indexs].isCheck = !this.tagList[index].tagList[indexs].isCheck
@@ -92,7 +83,7 @@ export default {
this.showTagList=false
},
getTagList(id) {
var url = this.sendType == 1 ? `/app/wxcp/wxgroupchattag/listAllByCorp?dvcpId=${id}` : '/wxcp/wxgroupchattag/listAllTag?size=100'
var url = this.sendType == 1 ? `/app/wxcp/wxcorptag/listAllByCorp?dvcpCorpId=${id}` : `/app/wxcp/wxgroupchattag/listAllByCorp?dvcpCorpId=${id}`
this.$http.post(url).then(res => {
if (res?.code == 0) {
res.data.records.map((item) => {
@@ -101,11 +92,23 @@ export default {
})
})
this.tagList = res.data.records
if(this.deptList[this.deptIndex].tagIdList) {
this.tagList.map((item) => {
item.tagList.map((items) => {
if(this.deptList[this.deptIndex].tagIdList.includes(items.id)) {
items.isCheck = true
}
})
})
}
this.showTagList = true
}
})
},
confirm() {
uni.setStorageSync('selectDeptUser', [this.deptList, ...this.userList])
console.log([...this.deptList, ...this.userList])
uni.setStorageSync('selectDeptUser', [...this.deptList, ...this.userList])
uni.navigateBack({ delta: 2 })
},
back() {
@@ -119,6 +122,7 @@ export default {
onLoad() {
var list = uni.getStorageSync('selectDeptUser')
this.sendType = uni.getStorageSync('sendType')
console.log(list)
list.map((item) => {
if(item.kind == 'dept') {
this.deptList.push(item)