fix:能源告警配置
This commit is contained in:
@@ -26,14 +26,11 @@
|
||||
import { ref } from 'vue';
|
||||
import { NsMessage } from '/nerv-lib/component';
|
||||
import { http } from '/nerv-lib/util';
|
||||
// import { deviceAlarms } from '/@/api/alarmSettings/deviceAlarms';
|
||||
import { dict } from '/@/api';
|
||||
import { energyAlarms } from '/@/api/alarmSettings/energyAlarm';
|
||||
|
||||
const visible = ref(false);
|
||||
//表单数据
|
||||
const infoObject = ref({
|
||||
id: null,
|
||||
accountNo: null,
|
||||
enableRules: 0,
|
||||
});
|
||||
const formRef = ref();
|
||||
@@ -44,8 +41,6 @@
|
||||
infoObject.value = value;
|
||||
} else {
|
||||
infoObject.value = {
|
||||
id: null,
|
||||
accountNo: null,
|
||||
enableRules: 0,
|
||||
};
|
||||
}
|
||||
@@ -145,9 +140,9 @@
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'priority',
|
||||
field: 'monitorFrequency',
|
||||
label: '监测频率',
|
||||
component: 'nsSelectApi',
|
||||
component: 'NsSelect',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
@@ -156,14 +151,30 @@
|
||||
},
|
||||
],
|
||||
componentProps: {
|
||||
api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }),
|
||||
// params: { dicKey: 'ENERGY_TYPE' },
|
||||
immediate: true,
|
||||
// resultField: 'data.ENERGY_TYPE',
|
||||
labelField: 'cnValue',
|
||||
valueField: 'cnValue',
|
||||
placeholder: '请选择能耗种类',
|
||||
autoSelectFirst: true,
|
||||
allowClear: true,
|
||||
placeholder: '请选择优先级',
|
||||
options: [
|
||||
{
|
||||
label: '小时',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '每日',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '每周',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '月度',
|
||||
value: 4,
|
||||
},
|
||||
{
|
||||
label: '年度',
|
||||
value: 5,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -185,24 +196,21 @@
|
||||
//表单校验
|
||||
formRef.value.triggerSubmit().then(() => {
|
||||
//调用接口
|
||||
// http.post(deviceAlarms.addOrUpNewData, infoObject.value).then(() => {
|
||||
// NsMessage.success('操作成功');
|
||||
// visible.value = false;
|
||||
// emit('editObject', null);
|
||||
// });
|
||||
// if (infoObject.value.id) {
|
||||
// NsMessage.success('告警编辑成功');
|
||||
// } else {
|
||||
// NsMessage.success('告警创建成功');
|
||||
// }
|
||||
http.post(energyAlarms.addOrUpNewData, infoObject.value).then(() => {
|
||||
emit('editObject', null);
|
||||
if (infoObject.value.id) {
|
||||
NsMessage.success('告警编辑成功');
|
||||
} else {
|
||||
NsMessage.success('告警创建成功');
|
||||
}
|
||||
handleClose();
|
||||
});
|
||||
});
|
||||
};
|
||||
const handleClose = () => {
|
||||
// 清楚校验错误信息
|
||||
formRef.value.formElRef.clearValidate();
|
||||
infoObject.value = {
|
||||
id: null,
|
||||
accountNo: null,
|
||||
enableRules: 0,
|
||||
};
|
||||
visible.value = false;
|
||||
|
Reference in New Issue
Block a user