diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue index efe9f92..1d2e2e9 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editConfigureEnergyAlarm.vue @@ -96,7 +96,7 @@ + :options="logicEnum" /> {{ `数值${index}:` }} ([ - { value: 0, label: '≥' }, - { value: 1, label: '>' }, - { value: 2, label: '≤' }, - { value: 3, label: '<' }, - { value: 4, label: '=' }, - ]); + const logicEnum = ref([]); //开关 const clickSwitch = () => { if (infoObject.value.enableRules === 1) { @@ -273,6 +267,8 @@ }; //父调子 页面显示方法 const toggle = async (value: any, info: any) => { + let menu = await getEnum({ params: { enumType: 'LogicEnum' } }); + logicEnum.value = menu.data; // 数据来源 let energyType = await dict({ params: { dicKey: 'ENERGY_TYPE' } }); if (energyType.data.data) { diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue index 9d20d37..abedc99 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/energyAlarm/editeEnergyAlarm.vue @@ -18,7 +18,7 @@ placeholder="请选择告警频率" style="width: 100%" allowClear - :options="alarmFrequencyData" + :options="AlarmFrequencyEnum" @change="handleChangeAlarmFrequency" /> @@ -45,7 +45,7 @@ placeholder="请选择优先级" style="width: 100%" allowClear - :options="priorityData" /> + :options="PriorityEnum" /> + :options="MonitorFrequencyEnumm" /> { + let menu = await getAllEnum({ + params: [ + 'PriorityEnum', + 'MonitorFrequencyEnumm', + 'AlarmFrequencyEnum', + 'IntervalDurationUnitEnum', + ], + }); + PriorityEnum.value = menu.data.PriorityEnum; + MonitorFrequencyEnumm.value = menu.data.MonitorFrequencyEnumm; + AlarmFrequencyEnum.value = menu.data.AlarmFrequencyEnum; + intervalDurationUnitData.value = menu.data.IntervalDurationUnitEnum; + }; const toggle = (value: any) => { + //获取枚举 回显 + getMenu(); //判断 是新增 还是修改 if (value) { infoObject.value = value; } else { infoObject.value = { + orgId: null, alarmTitle: null, alarmFrequency: null, priority: null, diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue index 4818fab..cad52e1 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editConfigureDeviceAlarm.vue @@ -84,7 +84,7 @@ placeholder="请选择取值类型" allow-clear style="width: 100%" - :options="qzOptions" /> + :options="valueTypeEnum" /> + :options="logicEnum" /> {{ `数值${index}:` }} ([ - { value: 1, label: '实时值' }, - { value: 2, label: '平均值' }, - ]); + const valueTypeEnum = ref(); //逻辑 - const ljOptions = ref([ - { value: 0, label: '≥' }, - { value: 1, label: '>' }, - { value: 2, label: '≤' }, - { value: 3, label: '<' }, - { value: 4, label: '=' }, - ]); + const logicEnum = ref([]); //开关 const clickSwitch = () => { @@ -299,10 +291,16 @@ } return null; // 没有找到目标节点,返回 null }; + const getMenu = async () => { + let menu = await getAllEnum({ params: ['LogicEnum', 'ValueTypeEnum'] }); + logicEnum.value = menu.data.LogicEnum; + valueTypeEnum.value = menu.data.ValueTypeEnum; + }; //父调子 页面显示方法 const toggle = async (value: any, info: any) => { equipmentAlarm.value = info; - + //获取枚举 回显 + getMenu(); //获取设备类型 await http .post(device.queryDeviceTree, { orgId: orgId.value, pageNum: 1, pageSize: 10 }) diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue index cb947bb..24a2ce1 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/equipmentAlarm/editeEquipmentAlarm.vue @@ -24,7 +24,7 @@ placeholder="请选择监测时长单位" style="width: 100%" allowClear - :options="monitorTimeUnitData" /> + :options="MonitorTimeUnitEnum" /> @@ -49,7 +49,7 @@ placeholder="请选择间隔时长单位" style="width: 80px" allowClear - :options="intervalDurationUnitData" /> + :options="IntervalDurationUnitEnum" /> @@ -59,7 +59,7 @@ placeholder="请选择优先级" style="width: 100%" allowClear - :options="priorityData" /> + :options="PriorityEnum" /> { + let menu = await getAllEnum({ + params: [ + 'PriorityEnum', + 'MonitorTimeUnitEnum', + 'AlarmFrequencyEnum', + 'IntervalDurationUnitEnum', + ], + }); + PriorityEnum.value = menu.data.PriorityEnum; + MonitorTimeUnitEnum.value = menu.data.MonitorTimeUnitEnum; + AlarmFrequencyEnum.value = menu.data.AlarmFrequencyEnum; + IntervalDurationUnitEnum.value = menu.data.IntervalDurationUnitEnum; + }; const toggle = (value: any) => { + //获取枚举 回显 + getMenu(); //判断 是新增 还是修改 if (value) { infoObject.value = value; diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/energyAlarmConfig.ts b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/energyAlarmConfig.ts index 037d9c6..83e9d3a 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/energyAlarmConfig.ts +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/energyAlarmConfig.ts @@ -2,6 +2,7 @@ import { http } from '/nerv-lib/util'; import { NsMessage } from '/nerv-lib/component'; import { energyAlarms } from '/@/api/alarmManagement/alarmSettings/energyAlarm'; import { ref } from 'vue'; +import { getEnum } from '/@/api'; const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); @@ -159,24 +160,23 @@ export const energyAlarmConfigs = ( { field: 'priority', label: '告警优先级', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择告警优先级', + api: () => getEnum({ params: { enumType: 'PriorityEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '紧急', - value: 1, - }, - { - label: '重要', - value: 2, - }, - { - label: '一般', - value: 3, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择告警优先级', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, { diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts index 6bb6bc2..92eef89 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/equipmentAlarmConfig.ts @@ -2,6 +2,7 @@ import { http } from '/nerv-lib/util'; import { NsMessage } from '/nerv-lib/component'; import { deviceAlarms } from '/@/api/alarmManagement/alarmSettings/deviceAlarms'; import { ref } from 'vue'; +import { getEnum } from '/@/api'; const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); @@ -158,24 +159,23 @@ export const equipmentAlarmTableConfig = ( { field: 'priority', label: '告警优先级', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择告警优先级', + api: () => getEnum({ params: { enumType: 'PriorityEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '紧急', - value: 1, - }, - { - label: '重要', - value: 2, - }, - { - label: '一般', - value: 3, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择告警优先级', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, { diff --git a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts index 838cdfc..710f779 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts +++ b/hx-ai-intelligent/src/view/alarmManagement/alarmSettings/ts/notificationManagementConfig.ts @@ -1,5 +1,6 @@ import { notificationManagementApi } from '/@/api/alarmManagement/alarmSettings/notificationManagements'; import { ref } from 'vue'; +import { getEnum } from '/@/api'; const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); @@ -91,24 +92,23 @@ export const notificationtableConfig = (notificationManagements: any) => { { field: 'priority', label: '告警优先级', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择告警优先级', + api: () => getEnum({ params: { enumType: 'PriorityEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '紧急', - value: 1, - }, - { - label: '重要', - value: 2, - }, - { - label: '一般', - value: 3, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择告警优先级', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, { diff --git a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue index d27a439..404781c 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/status.vue @@ -56,6 +56,7 @@ import { NsMessage } from '/nerv-lib/component'; import { http } from '/nerv-lib/util'; import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm'; + import { getEnum } from '/@/api'; export default defineComponent({ components: { NsSteps }, @@ -125,21 +126,10 @@ const toggle = async (data) => { energyAlarm.value = { ...data }; visible.value = true; - if (energyAlarm.value.createWorkOrder === 1) { - stateOptions.value = [ - { value: 1, label: '待处理' }, - { value: 2, label: '处理中' }, - { value: 3, label: '已完成' }, - { value: 4, label: '超时' }, - { value: 5, label: '已关闭' }, - ]; - } else { - stateOptions.value = [ - { value: 1, label: '待处理' }, - { value: 2, label: '处理中' }, - { value: 3, label: '已完成' }, - { value: 5, label: '已关闭' }, - ]; + let states = await getEnum({ params: { enumType: 'AlarmLogStateEnum' } }); + stateOptions.value = states.data; + if (energyAlarm.value.createWorkOrder !== 1) { + stateOptions.value = stateOptions.value.filter((item) => item.value !== 4); } await http .post(energyAlarmApi.getSelectAlarmEnergyConsumptionLogStatusProcess, { diff --git a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts index dda6037..9984202 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts +++ b/hx-ai-intelligent/src/view/alarmManagement/energyAlarm/ts/config.ts @@ -1,6 +1,7 @@ import { energyAlarmApi } from '/@/api/alarmManagement/energyAlarm'; import { dict } from '/@/api'; import { ref } from 'vue'; +import { getEnum } from '/@/api'; const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); @@ -24,7 +25,7 @@ const tableKeyMap = [ }, { title: '类型', - dataIndex: 'priority', + dataIndex: 'dataSourcesTypeName', }, { title: '优先级', @@ -107,55 +108,45 @@ export const notificationtableConfig = (look: any, status: any) => { { field: 'priority', label: '优先级', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择告警优先级', + api: () => getEnum({ params: { enumType: 'PriorityEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '紧急', - value: 1, - }, - { - label: '重要', - value: 2, - }, - { - label: '一般', - value: 3, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择告警优先级', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, { field: 'alarmLogState', label: '状态', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择状态', + api: () => getEnum({ params: { enumType: 'AlarmLogStateEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '待处理', - value: 1, - }, - { - label: '处理中', - value: 2, - }, - { - label: '已完成', - value: 3, - }, - { - label: '超时', - value: 4, - }, - { - label: '关闭', - value: 5, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择状态', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, { diff --git a/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue index d29f9e2..92a2a7f 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/status.vue @@ -56,6 +56,7 @@ import { NsMessage } from '/nerv-lib/component'; import { http } from '/nerv-lib/util'; import { equipmentAlarmApi } from '/@/api/alarmManagement/equipmentAlarm'; + import { getEnum } from '/@/api'; export default defineComponent({ components: { NsSteps }, @@ -126,21 +127,10 @@ const toggle = async (data) => { equipmentAlarm.value = { ...data }; visible.value = true; - if (equipmentAlarm.value.createWorkOrder === 1) { - stateOptions.value = [ - { value: 1, label: '待处理' }, - { value: 2, label: '处理中' }, - { value: 3, label: '已完成' }, - { value: 4, label: '超时' }, - { value: 5, label: '已关闭' }, - ]; - } else { - stateOptions.value = [ - { value: 1, label: '待处理' }, - { value: 2, label: '处理中' }, - { value: 3, label: '已完成' }, - { value: 5, label: '已关闭' }, - ]; + let states = await getEnum({ params: { enumType: 'AlarmLogStateEnum' } }); + stateOptions.value = states.data; + if (equipmentAlarm.value.createWorkOrder !== 1) { + stateOptions.value = stateOptions.value.filter((item) => item.value !== 4); } await http .post(equipmentAlarmApi.getSelectAlarmEquipmentLogStatusProcess, { diff --git a/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/ts/config.ts b/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/ts/config.ts index 45adaec..8da093c 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/ts/config.ts +++ b/hx-ai-intelligent/src/view/alarmManagement/equipmentAlarm/ts/config.ts @@ -1,5 +1,6 @@ import { equipmentAlarmApi } from '/@/api/alarmManagement/equipmentAlarm'; import { ref } from 'vue'; +import { getEnum } from '/@/api'; const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); @@ -88,55 +89,45 @@ export const notificationtableConfig = (look: any, status: any) => { { field: 'priority', label: '优先级', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择告警优先级', + api: () => getEnum({ params: { enumType: 'PriorityEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '紧急', - value: 1, - }, - { - label: '重要', - value: 2, - }, - { - label: '一般', - value: 3, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择告警优先级', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, { field: 'alarmLogState', label: '状态', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择状态', + api: () => getEnum({ params: { enumType: 'AlarmLogStateEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '待处理', - value: 1, - }, - { - label: '处理中', - value: 2, - }, - { - label: '已完成', - value: 3, - }, - { - label: '超时', - value: 4, - }, - { - label: '关闭', - value: 5, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择状态', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, { diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue index 49dfa8e..1c4b3ab 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/status.vue @@ -47,6 +47,7 @@ import { defineComponent } from 'vue'; import { ref } from 'vue'; import NsSteps from '/@/components/ns-steps.vue'; + import { getEnum } from '/@/api'; export default defineComponent({ components: { NsSteps }, @@ -54,13 +55,7 @@ setup() { const visible = ref(false); const infoObject = ref({}); - const stateOptions = ref([ - { value: 1, label: '待处理' }, - { value: 2, label: '处理中' }, - { value: 3, label: '已完成' }, - { value: 4, label: '超时' }, - { value: 5, label: '已关闭' }, - ]); + const stateOptions = ref(); const logList = ref([ { realName: '李四', state: 3, createTime: '2024-03-10 10:00:00', remarks: '完成' }, { realName: '王五', state: 5, createTime: '2024-03-10 10:00:00' }, @@ -78,7 +73,9 @@ const btnClick = () => { visible.value = false; }; - const toggle = (data) => { + const toggle = async (data) => { + let states = await getEnum({ params: { enumType: 'AlarmLogStateEnum' } }); + stateOptions.value = states.data; infoObject.value = { ...logList.value[0] }; let stateMap = { 1: '待处理', diff --git a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts index 854974d..3f72552 100644 --- a/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts +++ b/hx-ai-intelligent/src/view/alarmManagement/gatewayAlarm/ts/config.ts @@ -1,5 +1,6 @@ import { gatewayAlarmApi } from '/@/api/alarmManagement/gatewayAlarm'; import { ref } from 'vue'; +import { getEnum } from '/@/api'; const orgId = ref(''); const result = JSON.parse(sessionStorage.getItem('ORGID')!); @@ -104,32 +105,23 @@ export const notificationtableConfig = (look: any, status: any) => { { field: 'alarmLogState', label: '状态', - component: 'NsSelect', + component: 'nsSelectApi', + // dynamicParams: { + // id: 'deviceName', //帮定上级联动数据 + // }, componentProps: { - placeholder: '请选择状态', + api: () => getEnum({ params: { enumType: 'AlarmLogStateEnum' } }), + immediate: true, allowClear: true, - options: [ - { - label: '待处理', - value: 1, - }, - { - label: '处理中', - value: 2, - }, - { - label: '已完成', - value: 3, - }, - { - label: '超时', - value: 4, - }, - { - label: '关闭', - value: 5, - }, - ], + resultField: 'data', + labelField: 'label', + valueField: 'value', + placeholder: '请选择状态', + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; + }, + // autoSelectFirst: true, }, }, {