Browse Source

通知管理 bug处理

master
x_ying 2 years ago
parent
commit
ef9f9b3a80
  1. 87
      src/views/system/notifyManage/index.vue

87
src/views/system/notifyManage/index.vue

@ -89,7 +89,7 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 删除 --> <!-- 删除 -->
<el-dialog :visible.sync="delVisible" title="提示" @close="handleClose">
<el-dialog :visible.sync="delVisible" title="提示">
<span class="dialog-right-top" /> <span class="dialog-right-top" />
<span class="dialog-left-bottom" /> <span class="dialog-left-bottom" />
<div class="setting-dialog"> <div class="setting-dialog">
@ -182,16 +182,17 @@ export default {
}, },
getTableData() { getTableData() {
getNoticeList(this.getParams()).then(res => { // getNoticeList(this.getParams()).then(res => { //
console.log(res, 'res')
const table = res.content const table = res.content
this.page.total = res.totalElements this.page.total = res.totalElements
table.forEach(item => { table.forEach(item => {
item.pushTo = null item.pushTo = null
item.pushVal = null item.pushVal = null
if (item.noticeDevices.length > 0) { //
if (item.noticeDevices.length === this.devOptions.length - 1) {
item.pushTo = '全部设备'
item.pushVal = this.sendObjOptions.map(i => { return i.value })
} else {
if (item.pushType === 2) { //
// if (item.noticeDevices.length === this.devOptions.length - 1) {
// item.pushTo = ''
// item.pushVal = this.sendObjOptions.map(i => { return i.value })
// } else {
item.pushVal = item.noticeDevices.map(i => { return i.deviceInfoId }) item.pushVal = item.noticeDevices.map(i => { return i.deviceInfoId })
item.pushTo = item.noticeDevices.map(i => { item.pushTo = item.noticeDevices.map(i => {
let dev = null let dev = null
@ -202,13 +203,13 @@ export default {
}) })
return dev return dev
}) })
}
} else if (item.noticeUsers.length > 0) { //
// }
} else if (item.pushType === 1) { //
// pushArr = item.noticeDevices // pushArr = item.noticeDevices
if (item.noticeUsers.length === this.userOptions.length - 1) {
item.pushTo = '全部用户'
item.pushVal = this.userOptions.map(i => { return i.value })
} else {
// if (item.noticeUsers.length === this.userOptions.length - 1) {
// item.pushTo = ''
// item.pushVal = this.userOptions.map(i => { return i.value })
// } else {
item.pushVal = item.noticeUsers.map(i => { return i.userId }) item.pushVal = item.noticeUsers.map(i => { return i.userId })
item.pushTo = item.noticeUsers.map(i => { item.pushTo = item.noticeUsers.map(i => {
let user = null let user = null
@ -219,7 +220,26 @@ export default {
}) })
return user return user
}) })
// }
}
//
const arrTo = []
const arrVal = []
item.pushTo.forEach(i => {
if (arrTo.indexOf(i) === -1) {
arrTo.push(i)
}
})
item.pushVal.forEach(i => {
if (arrVal.indexOf(i) === -1) {
arrVal.push(i)
} }
})
item.pushVal = arrVal
if (item.pushType === 1) { //
item.pushTo = arrVal.length === this.userOptions.length - 1 ? '全部用户' : arrTo
} else {
item.pushTo = arrVal.length === this.devOptions.length - 1 ? '全部设备' : arrTo
} }
}) })
this.tableData = table this.tableData = table
@ -286,14 +306,17 @@ export default {
this.isEdit = false this.isEdit = false
this.sendVisible = true this.sendVisible = true
}, },
//
handleEdit() { handleEdit() {
this.isEdit = true this.isEdit = true
this.sendForm.notification = this.selections[0].noticeContent this.sendForm.notification = this.selections[0].noticeContent
this.selectOptions = this.selections[0].pushVal
const temp = this.selections[0].pushVal
if (this.selections[0].pushType === 1) { if (this.selections[0].pushType === 1) {
this.pushObj = '用户' this.pushObj = '用户'
this.selectOptions = temp.length === this.userOptions.length - 1 ? [0, ...temp] : temp
} else { } else {
this.pushObj = '设备' this.pushObj = '设备'
this.selectOptions = temp.length === this.devOptions.length - 1 ? [0, ...temp] : temp
} }
this.sendVisible = true this.sendVisible = true
}, },
@ -311,6 +334,7 @@ export default {
const params = {} const params = {}
params.noticeType = this.noticeType params.noticeType = this.noticeType
params.noticeContent = this.sendForm.notification params.noticeContent = this.sendForm.notification
//* ************** */
if (this.pushObj === '用户') { // if (this.pushObj === '用户') { //
params.pushType = 1 params.pushType = 1
params.userId = this.selectOptions.filter(item => item !== 0) params.userId = this.selectOptions.filter(item => item !== 0)
@ -337,7 +361,6 @@ export default {
}) })
this.$refs.formDom.resetFields() this.$refs.formDom.resetFields()
this.$refs.formDom.clearValidate() this.$refs.formDom.clearValidate()
// this.crud.refresh()
} else { } else {
this.btnloading = false this.btnloading = false
this.$message.error('发布失败') this.$message.error('发布失败')
@ -347,6 +370,9 @@ export default {
handleClose() { handleClose() {
this.$refs.formDom.resetFields() this.$refs.formDom.resetFields()
this.$refs.formDom.clearValidate() this.$refs.formDom.clearValidate()
this.sendForm.notification = ''
this.pushObj = '用户'
this.noticeType = 1
}, },
// //
handleDel() { handleDel() {
@ -400,42 +426,9 @@ export default {
} }
this.oldSelect = this.selectOptions this.oldSelect = this.selectOptions
} }
//
// var endSelectVal = val[val.length - 1]
// // showTags collapse-tags
// if (!val.includes('') && val.length === this.sendObjOptions.length) {
// //
// this.showTags = true
// val.unshift('')
// this.$refs.selectBox.$el.querySelector('.el-input__inner').style.height = '34px'
// } else if (val.includes('') && val.length === 1) {
// //
// this.showTags = true
// this.sendObjOptions.map(item => {
// val.push(item.value)
// })
// } else if (val.includes('') && val.length - 1 < this.sendObjOptions.length && endSelectVal === '') {
// //
// val = []
// this.sendObjOptions.map(item => {
// val.push(item.value)
// })
// val.unshift('')
// this.showTags = true
// this.$refs.selectBox.$el.querySelector('.el-input__inner').style.height = '34px'
// } else if (val.includes('') && val.length - 1 < this.sendObjOptions.length) {
// //
// this.showTags = false
// val = val.filter(item => {
// return item !== ''
// })
// }
// this.selectOptions = val // select
}, },
pushObjChange(val) { pushObjChange(val) {
if (val) { if (val) {
// this.selectOptions = []
// this.showTags = false
this.defaultSelAll() this.defaultSelAll()
this.showTags = true this.showTags = true
} }

Loading…
Cancel
Save