Просмотр исходного кода

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

puhui999 10 месяцев назад
Родитель
Сommit
8343faa027

+ 0 - 12
src/views/iot/rule/scene/components/action/DeviceControlAction.vue

@@ -1,17 +1,5 @@
 <template>
   <div class="bg-[#dbe5f6] flex p-10px">
-    <div class="flex flex-col items-center justify-center mr-10px h-a">
-      <el-select
-        v-model="deviceControlConfig.type"
-        disabled
-        class="!w-160px"
-        clearable
-        placeholder=""
-      >
-        <el-option label="属性" :value="IotDeviceMessageTypeEnum.PROPERTY" />
-        <el-option label="服务" :value="IotDeviceMessageTypeEnum.SERVICE" />
-      </el-select>
-    </div>
     <div class="">
       <div
         class="flex items-center justify-around mb-10px last:mb-0"

+ 4 - 31
src/views/iot/rule/scene/components/listener/DeviceListener.vue

@@ -54,32 +54,6 @@
           v-for="(condition, index) in triggerConfig.conditions"
           :key="index"
         >
-          <div class="flex flex-col items-center justify-center mr-10px h-a">
-            <el-select
-              v-model="condition.type"
-              @change="condition.parameters = []"
-              class="!w-160px"
-              clearable
-              placeholder=""
-              :disabled="isConditionTypeFixed"
-            >
-              <el-option
-                v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.DEVICE_PROPERTY_POST"
-                label="属性"
-                :value="IotDeviceMessageTypeEnum.PROPERTY"
-              />
-              <el-option
-                v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.DEVICE_EVENT_POST"
-                label="事件"
-                :value="IotDeviceMessageTypeEnum.EVENT"
-              />
-              <el-option
-                v-if="triggerConfig.type === IotRuleSceneTriggerTypeEnum.DEVICE_SERVICE_INVOKE"
-                label="服务"
-                :value="IotDeviceMessageTypeEnum.SERVICE"
-              />
-            </el-select>
-          </div>
           <div class="w-70%">
             <DeviceListenerCondition
               v-for="(parameter, index2) in condition.parameters"
@@ -198,11 +172,6 @@ const isDeviceTrigger = computed(() => {
   ].includes(triggerConfig.value.type as any)
 })
 
-/** 计算属性:判断条件类型是否固定(根据触发类型自动确定) */
-const isConditionTypeFixed = computed(() => {
-  return triggerConfig.value.type !== IotRuleSceneTriggerTypeEnum.DEVICE_SERVICE_INVOKE
-})
-
 /** 添加触发条件 */
 const addCondition = () => {
   // 根据触发类型设置默认的条件类型
@@ -237,6 +206,10 @@ const addConditionParameter = (conditionParameters: TriggerConditionParameter[])
     message.warning('请先选择一个产品')
     return
   }
+  if (conditionParameters.length >= 1) {
+    message.warning('只允许添加一个参数')
+    return
+  }
   conditionParameters.push({} as TriggerConditionParameter)
 }
 /** 移除参数 */