perf: 【IoT 物联网】场景联动注释优化

pull/808/head
puhui999 2025-08-07 21:36:27 +08:00
parent 85ba03b0ea
commit fd85c4d682
16 changed files with 338 additions and 91 deletions

View File

@ -63,9 +63,12 @@ const emit = defineEmits<{
(e: 'success'): void
}>()
const drawerVisible = useVModel(props, 'modelValue', emit) //
const drawerVisible = useVModel(props, 'modelValue', emit) //
/** 创建默认的表单数据 */
/**
* 创建默认的表单数据
* @returns 默认表单数据对象
*/
const createDefaultFormData = (): IotSceneRule => {
return {
name: '',
@ -87,10 +90,15 @@ const createDefaultFormData = (): IotSceneRule => {
}
}
//
const formRef = ref()
const formData = ref<IotSceneRule>(createDefaultFormData())
//
const formRef = ref() //
const formData = ref<IotSceneRule>(createDefaultFormData()) //
/**
* 触发器校验器
* @param _rule 校验规则未使用
* @param value 校验值
* @param callback 回调函数
*/
const validateTriggers = (_rule: any, value: any, callback: any) => {
if (!value || !Array.isArray(value) || value.length === 0) {
callback(new Error('至少需要一个触发器'))
@ -142,6 +150,12 @@ const validateTriggers = (_rule: any, value: any, callback: any) => {
callback()
}
/**
* 执行器校验器
* @param _rule 校验规则未使用
* @param value 校验值
* @param callback 回调函数
*/
const validateActions = (_rule: any, value: any, callback: any) => {
if (!value || !Array.isArray(value) || value.length === 0) {
callback(new Error('至少需要一个执行器'))
@ -201,6 +215,7 @@ const validateActions = (_rule: any, value: any, callback: any) => {
}
const formRules = reactive({
//
name: [
{ required: true, message: '场景名称不能为空', trigger: 'blur' },
{ type: 'string', min: 1, max: 50, message: '场景名称长度应在1-50个字符之间', trigger: 'blur' }
@ -221,13 +236,15 @@ const formRules = reactive({
actions: [{ required: true, validator: validateActions, trigger: 'change' }]
})
const submitLoading = ref(false)
const submitLoading = ref(false) //
const isEdit = ref(false) //
//
const isEdit = ref(false)
//
const drawerTitle = computed(() => (isEdit.value ? '编辑场景联动规则' : '新增场景联动规则'))
/** 提交表单 */
/**
* 提交表单
*/
const handleSubmit = async () => {
//
if (!formRef.value) return
@ -258,11 +275,16 @@ const handleSubmit = async () => {
}
}
/**
* 处理抽屉关闭事件
*/
const handleClose = () => {
drawerVisible.value = false
}
/** 初始化表单数据 */
/**
* 初始化表单数据
*/
const initFormData = () => {
if (props.ruleScene) {
// 使

View File

@ -181,9 +181,8 @@ const emit = defineEmits<{
const condition = useVModel(props, 'modelValue', emit)
//
const propertyType = ref<string>('string')
const propertyConfig = ref<any>(null)
const propertyType = ref<string>('string') //
const propertyConfig = ref<any>(null) //
//
const isDeviceCondition = computed(() => {
@ -193,17 +192,29 @@ const isDeviceCondition = computed(() => {
)
})
//
/**
* 更新条件字段
* @param field 字段名
* @param value 字段值
*/
const updateConditionField = (field: keyof TriggerCondition, value: any) => {
;(condition.value as any)[field] = value
emit('update:modelValue', condition.value)
}
/**
* 更新整个条件对象
* @param newCondition 新的条件对象
*/
const updateCondition = (newCondition: TriggerCondition) => {
condition.value = newCondition
emit('update:modelValue', condition.value)
}
/**
* 处理条件类型变化事件
* @param type 条件类型
*/
const handleConditionTypeChange = (type: number) => {
//
if (type === IotRuleSceneTriggerConditionTypeEnum.DEVICE_STATUS) {
@ -234,17 +245,29 @@ const handleConditionTypeChange = (type: number) => {
condition.value.param = ''
}
/**
* 处理产品变化事件
* @param _ 产品ID未使用
*/
const handleProductChange = (_: number) => {
//
condition.value.deviceId = undefined
condition.value.identifier = ''
}
/**
* 处理设备变化事件
* @param _ 设备ID未使用
*/
const handleDeviceChange = (_: number) => {
//
condition.value.identifier = ''
}
/**
* 处理属性变化事件
* @param propertyInfo 属性信息对象
*/
const handlePropertyChange = (propertyInfo: { type: string; config: any }) => {
propertyType.value = propertyInfo.type
propertyConfig.value = propertyInfo.config
@ -254,6 +277,9 @@ const handlePropertyChange = (propertyInfo: { type: string; config: any }) => {
condition.value.param = ''
}
/**
* 处理操作符变化事件
*/
const handleOperatorChange = () => {
//
condition.value.param = ''

View File

@ -154,7 +154,7 @@ const timeOperatorOptions = [
}
]
//
//
const needsTimeInput = computed(() => {
const timeOnlyOperators = [
IotRuleSceneTriggerTimeOperatorEnum.BEFORE_TIME.value,
@ -165,15 +165,21 @@ const needsTimeInput = computed(() => {
return timeOnlyOperators.includes(condition.value.operator)
})
//
const needsDateInput = computed(() => {
return false //
})
//
const needsSecondTimeInput = computed(() => {
return condition.value.operator === IotRuleSceneTriggerTimeOperatorEnum.BETWEEN_TIME.value
})
//
/**
* 更新条件字段
* @param field 字段名
* @param value 字段值
*/
const updateConditionField = (field: keyof TriggerCondition, value: any) => {
condition.value[field] = value
}
@ -183,7 +189,8 @@ watch(
() => condition.value.operator,
(newOperator) => {
if (newOperator === IotRuleSceneTriggerTimeOperatorEnum.TODAY.value) {
;(condition.value as any).timeValue = undefined(condition.value as any).timeValue2 = undefined
;(condition.value as any).timeValue = undefined
;(condition.value as any).timeValue2 = undefined
} else if (!needsSecondTimeInput.value) {
;(condition.value as any).timeValue2 = undefined
}

View File

@ -102,7 +102,6 @@ const emit = defineEmits<{
const action = useVModel(props, 'modelValue', emit)
//
const thingModelProperties = ref<ThingModelProperty[]>([]) //
const loadingThingModel = ref(false) //
const selectedService = ref<ThingModelService | null>(null) //
@ -125,13 +124,13 @@ const paramsValue = computed({
}
})
//
const isPropertySetAction = computed(() => {
//
return action.value.type === IotRuleSceneActionTypeEnum.DEVICE_PROPERTY_SET
})
//
const isServiceInvokeAction = computed(() => {
//
return action.value.type === IotRuleSceneActionTypeEnum.DEVICE_SERVICE_INVOKE
})
@ -314,8 +313,7 @@ const getDefaultValueForParam = (param: any) => {
}
}
//
const isInitialized = ref(false)
const isInitialized = ref(false) //
/**
* 初始化组件数据
@ -347,7 +345,7 @@ onMounted(() => {
initializeComponent()
})
//
//
watch(
() => [action.value.productId, action.value.type, action.value.identifier],
async ([newProductId, , newIdentifier], [oldProductId, , oldIdentifier]) => {

View File

@ -185,21 +185,29 @@ const emit = defineEmits<{
const trigger = useVModel(props, 'modelValue', emit)
//
const maxSubGroups = 3 // 3
const maxConditionsPerGroup = 3 // 3
//
/**
* 更新条件
* @param condition 条件对象
*/
const updateCondition = (condition: Trigger) => {
trigger.value = condition
}
/**
* 处理触发器类型变化事件
* @param type 触发器类型
*/
const handleTriggerTypeChange = (type: number) => {
trigger.value.type = type
emit('trigger-type-change', type)
}
//
/**
* 添加子条件组
*/
const addSubGroup = async () => {
if (!trigger.value.conditionGroups) {
trigger.value.conditionGroups = []
@ -217,18 +225,30 @@ const addSubGroup = async () => {
}
}
/**
* 移除子条件组
* @param index 子条件组索引
*/
const removeSubGroup = (index: number) => {
if (trigger.value.conditionGroups) {
trigger.value.conditionGroups.splice(index, 1)
}
}
/**
* 更新子条件组
* @param index 子条件组索引
* @param subGroup 子条件组数据
*/
const updateSubGroup = (index: number, subGroup: any) => {
if (trigger.value.conditionGroups) {
trigger.value.conditionGroups[index] = subGroup
}
}
/**
* 移除整个条件组
*/
const removeConditionGroup = () => {
trigger.value.conditionGroups = undefined
}

View File

@ -211,12 +211,11 @@ const emit = defineEmits<{
(e: 'trigger-type-change', value: number): void
}>()
//
const condition = useVModel(props, 'modelValue', emit)
const propertyType = ref('')
const propertyConfig = ref<any>(null)
const propertyType = ref('') //
const propertyConfig = ref<any>(null) //
//
//
const isDevicePropertyTrigger = computed(() => {
return (
props.triggerType === IotRuleSceneTriggerTypeEnum.DEVICE_PROPERTY_POST ||
@ -225,11 +224,12 @@ const isDevicePropertyTrigger = computed(() => {
)
})
//
const isDeviceStatusTrigger = computed(() => {
return props.triggerType === IotRuleSceneTriggerTypeEnum.DEVICE_STATE_UPDATE
})
// - JsonParamsInput
// - JsonParamsInput
const serviceConfig = computed(() => {
if (
propertyConfig.value &&
@ -245,7 +245,7 @@ const serviceConfig = computed(() => {
return undefined
})
// - JsonParamsInput
// - JsonParamsInput
const eventConfig = computed(() => {
if (propertyConfig.value && props.triggerType === IotRuleSceneTriggerTypeEnum.DEVICE_EVENT_POST) {
return {
@ -258,30 +258,47 @@ const eventConfig = computed(() => {
return undefined
})
// 使
const triggerTypeOptions = getTriggerTypeOptions()
const deviceStatusChangeOptions = getDeviceStatusChangeOptions()
const triggerTypeOptions = getTriggerTypeOptions() //
const deviceStatusChangeOptions = getDeviceStatusChangeOptions() //
//
/**
* 更新条件字段
* @param field 字段名
* @param value 字段值
*/
const updateConditionField = (field: keyof Trigger, value: any) => {
;(condition.value as any)[field] = value
}
/**
* 处理触发器类型变化事件
* @param type 触发器类型
*/
const handleTriggerTypeChange = (type: number) => {
emit('trigger-type-change', type)
}
/**
* 处理产品变化事件
*/
const handleProductChange = () => {
//
condition.value.deviceId = undefined
condition.value.identifier = ''
}
/**
* 处理设备变化事件
*/
const handleDeviceChange = () => {
//
condition.value.identifier = ''
}
/**
* 处理属性变化事件
* @param propertyInfo 属性信息对象
*/
const handlePropertyChange = (propertyInfo: any) => {
if (propertyInfo) {
propertyType.value = propertyInfo.type
@ -297,6 +314,9 @@ const handlePropertyChange = (propertyInfo: any) => {
}
}
/**
* 处理操作符变化事件
*/
const handleOperatorChange = () => {
//
}

View File

@ -103,10 +103,11 @@ const emit = defineEmits<{
const subGroup = useVModel(props, 'modelValue', emit)
//
const maxConditions = computed(() => props.maxConditions || 3)
const maxConditions = computed(() => props.maxConditions || 3) //
//
/**
* 添加条件
*/
const addCondition = async () => {
// subGroup.value
if (!subGroup.value) {
@ -134,12 +135,21 @@ const addCondition = async () => {
}
}
/**
* 移除条件
* @param index 条件索引
*/
const removeCondition = (index: number) => {
if (subGroup.value) {
subGroup.value.splice(index, 1)
}
}
/**
* 更新条件
* @param index 条件索引
* @param condition 条件对象
*/
const updateCondition = (index: number, condition: TriggerCondition) => {
if (subGroup.value) {
subGroup.value[index] = condition

View File

@ -204,11 +204,10 @@ const localValue = useVModel(props, 'modelValue', emit, {
defaultValue: ''
})
//
const paramsJson = ref('')
const jsonError = ref('')
const paramsJson = ref('') // JSON
const jsonError = ref('') // JSON
//
//
const hasConfig = computed(() => {
// TODO @puhui999:
console.log(props.config)
@ -221,6 +220,7 @@ const hasConfig = computed(() => {
return true
})
//
const paramsList = computed(() => {
switch (props.type) {
case JsonParamsInputTypeEnum.SERVICE:
@ -236,6 +236,7 @@ const paramsList = computed(() => {
}
})
//
const title = computed(() => {
switch (props.type) {
case JsonParamsInputTypeEnum.SERVICE:
@ -251,6 +252,7 @@ const title = computed(() => {
}
})
//
const titleIcon = computed(() => {
switch (props.type) {
case JsonParamsInputTypeEnum.SERVICE:
@ -266,6 +268,7 @@ const titleIcon = computed(() => {
}
})
//
const paramsIcon = computed(() => {
switch (props.type) {
case JsonParamsInputTypeEnum.SERVICE:
@ -281,6 +284,7 @@ const paramsIcon = computed(() => {
}
})
//
const paramsLabel = computed(() => {
switch (props.type) {
case JsonParamsInputTypeEnum.SERVICE:
@ -296,6 +300,7 @@ const paramsLabel = computed(() => {
}
})
//
const emptyMessage = computed(() => {
switch (props.type) {
case JsonParamsInputTypeEnum.SERVICE:
@ -311,6 +316,7 @@ const emptyMessage = computed(() => {
}
})
//
const noConfigMessage = computed(() => {
switch (props.type) {
case JsonParamsInputTypeEnum.SERVICE:
@ -326,7 +332,9 @@ const noConfigMessage = computed(() => {
}
})
//
/**
* 处理参数变化事件
*/
const handleParamsChange = () => {
try {
jsonError.value = '' //
@ -361,20 +369,28 @@ const handleParamsChange = () => {
}
}
//
/**
* 快速填充示例数据
*/
const fillExampleJson = () => {
paramsJson.value = generateExampleJson()
handleParamsChange()
}
//
/**
* 清空参数
*/
const clearParams = () => {
paramsJson.value = ''
localValue.value = ''
jsonError.value = ''
}
//
/**
* 获取参数类型名称
* @param dataType 数据类型
* @returns 类型名称
*/
const getParamTypeName = (dataType: string) => {
// 使 constants.ts getDataTypeName
const typeMap = {
@ -391,6 +407,11 @@ const getParamTypeName = (dataType: string) => {
return typeMap[dataType] || dataType
}
/**
* 获取参数类型标签样式
* @param dataType 数据类型
* @returns 标签样式
*/
const getParamTypeTag = (dataType: string) => {
const tagMap = {
[IoTDataSpecsDataTypeEnum.INT]: 'primary',
@ -406,12 +427,21 @@ const getParamTypeTag = (dataType: string) => {
return tagMap[dataType] || 'info'
}
/**
* 获取示例值
* @param param 参数对象
* @returns 示例值
*/
const getExampleValue = (param: any) => {
const exampleConfig =
JSON_PARAMS_EXAMPLE_VALUES[param.dataType] || JSON_PARAMS_EXAMPLE_VALUES.DEFAULT
return exampleConfig.display
}
/**
* 生成示例JSON
* @returns JSON字符串
*/
const generateExampleJson = () => {
if (paramsList.value.length === 0) {
return '{}'
@ -427,7 +457,10 @@ const generateExampleJson = () => {
return JSON.stringify(example, null, 2)
}
//
/**
* 处理数据回显
* @param value 值字符串
*/
const handleDataDisplay = (value: string) => {
if (!value || !value.trim()) {
paramsJson.value = ''

View File

@ -160,13 +160,12 @@ const localValue = useVModel(props, 'modelValue', emit, {
defaultValue: ''
})
//
const rangeStart = ref('')
const rangeEnd = ref('')
const dateValue = ref('')
const numberValue = ref<number>()
const rangeStart = ref('') //
const rangeEnd = ref('') //
const dateValue = ref('') //
const numberValue = ref<number>() //
//
//
const enumOptions = computed(() => {
if (props.propertyConfig?.enum) {
return props.propertyConfig.enum.map((item: any) => ({
@ -177,6 +176,7 @@ const enumOptions = computed(() => {
return []
})
//
const listPreview = computed(() => {
if (props.operator === 'in' && localValue.value) {
return localValue.value
@ -187,7 +187,10 @@ const listPreview = computed(() => {
return []
})
//
/**
* 判断是否为数字类型
* @returns 是否为数字类型
*/
const isNumericType = () => {
return [
IoTDataSpecsDataTypeEnum.INT,
@ -196,6 +199,10 @@ const isNumericType = () => {
].includes(props.propertyType || '')
}
/**
* 获取输入框类型
* @returns 输入框类型
*/
const getInputType = () => {
switch (props.propertyType) {
case IoTDataSpecsDataTypeEnum.INT:
@ -207,6 +214,10 @@ const getInputType = () => {
}
}
/**
* 获取占位符文本
* @returns 占位符文本
*/
const getPlaceholder = () => {
const typeMap = {
[IoTDataSpecsDataTypeEnum.TEXT]: '请输入字符串',
@ -219,27 +230,48 @@ const getPlaceholder = () => {
return typeMap[props.propertyType || ''] || '请输入值'
}
/**
* 获取数字精度
* @returns 数字精度
*/
const getPrecision = () => {
return props.propertyType === IoTDataSpecsDataTypeEnum.INT ? 0 : 2
}
/**
* 获取数字步长
* @returns 数字步长
*/
const getStep = () => {
return props.propertyType === IoTDataSpecsDataTypeEnum.INT ? 1 : 0.1
}
/**
* 获取最小值
* @returns 最小值
*/
const getMin = () => {
return props.propertyConfig?.min || undefined
}
/**
* 获取最大值
* @returns 最大值
*/
const getMax = () => {
return props.propertyConfig?.max || undefined
}
//
/**
* 处理值变化事件
*/
const handleChange = () => {
//
}
/**
* 处理范围变化事件
*/
const handleRangeChange = () => {
if (rangeStart.value && rangeEnd.value) {
localValue.value = `${rangeStart.value},${rangeEnd.value}`
@ -248,10 +280,18 @@ const handleRangeChange = () => {
}
}
/**
* 处理日期变化事件
* @param value 日期值
*/
const handleDateChange = (value: string) => {
localValue.value = value || ''
}
/**
* 处理数字变化事件
* @param value 数字值
*/
const handleNumberChange = (value: number | undefined) => {
localValue.value = value?.toString() || ''
}

View File

@ -157,8 +157,11 @@ const emit = defineEmits<{
const actions = useVModel(props, 'actions', emit)
const maxActions = SCENE_RULE_CONFIG.MAX_ACTIONS //
/**
* 创建默认的执行器数据
* @returns 默认执行器对象
*/
const createDefaultActionData = (): Action => {
return {
@ -171,10 +174,9 @@ const createDefaultActionData = (): Action => {
}
}
// 使
const maxActions = SCENE_RULE_CONFIG.MAX_ACTIONS
/** 添加执行器 */
/**
* 添加执行器
*/
const addAction = () => {
if (actions.value.length >= maxActions) {
return
@ -184,28 +186,47 @@ const addAction = () => {
actions.value.push(newAction)
}
/** 删除执行器 */
/**
* 删除执行器
* @param index 执行器索引
*/
const removeAction = (index: number) => {
actions.value.splice(index, 1)
}
/** 更新执行器类型 */
/**
* 更新执行器类型
* @param index 执行器索引
* @param type 执行器类型
*/
const updateActionType = (index: number, type: number) => {
actions.value[index].type = type
onActionTypeChange(actions.value[index], type)
}
/** 更新执行器 */
/**
* 更新执行器
* @param index 执行器索引
* @param action 执行器对象
*/
const updateAction = (index: number, action: Action) => {
actions.value[index] = action
}
/** 更新告警配置 */
/**
* 更新告警配置
* @param index 执行器索引
* @param alertConfigId 告警配置ID
*/
const updateActionAlertConfig = (index: number, alertConfigId?: number) => {
actions.value[index].alertConfigId = alertConfigId
}
/** 监听执行器类型变化 */
/**
* 监听执行器类型变化
* @param action 执行器对象
* @param type 执行器类型
*/
const onActionTypeChange = (action: Action, type: number) => {
//
if (isDeviceAction(type)) {

View File

@ -67,11 +67,12 @@ const props = defineProps<{
modelValue: IotSceneRule
rules?: any
}>()
const emit = defineEmits<{
(e: 'update:modelValue', value: IotSceneRule): void
}>()
const formData = useVModel(props, 'modelValue', emit)
const formData = useVModel(props, 'modelValue', emit) //
</script>
<style scoped>

View File

@ -137,7 +137,9 @@ const emit = defineEmits<{
const triggers = useVModel(props, 'triggers', emit)
//
/**
* 添加触发器
*/
const addTrigger = () => {
const newTrigger: Trigger = {
type: TriggerTypeEnum.DEVICE_STATE_UPDATE,
@ -152,25 +154,49 @@ const addTrigger = () => {
triggers.value.push(newTrigger)
}
/**
* 删除触发器
* @param index 触发器索引
*/
const removeTrigger = (index: number) => {
if (triggers.value.length > 1) {
triggers.value.splice(index, 1)
}
}
/**
* 更新触发器类型
* @param index 触发器索引
* @param type 触发器类型
*/
const updateTriggerType = (index: number, type: number) => {
triggers.value[index].type = type
onTriggerTypeChange(index, type)
}
/**
* 更新触发器设备配置
* @param index 触发器索引
* @param newTrigger 新的触发器对象
*/
const updateTriggerDeviceConfig = (index: number, newTrigger: Trigger) => {
triggers.value[index] = newTrigger
}
/**
* 更新触发器CRON配置
* @param index 触发器索引
* @param cronExpression CRON表达式
*/
const updateTriggerCronConfig = (index: number, cronExpression?: string) => {
triggers.value[index].cronExpression = cronExpression
}
/**
* 处理触发器类型变化事件
* @param index 触发器索引
* @param _ 触发器类型未使用
*/
const onTriggerTypeChange = (index: number, _: number) => {
const triggerItem = triggers.value[index]
triggerItem.productId = undefined

View File

@ -58,17 +58,21 @@ const emit = defineEmits<{
(e: 'change', value?: number): void
}>()
//
const deviceLoading = ref(false)
const deviceList = ref<any[]>([])
const deviceLoading = ref(false) //
const deviceList = ref<any[]>([]) //
//
/**
* 处理选择变化事件
* @param value 选中的设备ID
*/
const handleChange = (value?: number) => {
emit('update:modelValue', value)
emit('change', value)
}
//
/**
* 获取设备列表
*/
const getDeviceList = async () => {
if (!props.productId) {
deviceList.value = []
@ -88,8 +92,6 @@ const getDeviceList = async () => {
}
}
// constants.ts
//
watch(
() => props.productId,

View File

@ -217,7 +217,7 @@ const allOperators = [
}
]
//
//
const availableOperators = computed(() => {
if (!props.propertyType) {
return allOperators
@ -226,11 +226,15 @@ const availableOperators = computed(() => {
return allOperators.filter((op) => op.supportedTypes.includes(props.propertyType!))
})
//
const selectedOperator = computed(() => {
return allOperators.find((op) => op.value === localValue.value)
})
//
/**
* 处理选择变化事件
* @param value 选中的操作符值
*/
const handleChange = (value: string) => {
emit('change', value)
}

View File

@ -46,17 +46,21 @@ const emit = defineEmits<{
(e: 'change', value?: number): void
}>()
//
const productLoading = ref(false)
const productList = ref<any[]>([])
const productLoading = ref(false) //
const productList = ref<any[]>([]) //
//
/**
* 处理选择变化事件
* @param value 选中的产品ID
*/
const handleChange = (value?: number) => {
emit('update:modelValue', value)
emit('change', value)
}
//
/**
* 获取产品列表
*/
const getProductList = async () => {
try {
productLoading.value = true

View File

@ -212,12 +212,11 @@ const emit = defineEmits<{
const localValue = useVModel(props, 'modelValue', emit)
//
const loading = ref(false)
const propertyList = ref<PropertySelectorItem[]>([])
const thingModelTSL = ref<IotThingModelTSLResp | null>(null)
const loading = ref(false) //
const propertyList = ref<PropertySelectorItem[]>([]) //
const thingModelTSL = ref<IotThingModelTSLResp | null>(null) // TSL
//
//
const propertyGroups = computed(() => {
const groups: { label: string; options: any[] }[] = []
@ -245,11 +244,15 @@ const propertyGroups = computed(() => {
return groups.filter((group) => group.options.length > 0)
})
//
const selectedProperty = computed(() => {
return propertyList.value.find((p) => p.identifier === localValue.value)
})
//
/**
* 处理选择变化事件
* @param value 选中的属性标识符
*/
const handleChange = (value: string) => {
const property = propertyList.value.find((p) => p.identifier === value)
if (property) {
@ -289,7 +292,9 @@ const getThingModelTSL = async () => {
}
}
// TSL
/**
* 解析物模型TSL数据
*/
const parseThingModelData = () => {
const tsl = thingModelTSL.value
const properties: PropertySelectorItem[] = []
@ -352,7 +357,11 @@ const parseThingModelData = () => {
propertyList.value = properties
}
//
/**
* 获取属性单位
* @param property 属性对象
* @returns 属性单位
*/
const getPropertyUnit = (property: any) => {
if (!property) return undefined
@ -364,7 +373,11 @@ const getPropertyUnit = (property: any) => {
return undefined
}
//
/**
* 获取属性范围描述
* @param property 属性对象
* @returns 属性范围描述
*/
const getPropertyRange = (property: any) => {
if (!property) return undefined