Sfoglia il codice sorgente

fix: 联动规则增加中文展示

lvkun 1 anno fa
parent
commit
8e747b3328
1 ha cambiato i file con 37 aggiunte e 12 eliminazioni
  1. 37 12
      src/pages/Iot/rule/linkRules.vue

+ 37 - 12
src/pages/Iot/rule/linkRules.vue

@@ -115,6 +115,9 @@
               :pagination="false"
             >
               <template #bodyCell="{column, record}" >
+                <template v-if="column.key === 'conditionType'" >
+                  {{conditionTypeList.toMap('key', 'name').get(record.conditionType)}}
+                </template>
                 <template v-if="column.key === 'action'" >
                   <a @click="delCondiTionsAndActions(record.id, 'conditions')" >
                     删除
@@ -132,6 +135,9 @@
               :pagination="false"
             >
               <template #bodyCell="{column, record}" >
+                <template v-if="column.key === 'conditionType'" >
+                  {{conditionTypeList.toMap('key', 'name').get(record.conditionType)}}
+                </template>
                 <template v-if="column.key === 'sessionEventType'" >
                 {{record.sessionEventType === 'CONNECT' ? '连接' : '断开连接'  }}
                 </template>
@@ -152,6 +158,9 @@
               :pagination="false"
             >
               <template #bodyCell="{column, record}" >
+                <template v-if="column.key === 'conditionType'" >
+                  {{conditionTypeList.toMap('key', 'name').get(record.conditionType)}}
+                </template>
                 <template v-if="column.key === 'dayOfWeek'" >
                 {{record.dayOfWeek.map(item => '周' + item).join(',') }}
                 </template>
@@ -190,6 +199,9 @@
             >
 
               <template #bodyCell="{column, record}" >
+                <template v-if="column.key === 'actionType'" >
+                  {{actionTypeList.toMap('key', 'name').get(record.actionType) }}
+                </template>
                 <template v-if="column.key === 'cmdParameters'" >
                   <a-tooltip color="white" :overlayStyle="{width: '800px'}" >
                   <template #title>
@@ -222,6 +234,9 @@
               :pagination="false"
             >
               <template #bodyCell="{column, record}" >
+                <template v-if="column.key === 'actionType'" >
+                  {{actionTypeList.toMap('key', 'name').get(record.actionType) }}
+                </template>
                 <template v-if="column.key === 'action'" >
                   <a @click="delCondiTionsAndActions(record.id, 'actions')" >
                     删除
@@ -239,6 +254,9 @@
               :pagination="false"
             >
               <template #bodyCell="{column, record}" >
+                <template v-if="column.key === 'actionType'" >
+                  {{actionTypeList.toMap('key', 'name').get(record.actionType) }}
+                </template>
                 <template v-if="column.key === 'action'" >
                   <a @click="delCondiTionsAndActions(record.id, 'actions')" >
                     删除
@@ -256,6 +274,9 @@
               :pagination="false"
             >
               <template #bodyCell="{column, record}" >
+                <template v-if="column.key === 'actionType'" >
+                  {{actionTypeList.toMap('key', 'name').get(record.actionType) }}
+                </template>
                 <template v-if="column.key === 'action'" >
                   <a @click="delCondiTionsAndActions(record.id, 'actions')" >
                     删除
@@ -287,14 +308,14 @@
     <div  style="width: 100%;" v-if="state.opraModel === 'conditions'" >
       <a-row :gutter="[8, 8]" style="width: 100%;" >
         <a-form
-           style="width: 100%;"
+          style="width: 100%;"
           :label-col="{ span: 3 }"
           :wrapper-col="{ span: 16 }"
         >
           <a-col>
             <a-form-item label="触发条件" >
               <a-select
-              allowClear
+                allowClear
                 style="width: 170px"
                 v-model:value="initConditionsData.conditionType"
               >
@@ -781,38 +802,38 @@ const selectDeviceList = [
 
 const conditionColumns = reactive({
   DEVICE_DATA: [
-    { title: '触发条件', dataIndex: 'conditionType' }, { title: '产品ID', dataIndex: 'modelId' },
+    { title: '触发条件', dataIndex: 'conditionType', key: 'conditionType' }, { title: '产品ID', dataIndex: 'modelId' },
     { title: '属性key', dataIndex: 'attributeKey' }, { title: '操作符', dataIndex: 'operator' },
-    { title: '触发值', dataIndex: 'value' }, { title: '操作符', dataIndex: 'operator' }, { title: '操作', key: 'action' }
+    { title: '触发值', dataIndex: 'value' }, { title: '操作', key: 'action' }
   ],
   DEVICE_SESSION: [
-    { title: '触发条件', dataIndex: 'conditionType' }, { title: '产品ID', dataIndex: 'modelId' },
+    { title: '触发条件', dataIndex: 'conditionType', key: 'conditionType' }, { title: '产品ID', dataIndex: 'modelId' },
     { title: '设备类型', dataIndex: 'deviceType' }, { title: '设备名称', dataIndex: 'deviceLabel' },
     { title: 'sessionEventType', dataIndex: 'attributeKey', key: 'sessionEventType' }, { title: '操作', key: 'action' }
   ],
   DAILY_TIMER: [
-    { title: '触发条件', dataIndex: 'conditionType' }, { title: '时间', dataIndex: 'time', key: 'time' },
+    { title: '触发条件', dataIndex: 'conditionType', key: 'conditionType' }, { title: '时间', dataIndex: 'time', key: 'time' },
     { title: '日期', dataIndex: 'dayOfWeek', key: 'dayOfWeek' }, { title: '操作', key: 'action' }
   ]
 })
 
 const actionsColumns = reactive({
   DEVICE_CMD: [
-    { title: '触发动作', dataIndex: 'actionType' }, { title: '产品ID', dataIndex: 'modelId' },
+    { title: '触发动作', dataIndex: 'actionType', key: 'actionType' }, { title: '产品ID', dataIndex: 'modelId' },
     { title: '设备id', dataIndex: 'deviceId' }, { title: '命令名称', dataIndex: 'cmdLabel' },
     { title: '命令参数', key: 'cmdParameters', dataIndex: 'cmdParameters', ellipsis: true, width: 120 }, { title: '操作', dataIndex: 'action', key: 'action' }
   ],
   REPORT_WARN: [
-    { title: '触发动作', dataIndex: 'actionType' }, { title: '设备id', dataIndex: 'deviceId' },
+    { title: '触发动作', dataIndex: 'actionType', key: 'actionType' }, { title: '设备id', dataIndex: 'deviceId' },
     { title: '告警名称', dataIndex: 'warnLabel' }, { title: '告警描述', dataIndex: 'warnDescription' },
     { title: '告警级别', dataIndex: 'warnSeverity' }, { title: '操作', dataIndex: 'action', key: 'action' }
   ],
   RESUME_WARN: [
-    { title: '触发动作', dataIndex: 'actionType' }, { title: '告警名称', dataIndex: 'warnLabel' },
+    { title: '触发动作', dataIndex: 'actionType', key: 'actionType' }, { title: '告警名称', dataIndex: 'warnLabel' },
     { title: '告警级别', dataIndex: 'warnSeverity' }, { title: '操作', dataIndex: 'action', key: 'action' }
   ],
   NOTICE: [
-    { title: '触发动作', dataIndex: 'actionType' }, { title: '提示名称', dataIndex: 'noticeLabel' },
+    { title: '触发动作', dataIndex: 'actionType', key: 'actionType' }, { title: '提示名称', dataIndex: 'noticeLabel' },
     { title: '提示描述', dataIndex: 'noticeDescription' }, { title: '提示用户', dataIndex: 'userId' },
     { title: '操作', dataIndex: 'action', key: 'action' }
   ]
@@ -1131,9 +1152,13 @@ const delCondiTionsAndActions = (id: string, key: 'conditions' | 'actions') => {
 
 function selectConditionAndAction () {
   if (state.opraModel === 'conditions') {
-    bodyParamsState.conditions.push({ ...JSON.parse(JSON.stringify(initConditionsData)), id: useId() })
+    const _params = { ...JSON.parse(JSON.stringify({ ...initConditionsData })), id: useId() }
+    console.log('_params:', _params)
+    bodyParamsState.conditions.push(_params)
   } else {
-    bodyParamsState.actions.push({ ...initActionsData, id: useId() })
+    const _params = { ...JSON.parse(JSON.stringify({ ...initActionsData })), id: useId() }
+
+    bodyParamsState.actions.push(_params)
   }
   console.log('bodyParamsState.conditions:', bodyParamsState.conditions)