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

预警设置验证逻辑;拍照指令下发;有害生物分布-害虫数量设置颜色配置

yf_zhb 2 лет назад
Родитель
Сommit
d8aedb32c8

+ 10 - 2
minggao/src/page/commandCenter/laboratory.vue

@@ -829,7 +829,6 @@ export default {
 
     // 添加、删除确定事件
     confirmAxios() {
-      this.submitBtn = true;
       var array = [];
       for (var i = 0; i < this.fillList.length; i++) {
         var obj = {};
@@ -838,7 +837,7 @@ export default {
         array.push(obj);
       }
 
-      if (this.insectVal !== '' && this.numVal !== '') {
+      if (this.insectVal !== '' && this.numVal > 0) {
         array = [
           {
             pest_name: this.insectVal,
@@ -848,6 +847,13 @@ export default {
         ];
       }
 
+      if (!array.length) {
+        this.$message.error('请填写完整信息,数值请检查为大于0的整数');
+        return;
+      }
+
+      this.submitBtn = true;
+
       this.$axios({
         method: 'POST',
         url: '/api/api_gateway?method=control_center.task.discern_add',
@@ -920,6 +926,8 @@ export default {
         }
         e.target.value = 0;
       }
+
+      e.target.value = Math.floor(e.target.value);
     },
 
     // 有害生物添加

+ 11 - 7
minggao/src/page/homepage/pestdistribute.vue

@@ -530,6 +530,10 @@ export default {
         })
       }).then(res => {
         console.log(res.data.data);
+        if (res.data.data && res.data.data.threshold) {
+          this.ruleForm.threshold = res.data.data.threshold;
+        }
+
         this.map && this.map.clearMap();
         if (this.mouseTool) {
           this.mouseTool.close(true);
@@ -590,13 +594,13 @@ export default {
             capitals.push(obj);
           }
         }
-        var maxnum = 0;
-        for (var i = 0; i < capitals.length; i += 1) {
-          if (capitals[i].pest_total > maxnum) {
-            console.log();
-            maxnum = capitals[i].pest_total;
-          }
-        }
+        var maxnum = this.ruleForm.threshold;
+        // for (var i = 0; i < capitals.length; i += 1) {
+        //   if (capitals[i].pest_total > maxnum) {
+        //     console.log();
+        //     maxnum = capitals[i].pest_total;
+        //   }
+        // }
         for (var i = 0; i < capitals.length; i += 1) {
           var color = '';
           if (capitals[i].pest_total > Math.floor(maxnum * 0.8)) {

+ 18 - 11
minggao/src/page/monitor/Monitor.vue

@@ -1280,6 +1280,12 @@ export default {
             console.log(res.data);
             this.picUrl = res.data.data.addr;
             this.takePhotoDialogVisible = true;
+
+            this.$message({
+              message: '拍照指令下发成功',
+              type: 'success',
+              duration: 1500
+            });
           } else {
             if (document.getElementsByClassName('el-message').length == 0) {
               this.$message({
@@ -2118,17 +2124,18 @@ export default {
         if (arr[0].parent_name == '根组织') {
           this.versionsoptions = arr;
         } else {
-          var obj = {
-            id: 148,
-            org_name: '研发部',
-            childrens: []
-          };
-          for (var i = 0; i < arr.length; i++) {
-            obj.childrens.push(arr[i]);
-            obj.id = arr[0].parent_id;
-            obj.org_name = arr[0].parent_name;
-          }
-          this.versionsoptions.push(obj);
+          // var obj = {
+          //   id: 148,
+          //   org_name: '研发部',
+          //   childrens: []
+          // };
+          // for (var i = 0; i < arr.length; i++) {
+          //   obj.childrens.push(arr[i]);
+          //   obj.id = arr[0].parent_id;
+          //   obj.org_name = arr[0].parent_name;
+          // }
+          // this.versionsoptions.push(obj);
+          this.versionsoptions = arr;
         }
         console.log(this.versionsoptions);
         this.traponsoptions = res.data.data.point_data;

+ 23 - 10
minggao/src/page/warning/warningset.vue

@@ -215,6 +215,7 @@
 
 <script>
 //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
+import { uniq, filter, map } from 'lodash-es';
 
 export default {
   //import引入的组件需要注入到对象中才能使用
@@ -380,11 +381,11 @@ export default {
             pest_total_status: infoobj.pest_total_status, //       是       害虫总数预警状态
             alien_species_status: infoobj.alien_species_status, //    是       外来入侵物种预警状态
             user_uids: infoobj.user_uids.join(','),
-            level_1: infoobj.level_1,
-            level_2: infoobj.level_2,
-            level_3: infoobj.level_3,
-            level_4: infoobj.level_4,
-            level_5: infoobj.level_5
+            level_1: infoobj.level_1 || 0,
+            level_2: infoobj.level_2 || 0,
+            level_3: infoobj.level_3 || 0,
+            level_4: infoobj.level_4 || 0,
+            level_5: infoobj.level_5 || 0
           })
         })
           .then(res => {
@@ -419,6 +420,21 @@ export default {
         return item.pest_name != '' && item.pest_num != '';
       });
       console.log(tf);
+      const totalData = [
+        this.warninfo.level_1,
+        this.warninfo.level_2,
+        this.warninfo.level_3,
+        this.warninfo.level_4,
+        this.warninfo.level_5
+      ];
+
+      const filterData = filter(
+        map(totalData, num => num + ''),
+        item => !!item
+      );
+
+      const hasSameNum = uniq(filterData).length !== filterData.length;
+
       if (
         this.warninfo.alien_species_status == false &&
         this.warninfo.pest_name_status == false &&
@@ -426,6 +442,8 @@ export default {
         this.warninfo.species_status == false
       ) {
         return '请至少开启一项预警信息';
+      } else if (this.warninfo.pest_total_status && hasSameNum) {
+        return '总量预警信息值不能相同';
       } else if (
         this.warninfo.species_status &&
         this.warninfo.species_num == ''
@@ -433,11 +451,6 @@ export default {
         return '请将目标种类预警信息填写完整';
       } else if (this.warninfo.pest_name_status && tf == false) {
         return '请将数量预警信息填写完整';
-      } else if (
-        this.warninfo.pest_total_status &&
-        this.warninfo.pest_total_num == ''
-      ) {
-        return '请将总量预警信息填写完整';
       } else if (this.warninfo.user_uids.length == 0) {
         return '请选择预警接收人';
       } else {