From 95096ef6e6181c107987a12757541425c97b30e3 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Thu, 26 Mar 2026 17:45:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(ems):=20=E8=A1=A5=E5=85=85=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ems/record/recordAlarmRule.ts | 3 +- src/api/ems/types.ts | 139 ++++++++- .../ems/base/baseCollectDeviceInfo/index.vue | 87 +++++- src/views/ems/base/baseMonitorInfo/index.vue | 142 +++++---- .../base/baseMonitorInfoIOTDevice/index.vue | 274 +++++++++++++++--- .../ems/base/baseMonitorInfoSteam/index.vue | 208 ++++++++++--- .../ems/base/baseMonitorInfoWater/index.vue | 208 ++++++++++--- .../ems/record/recordAlarmData/index.vue | 151 +++++++--- .../ems/record/recordAlarmRule/index.vue | 206 +++++++++---- 9 files changed, 1137 insertions(+), 281 deletions(-) diff --git a/src/api/ems/record/recordAlarmRule.ts b/src/api/ems/record/recordAlarmRule.ts index ad18688..48974cc 100644 --- a/src/api/ems/record/recordAlarmRule.ts +++ b/src/api/ems/record/recordAlarmRule.ts @@ -56,6 +56,7 @@ export function getEmsRecordAlarmRuleTotalCount(): Promise> { return request({ url: '/ems/record/recordAlarmRule/getEmsRecordAlarmRuleList', - method: 'get' + method: 'get', + params: query }); } diff --git a/src/api/ems/types.ts b/src/api/ems/types.ts index 8f58345..d8b82ad 100644 --- a/src/api/ems/types.ts +++ b/src/api/ems/types.ts @@ -148,10 +148,11 @@ export interface RecordVibrationInstantQuery extends EmsQuery { * EMS 页面里大量查询条件都遵循“分页参数 + 业务筛选字段”的模式。 * 抽成泛型后,页面层可以直接复用 VO 作为查询基底,减少局部重复声明。 */ -export interface EmsCrudQuery extends Partial, Partial { - params?: Record; - [key: string]: unknown; -} +export type EmsCrudQuery = Partial & + Partial & { + params?: Record; + [key: string]: unknown; + }; /** * 表单对象通常就是 VO 的可编辑版本;页面层可在此基础上再补少量临时字段。 @@ -171,6 +172,7 @@ export interface EmsEntity extends BaseEntity { monitorName?: string; collectDeviceId?: string; collectDeviceName?: string; + tenantId?: string; energyTypeId?: EmsId; energyTypeName?: string; energyId?: EmsId; @@ -180,6 +182,24 @@ export interface EmsEntity extends BaseEntity { manufacturer?: string; ipAddress?: string; settingAddress?: string; + protocolType?: string; + protocolVersion?: string; + port?: EmsId; + slaveNo?: EmsId; + serialPort?: string; + baudRate?: EmsId; + dataBits?: EmsId; + stopBits?: EmsId; + parity?: string; + opcEndpointUrl?: string; + opcSecurityPolicy?: string; + opcSecurityMode?: string; + username?: string; + password?: string; + heartbeatTime?: EmsDateValue; + lastOnlineTime?: EmsDateValue; + offlineTimeoutSec?: EmsId; + onlineStatus?: string; collectTime?: EmsDateValue; recordTime?: EmsDateValue; beginTime?: EmsDateValue; @@ -189,6 +209,7 @@ export interface EmsEntity extends BaseEntity { endDate?: EmsDateValue; produceDate?: EmsDateValue; operationTime?: EmsDateValue; + recoverTime?: EmsDateValue; createdAt?: EmsDateValue; createdTime?: EmsDateValue; updatedAt?: EmsDateValue; @@ -197,9 +218,50 @@ export interface EmsEntity extends BaseEntity { parentName?: string; orderNum?: number; ancestors?: string; + pointType?: string; + metricCode?: string; + unitName?: string; + collectChannel?: string; + registerAddress?: string; + registerType?: string; + dataType?: string; + byteOrder?: string; + bitOffset?: EmsId; + nodeId?: string; + deviceSn?: string; + deviceName?: string; + locationCode?: string; + locationName?: string; + cabinetName?: string; + circuitName?: string; + phaseNo?: string; + sensorType?: string; + measurePrecision?: EmsDecimalValue; + rangeMin?: EmsDecimalValue; + rangeMax?: EmsDecimalValue; + alarmEnable?: string; + curveEnable?: string; + displaySort?: EmsId; isFlag?: string | number | boolean; isAmmeter?: string | number | boolean; + isEnable?: string | number | boolean; status?: string | number | boolean; + alarmLevel?: string; + thresholdValue?: EmsDecimalValue; + actualValue?: EmsDecimalValue; + alarmTitle?: string; + alarmContent?: string; + pushStatus?: string; + pushCount?: EmsId; + confirmUserId?: EmsId; + confirmRemark?: string; + alarmUpper?: EmsDecimalValue; + alarmLower?: EmsDecimalValue; + recoverUpper?: EmsDecimalValue; + recoverLower?: EmsDecimalValue; + hysteresis?: EmsDecimalValue; + durationSec?: EmsId; + notifyGroupId?: EmsId; remark?: string; remarks?: string; description?: string; @@ -228,12 +290,31 @@ export interface BaseCollectDeviceInfoVO extends EmsEntity { collectDeviceName?: string; energyTypeId?: EmsId; energyTypeName?: string; + tenantId?: string; model?: string; manufacturer?: string; ipAddress?: string; produceDate?: EmsDateValue; settingAddress?: string; - isFlag?: string; + isFlag?: string | number; + protocolType?: string; + protocolVersion?: string; + port?: EmsId; + slaveNo?: EmsId; + serialPort?: string; + baudRate?: EmsId; + dataBits?: EmsId; + stopBits?: EmsId; + parity?: string; + opcEndpointUrl?: string; + opcSecurityPolicy?: string; + opcSecurityMode?: string; + username?: string; + password?: string; + heartbeatTime?: EmsDateValue; + lastOnlineTime?: EmsDateValue; + offlineTimeoutSec?: EmsId; + onlineStatus?: string; } export interface BaseEnergyTypeVO extends EmsEntity { @@ -264,6 +345,7 @@ export interface BaseMonitorInfoVO extends EmsEntity { monitorType?: EmsId; monitorStatus?: EmsId; collectDeviceId?: string; + collectDeviceName?: string; grade?: EmsId; meterTypeId?: string; correctValue?: EmsDecimalValue; @@ -280,6 +362,30 @@ export interface BaseMonitorInfoVO extends EmsEntity { orderNum?: number; ancestors?: string; monitorTypeList?: Array; + tenantId?: string; + pointType?: string; + metricCode?: string; + unitName?: string; + collectChannel?: string; + registerAddress?: string; + registerType?: string; + dataType?: string; + byteOrder?: string; + bitOffset?: EmsId; + nodeId?: string; + deviceSn?: string; + locationCode?: string; + locationName?: string; + cabinetName?: string; + circuitName?: string; + phaseNo?: string; + sensorType?: string; + measurePrecision?: EmsDecimalValue; + rangeMin?: EmsDecimalValue; + rangeMax?: EmsDecimalValue; + alarmEnable?: string; + curveEnable?: string; + displaySort?: EmsId; children?: BaseMonitorInfoVO[]; } @@ -443,6 +549,18 @@ export interface EmsRecordAlarmDataVO extends EmsEntity { cause?: string; notifyUser?: string; deviceName?: string; + tenantId?: string; + metricCode?: string; + alarmLevel?: string; + thresholdValue?: EmsDecimalValue; + actualValue?: EmsDecimalValue; + alarmTitle?: string; + alarmContent?: string; + recoverTime?: EmsDateValue; + pushStatus?: string; + pushCount?: EmsId; + confirmUserId?: EmsId; + confirmRemark?: string; } export interface EmsRecordAlarmRuleVO extends EmsEntity { @@ -461,6 +579,17 @@ export interface EmsRecordAlarmRuleVO extends EmsEntity { notifyUser?: string; cause?: string; nickName?: string; + tenantId?: string; + metricCode?: string; + alarmUpper?: EmsDecimalValue; + alarmLower?: EmsDecimalValue; + recoverUpper?: EmsDecimalValue; + recoverLower?: EmsDecimalValue; + hysteresis?: EmsDecimalValue; + durationSec?: EmsId; + alarmLevel?: string; + notifyGroupId?: EmsId; + isEnable?: string; } export interface EmsRecordDnbInstantVO extends EmsEntity { diff --git a/src/views/ems/base/baseCollectDeviceInfo/index.vue b/src/views/ems/base/baseCollectDeviceInfo/index.vue index c916524..39284b9 100644 --- a/src/views/ems/base/baseCollectDeviceInfo/index.vue +++ b/src/views/ems/base/baseCollectDeviceInfo/index.vue @@ -181,7 +181,7 @@ import { } from '@/api/ems/base/baseCollectDeviceInfo'; import { getBaseEnergyTypeList } from '@/api/ems/base/baseEnergyType'; import { useDict } from '@/utils/dict'; -import type { EmsId } from '@/api/ems/types'; +import type { EmsDateValue, EmsId } from '@/api/ems/types'; defineOptions({ name: 'BaseCollectDeviceInfo' @@ -192,13 +192,33 @@ interface BaseCollectDeviceInfoVO extends BaseEntity { collectDeviceId?: string | null; collectDeviceName?: string | null; energyTypeId?: EmsId | null; + energyTypeName?: string | null; model?: string | null; manufacturer?: string | null; ipAddress?: string | null; - produceDate?: string | null; + produceDate?: EmsDateValue | null; settingAddress?: string | null; isFlag?: string | number | null; remark?: string | null; + tenantId?: string | null; + protocolType?: string | null; + protocolVersion?: string | null; + port?: EmsId | null; + slaveNo?: EmsId | null; + serialPort?: string | null; + baudRate?: EmsId | null; + dataBits?: EmsId | null; + stopBits?: EmsId | null; + parity?: string | null; + opcEndpointUrl?: string | null; + opcSecurityPolicy?: string | null; + opcSecurityMode?: string | null; + username?: string | null; + password?: string | null; + heartbeatTime?: EmsDateValue | null; + lastOnlineTime?: EmsDateValue | null; + offlineTimeoutSec?: EmsId | null; + onlineStatus?: string | null; } interface BaseCollectDeviceInfoQuery extends PageQuery { @@ -208,9 +228,11 @@ interface BaseCollectDeviceInfoQuery extends PageQuery { model?: string | null; manufacturer?: string | null; ipAddress?: string | null; - produceDate?: string | null; + produceDate?: EmsDateValue | null; settingAddress?: string | null; isFlag?: string | number | null; + protocolType?: string | null; + onlineStatus?: string | null; } interface BaseCollectDeviceInfoForm extends BaseEntity { @@ -218,13 +240,33 @@ interface BaseCollectDeviceInfoForm extends BaseEntity { collectDeviceId?: string | null; collectDeviceName?: string | null; energyTypeId?: EmsId | null; + energyTypeName?: string | null; model?: string | null; manufacturer?: string | null; ipAddress?: string | null; - produceDate?: string | null; + produceDate?: EmsDateValue | null; settingAddress?: string | null; isFlag?: string | number | null; remark?: string | null; + tenantId?: string | null; + protocolType?: string | null; + protocolVersion?: string | null; + port?: EmsId | null; + slaveNo?: EmsId | null; + serialPort?: string | null; + baudRate?: EmsId | null; + dataBits?: EmsId | null; + stopBits?: EmsId | null; + parity?: string | null; + opcEndpointUrl?: string | null; + opcSecurityPolicy?: string | null; + opcSecurityMode?: string | null; + username?: string | null; + password?: string | null; + heartbeatTime?: EmsDateValue | null; + lastOnlineTime?: EmsDateValue | null; + offlineTimeoutSec?: EmsId | null; + onlineStatus?: string | null; } interface EnergyTypeOption { @@ -253,7 +295,7 @@ const title = ref(''); const open = ref(false); const energyTypeList = ref([]); -const queryParams = ref({ +const createQueryParams = (): BaseCollectDeviceInfoQuery => ({ pageNum: 1, pageSize: 10, collectDeviceId: null, @@ -264,14 +306,20 @@ const queryParams = ref({ ipAddress: null, produceDate: null, settingAddress: null, - isFlag: null + isFlag: null, + protocolType: null, + onlineStatus: null }); +// 技术字段只保留在查询对象和表单里,供接口入参与详情回填使用,不直接渲染到页面。 +const queryParams = ref(createQueryParams()); + const createFormData = (): BaseCollectDeviceInfoForm => ({ objId: undefined, collectDeviceId: null, collectDeviceName: null, energyTypeId: null, + energyTypeName: null, model: null, manufacturer: null, ipAddress: null, @@ -282,7 +330,27 @@ const createFormData = (): BaseCollectDeviceInfoForm => ({ createTime: null, updateBy: null, updateTime: null, - remark: null + remark: null, + tenantId: null, + // 技术字段纳入表单对象,保证详情回写和再次提交时不会被前端意外丢失。 + protocolType: null, + protocolVersion: null, + port: null, + slaveNo: null, + serialPort: null, + baudRate: null, + dataBits: null, + stopBits: null, + parity: null, + opcEndpointUrl: null, + opcSecurityPolicy: null, + opcSecurityMode: null, + username: null, + password: null, + heartbeatTime: null, + lastOnlineTime: null, + offlineTimeoutSec: null, + onlineStatus: null }); const form = ref(createFormData()); @@ -371,7 +439,10 @@ const handleUpdate = async (row?: BaseCollectDeviceInfoVO) => { return; } const response = await getBaseCollectDeviceInfo(objId); - Object.assign(form.value, response.data); + form.value = { + ...createFormData(), + ...(response.data ?? {}) + }; open.value = true; title.value = '修改采集设备信息'; }; diff --git a/src/views/ems/base/baseMonitorInfo/index.vue b/src/views/ems/base/baseMonitorInfo/index.vue index 9f2ad5e..5effc61 100644 --- a/src/views/ems/base/baseMonitorInfo/index.vue +++ b/src/views/ems/base/baseMonitorInfo/index.vue @@ -52,7 +52,7 @@ - + @@ -200,16 +200,60 @@ const dict = reactive({ const formRef = ref(); const queryFormRef = ref(); +const createQueryParams = () => ({ + parentId: null, + parentName: null, + monitorCode: null, + monitorName: null, + monitorAddr: null, + monitorType: 2, + monitorTypeList: null, + monitorStatus: null, + collectDeviceId: null, + collectDeviceName: null, + energyName: null, + ancestors: null, + grade: null, + meterTypeId: null, + correctValue: null, + pt: null, + ct: null, + isAmmeter: null, + isKeyMonitor: null, + isCircuit: null, + createBy: null, + createTime: null, + updateBy: null, + updateTime: null, + publicShareType: null, + monitorHierarchy: null, + pointType: null, + metricCode: null, + unitName: null, + orderNum: null, + locationName: null, + cabinetName: null, + circuitName: null, + phaseNo: null, + sensorType: null, + deviceName: null, + alarmEnable: null, + curveEnable: null +}); + // 这里统一通过工厂函数重建表单,避免弹窗在新增/编辑切换时残留上一条业务数据。 const createFormData = () => ({ objId: null, parentId: null, + parentName: null, monitorCode: null, monitorName: null, monitorAddr: null, monitorType: '2', + monitorTypeList: null, monitorStatus: 0, collectDeviceId: null, + collectDeviceName: null, ancestors: null, grade: null, meterTypeId: null, @@ -224,7 +268,34 @@ const createFormData = () => ({ updateBy: null, updateTime: null, publicShareType: null, - monitorHierarchy: null + monitorHierarchy: null, + tenantId: null, + energyName: null, + orderNum: null, + pointType: null, + metricCode: null, + unitName: null, + collectChannel: null, + registerAddress: null, + registerType: null, + dataType: null, + byteOrder: null, + bitOffset: null, + nodeId: null, + deviceSn: null, + deviceName: null, + locationCode: null, + locationName: null, + cabinetName: null, + circuitName: null, + phaseNo: null, + sensorType: null, + measurePrecision: null, + rangeMin: null, + rangeMax: null, + alarmEnable: null, + curveEnable: null, + displaySort: null }); // 这里保留原页面字段结构,优先保证 EMS 业务行为与接口入参不发生漂移。 @@ -246,30 +317,8 @@ const state = reactive({ // 重新渲染表格状态 refreshTable: true, // 查询参数 - queryParams: { - parentId: null, - monitorCode: null, - monitorName: null, - monitorAddr: null, - monitorType: 2, - monitorStatus: null, - collectDeviceId: null, - ancestors: null, - grade: null, - meterTypeId: null, - correctValue: null, - pt: null, - ct: null, - isAmmeter: null, - isKeyMonitor: null, - isCircuit: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, - publicShareType: null, - monitorHierarchy: null - }, + // 关联名称字段和技术字段都保留在 state 中,页面只挑业务字段做展示。 + queryParams: createQueryParams(), // 表单参数 form: createFormData(), // 表单校验 @@ -334,7 +383,7 @@ const state = reactive({ }, { key: 7, - label: `采集设备编号`, + label: `采集设备名称`, visible: true }, { @@ -436,7 +485,8 @@ const { const getList = () => { loading.value = true; listBaseMonitorInfo(queryParams.value).then((response) => { - baseMonitorInfoList.value = handleTree(response.data, 'objId', 'parentId'); + const source = response.rows ?? response.data ?? []; + baseMonitorInfoList.value = handleTree(source, 'objId', 'parentId'); loading.value = false; }); }; @@ -455,12 +505,13 @@ const normalizer = (node) => { const getTreeselect = () => { listBaseMonitorInfo().then((response) => { baseMonitorInfoOptions.value = []; + const source = response.rows ?? response.data ?? []; const data = { objId: 0, monitorName: '顶级节点', children: [] }; - data.children = handleTree(response.data, 'objId', 'parentId'); + data.children = handleTree(source, 'objId', 'parentId'); baseMonitorInfoOptions.value.push(data); }); }; @@ -471,31 +522,7 @@ const cancel = () => { }; const reset = () => { - form.value = { - objId: null, - parentId: null, - monitorCode: null, - monitorName: null, - monitorAddr: null, - monitorType: '2', - monitorStatus: 0, - collectDeviceId: null, - ancestors: null, - grade: null, - meterTypeId: null, - correctValue: null, - pt: 1, - ct: 1, - isAmmeter: '1', - isKeyMonitor: null, - isCircuit: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, - publicShareType: null, - monitorHierarchy: null - }; + form.value = createFormData(); formRef.value?.resetFields(); }; @@ -535,7 +562,10 @@ const handleUpdate = (row) => { form.value.parentId = row.parentId; } getBaseMonitorInfo(row.objId).then((response) => { - form.value = response.data; + form.value = { + ...createFormData(), + ...(response.data ?? {}) + }; open.value = true; title.value = '修改计量设备信息'; }); @@ -576,7 +606,7 @@ const handleDelete = (row) => { onMounted(() => { getCollectDeviceInfo({}).then((response) => { - collectDeviceList.value = response.data; + collectDeviceList.value = response.rows ?? response.data ?? []; }); getList(); }); diff --git a/src/views/ems/base/baseMonitorInfoIOTDevice/index.vue b/src/views/ems/base/baseMonitorInfoIOTDevice/index.vue index 2ac65f2..d0a7c2e 100644 --- a/src/views/ems/base/baseMonitorInfoIOTDevice/index.vue +++ b/src/views/ems/base/baseMonitorInfoIOTDevice/index.vue @@ -22,6 +22,12 @@ + + + + + + @@ -72,7 +78,16 @@ - + + + + + + + + @@ -146,8 +161,61 @@ {{ dict.label }} - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + {{ dict.label }} + + + + @@ -240,7 +308,18 @@ - + + + + + + + + + + - + + + + + + + + @@ -118,8 +133,61 @@ {{ dict.label }} - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + {{ dict.label }} + + + + @@ -167,18 +235,19 @@ import { addBaseMonitorInfo, updateBaseMonitorInfo } from '@/api/ems/base/baseMonitorInfo'; +import { getCollectDeviceInfo } from '@/api/ems/base/baseCollectDeviceInfo'; import EmsTreeSelect from '@/views/ems/components/EmsTreeSelect.vue'; import { handleTree } from '@/utils/ruoyi'; defineOptions({ name: 'BaseMonitorInfo', - dicts: ['is_ammeter', 'monitor_status'] + dicts: ['is_ammeter', 'monitor_status', 'is_flag'] }); const { proxy } = getCurrentInstance() as ComponentInternalInstance; const dict = reactive({ - type: useDict('is_ammeter', 'monitor_status') + type: useDict('is_ammeter', 'monitor_status', 'is_flag') }); const formRef = ref(); @@ -208,7 +277,31 @@ const createFormData = () => ({ updateBy: null, updateTime: null, publicShareType: null, - monitorHierarchy: null + monitorHierarchy: null, + tenantId: null, + pointType: null, + metricCode: null, + unitName: null, + collectChannel: null, + registerAddress: null, + registerType: null, + dataType: null, + byteOrder: null, + bitOffset: null, + nodeId: null, + deviceSn: null, + locationCode: null, + locationName: null, + cabinetName: null, + circuitName: null, + phaseNo: null, + sensorType: null, + measurePrecision: null, + rangeMin: null, + rangeMax: null, + alarmEnable: null, + curveEnable: null, + displaySort: null }); // 这里保留原页面字段结构,优先保证 EMS 业务行为与接口入参不发生漂移。 @@ -230,6 +323,7 @@ const state = reactive({ // 重新渲染表格状态 refreshTable: true, // 查询参数 + // 查询对象补齐最新字段,页面只展示业务字段,技术字段继续留在内部承载和导出参数中。 queryParams: { parentId: null, monitorCode: null, @@ -238,6 +332,7 @@ const state = reactive({ monitorType: 3, monitorStatus: null, collectDeviceId: null, + collectDeviceName: null, ancestors: null, grade: null, meterTypeId: null, @@ -252,7 +347,31 @@ const state = reactive({ updateBy: null, updateTime: null, publicShareType: null, - monitorHierarchy: null + monitorHierarchy: null, + tenantId: null, + pointType: null, + metricCode: null, + unitName: null, + collectChannel: null, + registerAddress: null, + registerType: null, + dataType: null, + byteOrder: null, + bitOffset: null, + nodeId: null, + deviceSn: null, + locationCode: null, + locationName: null, + cabinetName: null, + circuitName: null, + phaseNo: null, + sensorType: null, + measurePrecision: null, + rangeMin: null, + rangeMax: null, + alarmEnable: null, + curveEnable: null, + displaySort: null }, // 表单参数 form: createFormData(), @@ -311,7 +430,7 @@ const state = reactive({ }, { key: 7, - label: `采集设备编号`, + label: `采集设备名称`, visible: true }, { @@ -388,14 +507,41 @@ const state = reactive({ key: 22, label: `表具层级`, visible: false + }, + { + key: 23, + label: `点位类型`, + visible: true + }, + { + key: 24, + label: `单位`, + visible: true + }, + { + key: 25, + label: `安装位置`, + visible: true + }, + { + key: 26, + label: `传感器类型`, + visible: true + }, + { + key: 27, + label: `启用报警`, + visible: true } - ] + ], + collectDeviceList: [] } as any); const { baseMonitorInfoList, baseMonitorInfoOptions, columns, + collectDeviceList, form, isExpandAll, loading, @@ -410,7 +556,8 @@ const { const getList = () => { loading.value = true; listBaseMonitorInfo(queryParams.value).then((response) => { - baseMonitorInfoList.value = handleTree(response.data, 'objId', 'parentId'); + const source = response.rows ?? response.data ?? []; + baseMonitorInfoList.value = handleTree(source, 'objId', 'parentId'); loading.value = false; }); }; @@ -434,7 +581,7 @@ const getTreeselect = () => { monitorName: '顶级节点', children: [] }; - data.children = handleTree(response.data, 'objId', 'parentId'); + data.children = handleTree(response.rows ?? response.data ?? [], 'objId', 'parentId'); baseMonitorInfoOptions.value.push(data); }); }; @@ -445,31 +592,8 @@ const cancel = () => { }; const reset = () => { - form.value = { - objId: null, - parentId: null, - monitorCode: null, - monitorName: null, - monitorAddr: null, - monitorType: 3, - monitorStatus: null, - collectDeviceId: null, - ancestors: null, - grade: null, - meterTypeId: null, - correctValue: null, - pt: null, - ct: null, - isAmmeter: null, - isKeyMonitor: null, - isCircuit: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, - publicShareType: null, - monitorHierarchy: null - }; + // 统一重建默认对象,避免详情回填后隐藏技术字段在再次新增时串到下一条记录。 + form.value = createFormData(); formRef.value?.resetFields(); }; @@ -509,7 +633,10 @@ const handleUpdate = (row) => { form.value.parentId = row.parentId; } getBaseMonitorInfo(row.objId).then((response) => { - form.value = response.data; + form.value = { + ...createFormData(), + ...(response.data ?? {}) + }; open.value = true; title.value = '修改计量设备信息'; }); @@ -550,6 +677,9 @@ const handleDelete = (row) => { }; onMounted(() => { + getCollectDeviceInfo({}).then((response) => { + collectDeviceList.value = response.rows || response.data || []; + }); getList(); }); diff --git a/src/views/ems/base/baseMonitorInfoWater/index.vue b/src/views/ems/base/baseMonitorInfoWater/index.vue index 38cb27c..9a9f494 100644 --- a/src/views/ems/base/baseMonitorInfoWater/index.vue +++ b/src/views/ems/base/baseMonitorInfoWater/index.vue @@ -15,8 +15,14 @@ - - + + + + + + + + @@ -59,7 +65,16 @@ - + + + + + + + + @@ -119,8 +134,61 @@ {{ dict.label }} - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + {{ dict.label }} + + + + @@ -168,18 +236,19 @@ import { addBaseMonitorInfo, updateBaseMonitorInfo } from '@/api/ems/base/baseMonitorInfo'; +import { getCollectDeviceInfo } from '@/api/ems/base/baseCollectDeviceInfo'; import EmsTreeSelect from '@/views/ems/components/EmsTreeSelect.vue'; import { handleTree } from '@/utils/ruoyi'; defineOptions({ name: 'BaseMonitorInfo', - dicts: ['is_ammeter', 'monitor_status'] + dicts: ['is_ammeter', 'monitor_status', 'is_flag'] }); const { proxy } = getCurrentInstance() as ComponentInternalInstance; const dict = reactive({ - type: useDict('is_ammeter', 'monitor_status') + type: useDict('is_ammeter', 'monitor_status', 'is_flag') }); const formRef = ref(); @@ -209,7 +278,31 @@ const createFormData = () => ({ updateBy: null, updateTime: null, publicShareType: null, - monitorHierarchy: null + monitorHierarchy: null, + tenantId: null, + pointType: null, + metricCode: null, + unitName: null, + collectChannel: null, + registerAddress: null, + registerType: null, + dataType: null, + byteOrder: null, + bitOffset: null, + nodeId: null, + deviceSn: null, + locationCode: null, + locationName: null, + cabinetName: null, + circuitName: null, + phaseNo: null, + sensorType: null, + measurePrecision: null, + rangeMin: null, + rangeMax: null, + alarmEnable: null, + curveEnable: null, + displaySort: null }); // 这里保留原页面字段结构,优先保证 EMS 业务行为与接口入参不发生漂移。 @@ -231,6 +324,7 @@ const state = reactive({ // 重新渲染表格状态 refreshTable: true, // 查询参数 + // 查询对象补齐最新字段,页面只展示业务字段,技术字段继续留在内部承载和导出参数中。 queryParams: { parentId: null, monitorCode: null, @@ -239,6 +333,7 @@ const state = reactive({ monitorType: 3, monitorStatus: null, collectDeviceId: null, + collectDeviceName: null, ancestors: null, grade: null, meterTypeId: null, @@ -253,7 +348,31 @@ const state = reactive({ updateBy: null, updateTime: null, publicShareType: null, - monitorHierarchy: null + monitorHierarchy: null, + tenantId: null, + pointType: null, + metricCode: null, + unitName: null, + collectChannel: null, + registerAddress: null, + registerType: null, + dataType: null, + byteOrder: null, + bitOffset: null, + nodeId: null, + deviceSn: null, + locationCode: null, + locationName: null, + cabinetName: null, + circuitName: null, + phaseNo: null, + sensorType: null, + measurePrecision: null, + rangeMin: null, + rangeMax: null, + alarmEnable: null, + curveEnable: null, + displaySort: null }, // 表单参数 form: createFormData(), @@ -312,7 +431,7 @@ const state = reactive({ }, { key: 7, - label: `采集设备编号`, + label: `采集设备名称`, visible: true }, { @@ -389,14 +508,41 @@ const state = reactive({ key: 22, label: `表具层级`, visible: false + }, + { + key: 23, + label: `点位类型`, + visible: true + }, + { + key: 24, + label: `单位`, + visible: true + }, + { + key: 25, + label: `安装位置`, + visible: true + }, + { + key: 26, + label: `传感器类型`, + visible: true + }, + { + key: 27, + label: `启用报警`, + visible: true } - ] + ], + collectDeviceList: [] } as any); const { baseMonitorInfoList, baseMonitorInfoOptions, columns, + collectDeviceList, form, isExpandAll, loading, @@ -411,7 +557,8 @@ const { const getList = () => { loading.value = true; listBaseMonitorInfo(queryParams.value).then((response) => { - baseMonitorInfoList.value = handleTree(response.data, 'objId', 'parentId'); + const source = response.rows ?? response.data ?? []; + baseMonitorInfoList.value = handleTree(source, 'objId', 'parentId'); loading.value = false; }); }; @@ -435,7 +582,7 @@ const getTreeselect = () => { monitorName: '顶级节点', children: [] }; - data.children = handleTree(response.data, 'objId', 'parentId'); + data.children = handleTree(response.rows ?? response.data ?? [], 'objId', 'parentId'); baseMonitorInfoOptions.value.push(data); }); }; @@ -446,31 +593,8 @@ const cancel = () => { }; const reset = () => { - form.value = { - objId: null, - parentId: null, - monitorCode: null, - monitorName: null, - monitorAddr: null, - monitorType: 3, - monitorStatus: null, - collectDeviceId: null, - ancestors: null, - grade: null, - meterTypeId: null, - correctValue: null, - pt: null, - ct: null, - isAmmeter: null, - isKeyMonitor: null, - isCircuit: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, - publicShareType: null, - monitorHierarchy: null - }; + // 统一重建默认对象,避免详情回填后隐藏技术字段在再次新增时串到下一条记录。 + form.value = createFormData(); formRef.value?.resetFields(); }; @@ -510,7 +634,10 @@ const handleUpdate = (row) => { form.value.parentId = row.parentId; } getBaseMonitorInfo(row.objId).then((response) => { - form.value = response.data; + form.value = { + ...createFormData(), + ...(response.data ?? {}) + }; open.value = true; title.value = '修改计量设备信息'; }); @@ -551,6 +678,9 @@ const handleDelete = (row) => { }; onMounted(() => { + getCollectDeviceInfo({}).then((response) => { + collectDeviceList.value = response.rows || response.data || []; + }); getList(); }); diff --git a/src/views/ems/record/recordAlarmData/index.vue b/src/views/ems/record/recordAlarmData/index.vue index 2a24545..9de942d 100644 --- a/src/views/ems/record/recordAlarmData/index.vue +++ b/src/views/ems/record/recordAlarmData/index.vue @@ -1,8 +1,8 @@ - - - + + + + + + + + - + + + + + - - - - + + + + + + + + + + +