cxs 2 nedēļas atpakaļ
vecāks
revīzija
67fe9bd207

+ 4 - 1
src/views/alarm/gis/index.vue

@@ -617,6 +617,7 @@ function hideStationName() {
     }
   };
 
+
   // 地图台站信息标注
   const getStations = (stations) => {
     console.log(stations,'getstation2');
@@ -847,7 +848,9 @@ const getAllRgDataList = async () => {
 };
 
 // 存放选中要素列表
-const copiedCustomizeColumns = ref<any>([]);
+const copiedCustomizeColumns = ref<any>([
+
+]);
 // 要素的选中和取消
 const toggleSelection = (item) => {
   item.isSelected = !item.isSelected;

+ 185 - 35
src/views/system/stations/components/strategySafeguard.vue

@@ -29,6 +29,9 @@
                       <template v-if="item.prop === 'eliminate'">
                         {{parseItemValue(scope.row[item.prop])}}
                       </template>
+                      <template v-if="item.prop === 'alarmManner'">
+                        {{getAlarmMannerItemValue(scope.row[item.prop])}}
+                      </template>
                       <template v-if="item.prop === 'operation'">
                         <el-tooltip
                           class="box-item"
@@ -36,7 +39,7 @@
                           content="编辑"
                           placement="top"
                         >
-                          <el-button type="primary" link @click="handleUpdate">
+                          <el-button type="primary" link @click="handleUpdate(scope.row)">
                             <el-icon >
                               <Edit />
                             </el-icon>
@@ -114,20 +117,20 @@
     <el-form ref="formRef" :model="dailyForm" :rules="rules" >
       <div class="disposition-title">警告设置</div>
       <el-form-item label="触发条件:" prop="relationship"  style="display: flex;align-items: center">
-        <el-radio-group v-model="dailyForm.relationship">
-          <el-radio value="1" size="large">条件并且</el-radio>
-          <el-radio value="2" size="large">条件或者</el-radio>
+        <el-radio-group v-model="itemData.alarmCondition" disabled>
+          <el-radio value="0" size="large">条件并且</el-radio>
+          <el-radio value="1" size="large">条件或者</el-radio>
         </el-radio-group>
       </el-form-item>
       <el-form-item label="触发周期:" prop="cycle"  style="display: flex;align-items: center">
         <div class="flex-center">
-          <el-input v-model="dailyForm.cycle" style="width: 150px" />
+          <el-input v-model="itemData.alarmTime" style="width: 150px"  disabled/>
           <div style="margin-left: 10px">分钟</div>
         </div>
       </el-form-item>
-      <el-button type="primary" plain style="margin-top: 10px">新增</el-button>
+      <!-- <el-button type="primary" plain style="margin-top: 10px">新增</el-button>-->
       <div class="table-box" style="margin-top: 10px;height: 160px">
-        <el-table stripe ref="tableRef" :border="true" :data="processTableData3"  size="small" >
+        <el-table stripe ref="tableRef" :border="true" :data="itemData.alarmList"  size="small" >
           <template v-for="item in columns3" :key="item">
             <el-table-column v-bind="item" :align="item.align ?? 'left'" :reserve-selection="item.type == 'selection'" :show-overflow-tooltip="true">
               <template v-if="item.prop === 'operation'">
@@ -161,20 +164,20 @@
 
       <div class="disposition-title">消警设置</div>
       <el-form-item label="解除条件:" prop="relationship"  style="display: flex;align-items: center">
-        <el-radio-group v-model="dailyForm.relationship">
-          <el-radio value="1" size="large">条件并且</el-radio>
-          <el-radio value="2" size="large">条件或者</el-radio>
+        <el-radio-group v-model="itemData.eliminateCondition" disabled>
+          <el-radio value="0" size="large">条件并且</el-radio>
+          <el-radio value="1" size="large">条件或者</el-radio>
         </el-radio-group>
       </el-form-item>
       <el-form-item label="解除周期:" prop="cycle"  style="display: flex;align-items: center">
         <div class="flex-center">
-          <el-input v-model="dailyForm.cycle" style="width: 150px" />
+          <el-input v-model="itemData.eliminateTime" disabled style="width: 150px" />
           <div style="margin-left: 10px">分钟</div>
         </div>
       </el-form-item>
-      <el-button type="primary" plain style="margin-top: 10px">新增</el-button>
+<!--      <el-button type="primary" plain style="margin-top: 10px">新增</el-button>-->
       <div class="table-box" style="margin-top: 10px;height: 160px">
-        <el-table stripe ref="tableRef" :border="true" :data="processTableData4"  size="small" >
+        <el-table stripe ref="tableRef" :border="true" :data="itemData.eliminateList"  size="small" >
           <template v-for="item in columns4" :key="item">
             <el-table-column v-bind="item" :align="item.align ?? 'left'" :reserve-selection="item.type == 'selection'" :show-overflow-tooltip="true">
               <template v-if="item.prop === 'operation'">
@@ -209,7 +212,7 @@
     <template #footer>
       <div class="dialog-footer">
         <el-button @click="cancel">取 消</el-button>
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+<!--        <el-button type="primary" @click="submitForm">确 定</el-button>-->
       </div>
     </template>
   </el-dialog>
@@ -375,13 +378,16 @@ const getList= async ()=>{
   dataList.forEach(item => {
     if (item.tact_index === 1) {
       dailyData.value.push(item);
+      getDailyData()
     } else {
       taskData.value.push(item);
     }
   });
-  getDailyData()
+
 }
 
+
+
 const getDailyData=()=>{
   if(dailyData.value!=undefined&&dailyData.value.length>0){
     const data = dailyData.value[0]
@@ -391,41 +397,82 @@ const getDailyData=()=>{
         item.eliminate = data.tact_njd_off;
         item.alarmTime = getAlarmTime(data.tact_njd_on)
         item.eliminateTime = getEliminateTime(data.tact_njd_off)
+        item.alarmManner = getAlarmManner(data.tact_njd_on)
+        item.alarmCondition =getAlarmCondition(data.tact_njd_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_njd_off)
+        item.alarmList = parseItemList(data.tact_njd_on)
+        item.eliminateList = parseItemList(data.tact_njd_off)
+
       } else if (item.name === '风速') {
         item.alarm = data.tact_fs_on;
         item.eliminate = data.tact_fs_off;
         item.alarmTime = getAlarmTime(data.tact_fs_on)
         item.eliminateTime = getEliminateTime(data.tact_fs_off)
+        item.alarmManner = getAlarmManner(data.tact_fs_on)
+        item.alarmCondition =getAlarmCondition(data.tact_fs_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_fs_off)
+        item.alarmList = parseItemList(data.tact_fs_on)
+        item.eliminateList = parseItemList(data.tact_fs_off)
       } else if (item.name === '大气电场') {
         item.alarm = data.tact_dqdc_on;
         item.eliminate = data.tact_dqdc_off;
         item.alarmTime = getAlarmTime(data.tact_dqdc_on)
         item.eliminateTime = getEliminateTime(data.tact_dqdc_off)
+        item.alarmManner = getAlarmManner(data.tact_dqdc_on)
+        item.alarmCondition =getAlarmCondition(data.tact_dqdc_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_dqdc_off)
+        item.alarmList = parseItemList(data.tact_dqdc_on)
+        item.eliminateList = parseItemList(data.tact_dqdc_off)
       } else if (item.name === '云量') {
         item.alarm = data.tact_yl_on;
         item.eliminate = data.tact_yl_off;
         item.alarmTime = getAlarmTime(data.tact_yl_on)
         item.eliminateTime = getEliminateTime(data.tact_yl_off)
+        item.alarmManner = getAlarmManner(data.tact_yl_on)
+        item.alarmCondition =getAlarmCondition(data.tact_yl_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_yl_off)
+        item.alarmList = parseItemList(data.tact_yl_on)
+        item.eliminateList = parseItemList(data.tact_yl_off)
       } else if (item.name === '云高') {
         item.alarm = data.tact_yg_on;
         item.eliminate = data.tact_yg_off;
         item.alarmTime = getAlarmTime(data.tact_yg_on)
         item.eliminateTime = getEliminateTime(data.tact_yg_off)
+        item.alarmManner = getAlarmManner(data.tact_yg_on)
+        item.alarmCondition =getAlarmCondition(data.tact_yg_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_yg_off)
+        item.alarmList = parseItemList(data.tact_yg_on)
+        item.eliminateList = parseItemList(data.tact_yg_off)
       } else if (item.name === '气温') {
         item.alarm = data.tact_wd_on;
         item.eliminate = data.tact_wd_off;
         item.alarmTime = getAlarmTime(data.tact_wd_on)
         item.eliminateTime = getEliminateTime(data.tact_wd_off)
+        item.alarmManner = getAlarmManner(data.tact_wd_on)
+        item.alarmCondition =getAlarmCondition(data.tact_wd_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_wd_off)
+        item.alarmList = parseItemList(data.tact_wd_on)
+        item.eliminateList = parseItemList(data.tact_wd_off)
       } else if (item.name === '湿度') {
         item.alarm = data.tact_sd_on;
         item.eliminate = data.tact_sd_off;
         item.alarmTime = getAlarmTime(data.tact_sd_on)
         item.eliminateTime = getEliminateTime(data.tact_sd_off)
+        item.alarmManner = getAlarmManner(data.tact_sd_on)
+        item.alarmCondition =getAlarmCondition(data.tact_sd_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_sd_off)
+        item.alarmList = parseItemList(data.tact_sd_on)
+        item.eliminateList = parseItemList(data.tact_sd_off)
       } else if (item.name === '小时雨量') {
         item.alarm = data.tact_xsyl_on;
         item.eliminate = data.tact_xsyl_off;
         item.alarmTime = getAlarmTime(data.tact_xsyl_on)
         item.eliminateTime = getEliminateTime(data.tact_xsyl_off)
+        item.alarmManner = getAlarmManner(data.tact_xsyl_on)
+        item.alarmCondition =getAlarmCondition(data.tact_xsyl_on)
+        item.eliminateCondition =getEliminateCondition(data.tact_xsyl_off)
+        item.alarmList = parseItemList(data.tact_xsyl_on)
+        item.eliminateList = parseItemList(data.tact_xsyl_off)
       }
     });
 
@@ -441,7 +488,11 @@ const tableDailyData =ref(
      eliminate:'',
      alarmTime:'',
      eliminateTime:'',
-      alarmManner:''
+     alarmManner:'',
+     alarmCondition:'',
+     eliminateCondition:'',
+     alarmList:[],
+     eliminateList:[]
     },
     {
       name:'风速',
@@ -449,7 +500,11 @@ const tableDailyData =ref(
       eliminate:'',
       alarmTime:'',
       eliminateTime:'',
-      alarmManner:''
+      alarmManner:'',
+      alarmCondition:'',
+      eliminateCondition:'',
+      alarmList:[],
+      eliminateList:[]
     },
     {
       name:'大气电场',
@@ -457,7 +512,11 @@ const tableDailyData =ref(
       eliminate:'',
       alarmTime:'',
       eliminateTime:'',
-      alarmManner:''
+      alarmManner:'',
+      alarmCondition:'',
+      eliminateCondition:'',
+      alarmList:[],
+      eliminateList:[]
     },
     {
       name:'云量',
@@ -465,7 +524,11 @@ const tableDailyData =ref(
       eliminate:'',
       alarmTime:'',
       eliminateTime:'',
-      alarmManner:''
+      alarmManner:'',
+      alarmCondition:'',
+      eliminateCondition:'',
+      alarmList:[],
+      eliminateList:[]
     },
     {
       name:'云高',
@@ -473,7 +536,11 @@ const tableDailyData =ref(
       eliminate:'',
       alarmTime:'',
       eliminateTime:'',
-      alarmManner:''
+      alarmManner:'',
+      alarmCondition:'',
+      eliminateCondition:'',
+      alarmList:[],
+      eliminateList:[]
     },
     {
       name:'气温',
@@ -481,7 +548,11 @@ const tableDailyData =ref(
       eliminate:'',
       alarmTime:'',
       eliminateTime:'',
-      alarmManner:''
+      alarmManner:'',
+      alarmCondition:'',
+      eliminateCondition:'',
+      alarmList:[],
+      eliminateList:[]
     },
     {
       name:'湿度',
@@ -489,7 +560,11 @@ const tableDailyData =ref(
       eliminate:'',
       alarmTime:'',
       eliminateTime:'',
-      alarmManner:''
+      alarmManner:'',
+      alarmCondition:'',
+      eliminateCondition:'',
+      alarmList:[],
+      eliminateList:[]
     },
     {
       name:'小时雨量',
@@ -497,7 +572,11 @@ const tableDailyData =ref(
       eliminate:'',
       alarmTime:'',
       eliminateTime:'',
-      alarmManner:''
+      alarmManner:'',
+      alarmCondition:'',
+      eliminateCondition:'',
+      alarmList:[],
+      eliminateList:[]
     }
   ]
 )
@@ -506,7 +585,10 @@ const tableDailyData =ref(
 
 onMounted(() => {
   getAllRgDataList()
-  getList()
+  setTimeout(() => {
+    getList()
+  }, 1000);
+
 })
 
 const dailyData = ref([])
@@ -565,6 +647,44 @@ const handleUpdateTask = async (row?: any) => {
   dialogTask.title = "策略管理";
   dialogTask.isMode = false;
 }
+
+const getAlarmCondition = (itemValue) => {
+  if (itemValue === '1|1|0') {
+    const time = itemValue.split('|');
+    return time[0]
+  }else if (typeof itemValue === 'string') {
+    const alarm = itemValue.split(';');
+    const time = alarm[0].split('|');
+    return time[0]
+  }
+
+  return '0';
+}
+
+const getEliminateCondition = (itemValue) => {
+  if (itemValue === '0|15') {
+    const time = itemValue.split('|');
+    return time[0]
+  }else if (typeof itemValue === 'string') {
+    const alarm = itemValue.split(';');
+    const time = alarm[0].split('|');
+    return time[0]
+  }
+  return '0';
+}
+
+const getAlarmManner = (itemValue)=>{
+  if (itemValue === '1|1|0') {
+    const time = itemValue.split('|');
+    return time[2]
+  }else if (typeof itemValue === 'string') {
+    const alarm = itemValue.split(';');
+    const time = alarm[0].split('|');
+    return time[2]
+  }
+
+  return '';
+}
 const getAlarmTime = (itemValue)=>{
   if (itemValue === '1|1|0') {
     const time = itemValue.split('|');
@@ -589,6 +709,30 @@ const getEliminateTime = (itemValue)=>{
   return '';
 }
 
+const getAlarmMannerItemValue = (itemValue) => {
+  if(itemValue==='0'){
+    return '字幕提示'
+  }else if(itemValue==='1'){
+   return '声音提示'
+  }
+  return ''
+}
+
+const parseItemList = (itemValue) => {
+  if (itemValue === '1|1|0'||itemValue === '0|15') {
+    return [];
+  }
+  if (typeof itemValue === 'string') {
+    const alarm = itemValue.split(';');
+    const data = []
+    for (var i = 1; i < alarm.length; i++) {
+      data.push(getItemList(alarm[i]))
+    }
+    return data;
+  }
+  return [];
+
+}
 
 const parseItemValue = (itemValue) => {
   if (itemValue === '1|1|0'||itemValue === '0|15') {
@@ -606,6 +750,12 @@ const parseItemValue = (itemValue) => {
   return '';
 }
 
+const getItemList=(itemValue)=>{
+  const [element, operator, value] = itemValue.split('|');
+  console.log("findDataName",findDataName(element))
+  return {element:findDataName(element),operator:operatorDataName(operator),valueName:value}
+}
+
 const getItemValue=(itemValue)=>{
   const [element, operator, value] = itemValue.split('|');
   return `${findDataName(element)} ${operatorDataName(operator)} ${value}`;
@@ -654,10 +804,10 @@ const findDataName = (id) => {
   }
 };
 
-
+const itemData = ref({})
 /** 修改按钮操作 */
 const handleUpdate = async (row?: any) => {
-  reset();
+  itemData.value = row
   dialog.visible = true;
   dialog.title = "策略管理";
   dialog.isMode = false;
@@ -704,7 +854,7 @@ const columns = reactive<ColumnProps[]>([
   { prop: "eliminate", label: "消警条件" },
   { prop: "alarmTime", label: "告警时间" },
   { prop: "eliminateTime", label: "消警时间" },
-  { prop: "f", label: "告警方式" },
+  { prop: "alarmManner", label: "告警方式" },
   { prop: "operation", label: "操作", width:150,align: 'center' }
 ]);
 
@@ -735,10 +885,10 @@ const processTableData3 = ref([
 
 // 表格配置项
 const columns3 = reactive<ColumnProps[]>([
-  { prop: "a", label: "告警要素"},
-  { prop: "b", label: "告警条件"},
-  { prop: "c", label: "告警阈值" },
-  { prop: "operation", label: "操作", width:100,align: 'center' }
+  { prop: "element", label: "消警要素"},
+  { prop: "operator", label: "消警条件"},
+  { prop: "valueName", label: "消警阈值" },
+  // { prop: "operation", label: "操作", width:100,align: 'center' }
 ]);
 
 const processTableData4 = ref([
@@ -747,10 +897,10 @@ const processTableData4 = ref([
 
 // 表格配置项
 const columns4 = reactive<ColumnProps[]>([
-  { prop: "a", label: "消警要素"},
-  { prop: "b", label: "消警条件"},
-  { prop: "c", label: "消警阈值" },
-  { prop: "operation", label: "操作", width:100,align: 'center' }
+  { prop: "element", label: "消警要素"},
+  { prop: "operator", label: "消警条件"},
+  { prop: "valueName", label: "消警阈值" },
+  // { prop: "operation", label: "操作", width:100,align: 'center' }
 ]);
 </script>