+
以下设备都将被发送总计{{ deviceTags.length }}个设备
@@ -279,8 +279,10 @@ export default {
reqQueryMessage(params).then((res) => {
if (res.code == 200) {
this.form.notice_device = res.data.notice.noticeDevice
+ this.deviceTags = res.data.noticeDeviceDetailsVO
this.form.context_color = res.data.notice.contextColor
this.form.context = res.data.notice.context
+ this.form.context_speed = res.data.notice.contextSpeed
this.form.context_position = res.data.notice.contextPosition
this.form.context_size = res.data.notice.contextSize
this.form.notice_id = row.notice_id
@@ -293,7 +295,7 @@ export default {
this.form.context_position_name = '底部'
}
// 判断速度
- if (this.form.context_speed_name == 0) {
+ if (this.form.context_speed == 0) {
this.form.context_speed_name = '1s'
} else if (this.form.context_speed == 1) {
this.form.context_speed_name = '2s'
@@ -323,6 +325,18 @@ export default {
// 提交
submit() {
this.$refs.form.validate((valid) => {
+ console.log(this.deviceTags)
+ console.log(this.form.notice_devices)
+ if (this.form.notice_device == 2) {
+ if (this.deviceTags.length != 0) {
+ this.deviceTags.forEach(item => {
+ this.form.notice_devices.push({ deviceId: item.device_id })
+ })
+ } else {
+ this.$message.error('请添加设备!')
+ return
+ }
+ }
// 修改
if (valid) {
const params = {
@@ -336,6 +350,7 @@ export default {
notice_id: this.form.notice_id,
orga_id: '133221333123111'
}
+ console.log(params)
reqEditMessage(params).then((res) => {
if (res.code == 200) {
this.$message({
@@ -345,6 +360,7 @@ export default {
: '添加紧急通知成功'
})
this.messageVisible = false
+ this.$refs.form.resetFields()
this.getUrgentMessage(this.queryInfo.page)
}
})
@@ -393,26 +409,27 @@ export default {
// 添加设备
tagHandle(tag) {
// 收集参数 部分设备的列表
- if (this.form.notice_devices.length == 0) {
- this.form.notice_devices.push({ deviceId: tag.device_id })
- } else {
- const result = this.form.notice_devices.some((item) => {
- return item.deviceId == tag.device_id
- })
- if (!result) {
- this.form.notice_devices.push({ deviceId: tag.device_id })
- }
- }
-
+ // if (this.form.notice_devices.length == 0) {
+ // this.form.notice_devices.push({ deviceId: tag.device_id })
+ // } else {
+ // const result = this.form.notice_devices.some((item) => {
+ // return item.deviceId == tag.device_id
+ // })
+ // if (!result) {
+ // this.form.notice_devices.push({ deviceId: tag.device_id })
+ // }
+ // }
// 添加设备不能重复 不重复才添加
if (this.deviceTags.length == 0) {
+ // this.form.notice_devices.push({ deviceId: tag.device_id })
this.deviceTags.push(tag)
} else {
const current =
this.deviceTags &&
- this.deviceTags.some((item) => item.device_name == tag.device_name)
+ this.deviceTags.some((item) => item.device_id == tag.device_id)
if (!current) {
this.deviceTags.push(tag)
+ // this.form.notice_devices.push({ deviceId: tag.device_id })
} else {
this.$message('请勿添加重复的设备!')
}
@@ -427,6 +444,7 @@ export default {
// 清空设备
clearDevice() {
this.deviceTags = []
+ this.form.notice_devices = []
},
// 关闭重置表单
closeDialog() {