fix: 【IoT 物联网】场景联动修复产品切换时监控项没触发更新的问题
parent
d6f3c511b8
commit
6bfd888b54
|
|
@ -65,7 +65,6 @@
|
||||||
:model-value="condition.operator"
|
:model-value="condition.operator"
|
||||||
@update:model-value="(value) => updateConditionField('operator', value)"
|
@update:model-value="(value) => updateConditionField('operator', value)"
|
||||||
:property-type="propertyType"
|
:property-type="propertyType"
|
||||||
@change="handleOperatorChange"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
@ -326,12 +325,4 @@ const handlePropertyChange = (propertyInfo: any) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:这个貌似没用上
|
|
||||||
/**
|
|
||||||
* 处理操作符变化事件
|
|
||||||
*/
|
|
||||||
const handleOperatorChange = () => {
|
|
||||||
// 操作符变化处理
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,9 @@ const availableOperators = computed(() => {
|
||||||
if (!props.propertyType) {
|
if (!props.propertyType) {
|
||||||
return allOperators
|
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,
|
() => props.propertyType,
|
||||||
() => {
|
() => {
|
||||||
// 如果当前选择的操作符不支持新的属性类型,则清空选择
|
// 如果当前选择的操作符不支持新的属性类型,则清空选择
|
||||||
if (localValue.value && selectedOperator.value) {
|
if (
|
||||||
if (!selectedOperator.value.supportedTypes.includes(props.propertyType || '')) {
|
localValue.value &&
|
||||||
localValue.value = ''
|
selectedOperator.value &&
|
||||||
}
|
!(selectedOperator.value.supportedTypes as any[]).includes(props.propertyType || '')
|
||||||
|
) {
|
||||||
|
localValue.value = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,6 @@ const handleChange = (value: string) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @puhui999:这里没用到哈;
|
|
||||||
/**
|
/**
|
||||||
* 获取物模型TSL数据
|
* 获取物模型TSL数据
|
||||||
*/
|
*/
|
||||||
|
|
@ -297,62 +296,62 @@ const parseThingModelData = () => {
|
||||||
const tsl = thingModelTSL.value
|
const tsl = thingModelTSL.value
|
||||||
const properties: PropertySelectorItem[] = []
|
const properties: PropertySelectorItem[] = []
|
||||||
|
|
||||||
// TODO @puhui999:if return,减少下括号层级;
|
if (!tsl) {
|
||||||
if (tsl) {
|
propertyList.value = properties
|
||||||
// 解析属性
|
return
|
||||||
if (tsl.properties && Array.isArray(tsl.properties)) {
|
}
|
||||||
tsl.properties.forEach((prop) => {
|
// 解析属性
|
||||||
properties.push({
|
if (tsl.properties && Array.isArray(tsl.properties)) {
|
||||||
identifier: prop.identifier,
|
tsl.properties.forEach((prop) => {
|
||||||
name: prop.name,
|
properties.push({
|
||||||
description: prop.description,
|
identifier: prop.identifier,
|
||||||
dataType: prop.dataType,
|
name: prop.name,
|
||||||
type: IoTThingModelTypeEnum.PROPERTY,
|
description: prop.description,
|
||||||
accessMode: prop.accessMode,
|
dataType: prop.dataType,
|
||||||
required: prop.required,
|
type: IoTThingModelTypeEnum.PROPERTY,
|
||||||
unit: getPropertyUnit(prop),
|
accessMode: prop.accessMode,
|
||||||
range: getPropertyRange(prop),
|
required: prop.required,
|
||||||
property: prop
|
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
|
propertyList.value = properties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -396,7 +395,7 @@ const getPropertyRange = (property: any) => {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 监听产品变化 *、
|
/** 监听产品变化 */
|
||||||
watch(
|
watch(
|
||||||
() => props.productId,
|
() => props.productId,
|
||||||
() => {
|
() => {
|
||||||
|
|
@ -410,7 +409,6 @@ watch(
|
||||||
() => props.triggerType,
|
() => props.triggerType,
|
||||||
() => {
|
() => {
|
||||||
localValue.value = ''
|
localValue.value = ''
|
||||||
// el-popover 会自动关闭,无需手动处理
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue