From 213e596a05561376678293b30a2163591bdcf0de Mon Sep 17 00:00:00 2001 From: hwj Date: Tue, 10 Feb 2026 15:46:19 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E8=A1=A8=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E8=A7=84=E5=88=99=E6=B7=BB=E5=8A=A0bool?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/energydevice/EnergyDeviceForm.vue | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/views/mes/energydevice/EnergyDeviceForm.vue b/src/views/mes/energydevice/EnergyDeviceForm.vue index d24b648b..b6925707 100644 --- a/src/views/mes/energydevice/EnergyDeviceForm.vue +++ b/src/views/mes/energydevice/EnergyDeviceForm.vue @@ -250,7 +250,7 @@ const loadDevicePointTree = async () => { const deviceGroups = new Map() - const pushPoint = (deviceId: any, deviceName: any, pointId: any, pointName: any) => { + const pushPoint = (deviceId: any, deviceName: any, pointId: any, pointName: any, dataType?: any) => { const dId = normalizeToString(deviceId) if (!dId) return const group = deviceGroups.get(dId) ?? { deviceId: dId, deviceName: String(deviceName ?? ''), points: [] } @@ -260,7 +260,7 @@ const loadDevicePointTree = async () => { deviceGroups.set(dId, group) return } - group.points.push({ id: `${dId}:${pId}`, name: `${group.deviceName}: ${String(pointName ?? '')}`.trim() }) + group.points.push({ id: `${dId}:${pId}`, name: `${group.deviceName}: ${String(pointName ?? '')}`.trim(), dataType }) deviceGroups.set(dId, group) } @@ -279,7 +279,7 @@ const loadDevicePointTree = async () => { points.forEach((p) => { const pointId = p?.pointId ?? p?.id const pointName = p?.attributeName ?? p?.pointName ?? p?.name - pushPoint(deviceId, deviceName, pointId, pointName) + pushPoint(deviceId, deviceName, pointId, pointName, (p as any)?.dataType) }) } else { const pointId = row?.pointId ?? row?.attributeId ?? row?.devicePointId @@ -293,7 +293,7 @@ const loadDevicePointTree = async () => { const deviceName = row?.deviceName ?? row?.devName const pointId = row?.pointId ?? row?.id const pointName = row?.attributeName ?? row?.pointName ?? row?.name - pushPoint(deviceId, deviceName, pointId, pointName) + pushPoint(deviceId, deviceName, pointId, pointName, (row as any)?.dataType) }) } @@ -313,6 +313,23 @@ const equipmentTree = computed(() => { return devicePointTree.value }) +const findPointDataType = (deviceId: any, pointId: any): string | undefined => { + const dId = String(deviceId ?? '') + const pId = String(pointId ?? '') + if (!dId || !pId) return undefined + const key = `${dId}:${pId}` + const groups = devicePointTree.value ?? [] + for (const g of groups) { + const children = Array.isArray((g as any).children) ? (g as any).children : [] + for (const c of children) { + if (String((c as any).id ?? '') === key) { + return (c as any).dataType as string | undefined + } + } + } + return undefined +} + /** 打开弹窗 */ const open = async (type: string, id?: number) => { dialogVisible.value = true @@ -496,6 +513,13 @@ const validateRules = (callback: any) => { callback(new Error(t('EnergyManagement.EnergyDevice.validatorRulesOperatorRequired'))) return } + const dt = findPointDataType(r.deviceId, r.pointId) + const dtText = String(dt ?? '').toLowerCase() + if (dtText === 'bool' || dtText === 'boolean') { + message.warning('布尔类型点位暂不支持用于计算规则,请重新选择') + callback(new Error('布尔类型点位暂不支持用于计算规则,请重新选择')) + return + } } callback() }