style:表管理-计算规则添加bool类型提示

main
黄伟杰 1 month ago
parent 167e1291e2
commit 213e596a05

@ -250,7 +250,7 @@ const loadDevicePointTree = async () => {
const deviceGroups = new Map<string, { deviceId: string; deviceName: string; points: any[] }>()
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()
}

Loading…
Cancel
Save