feat:【IoT 物联网】物模型,移除 config.ts

This commit is contained in:
YunaiV
2025-06-29 11:40:03 +08:00
parent cbfd9660a2
commit 677b0d61ca
18 changed files with 411 additions and 354 deletions

View File

@ -6,21 +6,22 @@
prop="event.type"
>
<el-radio-group v-model="thingModelEvent.type">
<el-radio :value="ThingModelEventType.INFO.value">
{{ ThingModelEventType.INFO.label }}
<!-- TODO @AI使用枚举 -->
<el-radio :value="IoTThingModelEventTypeEnum.INFO.value">
{{ IoTThingModelEventTypeEnum.INFO.label }}
</el-radio>
<el-radio :value="ThingModelEventType.ALERT.value">
{{ ThingModelEventType.ALERT.label }}
<el-radio :value="IoTThingModelEventTypeEnum.ALERT.value">
{{ IoTThingModelEventTypeEnum.ALERT.label }}
</el-radio>
<el-radio :value="ThingModelEventType.ERROR.value">
{{ ThingModelEventType.ERROR.label }}
<el-radio :value="IoTThingModelEventTypeEnum.ERROR.value">
{{ IoTThingModelEventTypeEnum.ERROR.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="输出参数">
<ThingModelInputOutputParam
v-model="thingModelEvent.outputParams"
:direction="ThingModelParamDirection.OUTPUT"
:direction="IoTThingModelParamDirectionEnum.OUTPUT"
/>
</el-form-item>
</template>
@ -29,8 +30,11 @@
import ThingModelInputOutputParam from './ThingModelInputOutputParam.vue'
import { useVModel } from '@vueuse/core'
import { ThingModelEvent } from '@/api/iot/thingmodel'
import { ThingModelEventType, ThingModelParamDirection } from './config'
import { isEmpty } from '@/utils/is'
import {
IoTThingModelEventTypeEnum,
IoTThingModelParamDirectionEnum
} from '@/views/iot/utils/constants'
/** IoT 物模型事件 */
defineOptions({ name: 'ThingModelEvent' })
@ -42,7 +46,8 @@ const thingModelEvent = useVModel(props, 'modelValue', emits) as Ref<ThingModelE
// 默认选中INFO 信息
watch(
() => thingModelEvent.value.type,
(val: string) => isEmpty(val) && (thingModelEvent.value.type = ThingModelEventType.INFO.value),
(val: string) =>
isEmpty(val) && (thingModelEvent.value.type = IoTThingModelEventTypeEnum.INFO.value),
{ immediate: true }
)
</script>