fix:andon报警异常类型
This commit is contained in:
parent
0140a9f834
commit
8e58b9a54b
@ -264,9 +264,10 @@ export default {
|
||||
},
|
||||
// 联系人选择变化处理
|
||||
handleReceiverChange(val, index) {
|
||||
const selectedOption = this.alarmContactOptions.find(option => option.value === val);
|
||||
// 获取选中的值和对应的标签
|
||||
const selectedOptions = this.alarmContactOptions.filter(option => val.includes(option.value));
|
||||
this.form[`receiver${index}`] = val;
|
||||
this.form[`receiver${index}Name`] = selectedOption ? selectedOption.label : undefined;
|
||||
this.form[`receiver${index}Name`] = selectedOptions.map(option => option.label).join(',');
|
||||
},
|
||||
// 重置查询操作
|
||||
resetQuery() {
|
||||
@ -332,6 +333,20 @@ export default {
|
||||
this.form = {
|
||||
...data,
|
||||
};
|
||||
|
||||
// 如果后端返回的是逗号分隔的字符串,需要转换为数组
|
||||
if (data.receiver1) {
|
||||
this.form.receiver1 = data.receiver1.split(',');
|
||||
}
|
||||
if (data.receiver2) {
|
||||
this.form.receiver2 = data.receiver2.split(',');
|
||||
}
|
||||
if (data.receiver3) {
|
||||
this.form.receiver3 = data.receiver3.split(',');
|
||||
}
|
||||
if (data.receiver4) {
|
||||
this.form.receiver4 = data.receiver4.split(',');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -340,14 +355,35 @@ export default {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
console.log(JSON.stringify(this.form));
|
||||
let data={
|
||||
let data = {
|
||||
...this.form,
|
||||
receiver1:this.form.receiver1.join(','),
|
||||
receiver2:this.form.receiver2.join(',') ,
|
||||
receiver3:this.form.receiver3.join(',') ,
|
||||
receiver4:this.form.receiver4.join(',') ,
|
||||
|
||||
receiver1: Array.isArray(this.form.receiver1) ? this.form.receiver1.join(',') : this.form.receiver1,
|
||||
receiver2: Array.isArray(this.form.receiver2) ? this.form.receiver2.join(',') : this.form.receiver2,
|
||||
receiver3: Array.isArray(this.form.receiver3) ? this.form.receiver3.join(',') : this.form.receiver3,
|
||||
receiver4: Array.isArray(this.form.receiver4) ? this.form.receiver4.join(',') : this.form.receiver4,
|
||||
// 添加名称字段
|
||||
receiver1Name: Array.isArray(this.form.receiver1) ?
|
||||
this.form.receiver1.map(id => {
|
||||
const option = this.alarmContactOptions.find(opt => opt.value == id);
|
||||
return option ? option.label : '';
|
||||
}).join(',') : this.form.receiver1Name,
|
||||
receiver2Name: Array.isArray(this.form.receiver2) ?
|
||||
this.form.receiver2.map(id => {
|
||||
const option = this.alarmContactOptions.find(opt => opt.value == id);
|
||||
return option ? option.label : '';
|
||||
}).join(',') : this.form.receiver2Name,
|
||||
receiver3Name: Array.isArray(this.form.receiver3) ?
|
||||
this.form.receiver3.map(id => {
|
||||
const option = this.alarmContactOptions.find(opt => opt.value == id);
|
||||
return option ? option.label : '';
|
||||
}).join(',') : this.form.receiver3Name,
|
||||
receiver4Name: Array.isArray(this.form.receiver4) ?
|
||||
this.form.receiver4.map(id => {
|
||||
const option = this.alarmContactOptions.find(opt => opt.value == id);
|
||||
return option ? option.label : '';
|
||||
}).join(',') : this.form.receiver4Name,
|
||||
}
|
||||
|
||||
if (this.form.id != undefined && this.opertype === 2) {
|
||||
updateAndonAlarmTypeDict(data)
|
||||
.then((res) => {
|
||||
|
||||
@ -481,6 +481,7 @@ export default {
|
||||
this.open = false;
|
||||
this.reset(); // 清空表单数据
|
||||
this.getLeftList();
|
||||
this.processingData = []
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
@ -533,7 +534,8 @@ export default {
|
||||
message: '响应成功!'
|
||||
});
|
||||
this.form.status = '已响应'
|
||||
this.getLeftList();
|
||||
this.processingData = res.data.result
|
||||
// this.getLeftList();
|
||||
}
|
||||
})
|
||||
|
||||
@ -583,7 +585,7 @@ export default {
|
||||
message: '处理完毕!'
|
||||
});
|
||||
this.form.status = '已处理'
|
||||
this.getLeftList();
|
||||
this.processingData = res.data.result
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user