style:表管理-新增/编辑-计算规则hover提示词

main
黄伟杰 2 days ago
parent a656a20caf
commit 12e4be5a07

@ -4480,6 +4480,7 @@ export default {
dialogOrgTreePlaceholder: 'Please select area',
dialogRulesLabel: 'Calculation Rule',
dialogRulesPointPlaceholder: 'Please select device point',
dialogRulesRatioTooltip: 'The ratio of the calculated variable value to the actual value is {ratio}.',
dialogOperatorPlaceholder: 'Please select operator',
dialogIsEnableLabel: 'Enabled',
dialogSubmitButtonText: 'Confirm',

@ -5734,6 +5734,7 @@ export default {
dialogOrgTreePlaceholder: '请选择所属区域',
dialogRulesLabel: '计算规则',
dialogRulesPointPlaceholder: '请选择设备点位',
dialogRulesRatioTooltip: '该变量计算值与实际值的倍率为 {ratio}',
dialogOperatorPlaceholder: '请选择运算符',
dialogIsEnableLabel: '是否启用',
dialogSubmitButtonText: '确 定',

@ -65,17 +65,27 @@
:key="index"
class="w-full flex items-center gap-8px"
>
<el-cascader
v-model='rule.pointValue'
:options='devicePointOptions'
:props='devicePointCascaderProps'
filterable
clearable
class="!w-full"
:placeholder="t('EnergyManagement.EnergyDevice.dialogRulesPointPlaceholder')"
:show-all-levels='false'
@change='(val) => handlePointSelected(index, val)'
/>
<div class="flex-1 min-w-0">
<el-tooltip
:content="getRuleRatioTooltip(rule)"
:disabled="!getRuleRatioTooltip(rule)"
placement="top"
>
<div class="w-full">
<el-cascader
v-model='rule.pointValue'
:options='devicePointOptions'
:props='devicePointCascaderProps'
filterable
clearable
class="!w-full"
:placeholder="t('EnergyManagement.EnergyDevice.dialogRulesPointPlaceholder')"
:show-all-levels='false'
@change='(val) => handlePointSelected(index, val)'
/>
</div>
</el-tooltip>
</div>
<template v-if="index < formData.operationRulesVOList.length - 1">
<el-select
@ -227,6 +237,7 @@ type DevicePointOption = {
label: string
leaf?: boolean
dataType?: string | null
ratio?: number | string | null
children?: DevicePointOption[]
}
@ -300,6 +311,16 @@ const findPointDataType = (deviceId: any, pointId: any): string | undefined => {
return devicePointCache.get(String(deviceId))?.find((point) => isSameId(point.value, pointId))?.dataType as string | undefined
}
const getRuleRatioTooltip = (rule: any) => {
const [deviceId, pointId] = Array.isArray(rule?.pointValue)
? rule.pointValue
: [rule?.deviceId, rule?.pointId]
const ratio = devicePointCache.get(String(deviceId))
?.find((point) => isSameId(point.value, pointId))?.ratio
if (ratio === undefined || ratio === null || ratio === '') return ''
return t('EnergyManagement.EnergyDevice.dialogRulesRatioTooltip', { ratio })
}
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
@ -417,7 +438,13 @@ const loadDevicePoints = async (deviceId: number | string): Promise<DevicePointO
const cached = devicePointCache.get(cacheKey)
if (cached) return cached
const data = await DeviceApi.getDeviceAttributePage({ pageNo: 1, pageSize: 100, deviceId })
const points = (data?.list ?? []).map((point: any) => ({ value: point.id, label: String(point.attributeName ?? point.attributeCode ?? point.id), leaf: true, dataType: point.dataType ?? point.type ?? undefined }))
const points = (data?.list ?? []).map((point: any) => ({
value: point.id,
label: String(point.attributeName ?? point.attributeCode ?? point.id),
leaf: true,
dataType: point.dataType ?? point.type ?? undefined,
ratio: point.ratio
}))
devicePointCache.set(cacheKey, points)
const device = devicePointOptions.value.find((item) => isSameId(item.value, deviceId))
if (device) device.children = points

Loading…
Cancel
Save