Browse Source

通知管理 bug处理

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

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

@ -89,7 +89,7 @@
</div>
</el-dialog>
<!-- 删除 -->
<el-dialog :visible.sync="delVisible" title="提示" @close="handleClose">
<el-dialog :visible.sync="delVisible" title="提示">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
@ -182,44 +182,64 @@ export default {
},
getTableData() {
getNoticeList(this.getParams()).then(res => { //
console.log(res, 'res')
const table = res.content
this.page.total = res.totalElements
table.forEach(item => {
item.pushTo = 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 {
item.pushVal = item.noticeDevices.map(i => { return i.deviceInfoId })
item.pushTo = item.noticeDevices.map(i => {
let dev = null
this.devOptions.forEach(val => {
if (val.value === i.deviceInfoId) {
dev = val.label
}
})
return dev
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.pushTo = item.noticeDevices.map(i => {
let dev = null
this.devOptions.forEach(val => {
if (val.value === i.deviceInfoId) {
dev = val.label
}
})
}
} else if (item.noticeUsers.length > 0) { //
return dev
})
// }
} else if (item.pushType === 1) { //
// pushArr = item.noticeDevices
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.pushTo = item.noticeUsers.map(i => {
let user = null
this.userOptions.forEach(val => {
if (val.value === i.userId) {
user = val.label
}
})
return user
// 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.pushTo = item.noticeUsers.map(i => {
let user = null
this.userOptions.forEach(val => {
if (val.value === i.userId) {
user = val.label
}
})
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
@ -286,14 +306,17 @@ export default {
this.isEdit = false
this.sendVisible = true
},
//
handleEdit() {
this.isEdit = true
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) {
this.pushObj = '用户'
this.selectOptions = temp.length === this.userOptions.length - 1 ? [0, ...temp] : temp
} else {
this.pushObj = '设备'
this.selectOptions = temp.length === this.devOptions.length - 1 ? [0, ...temp] : temp
}
this.sendVisible = true
},
@ -311,6 +334,7 @@ export default {
const params = {}
params.noticeType = this.noticeType
params.noticeContent = this.sendForm.notification
//* ************** */
if (this.pushObj === '用户') { //
params.pushType = 1
params.userId = this.selectOptions.filter(item => item !== 0)
@ -337,7 +361,6 @@ export default {
})
this.$refs.formDom.resetFields()
this.$refs.formDom.clearValidate()
// this.crud.refresh()
} else {
this.btnloading = false
this.$message.error('发布失败')
@ -347,6 +370,9 @@ export default {
handleClose() {
this.$refs.formDom.resetFields()
this.$refs.formDom.clearValidate()
this.sendForm.notification = ''
this.pushObj = '用户'
this.noticeType = 1
},
//
handleDel() {
@ -400,42 +426,9 @@ export default {
}
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) {
if (val) {
// this.selectOptions = []
// this.showTags = false
this.defaultSelAll()
this.showTags = true
}

Loading…
Cancel
Save