Browse Source

预警设置新增接收人

zhangyun 2 năm trước cách đây
mục cha
commit
7361559409

+ 47 - 42
minggao/src/page/commandCenter/superviseDetails.vue

@@ -113,8 +113,8 @@
                 <div class="list_div">
                   <span class="list_div_tlt">实际处理人:</span>
                   <span class="list_div_val">{{
-                    taskObj.actual_operator == ""
-                      ? "无"
+                    taskObj.actual_operator == ''
+                      ? '无'
                       : taskObj.actual_operator
                   }}</span>
                 </div>
@@ -142,7 +142,7 @@
             </div>
             <ul class="list_report_ul">
               <li class="list_report_li">
-                {{ taskObj.report_msg || "暂无任务汇报" }}
+                {{ taskObj.report_msg || '暂无任务汇报' }}
               </li>
             </ul>
           </div>
@@ -220,12 +220,12 @@
                         style="color: #409eff; cursor: pointer"
                         >查看</span
                       >
-                      <span v-else>{{ scope.row.report_status || "无" }}</span>
+                      <span v-else>{{ scope.row.report_status || '无' }}</span>
                     </template>
                   </el-table-column>
                   <el-table-column prop="report_time" label="录入时间">
                     <template slot-scope="scope">
-                      <span>{{ scope.row.report_time || "无" }}</span>
+                      <span>{{ scope.row.report_time || '无' }}</span>
                     </template>
                   </el-table-column>
                 </el-table>
@@ -314,7 +314,7 @@
           v-for="(item, index) in insectList"
           :key="index"
         >
-          <div>{{ item.pest_name + ":" }}</div>
+          <div>{{ item.pest_name + ':' }}</div>
           <div style="margin: 0 0 0 20px">{{ item.pest_number }}</div>
         </li>
       </ul>
@@ -323,7 +323,7 @@
 </template>
 
 <script>
-import DOMIN from "../../util/server";
+import DOMIN from '../../util/server';
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: {},
@@ -339,15 +339,15 @@ export default {
       // 任务填报信息
       tableData: [],
       dialogVisible: false, // 弹框
-      titleData: "", // 弹框标题
+      titleData: '', // 弹框标题
       insectList: [], //害虫列表
 
       // 任务汇报
       reportList: [
-        "1、今天做了检测完成任务了没有",
-        "2、途中发生了什么事情",
-        "3、对这次任务有什么总结",
-        "4、我对这次任务有哪些建议",
+        '1、今天做了检测完成任务了没有',
+        '2、途中发生了什么事情',
+        '3、对这次任务有什么总结',
+        '4、我对这次任务有哪些建议',
       ],
       //二期
       taskindex: 0,
@@ -386,17 +386,17 @@ export default {
             map: this.map,
             path: this.lineArr[i],
             isOutline: true,
-            outlineColor: "#ED7119",
+            outlineColor: '#ED7119',
             borderWeight: 10,
-            strokeColor: "#3AD00C",
+            strokeColor: '#3AD00C',
             strokeOpacity: 0.6,
             strokeWeight: 6,
             // 折线样式还支持 'dashed'
-            strokeStyle: "solid",
+            strokeStyle: 'solid',
             // strokeStyle是dashed时有效
             strokeDasharray: [10, 5],
-            lineJoin: "round",
-            lineCap: "round",
+            lineJoin: 'round',
+            lineCap: 'round',
             zIndex: 50,
           });
           this.polyline2.push(polyline2);
@@ -405,7 +405,7 @@ export default {
         for (var i = 0; i < this.polyline2.length; i++) {
           this.map.remove(this.polyline2[i]);
         }
-        this.polyline2 = []
+        this.polyline2 = [];
       }
     },
   },
@@ -425,8 +425,8 @@ export default {
     // 详情界面数据
     detailsData() {
       this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=control_center.task.task_info",
+        method: 'POST',
+        url: '/api/api_gateway?method=control_center.task.task_info',
         data: this.qs.stringify({
           task_id: this.$route.query.id,
         }),
@@ -436,15 +436,20 @@ export default {
             var data = res.data.data;
             // data.img_list = JSON.parse(data.img_list);
             this.taskObj = data;
-            this.taskObj.supervisor_imglist = JSON.parse(
-              this.taskObj.supervisor_imglist
-            );
+            if (this.taskObj.supervisor_imglist == '') {
+              this.taskObj.supervisor_imglist = [];
+            } else {
+              this.taskObj.supervisor_imglist = JSON.parse(
+                this.taskObj.supervisor_imglist
+              );
+            }
+
             this.activities = [];
             for (var i = 0; i < this.taskObj.clock_in_list.length; i++) {
               var obj = {
                 content: this.taskObj.clock_in_list[i].address,
                 timestamp: this.taskObj.clock_in_list[i].create_time,
-                color: "#409eff",
+                color: '#409eff',
                 text: this.taskObj.clock_in_list[i].message,
                 arrlist: [],
               };
@@ -476,7 +481,7 @@ export default {
 
     // 查看
     examine(data) {
-      this.titleData = "设备编号:" + data.trap_number;
+      this.titleData = '设备编号:' + data.trap_number;
       this.insectList = data.pest_list;
       this.dialogVisible = true;
     },
@@ -484,22 +489,22 @@ export default {
       this.taskindex = index;
     },
     initmap() {
-      var map = new AMap.Map(document.getElementById("mapContainer2"), {
+      var map = new AMap.Map(document.getElementById('mapContainer2'), {
         center: [114.052758, 22.545817],
         resizeEnable: true,
         zoom: 10,
-        lang: "en",
-        mapStyle: "amap://styles/fresh",
+        lang: 'en',
+        mapStyle: 'amap://styles/fresh',
         layers: [],
       });
-      AMap.plugin(["AMap.ToolBar", "AMap.Geocoder"], () => {
+      AMap.plugin(['AMap.ToolBar', 'AMap.Geocoder'], () => {
         map.addControl(new AMap.ToolBar());
         this.geocoder = new AMap.Geocoder({
-          city: "全国",
+          city: '全国',
           radius: 1000,
         });
       });
-      AMap.plugin("AMap.MoveAnimation", function () {});
+      AMap.plugin('AMap.MoveAnimation', function () {}); 
       this.map = map;
       for (var i = 0; i < this.lineArr.length; i++) {
         this.inittrack(this.lineArr[i]);
@@ -520,7 +525,7 @@ export default {
         // 图标尺寸
         size: new AMap.Size(44, 42),
         // 图标的取图地址
-        image: "../../../static/images/warning/person1.png",
+        image: '../../../static/images/warning/person1.png',
         // 图标所用图片大小
         imageSize: new AMap.Size(44, 42),
       });
@@ -539,7 +544,7 @@ export default {
         // 图标尺寸
         size: new AMap.Size(18, 22),
         // 图标的取图地址
-        image: "../../../static/images/warning/" + index + ".png",
+        image: '../../../static/images/warning/' + index + '.png',
         // 图标所用图片大小
         imageSize: new AMap.Size(18, 22),
       });
@@ -547,7 +552,7 @@ export default {
         position: data,
         offset: new AMap.Pixel(-10, -10),
         icon: pos_icon, // 添加 Icon 图标 URL
-        title: "设备标点",
+        title: '设备标点',
       });
       this.map.add(marker);
     },
@@ -559,17 +564,17 @@ export default {
           map: this.map,
           path: arrlist,
           isOutline: true,
-          outlineColor: "#ED7119",
+          outlineColor: '#ED7119',
           borderWeight: 10,
-          strokeColor: "#3AD00C",
+          strokeColor: '#3AD00C',
           strokeOpacity: 0.6,
           strokeWeight: 6,
           // 折线样式还支持 'dashed'
-          strokeStyle: "solid",
+          strokeStyle: 'solid',
           // strokeStyle是dashed时有效
           strokeDasharray: [10, 5],
-          lineJoin: "round",
-          lineCap: "round",
+          lineJoin: 'round',
+          lineCap: 'round',
           zIndex: 50,
         });
         this.polyline2.push(polyline2);
@@ -578,7 +583,7 @@ export default {
         map: this.map,
         path: arrlist,
         showDir: true,
-        strokeColor: "#3AD00C", //线颜色
+        strokeColor: '#3AD00C', //线颜色
         strokeOpacity: 1, //线透明度
         strokeWeight: 6, //线宽
         zIndex: 51,
@@ -586,7 +591,7 @@ export default {
       });
       var passedPolyline = new AMap.Polyline({
         map: this.map,
-        strokeColor: "red", //线颜色
+        strokeColor: 'red', //线颜色
         strokeWeight: 6, //线宽
       });
       this.map.setFitView();
@@ -610,7 +615,7 @@ export default {
         // JSAPI2.0 是否延道路自动设置角度在 moveAlong 里设置
         autoRotation: false,
       });
-      this.trackmarker.on("movealong", (e) => {
+      this.trackmarker.on('movealong', (e) => {
         index++;
         if (index == this.lineArr.length || index > this.lineArr.length) {
           this.btndisabled = false;

+ 11 - 2
minggao/src/page/homepage/facilitydistribute.vue

@@ -100,7 +100,13 @@
         </p>
       </div>
     </div>
-    <div class="tracklistbox">
+    <div
+      class="tracklistbox"
+      v-loading="trackloading"
+      element-loading-text="拼命加载中"
+      element-loading-spinner="el-icon-loading"
+      element-loading-background="rgba(0, 0, 0, 0.8)"
+    >
       <el-date-picker
         v-model="tracktime"
         type="date"
@@ -383,6 +389,7 @@ export default {
       total: 8,
       tracklistdata_backups: {},
       arealistmouse: {},
+      trackloading: true,
     };
   },
   //监听属性 类似于data概念
@@ -808,6 +815,7 @@ export default {
     },
     //获取路径数据
     gettracklist_data() {
+      this.trackloading = true;
       this.$axios({
         method: 'POST',
         url: '/api/api_gateway?method=monitor_manage.home_map.user_walk_list',
@@ -838,9 +846,10 @@ export default {
             arr.push(obj);
           }
           this.$set(this.tracklistdata_backups, this.trackpage, arr);
-          // this.tracklistdata_backups[this.trackpage] = arr;n
+          // this.tracklistdata_backups[this.trackpage] = arr;
         }
         this.tracklistdata = data;
+        this.trackloading = false;
         console.log(this.tracklistdata_backups);
       });
     },

+ 1 - 0
minggao/src/page/homepage/pestdistribute.vue

@@ -476,6 +476,7 @@ export default {
       }).then((res) => {
         // console.log(res.data.data);
         this.map.clearMap();
+        this.mouseTool.close(true);
         var resdata = res.data.data;
         this.loading = false;
         var pest_count = res.data.data.pest_count;

+ 116 - 35
minggao/src/page/warning/warningset.vue

@@ -42,7 +42,12 @@
           v-for="(items, index) in wormlist"
           :key="index"
         >
-          <el-select v-model="items.pest_name" size="mini" filterable placeholder="请选择">
+          <el-select
+            v-model="items.pest_name"
+            size="mini"
+            filterable
+            placeholder="请选择"
+          >
             <el-option
               v-for="item in options"
               :key="item.value"
@@ -62,10 +67,16 @@
             v-if="index == 0"
             @click="addworm(index)"
           >
-            <i class="el-icon-circle-plus-outline" style="color: #409eff"></i>
+            <i
+              class="el-icon-circle-plus-outline"
+              style="color: #409eff; cursor: pointer"
+            ></i>
           </p>
           <p class="setinfo_text_addordel" v-else @click="delworm(index)">
-            <i class="el-icon-delete" style="color: #ff4949"></i>
+            <i
+              class="el-icon-delete"
+              style="color: #ff4949; cursor: pointer"
+            ></i>
           </p>
           <p class="setinfo_text_describe" v-if="index == 0">
             每天害虫
@@ -110,6 +121,28 @@
         </el-switch>
       </div>
     </div>
+    <div class="setinfo">
+      <div class="setinfo_off">
+        <p class="setinfo_off_index">5</p>
+        <p class="setinfo_off_title">预警接收人</p>
+      </div>
+      <div class="setinfo_text3">
+        <el-select
+          v-model="warninfo.user_uids"
+          size="mini"
+          multiple
+          placeholder="请选择"
+        >
+          <el-option
+            v-for="item in useroptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          >
+          </el-option>
+        </el-select>
+      </div>
+    </div>
     <el-button type="info" @click="saveinfo" size="mini">保 存</el-button>
   </div>
 </template>
@@ -126,6 +159,8 @@ export default {
       warninfo: {},
       wormlist: [],
       options: [],
+      useroptions: [],
+      value1: [391, 390],
     };
   },
   //监听属性 类似于data概念
@@ -137,38 +172,65 @@ export default {
     addworm(index) {
       console.log(this.wormlist);
       var tf = this.wormlist.every((item, index, arr) => {
-        return item.pest_name != "" && item.pest_num != "";
+        return item.pest_name != '' && item.pest_num != '';
       });
       console.log(tf);
       if (tf) {
         var obj = {
-          pest_name: "",
-          pest_num: "",
+          pest_name: '',
+          pest_num: '',
         };
         this.wormlist.push(obj);
       } else {
         this.$message({
           showClose: true,
-          message: "请将信息填写完整后增加",
-          type: "warning",
+          message: '请将信息填写完整后增加',
+          type: 'warning',
         });
       }
     },
     delworm(index) {
       this.wormlist.splice(index, 1);
     },
+    //获取接收人列表
+    getuserlist() {
+      this.$axios({
+        method: 'POST',
+        url: '/api/api_gateway?method=sysmenage.usermanager.user_list',
+        data: this.qs.stringify({
+          page: '1',
+          page_item: '99999999',
+        }),
+      })
+        .then((res) => {
+          // console.log(res.data.data.page_list);
+          var page_list = res.data.data.page_list;
+          for (var i = 0; i < page_list.length; i++) {
+            var obj = {
+              value: page_list[i].user_id,
+              label: page_list[i].real_name,
+            };
+            this.useroptions.push(obj);
+          }
+          // real_name
+          // useroptions
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
     //获取害虫列表
     getwarnlist() {
       this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=sysmenage.maintain.pest_list",
+        method: 'POST',
+        url: '/api/api_gateway?method=sysmenage.maintain.pest_list',
         data: this.qs.stringify({
-          page: "1",
-          page_item: "99999999",
+          page: '1',
+          page_item: '99999999',
         }),
       })
         .then((res) => {
-          console.log(res.data.data.page_list);
+          // console.log(res.data.data.page_list);
           this.options = [];
           var data = res.data.data.page_list;
           for (var i = 0; i < data.length; i++) {
@@ -186,8 +248,8 @@ export default {
     //获取预警信息
     getwarninfo() {
       this.$axios({
-        method: "POST",
-        url: "/api/api_gateway?method=alert_manage.alert.get_alert_config",
+        method: 'POST',
+        url: '/api/api_gateway?method=alert_manage.alert.get_alert_config',
         data: this.qs.stringify({}),
       })
         .then((res) => {
@@ -209,12 +271,20 @@ export default {
           } else {
             this.wormlist = [
               {
-                pest_name: "",
-                pest_num: "",
+                pest_name: '',
+                pest_num: '',
               },
             ];
           }
-          console.log(this.wormlist);
+          if (this.warninfo.user_uids == '') {
+            this.warninfo.user_uids = [];
+          } else {
+            this.warninfo.user_uids = this.warninfo.user_uids.split(',');
+            for (var i = 0; i < this.warninfo.user_uids.length; i++) {
+              this.warninfo.user_uids[i] = Number(this.warninfo.user_uids[i]);
+            }
+          }
+          console.log(this.warninfo);
         })
         .catch((err) => {
           console.log(err);
@@ -222,7 +292,7 @@ export default {
     },
     //设置预警
     saveinfo() {
-      if (this.yanzheng() == "") {
+      if (this.yanzheng() == '') {
         var infoobj = JSON.parse(JSON.stringify(this.warninfo));
         infoobj.alien_species_status =
           infoobj.alien_species_status == true ? 1 : 0; //外侵开关
@@ -230,11 +300,11 @@ export default {
         infoobj.pest_total_status = infoobj.pest_total_status == true ? 1 : 0; //总数开关
         infoobj.species_status = infoobj.species_status == true ? 1 : 0; //种类开关
 
-        infoobj["pest_list"] = this.wormlist;
+        infoobj['pest_list'] = this.wormlist;
         console.log(infoobj);
         this.$axios({
-          method: "POST",
-          url: "/api/api_gateway?method=alert_manage.alert.modify_alert_config",
+          method: 'POST',
+          url: '/api/api_gateway?method=alert_manage.alert.modify_alert_config',
           data: this.qs.stringify({
             species_num: infoobj.species_num, //            是       目标种类数量
             species_status: infoobj.species_status, //         是       目标种类预期状态
@@ -243,20 +313,21 @@ export default {
             pest_total_num: infoobj.pest_total_num, //          是       害虫总类预警数量
             pest_total_status: infoobj.pest_total_status, //       是       害虫总数预警状态
             alien_species_status: infoobj.alien_species_status, //    是       外来入侵物种预警状态
+            user_uids: infoobj.user_uids.join(','),
           }),
         })
           .then((res) => {
             console.log(res);
-            if (res.data.message == "") {
+            if (res.data.message == '') {
               this.$message({
-                message: "预警设置成功",
-                type: "success",
+                message: '预警设置成功',
+                type: 'success',
               });
               this.getwarninfo();
             } else {
               this.$message({
                 message: res.data.message,
-                type: "error",
+                type: 'error',
               });
             }
           })
@@ -266,7 +337,7 @@ export default {
       } else {
         this.$message({
           message: this.yanzheng(),
-          type: "warning",
+          type: 'warning',
           duration: 1500,
         });
       }
@@ -274,7 +345,7 @@ export default {
     //验证信息
     yanzheng() {
       var tf = this.wormlist.every((item, index, arr) => {
-        return item.pest_name != "" && item.pest_num != "";
+        return item.pest_name != '' && item.pest_num != '';
       });
       console.log(tf);
       if (
@@ -283,21 +354,23 @@ export default {
         this.warninfo.pest_total_status == false &&
         this.warninfo.species_status == false
       ) {
-        return "请至少开启一项预警信息";
+        return '请至少开启一项预警信息';
       } else if (
         this.warninfo.species_status &&
-        this.warninfo.species_num == ""
+        this.warninfo.species_num == ''
       ) {
-        return "请将目标种类预警信息填写完整";
+        return '请将目标种类预警信息填写完整';
       } else if (this.warninfo.pest_name_status && tf == false) {
-        return "请将数量预警信息填写完整";
+        return '请将数量预警信息填写完整';
       } else if (
         this.warninfo.pest_total_status &&
-        this.warninfo.pest_total_num == ""
+        this.warninfo.pest_total_num == ''
       ) {
-        return "请将总量预警信息填写完整";
+        return '请将总量预警信息填写完整';
+      } else if (this.warninfo.user_uids.length == 0) {
+        return '请选择预警接收人';
       } else {
-        return "";
+        return '';
       }
     },
   },
@@ -307,6 +380,7 @@ export default {
   beforeMount() {}, //生命周期 - 挂载之前
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
+    this.getuserlist();
     this.getwarnlist();
     this.getwarninfo();
   },
@@ -382,6 +456,13 @@ export default {
         }
       }
     }
+    .setinfo_text3 {
+      margin-top: 20px;
+      display: flex;
+      /deep/.el-input {
+        width: 515px;
+      }
+    }
   }
   /deep/.el-button--info {
     background-color: #409eff;