浏览代码

Merge branch 'v0.1.1_alarm' of http://10.87.21.221:8000/jzyd_yyds/soc_web into v0.1.1_alarm

zhulu 1 年之前
父节点
当前提交
c5422f1fc7

+ 13 - 2
src/api/system/device.js

@@ -1,5 +1,5 @@
 import request from '@/utils/request'
-import { parseStrEmpty } from "@/utils/ruoyi";
+
 // 查询列表【请填写功能名称】
 export function listDevice(query) {
   return request({
@@ -29,16 +29,18 @@ export function getDevice(id) {
 // 查询主机
 export function getHostByOrgId(orgId) {
   return request({
-    url: '/system/device/getHostByOrgId/'+ orgId.id,
+    url: '/system/device/getHostByOrgId/' + orgId.id,
     method: 'get'
   })
 }
+
 export function downInCharge() {
   return request({
     url: '/system/device/downInChargeOfTemplate',
     method: 'get'
   })
 }
+
 // 新增【请填写功能名称】
 export function addDevice(data) {
   return request({
@@ -90,4 +92,13 @@ export function getDictTreeByParentId(parentId) {
   })
 }
 
+// 检查是否存在已经有主机同步子系统上来
+export function checkExitSyncSubSystem(orgId, deviceType, deviceId) {
+  return request({
+    url: '/system/device/checkExitSyncSubSystem',
+    method: 'get',
+    params: {orgId: orgId, deviceType: deviceType, deviceId: deviceId}
+  })
+}
+
 

+ 8 - 0
src/api/system/logManagement.js

@@ -52,3 +52,11 @@ export function downloadLogData(data) {
     data: data
   })
 }
+
+// 查询看门猫详细
+export function delServer(id) {
+  return request({
+    url: '/system/server/' + id,
+    method: 'delete'
+  })
+}

+ 5 - 2
src/views/iot/board/components/alarmRate.vue

@@ -118,8 +118,8 @@ export default {
             center: ["50%", "60%"],
             // color: ['#e72325', '#98e002', '#2ca3fd'],
             color: ["#F6A645", "#13D0B2"],
-            selectedMode: true,
-            selectedOffset: 4,
+            selectedMode: 'single',
+            selectedOffset: 6,
             // avoidLabelOverlap:false,
             // padAngle: 5,
             // emphasis:{
@@ -144,6 +144,9 @@ export default {
                 }%`;
               },
             },
+            // labelLine:{
+            //   show:false
+            // },
             data: [
               {
                 value: this.data.alarmCount,

+ 9 - 9
src/views/iot/deviceInfo/detailDialog.vue

@@ -47,15 +47,15 @@
               align="center"
             >
             </el-table-column>
-            <el-table-column
-              align="center"
-              prop="netStatus"
-              label="网络状态"
-            >
-              <template slot-scope="scope">
-                {{ getNetStatusDesc(scope.row.netStatus)}}
-              </template>
-            </el-table-column>
+<!--            <el-table-column-->
+<!--              align="center"-->
+<!--              prop="netStatus"-->
+<!--              label="网络状态"-->
+<!--            >-->
+<!--              <template slot-scope="scope">-->
+<!--                {{ getNetStatusDesc(scope.row.netStatus)}}-->
+<!--              </template>-->
+<!--            </el-table-column>-->
           </el-table>
         </div>
         <div class="extend_mod" v-if="formData.deviceType === '4'" style="max-height: 500px;">

+ 16 - 11
src/views/iot/deviceInfo/index.vue

@@ -31,7 +31,7 @@
               </el-select>
             </el-form-item>
 
-            <el-form-item label="网络状态" prop="netStatus" label-width="80">
+            <el-form-item label="网络状态" prop="netStatus" label-width="80" v-if="activeName!='fsu' ">
               <el-select style="width: 100%;"  v-model="queryParams.netStatus" placeholder="网络状态"
                          @change="searchChangeSelectNetStatus" clearable>
                 <el-option v-for="dict in netStatusList" :key="dict.value" :label="dict.label"
@@ -93,7 +93,7 @@
             v-if="activeName != 'fsu'"
           >
             <template slot-scope="scope">
-              {{ getNetStatusDesc(scope.row.netStatus)}}
+              {{ getNetStatusDesc(scope.row)}}
             </template>
           </el-table-column>
           <el-table-column
@@ -238,15 +238,20 @@ export default {
   },
 
   methods: {
-    getNetStatusDesc(val){
-      if (val === '0'){
-        return "未知";
-      }else if(val === '1'){
-        return "在线";
-      }else if(val === '2'){
-        return "离线";
-      }else if(val === '3'){
-        return "异常";
+    getNetStatusDesc(row){
+      if (row.deviceType === '2' || row.deviceType === '3'){
+        return "-";
+      }else {
+        let val = row.netStatus;
+        if (val === '0'){
+          return "未知";
+        }else if(val === '1'){
+          return "在线";
+        }else if(val === '2'){
+          return "离线";
+        }else if(val === '3'){
+          return "异常";
+        }
       }
     },
     onOrgSelect(node) {

+ 34 - 19
src/views/system/device/index.vue

@@ -177,7 +177,8 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="设备型号" prop="deviceModel">
-              <el-select @change="brandSelectChange1" style="width: 100%" v-model="form.deviceModel" placeholder="请选择设备型号">
+              <el-select @change="brandSelectChange1" style="width: 100%" v-model="form.deviceModel"
+                         placeholder="请选择设备型号">
                 <el-option v-for="item in brandChildrenDictList" :key="item.id" :label="item.name"
                            :value="item.id"></el-option>
               </el-select>
@@ -287,22 +288,24 @@ import orgDropDown from "../../../components/orgTree/orgDropDown.vue";
 import OrgTree from "@/components/orgTree";
 import tableList from "@/mixins/tableList";
 import {deptTreeSelect} from "@/api/system/public";
-import {getDeviceType} from "@/api/system/dict/data";
 import {
   addDevice,
+  checkExitSyncSubSystem,
   delDevice,
-  getDevice, getDictList,
-  getDictTree, getDictTreeByParentId,
+  getDevice,
+  getDictList,
+  getDictTree,
+  getDictTreeByParentId,
   getHostByOrgId,
   listDevice,
-  updateDevice,
+  updateDevice
 } from "@/api/system/device";
 import request from "@/utils/request";
 
 export default {
   /** 引入基础minxins*/
   mixins: [tableList],
-  dicts: ["sys_asset_type", "sys_device_type",'asset_status'],
+  dicts: ["sys_asset_type", "sys_device_type", 'asset_status'],
   name: "Device",
   components: {OrgTree, orgDropDown},
   data() {
@@ -321,8 +324,8 @@ export default {
         deviceName: [{required: true, message: "请输入设备名称", trigger: "change"}],
         orgId: [{required: true, message: "请选择所属机构", trigger: "blur"}],
         assetType: [{required: true, message: '请选择资产分类', trigger: 'change'}],
-      /*  hostId: [{required: true, message: '请选择主机', trigger: 'change'}],
-        channel: [{required: true, message: '请输入通道号', trigger: 'change'}],*/
+        /*  hostId: [{required: true, message: '请选择主机', trigger: 'change'}],
+          channel: [{required: true, message: '请输入通道号', trigger: 'change'}],*/
         deviceType: [{required: true, message: "请选择设备分类", trigger: "change"}],
         deviceStatus: [{required: true, message: "请选择资产状态", trigger: "blur"}],
       },
@@ -484,7 +487,7 @@ export default {
           this.upload.open = false;
           this.upload.isUploading = false;
           this.$refs.upload.clearFiles();
-          if (response&&response.size >0) {
+          if (response && response.size > 0) {
             this.$alert(
               "导入失败,请根据返回的Excel检查文件内容"
             );
@@ -719,7 +722,7 @@ export default {
       });
     },
     brandSelectChange1(val) {
-      console.log(this.form.deviceModel,val)
+      console.log(this.form.deviceModel, val)
     },
     clearAsset() {
       this.queryParams.deviceType = null;
@@ -732,7 +735,7 @@ export default {
         this.form = response.data;
         this.open = true;
         this.title = "编辑设备信息";
-        console.log(this.form.assetType,this.form.deviceBrand)
+        console.log(this.form.assetType, this.form.deviceBrand)
         getDictTreeByParentId(this.form.assetType).then((response) => {
           this.assetChildrenDictList = response.data;
         });
@@ -746,16 +749,28 @@ export default {
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.form.id != null) {
-            updateDevice(this.form).then((response) => {
-              this.$modal.msgSuccess("处理成功");
-              this.open = false;
-              this.getList();
+            checkExitSyncSubSystem(this.form.orgId, this.form.deviceType, this.form.id).then((response) => {
+              if (response.code == 200 && response.data == 0) {
+                updateDevice(this.form).then((response) => {
+                  this.$modal.msgSuccess("处理成功");
+                  this.open = false;
+                  this.getList();
+                });
+              } else {
+                return this.$modal.msgError("该机构已接入巡检主机,无需手动新增/编辑该类型设备");
+              }
             });
           } else {
-            addDevice(this.form).then((response) => {
-              this.$modal.msgSuccess("处理成功");
-              this.open = false;
-              this.getList();
+            checkExitSyncSubSystem(this.form.orgId, this.form.deviceType, null).then((response) => {
+              if (response.code == 200 && response.data == 0) {
+                addDevice(this.form).then((response) => {
+                  this.$modal.msgSuccess("处理成功");
+                  this.open = false;
+                  this.getList();
+                });
+              } else {
+                return this.$modal.msgError("该机构已接入巡检主机,无需手动新增/编辑该类型设备");
+              }
             });
           }
         }

+ 1 - 1
src/views/system/logManagement/dialog.info.vue

@@ -42,7 +42,7 @@
                 <el-button
                   size="mini"
                   type="text"
-                  icon="el-icon-delete"
+                  class="el-icon-download"
                   v-if="scope.row.exit == 1"
                   @click="downloadLog(scope.row)"
                 >下载

+ 3 - 3
src/views/system/logManagement/index.vue

@@ -71,7 +71,7 @@
                   <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
                     <template slot-scope="scope">
                     <el-button size="mini" type="text" icon="el-icon-edit-outline" @click="handleGetLog(props.row,scope.row)">
-                      日志获取
+                      日志详情
                     </el-button>
                   </template>
 
@@ -164,7 +164,7 @@
 </template>
 
 <script>
-import {detail, edit, listData,} from "@/api/system/logManagement";
+import {detail, edit, listData,delServer,} from "@/api/system/logManagement";
 import BtnTip from "@/components/btnTip";
 import tableList from "@/mixins/tableList";
 import {mapGetters} from "vuex";
@@ -336,7 +336,7 @@ export default {
       this.$modal
         .confirm("是否确认删除?")
         .then(function () {
-          return delDrillDictionary(ids);
+          return delServer(ids);
         })
         .then(() => {
           this.getList();

+ 5 - 2
src/views/warnRule/addRelvance.vue

@@ -221,11 +221,13 @@ export default {
       treeList: [],
       deptOptions:[],
       boundDevicesClone:JSON.parse(JSON.stringify(this.currentTempList)),
+      iotCode:null,
       left: {
         condition: {
           orgId: this.$store.getters.orgId,
           deviceName: "",
           searchChild: false,
+          iotCode: '',
         },
         total: 0,
         selectedCount: 0,
@@ -237,6 +239,7 @@ export default {
           orgId: this.$store.getters.orgId,
           deviceName: "",
           searchChild: false,
+          iotCode: '',
         },
         total: 0,
         selectedCount: 0,
@@ -286,7 +289,6 @@ export default {
         else {
           this.treeList = this.$store.getters.orgTree;
         }
-        console.log(this.treeList)
       }
     },
     getChildIds(orgTree,parentId){
@@ -352,6 +354,7 @@ export default {
       this.right.condition.orgId = null;
       this.right.condition.searchChild = false;
       this.right.condition.deviceName = null;
+      this.right.condition.iotCode = null;
       let addData = this.left.selectedRows.filter(
         (row) => this.boundDeviceIds.indexOf(row.deviceId) < 0
       );
@@ -397,6 +400,7 @@ export default {
         orgId:condition.orgId,
         deviceName:condition.deviceName,
         type:this.deviceType,
+        iotCode:this.iotCode,
         includeSub:condition.searchChild,
         page:0,
         size:9999
@@ -405,7 +409,6 @@ export default {
           this.searchDevices = result.data.records;
           this.boundDeviceIds = this.boundDevicesClone.map((d) => d.deviceId);
           let data = result.data.records.filter((row) => this.boundDeviceIds.indexOf(row.deviceId) < 0);
-        console.log("data",data)
           this.left.data = data;
         });
     },

+ 1 - 3
src/views/warnRule/index.vue

@@ -216,8 +216,6 @@ export default {
           })
         }
       })
-
-      console.log(this.alarmRules);
       this.loading = false;
     },
     ConvertToSourceTypeDics(sourceTypeList) {
@@ -290,7 +288,7 @@ export default {
     },
     /** 关联按钮操作 */
     lookView(row) {
-      this.$refs["relevanceDialog"].show(row.iotAlarmRule.id, {});
+      this.$refs["relevanceDialog"].show(row.iotAlarmRule.id,row.iotAlarmRule.iotCode, {});
     },
     getDeviceNumber(row) {
       let text = "";

+ 7 - 1
src/views/warnRule/relevanceDialog.vue

@@ -68,8 +68,10 @@ export default {
         deviceTempList: [],
         type: -1,
         typeText: "",
+        iotCode: "",
       },
       data: defaultDetail,
+      iotCode: null,
       queryParams: {},
     };
   },
@@ -77,8 +79,10 @@ export default {
   },
 
   methods: {
-    show(ruleId) {
+    show(ruleId,iotCode) {
       this.isShow = true;
+      this.iotCode = iotCode;
+      this.currentTypeData.iotCode = iotCode;
       this.init(ruleId);
     },
     init(ruleId) {
@@ -90,6 +94,7 @@ export default {
             setTimeout(() => {
               this.selectedTab = String(this.data.typeDataList[0].type);
               this.currentTypeData = this.data.typeDataList[0];
+              this.currentTypeData.iotCode = this.iotCode;
             }, 200);
           }
         })
@@ -101,6 +106,7 @@ export default {
       this.currentTypeData = this.data.typeDataList.find(
         (t) => t.type == this.selectedTab
       );
+      this.currentTypeData.iotCode = this.iotCode;
     },
     updateDeviceData(rel) {
       this.data.typeDataList.forEach((obj, index) => {

+ 2 - 0
src/views/warnRule/relevanceDialogCom.vue

@@ -53,6 +53,7 @@ export default {
         deviceTempList: [],
         isAllDeviceEnable: false,
         type: 4,
+        iotCode: '',
       }
     };
   },
@@ -68,6 +69,7 @@ export default {
     handleAddDevice() {
       this.$refs.addrelvance.visible = true
       this.$refs.addrelvance.deviceType = this.currentDevice.type;
+      this.$refs.addrelvance.iotCode = this.currentDevice.iotCode;
       this.$refs.addrelvance.orgTree();
     },
     addDevice(data) {