fix: 【IoT 物联网】场景联动修复产品切换时监控项没触发更新的问题

pull/812/head
puhui999 2025-08-14 18:21:27 +08:00
parent d6f3c511b8
commit 6bfd888b54
3 changed files with 63 additions and 70 deletions

View File

@ -65,7 +65,6 @@
:model-value="condition.operator"
@update:model-value="(value) => updateConditionField('operator', value)"
:property-type="propertyType"
@change="handleOperatorChange"
/>
</el-form-item>
</el-col>
@ -326,12 +325,4 @@ const handlePropertyChange = (propertyInfo: any) => {
}
}
}
// TODO @puhui999
/**
* 处理操作符变化事件
*/
const handleOperatorChange = () => {
//
}
</script>

View File

@ -222,7 +222,9 @@ const availableOperators = computed(() => {
if (!props.propertyType) {
return allOperators
}
return allOperators.filter((op) => op.supportedTypes.includes(props.propertyType!))
return allOperators.filter((op) =>
(op.supportedTypes as any[]).includes(props.propertyType || '')
)
})
//
@ -243,10 +245,12 @@ watch(
() => props.propertyType,
() => {
//
if (localValue.value && selectedOperator.value) {
if (!selectedOperator.value.supportedTypes.includes(props.propertyType || '')) {
localValue.value = ''
}
if (
localValue.value &&
selectedOperator.value &&
!(selectedOperator.value.supportedTypes as any[]).includes(props.propertyType || '')
) {
localValue.value = ''
}
}
)

View File

@ -262,7 +262,6 @@ const handleChange = (value: string) => {
}
}
// TODO @puhui999
/**
* 获取物模型TSL数据
*/
@ -297,62 +296,62 @@ const parseThingModelData = () => {
const tsl = thingModelTSL.value
const properties: PropertySelectorItem[] = []
// TODO @puhui999if return
if (tsl) {
//
if (tsl.properties && Array.isArray(tsl.properties)) {
tsl.properties.forEach((prop) => {
properties.push({
identifier: prop.identifier,
name: prop.name,
description: prop.description,
dataType: prop.dataType,
type: IoTThingModelTypeEnum.PROPERTY,
accessMode: prop.accessMode,
required: prop.required,
unit: getPropertyUnit(prop),
range: getPropertyRange(prop),
property: prop
})
if (!tsl) {
propertyList.value = properties
return
}
//
if (tsl.properties && Array.isArray(tsl.properties)) {
tsl.properties.forEach((prop) => {
properties.push({
identifier: prop.identifier,
name: prop.name,
description: prop.description,
dataType: prop.dataType,
type: IoTThingModelTypeEnum.PROPERTY,
accessMode: prop.accessMode,
required: prop.required,
unit: getPropertyUnit(prop),
range: getPropertyRange(prop),
property: prop
})
}
//
if (tsl.events && Array.isArray(tsl.events)) {
tsl.events.forEach((event) => {
properties.push({
identifier: event.identifier,
name: event.name,
description: event.description,
dataType: 'struct',
type: IoTThingModelTypeEnum.EVENT,
eventType: event.type,
required: event.required,
outputParams: event.outputParams,
event: event
})
})
}
//
if (tsl.services && Array.isArray(tsl.services)) {
tsl.services.forEach((service) => {
properties.push({
identifier: service.identifier,
name: service.name,
description: service.description,
dataType: 'struct',
type: IoTThingModelTypeEnum.SERVICE,
callType: service.callType,
required: service.required,
inputParams: service.inputParams,
outputParams: service.outputParams,
service: service
})
})
}
})
}
//
if (tsl.events && Array.isArray(tsl.events)) {
tsl.events.forEach((event) => {
properties.push({
identifier: event.identifier,
name: event.name,
description: event.description,
dataType: 'struct',
type: IoTThingModelTypeEnum.EVENT,
eventType: event.type,
required: event.required,
outputParams: event.outputParams,
event: event
})
})
}
//
if (tsl.services && Array.isArray(tsl.services)) {
tsl.services.forEach((service) => {
properties.push({
identifier: service.identifier,
name: service.name,
description: service.description,
dataType: 'struct',
type: IoTThingModelTypeEnum.SERVICE,
callType: service.callType,
required: service.required,
inputParams: service.inputParams,
outputParams: service.outputParams,
service: service
})
})
}
propertyList.value = properties
}
@ -396,7 +395,7 @@ const getPropertyRange = (property: any) => {
return undefined
}
/** *
/** 监听产品变化 */
watch(
() => props.productId,
() => {
@ -410,7 +409,6 @@ watch(
() => props.triggerType,
() => {
localValue.value = ''
// el-popover
}
)
</script>