Browse Source

布撤防控制页面提交

xujie 1 year ago
parent
commit
5ac01928f7

+ 9 - 1
src/api/resumption/protection.js

@@ -43,7 +43,7 @@ export function updateStatus(id,status) {
     });
   }
 
-  
+
 // 更新状态
 export function history(query) {
   // query.startTime=new Date().toLocaleString()
@@ -54,3 +54,11 @@ export function history(query) {
     params:query
   });
 }
+//布撤防控制
+export function subSystemControl(data) {
+  return request({
+    url: `/core/resumption/protection/subSystemControl`,
+    method: "post",
+    data: data
+  });
+}

+ 60 - 13
src/views/iot/deviceInfo/detailDialog.vue

@@ -58,6 +58,36 @@
             </el-table-column>
           </el-table>
         </div>
+        <div class="extend_mod" v-if="formData.deviceType === '4'" style="max-height: 500px;">
+          <el-table :data="childrenInfos" border style="width: 100%;max-height: 500px;overflow-y: auto;">
+            <el-table-column
+              type="index"
+              label="序号"
+              width="60"
+              align="center"
+            ></el-table-column>
+            <el-table-column
+              prop="deviceTypeName"
+              label="设备类型"
+              align="center"
+            ></el-table-column>
+            <el-table-column
+              prop="deviceName"
+              label="设备名称"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              align="center"
+              prop="subSystemStatus"
+              label="布撤防状态"
+            >
+              <template slot-scope="scope">
+                {{ getSubSystemStatusDesc(scope.row.subSystemStatus)}}
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
       </div>
 
       <div slot="footer" class="dialog-footer">
@@ -71,6 +101,7 @@
 import { mapState, mapMutations } from "vuex";
 import {
   getDetailById,
+  getAlarmHostDetailById
 } from "@/api/iot/deviceInfo";
 
 export default {
@@ -80,7 +111,6 @@ export default {
   data() {
     const params = this.$route.params;
     return {
-      id: params ? params.id : null,
       isShow: false,
       formData: this.reset(),
       childrenInfos: [],
@@ -127,28 +157,45 @@ export default {
       };
     },
     getNetStatusDesc(val){
-      if (val === '0'){
-        return "未知";
-      }else if(val === '1'){
+      if(val === '1'){
         return "在线";
       }else if(val === '2'){
         return "离线";
       }else if(val === '3'){
         return "异常";
+      }else {
+        return "未知";
       }
     },
-    async refresh(id) {
-      getDetailById(id).then(response => {
-        this.formData = response.data;
-        this.childrenInfos = this.formData.childrenInfos;
-        this.loading = false;
-      })
+    getSubSystemStatusDesc(val){
+      if (val === '0'){
+        return "撤防";
+      }else if(val === '1'){
+        return "布防";
+      }else {
+        return "未知";
+      }
+    },
+    async refresh(id,deviceType) {
+      if (deviceType && deviceType === '4'){
+        getAlarmHostDetailById(id).then(response => {
+          this.formData = response.data;
+          this.childrenInfos = this.formData.childrenInfos;
+          this.loading = false;
+        })
+      }else {
+        getDetailById(id).then(response => {
+          this.formData = response.data;
+          this.childrenInfos = this.formData.childrenInfos;
+          this.loading = false;
+        })
+      }
     },
-    async show(id) {
-      this.id = id;
+    async show(id,deviceType) {
+      //this.id = id;
       // this.isSignType = isSignType;
       // this.showSignBtn = showSignBtn;
-      await this.refresh(id);
+      await this.refresh(id,deviceType);
       this.isShow = true;
     },
     // 事件

+ 3 - 3
src/views/iot/deviceInfo/index.vue

@@ -105,7 +105,7 @@
                 size="mini"
                 type="text"
                 icon="el-icon-edit-outline"
-                @click="showDetail(scope.row.id)"
+                @click="showDetail(scope.row)"
               >详情</el-button>
             </template>
           </el-table-column>
@@ -347,8 +347,8 @@ export default {
         this.queryParams.netStatus = val;
       }
     },
-    showDetail(deviceId){
-      this.$refs.detailInfo.show(deviceId);
+    showDetail(row){
+      this.$refs.detailInfo.show(row.id,row.deviceType);
     },
   },
 };

+ 36 - 2
src/views/iot/subSystem/index.vue

@@ -227,6 +227,22 @@
                   v-hasPermi="['device:protection']"
                   >布撤防历史</el-button
                 >
+                <el-button
+                  v-if="r.row.source === 1 && r.row.status === '1'"
+                  size="mini"
+                  type="text"
+                  icon="el-icon-circle-close"
+                  @click="subSystemControl(r.row.id,false)"
+                >撤防</el-button
+                >
+                <el-button
+                  v-else-if="r.row.source === 1"
+                  size="mini"
+                  type="text"
+                  icon="el-icon-circle-check"
+                  @click="subSystemControl(r.row.id, true)"
+                >布防</el-button
+                >
                 <!-- <el-popconfirm
                   @confirm="onDel(r.row.id)"
                   title="点击确定删除报警控制器"
@@ -289,6 +305,7 @@ export default {
   data() {
     const { params, query } = this.$route;
     return {
+      intervalId: null,
       isShow: false,
       loading: false,
       ids: [],
@@ -343,7 +360,15 @@ export default {
           this.loading = false;
         });
     },
-
+    subSystemControl(id,isAlarm){
+      api
+        .subSystemControl({id:id,isAlarm:isAlarm})
+        .then((response) => {
+          this.$message.success("布撤防控制指令下发成功!")
+        })
+        .catch(() => {
+        });
+    },
     handleAdd(id, other = {}) {
       this.$refs.editDialog.show(id, other);
     },
@@ -422,7 +447,16 @@ export default {
       this.getList();
     },
   },
-  mounted() {},
+  mounted() {
+    this.intervalId = setInterval(() => {
+      this.getList();
+    },1 * 60 * 1000);
+  },
+  beforeDestroy() {
+    if (this.intervalId){
+      clearInterval(this.intervalId);
+    }
+  }
 };
 </script>