【功能新增】IoT: 获取产品物模型 TSL
This commit is contained in:
parent
0743d372c2
commit
7680ff83d0
@ -5,6 +5,7 @@
|
||||
clearable
|
||||
:placeholder="placeholder"
|
||||
>
|
||||
<!-- TODO puhui999: 考虑根据属性类型不同展示不同的可选条件 -->
|
||||
<el-option label="等于" value="=" />
|
||||
<el-option label="不等于" value="!=" />
|
||||
<el-option label="大于" value=">" />
|
||||
|
@ -43,7 +43,13 @@
|
||||
:key="index"
|
||||
>
|
||||
<div class="flex flex-col items-center justify-center mr-10px h-a">
|
||||
<el-select v-model="condition.type" class="!w-160px" clearable placeholder="">
|
||||
<el-select
|
||||
v-model="condition.type"
|
||||
@change="condition.parameters = []"
|
||||
class="!w-160px"
|
||||
clearable
|
||||
placeholder=""
|
||||
>
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in getStrDictOptions(DICT_TYPE.IOT_DEVICE_MESSAGE_TYPE_ENUM)"-->
|
||||
<!-- :key="dict.value"-->
|
||||
@ -148,6 +154,10 @@ const removeCondition = (index: number) => {
|
||||
}
|
||||
/** 添加参数 */
|
||||
const addConditionParameter = (conditionParameters: IotRuleSceneTriggerConditionParameter[]) => {
|
||||
if (!product.value) {
|
||||
message.warning('请先选择一个产品')
|
||||
return
|
||||
}
|
||||
conditionParameters.push({} as IotRuleSceneTriggerConditionParameter)
|
||||
}
|
||||
/** 移除参数 */
|
||||
@ -189,10 +199,11 @@ const thingModels = computed(() => (condition: IotRuleSceneTriggerCondition) =>
|
||||
switch (condition.type) {
|
||||
case 'property':
|
||||
return thingModelTSL.value.properties
|
||||
// TODO puhui999: 服务和事件后续考虑
|
||||
case 'service':
|
||||
return thingModelTSL.value.service
|
||||
return thingModelTSL.value.services
|
||||
case 'event':
|
||||
return thingModelTSL.value.event
|
||||
return thingModelTSL.value.events
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
@ -14,6 +14,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
<ConditionSelector v-model="conditionParameter.operator" class="!w-180px mr-10px" />
|
||||
<!-- TODO puhui999: 输入值范围校验? -->
|
||||
<el-input v-model="conditionParameter.value" class="!w-240px mr-10px" placeholder="请输入值">
|
||||
<template #append> {{ getUnitName }} </template>
|
||||
</el-input>
|
||||
@ -37,11 +38,20 @@ const conditionParameter = useVModel(
|
||||
) as Ref<IotRuleSceneTriggerConditionParameter>
|
||||
|
||||
/** 获得属性单位 */
|
||||
const getUnitName = computed(
|
||||
() =>
|
||||
props.thingModels.find((item: any) => item.identifier === conditionParameter.value.identifier)
|
||||
?.dataSpecs?.unitName || '单位'
|
||||
)
|
||||
const getUnitName = computed(() => {
|
||||
const model = props.thingModels?.find(
|
||||
(item: any) => item.identifier === conditionParameter.value.identifier
|
||||
)
|
||||
// 属性
|
||||
if (model?.dataSpecs) {
|
||||
return model.dataSpecs.unitName
|
||||
}
|
||||
// 服务和事件
|
||||
// if (model?.outputParams) {
|
||||
// return model.dataSpecs.unitName
|
||||
// }
|
||||
return '单位'
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
Loading…
Reference in New Issue
Block a user