@@ -40,9 +26,11 @@
diff --git a/src/views/iot/product/product/components/ProductTableSelect.vue b/src/views/iot/product/product/components/ProductTableSelect.vue
index f43d67786d8cdc53b935580aac4cf2ddbf83b41e..a1ab0f2baa9a95f229cc7f80fe24310f08eb10f4 100644
--- a/src/views/iot/product/product/components/ProductTableSelect.vue
+++ b/src/views/iot/product/product/components/ProductTableSelect.vue
@@ -57,7 +57,7 @@
handleRadioChange(scope.row)"
>
diff --git a/src/views/iot/rule/scene/RuleSceneForm.vue b/src/views/iot/rule/scene/RuleSceneForm.vue
index 034c52549c45920fe8e9a43cc1e89949e84d8431..5c0c8e3337b53d40704a4a2743cc959f558b6c89 100644
--- a/src/views/iot/rule/scene/RuleSceneForm.vue
+++ b/src/views/iot/rule/scene/RuleSceneForm.vue
@@ -19,7 +19,7 @@
{{ dict.label }}
@@ -35,7 +35,7 @@
触发器配置
(formData.triggers[index] = val)"
class="mb-10px"
@@ -49,10 +49,21 @@
- 执行动作配置
-
-
-
+ 执行器配置
+ (formData.actions[index] = val)"
+ class="mb-10px"
+ >
+
+
+
+
+
+ 添加执行器
+
@@ -65,15 +76,19 @@
diff --git a/src/views/iot/rule/scene/components/ThingModelParamInput.vue b/src/views/iot/rule/scene/components/ThingModelParamInput.vue
new file mode 100644
index 0000000000000000000000000000000000000000..b6e35cbe9157aeddc6c04d157aff7eaf1a0878fd
--- /dev/null
+++ b/src/views/iot/rule/scene/components/ThingModelParamInput.vue
@@ -0,0 +1,138 @@
+
+
+
+
+
+ {{ dataSpecs.unit }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/rule/scene/components/action/ActionExecutor.vue b/src/views/iot/rule/scene/components/action/ActionExecutor.vue
new file mode 100644
index 0000000000000000000000000000000000000000..c01db3c6b8bb37940252d445d6d9f35ec8e8b336
--- /dev/null
+++ b/src/views/iot/rule/scene/components/action/ActionExecutor.vue
@@ -0,0 +1,253 @@
+
+
+
+
+
+
+ 执行动作
+
+
+
+
+
+ 产品
+
+ {{ product ? product.name : '选择产品' }}
+
+
+
+ 设备
+
+ {{ isEmpty(deviceList) ? '选择设备' : deviceList.map((d) => d.deviceName).join(',') }}
+
+
+
+
+
+
+
+
+
+
+
+
(actionConfig.deviceControl = val)"
+ />
+
+
+ (actionConfig.alert = val)"
+ />
+
+
+ (actionConfig.dataBridgeId = val)"
+ />
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/rule/scene/components/action/AlertAction.vue b/src/views/iot/rule/scene/components/action/AlertAction.vue
new file mode 100644
index 0000000000000000000000000000000000000000..1dcebd61cf363d703da5c51ccd75a63e734f9e33
--- /dev/null
+++ b/src/views/iot/rule/scene/components/action/AlertAction.vue
@@ -0,0 +1,83 @@
+
+
+
+ 接收方式
+
+
+
+
+
+ 手机号码
+
+
+
+ 邮箱地址
+
+
+
+ 通知内容
+
+
+
+
+
+
diff --git a/src/views/iot/rule/scene/components/action/DataBridgeAction.vue b/src/views/iot/rule/scene/components/action/DataBridgeAction.vue
new file mode 100644
index 0000000000000000000000000000000000000000..c429a073f4392835fdc83aacbebb0eea0525cb72
--- /dev/null
+++ b/src/views/iot/rule/scene/components/action/DataBridgeAction.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
diff --git a/src/views/iot/rule/scene/components/action/DeviceControlAction.vue b/src/views/iot/rule/scene/components/action/DeviceControlAction.vue
new file mode 100644
index 0000000000000000000000000000000000000000..1e5936a3eda598d573841713cc25109cb3e7cea5
--- /dev/null
+++ b/src/views/iot/rule/scene/components/action/DeviceControlAction.vue
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/rule/scene/components/ConditionSelector.vue b/src/views/iot/rule/scene/components/listener/ConditionSelector.vue
similarity index 100%
rename from src/views/iot/rule/scene/components/ConditionSelector.vue
rename to src/views/iot/rule/scene/components/listener/ConditionSelector.vue
diff --git a/src/views/iot/rule/scene/components/DeviceListener.vue b/src/views/iot/rule/scene/components/listener/DeviceListener.vue
similarity index 36%
rename from src/views/iot/rule/scene/components/DeviceListener.vue
rename to src/views/iot/rule/scene/components/listener/DeviceListener.vue
index 1c5d32f45e3b2ec88ee6e4f509558c279873b140..024fbec1d4f3fd01f54351a9848e703af2554db6 100644
--- a/src/views/iot/rule/scene/components/DeviceListener.vue
+++ b/src/views/iot/rule/scene/components/listener/DeviceListener.vue
@@ -1,140 +1,143 @@
-
-
-
- 触发条件
-
-
-
-
-
- 产品
-
- {{ product ? product.name : '选择产品' }}
-
-
-
- 设备
-
- {{ isEmpty(deviceList) ? '选择设备' : triggerConfig.deviceNames.join(',') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ 触发条件
-
-
-
+
-
-
(condition.parameters[index2] = val)"
- class="mb-10px last:mb-0"
- >
-
+
+ 产品
+
+ {{ product ? product.name : '选择产品' }}
+
+
+
+ 设备
+
+ {{ isEmpty(deviceList) ? '选择设备' : triggerConfig.deviceNames.join(',') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (condition.parameters[index2] = val)"
+ class="mb-10px last:mb-0"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ CRON 表达式
+
-
-
-
- CRON 表达式
-
+
+
+ 添加触发条件
+
-
-
- 添加触发条件
-
-
-
-
-
+
+
+
+
diff --git a/src/views/iot/rule/scene/components/DeviceListenerCondition.vue b/src/views/iot/rule/scene/components/listener/DeviceListenerCondition.vue
similarity index 41%
rename from src/views/iot/rule/scene/components/DeviceListenerCondition.vue
rename to src/views/iot/rule/scene/components/listener/DeviceListenerCondition.vue
index 8ada49436fb1123010bd6e5e3a3fc12be3e16de7..3838e63116e9142ceadbbe96432a9c2101b7f8b1 100644
--- a/src/views/iot/rule/scene/components/DeviceListenerCondition.vue
+++ b/src/views/iot/rule/scene/components/listener/DeviceListenerCondition.vue
@@ -1,13 +1,30 @@
-
+
+
+
+
+
-
-
- {{ getUnitName }}
-
+ :thing-model="model"
+ />
@@ -38,43 +52,36 @@
-
+/** 获得物模型属性、类型 */
+const model = computed(() =>
+ getThingModels.value.find((item: any) => item.identifier === conditionParameter.value.identifier)
+)
+
diff --git a/src/views/iot/rule/scene/index.vue b/src/views/iot/rule/scene/index.vue
index 80c1ba97505ad4b29d89dbdd510cd755e6f38774..4a05a201d3b946d73856761c77878890834506bb 100644
--- a/src/views/iot/rule/scene/index.vue
+++ b/src/views/iot/rule/scene/index.vue
@@ -69,9 +69,12 @@
-
-
-
+
+ {{ row.triggers?.length }}个
+
+
+ {{ row.actions?.length }}个
+
@@ -19,6 +27,7 @@ defineOptions({ name: 'ThingModelTSL' })
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('物模型 TSL') // 弹窗的标题
const product = inject[>(IOT_PROVIDE_KEY.PRODUCT) // 注入产品信息
+const viewMode = ref('code') // 查看模式:code-代码视图,editor-编辑器视图
/** 打开弹窗 */
const open = () => {
@@ -27,17 +36,9 @@ const open = () => {
defineExpose({ open })
/** 获取 TSL */
-const thingModelTSL = ref('')
+const thingModelTSL = ref({})
const getTsl = async () => {
- const res = await ThingModelApi.getThingModelTSLByProductId(product?.value?.id || 0)
- thingModelTSL.value = JSON.stringify(res, null, 2)
-}
-
-/** 代码高亮 */
-const highlightedCode = () => {
- // TODO @puhui999:可以考虑 highlight 的告警解决下;另外,可以考虑配置设置里面,有个 json editor 预览
- const result = hljs.highlight('json', thingModelTSL.value, true)
- return result.value || ' '
+ thingModelTSL.value = await ThingModelApi.getThingModelTSLByProductId(product?.value?.id || 0)
}
/** 初始化 **/
diff --git a/src/views/iot/thingmodel/index.vue b/src/views/iot/thingmodel/index.vue
index 74aec6fecba1f289387391fc6aa1023a0aaf0353..1766f73960b357fbe699acb29dccc0d92c3f2506 100644
--- a/src/views/iot/thingmodel/index.vue
+++ b/src/views/iot/thingmodel/index.vue
@@ -108,6 +108,7 @@
import { ThingModelApi, ThingModelData } from '@/api/iot/thingmodel'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import ThingModelForm from './ThingModelForm.vue'
+import ThingModelTSL from './ThingModelTSL.vue'
import { ProductVO } from '@/api/iot/product/product'
import { IOT_PROVIDE_KEY } from '@/views/iot/utils/constants'
import { getDataTypeOptionsLabel } from './config'
]