【代码评审】IoT:场景联动的 review

This commit is contained in:
YunaiV
2025-03-30 10:18:33 +08:00
parent 30c9f0b872
commit 782337952d
12 changed files with 28 additions and 33 deletions

View File

@ -1,12 +1,12 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle" :appendToBody="true" v-loading="loading">
<div class="flex h-600px">
<!-- 左侧物模型属性view模式 -->
<!-- 左侧物模型属性view 模式 -->
<div class="w-1/2 border-r border-gray-200 pr-2 overflow-auto">
<JsonEditor :model-value="thingModel" mode="view" height="600px" />
</div>
<!-- 右侧JSON编辑器code模式 -->
<!-- 右侧 JSON 编辑器code 模式 -->
<div class="w-1/2 pl-2 overflow-auto">
<JsonEditor v-model="editableModelTSL" mode="code" height="600px" @error="handleError" />
</div>

View File

@ -193,16 +193,13 @@ watch(
{ immediate: true }
)
/**
* 初始化产品回显信息
*/
/** 初始化产品回显信息 */
const initProductInfo = async () => {
if (!actionConfig.value.deviceControl?.productKey) {
return
}
try {
// 使用新的API直接通过productKey获取产品信息
const productData = await ProductApi.getProductByKey(
actionConfig.value.deviceControl.productKey
)
@ -226,12 +223,10 @@ const initDeviceInfo = async () => {
}
try {
// 使用新的API直接通过productKey和deviceNames获取设备列表
const deviceData = await DeviceApi.getDevicesByProductKeyAndNames(
actionConfig.value.deviceControl.productKey,
actionConfig.value.deviceControl.deviceNames
)
if (deviceData && deviceData.length > 0) {
deviceList.value = deviceData
}

View File

@ -8,7 +8,9 @@
clearable
placeholder="选择接收方式"
>
<el-option
<!-- TODO @芋艿后续搞成字典 -->
<!-- TODO @puhui999这里好像是 1/2/3 -->
<el-option
v-for="(value, key) in IotAlertConfigReceiveTypeEnum"
:key="value"
:label="key === 'SMS' ? '短信' : key === 'MAIL' ? '邮箱' : '通知'"
@ -16,7 +18,10 @@
/>
</el-select>
</div>
<div v-if="alertConfig.receiveType === IotAlertConfigReceiveTypeEnum.SMS" class="flex items-center mb-10px">
<div
v-if="alertConfig.receiveType === IotAlertConfigReceiveTypeEnum.SMS"
class="flex items-center mb-10px"
>
<span class="mr-10px w-80px">手机号码</span>
<el-select
v-model="alertConfig.phoneNumbers"
@ -28,7 +33,10 @@
placeholder="请输入手机号码"
/>
</div>
<div v-if="alertConfig.receiveType === IotAlertConfigReceiveTypeEnum.MAIL" class="flex items-center mb-10px">
<div
v-if="alertConfig.receiveType === IotAlertConfigReceiveTypeEnum.MAIL"
class="flex items-center mb-10px"
>
<span class="mr-10px w-80px">邮箱地址</span>
<el-select
v-model="alertConfig.emails"
@ -80,4 +88,4 @@ const initAlertConfig = () => {
onMounted(() => {
initAlertConfig()
})
</script>
</script>

View File

@ -25,7 +25,7 @@ const props = defineProps<{ modelValue: any }>()
const emits = defineEmits(['update:modelValue'])
const dataBridgeId = useVModel(props, 'modelValue', emits)
const dataBridgeList = ref<any[]>([]) /** 数据桥接列表 */
const dataBridgeList = ref<any[]>([]) // 数据桥接列表
/** 获取数据桥接列表 */
const getDataBridgeList = async () => {

View File

@ -162,7 +162,7 @@ const initDeviceControlConfig = () => {
}))
}
// 确保data对象存在
// 确保 data 对象存在
if (!deviceControlConfig.value.data) {
deviceControlConfig.value.data = {}
}