From 63ad2c3598400370dd7da5534659fd7e768a0a4a Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 May 2022 17:29:46 +0800
Subject: [PATCH] 地址替换

---
 src/views/realTimePolice/real.vue |  352 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 271 insertions(+), 81 deletions(-)

diff --git a/src/views/realTimePolice/real.vue b/src/views/realTimePolice/real.vue
index 9913e9f..3c0ae05 100644
--- a/src/views/realTimePolice/real.vue
+++ b/src/views/realTimePolice/real.vue
@@ -22,11 +22,11 @@
       @size-change="sizeChange"
       @refresh-change="refreshChange"
       @on-load="onLoad"
-      @row-click="rowClick">
-
+      @row-click="rowClick"
+    >
       <template slot="menuLeft">
         <el-button
-          type="danger"
+
           v-show="true"
           size="mini"
           icon="el-icon-delete"
@@ -86,7 +86,15 @@
       <template slot-scope="{ row }" slot="jtype">
         <el-tag
         >{{
-          row.jtype == "0" || row.jtype == "" ? "未处理" : row.jtype == "1" ? "处理中" : "已处理"
+          row.jtype == "0" || row.jtype == ""
+          ? "未派发"
+          : row.jtype == "1" &&
+          (row.securityId == null || row.securityId == "")
+          ? "未接收"
+          : row.jtype == "1" &&
+          (row.securityId != null || row.securityId != "")
+          ? "已接收"
+          : "已处置"
           }}
         </el-tag>
       </template>
@@ -108,7 +116,17 @@
         >派发
         </el-button>
       </template>
+
+      <template slot-scope="{type,disabled}" slot="xllxzsForm">
+        <div class="mapClassMain" style="width: 860px;height: 400px">
+          <Map ref="modalForm"/>
+        </div>
+      </template>
+
+
     </avue-crud>
+
+
     <real-popup ref="realPopupView"></real-popup>
     <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
       <iframe
@@ -153,8 +171,8 @@
           labelWidth: "100",
           size: "mini",
           border: false,
-          stripe: true,
-          menuWidth: 240,
+          //stripe:true,
+          menuWidth: 260,
           dialogWidth: 950,
           tip: false,
           searchShow: true,
@@ -166,8 +184,8 @@
           dialogClickModal: false,
           column: [
             {
-              label: "警情类型",
-              prop: "waringType",
+              label: "任务类型",
+              prop: "alarmType",
               search: false,
               searchSpan: 3,
               width: 85,
@@ -181,14 +199,33 @@
               //cascaderItem: ["city", "district"],
               dicUrl:
                 "/api/blade-system/dict-biz/child-list?parentId=1356523651644043266",
+              control: (val, form) => {
+                // if (val) {
+                // }
+                return {
+                  text2: {
+                    display: true,
+                  },
+                  text3: {
+                    label: "内容3",
+                  },
+                };
+              },
             },
             {
-              label: "报警时间",
+              label: "下发时间",
               type: "datetime",
               width: 160,
               format: "yyyy-MM-dd HH:mm:ss",
               valueFormat: "yyyy-MM-dd HH:mm:ss",
               prop: "alarmTime",
+              rules: [
+                {
+                  required: true,
+                  message: "请选择报警时间",
+                  trigger: "blur",
+                },
+              ],
             },
             {
               label: "报警时间",
@@ -211,22 +248,30 @@
                   trigger: "blur",
                 },
               ],
-            },{
+            },
+            {
               label: "备注",
               prop: "bz",
-              span:24,
+              span: 24,
             },
             {
               label: "地址",
               prop: "place",
-              span:10,
+              span: 10,
+              rules: [
+                {
+                  required: true,
+                  message: "请选择地址",
+                  trigger: "blur",
+                },
+              ],
             },
             {
               label: null,
               prop: "map",
               labelWidth: "0",
-              searchSpan:0,
-              maxlength:0,
+              searchSpan: 0,
+              maxlength: 0,
               hide: true,
               span: 2,
               // display:false,
@@ -236,28 +281,29 @@
               label: "经度",
               hide: true,
               prop: "jd",
-              searchSpan:2,
-              width:"100",
+              searchSpan: 2,
+              width: "100",
               labelWidth: "120",
-              formatter: (row,value,label,column)=>{
-                return value = value.substring(0,11);
+              formatter: (row, value, label, column) => {
+                return (value = value.substring(0, 11));
               },
-              span:7,
+              span: 7,
             },
             {
               label: "纬度",
               labelWidth: "45",
               hide: true,
               prop: "wd",
-              formatter: (row,value,label,column) => {
-                return value = value.substring(0,10);
+              formatter: (row, value, label, column) => {
+                return (value = value.substring(0, 10));
               },
-              span:5,
+              span: 5,
             },
             {
               label: "省份",
               prop: "province",
               search: true,
+              width: 100,
               searchSpan: 2,
               searchLabelWidth: 45,
               placeholder: "省份",
@@ -278,6 +324,7 @@
               label: "地市",
               prop: "city",
               type: "select",
+              width: 100,
               searchPlaceholder: "地市",
               placeholder: "地市",
               searchLabelWidth: 1,
@@ -299,6 +346,7 @@
               label: "区县",
               searchSpan: 2,
               searchLabelWidth: 1,
+              width: 100,
               searchPlaceholder: "区县",
               placeholder: "区县",
               search: true,
@@ -317,17 +365,18 @@
               viewDisplay: true,
             },
             {
-              label: "警情状态",
+              label: "状态",
               searchSpan: 3,
               width: 96,
               search: true,
               slot: true,
+              value: "0",
               searchPlaceholder: "请选择",
               prop: "jtype",
               type: "select",
               dicData: [
                 {
-                  label: "未处理",
+                  label: "未派发",
                   value: "0",
                 },
                 {
@@ -335,26 +384,26 @@
                   value: "1",
                 },
                 {
-                  label: "已处理",
+                  label: "已处置",
                   value: "2",
                 },
               ],
             },
+            // {
+            //   label: "派发人",
+            //   prop: "alarmPeople",
+            //   width: 90,
+            //   addDisplay: false,
+            //   editDisplay: false,
+            // },
             {
-              label: "派发人",
-              prop: "alarmPeople",
-              width: 90,
-              addDisplay: false,
-              editDisplay: false,
-            },
-            {
-              label: "处警员",
+              label: "接收人",
               prop: "securityArr",
               type: "tree",
               multiple: true,
-              dicUrl: "/api/blade-jfpts/catalogs/catalogs/getBigTree",
+              dicUrl: "/api/catalogs/catalogs/getBigTree",
               props: {
-                label: "title"
+                label: "title",
               },
               width: 72,
               hide: true,
@@ -362,12 +411,27 @@
               addDisplay: true,
               editDisplay: true,
               viewDisplay: true,
-              rules: [{
-                required: true,
-                message: "请选择处警员",
-                trigger: "blur"
-              }],
-            }
+            },
+            {
+              label: "巡逻路线",
+              prop: "xllx",
+              hide: true,
+              display: true,
+              type: "tree",
+              dicUrl: "/api/routeIn/routein/tree",
+              props: {
+                label: "title",
+              },
+            },
+            {
+              label: "路线展示",
+              labelWidth: "0",
+              prop: "xllxzs",
+              className: "mapClass",
+              hide: true,
+              display: true,
+              formslot: true,
+            },
           ],
         },
         data: [],
@@ -383,8 +447,8 @@
           if (val) {
             //重新加载一次页面详情数据,解决新的省市区无法写入问题
             //判断是新增还是修改
-            if(that.isEdit){
-              getclient(this.form.id).then(res => {
+            if (that.isEdit) {
+              getclient(this.form.id).then((res) => {
                 // that.province = res.data.data.province;
                 // that.city = res.data.data.city;
                 // that.district = res.data.data.district;
@@ -392,7 +456,7 @@
             }
 
             //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
-            if (val.formattedAddress == ""){
+            if (val.formattedAddress == "") {
               return;
             }
 
@@ -401,37 +465,67 @@
             this.form.jd = val.longitude;
 
             var address = val.formattedAddress.toString();
-            if(address.search("县") != -1){
-              this.form.place = address.substring(address.indexOf("县")+1,address.length);
+            if (address.search("县") != -1) {
+              this.form.place = address.substring(
+                address.indexOf("县") + 1,
+                address.length
+              );
             }
-            if(address.search("区") != -1){
-              this.form.place = address.substring(address.indexOf("区")+1,address.length);
+            if (address.search("区") != -1) {
+              this.form.place = address.substring(
+                address.indexOf("区") + 1,
+                address.length
+              );
             }
             //写入新的省市区
             that.form.province = val.addressComponent.province;
-            if(val.addressComponent.city==""){
+            if (val.addressComponent.city == "") {
               that.form.city = val.addressComponent.province;
-            }else{
+            } else {
               that.form.city = val.addressComponent.city;
             }
             that.form.district = val.addressComponent.district;
-          }else{
-              that.form.map = {
-                formattedAddress:"",
-                latitude: 28.68235075592195,
-                longitude: 115.9021417169273,
-              };
+          } else {
+            that.form.map = {
+              formattedAddress: "",
+              latitude: 28.699957,
+              longitude: 115.862118,
+            };
           }
         },
         immediate: true,
       },
-      //随意一个
-      // 'form.deviceName'() {
-      //   if (this.initFlag) {
-      //     this.initData();
-      //   }
-      // }
+      "form.alarmType": {
+        handler(val) {
+          var xllx = this.findObject(this.option.column, "xllx");
+          var xllxzs = this.findObject(this.option.column, "xllxzs");
+          if (val === "巡逻任务") {
+            xllx.display = true;
+            xllxzs.display = true;
+            xllx.rules = [
+              {
+                required: true,
+                message: "请选择巡逻路线",
+                trigger: "blur",
+              },
+            ];
+          } else {
+            xllx.display = false;
+            xllxzs.display = false;
+            xllx.rules = [];
+          }
+        },
+        immediate: true,
+      },
+      "form.xllx":{
+        handler(val) {
+          if (val){
+            this.getxllx(val)
+          }
 
+        },
+        immediate: true,
+      }
     },
     computed: {
       ...mapGetters(["permission", "flowRoutes"]),
@@ -454,17 +548,39 @@
     created() {
       this.dateTime = this.getDate();
     },
+    mounted() {
+      var xb = JSON.parse(window.sessionStorage.getItem('sjsb'));
+      var data = this.$route.query;
+      if (xb == 1) {
+        this.form = data;
+        this.openAdd();
+        window.sessionStorage.removeItem('sjsb');
+      }
+    },
     methods: {
       rowSave(row, done, loading) {
-        var security = "";
-        row.securityArr.forEach((item) => {
-          security = security + item + ",";
-        });
-        row.securityArr = security.substring(0, security.length - 1);
+        if (typeof row.securityArr != "string") {
+          var security = "";
+          row.securityArr.forEach((item) => {
+            security = security + item + ",";
+          });
+          row.securityArr = security.substring(0, security.length - 1);
+        }
         var userId = JSON.parse(
-          window.localStorage.getItem("群防群控后台管理系统-userInfo")
-        ).content.real_name;
+          window.localStorage.getItem("洪城义警后台管理系统-userInfo")
+        ).content.nick_name;
+
+        if (row.jtype != "2") {
+          if (row.securityArr == "" || row.securityArr == null) {
+            row.jtype = "0";
+            row.alarmPeople = "";
+          } else {
+            row.jtype = "1";
+            //已派发保安
+          }
+        }
         row.alarmPeople = userId;
+
         add(row).then(
           () => {
             this.onLoad(this.page);
@@ -479,7 +595,37 @@
           }
         );
       },
+      getxllx(val){
+        var that = this;
+        if (this.$refs.modalForm == undefined) {
+          setTimeout(function () {
+            that.$refs.modalForm.addLines(val);
+          }, 1500)
+        } else {
+          that.$refs.modalForm.addLines(val);
+        }
+      },
       rowUpdate(row, index, done, loading) {
+        var userId = JSON.parse(
+          window.localStorage.getItem("洪城义警后台管理系统-userInfo")
+        ).content.nick_name;
+        if (typeof row.securityArr != "string") {
+          var security = "";
+          row.securityArr.forEach((item) => {
+            security = security + item + ",";
+          });
+          row.securityArr = security.substring(0, security.length - 1);
+        }
+        if (row.jtype != "2") {
+          if (row.securityArr == "" || row.securityArr == null) {
+            row.jtype = "0";
+            row.alarmPeople = "";
+          } else {
+            row.jtype = "1";
+            //已派发保安
+          }
+        }
+        row.alarmPeople = userId;
         row.coordinate = "";
         update(row).then(
           () => {
@@ -634,7 +780,6 @@
             };
           }
         }
-
         if (releaseTimeRange) {
           values = {
             ...params,
@@ -794,7 +939,10 @@
             endTime: this.showToDay(today) + " 23:59:59",
           };
           //修改搜索框中的值
-          this.search.releaseTimeRange = [this.showToDay(today) + " 00:00:00", this.showToDay(today) + " 23:59:59"]
+          this.search.releaseTimeRange = [
+            this.showToDay(today) + " 00:00:00",
+            this.showToDay(today) + " 23:59:59",
+          ];
         }
         if (e == 1) {
           params = {
@@ -802,7 +950,10 @@
             endTime: this.showToDay(today) + " 23:59:59",
           };
           //修改搜索框中的值
-          this.search.releaseTimeRange = [this.showWeekFirstDay(today) + " 00:00:00", this.showToDay(today) + " 23:59:59"]
+          this.search.releaseTimeRange = [
+            this.showWeekFirstDay(today) + " 00:00:00",
+            this.showToDay(today) + " 23:59:59",
+          ];
         }
         if (e == 2) {
           params = {
@@ -810,7 +961,10 @@
             endTime: this.showToDay(today) + " 23:59:59",
           };
           //修改搜索框中的值
-          this.search.releaseTimeRange = [this.showMonthFirstDay(today) + " 00:00:00", this.showToDay(today) + " 23:59:59"]
+          this.search.releaseTimeRange = [
+            this.showMonthFirstDay(today) + " 00:00:00",
+            this.showToDay(today) + " 23:59:59",
+          ];
         }
         this.query = params;
         this.page.currentPage = 1;
@@ -845,12 +999,23 @@
 
       //本月第一天
       showMonthFirstDay(Nowdate) {
-        var MonthFirstDay = new Date(Nowdate.getFullYear(), Nowdate.getMonth(), 1);
+        var MonthFirstDay = new Date(
+          Nowdate.getFullYear(),
+          Nowdate.getMonth(),
+          1
+        );
         var M = Number(MonthFirstDay.getMonth()) + 1;
         if (M < 10) {
           M = "0" + M;
         }
-        return MonthFirstDay.getFullYear() + "-" + M + "-" + "0" + MonthFirstDay.getDate();
+        return (
+          MonthFirstDay.getFullYear() +
+          "-" +
+          M +
+          "-" +
+          "0" +
+          MonthFirstDay.getDate()
+        );
       },
       getBZdata(e) {
         this.activeClass = e;
@@ -873,7 +1038,6 @@
         this.onLoad(this.page, params);
       },
       getQBdata(e) {
-        debugger;
         this.search.releaseTimeRange = ["", ""];
         this.activeClass = e;
         var params = {};
@@ -923,7 +1087,11 @@
         this.showMap = true;
         this.$nextTick(() => {
           this.$refs.mapDiv.onload = () => {
-            window.frames[1].init("ClientManagement", {x: row.jd, y: row.wd, clientID: row.deviceNumber});
+            window.frames[0].init("ClientManagement", {
+              x: row.jd,
+              y: row.wd,
+              clientID: row.deviceNumber,
+            });
           };
         });
       },
@@ -1012,8 +1180,20 @@
       },
 
       PoliceTracking(row) {
+        var arr = [];
+        this.$store.state.tags.tagList.forEach((item) => {
+          if (item.label != "任务追踪") {
+            arr.push(item);
+          }
+        });
+        this.$store.state.tags.tagList = arr;
         //警情追踪
         this.$router.push({path: "/policeTracking/track", query: row});
+
+      },
+      //打开新增窗体
+      openAdd() {
+        this.$refs.crud.rowAdd();
       },
 
       //数据导出
@@ -1024,7 +1204,7 @@
           type: "warning",
         }).then(() => {
           window.open(
-            `/api/blade-jfpts/alarm/alarm/export-alarm?beginTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&waringType=${this.$route.query.waringType}&timeDesc=${this.$route.query.timeDesc}`
+            `/api/alarm/alarm/export-alarm?beginTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&waringType=${this.$route.query.waringType}&timeDesc=${this.$route.query.timeDesc}`
           );
         });
       },
@@ -1049,10 +1229,12 @@
         );
         //window.open(`http://localhost:8108/ureport/excel?_u=blade-alarm.statis.ureport.xml&beginTime=${beginTime}&endTime=${endTime}&waringType=${waringType}&timeDesc=${timeDesc}`);
       },
-      rowClick(val) {//行点击事件
+      rowClick(val) {
+        //行点击事件
         //警情追踪
-        this.$router.push({path: "/policeTracking/track", query: val});
-      }
+        this.PoliceTracking(val);
+
+      },
     },
   };
 </script>
@@ -1062,6 +1244,14 @@
     width: 12%;
   }
 
+  .mapClass div label {
+    display: none;
+  }
+
+  .mapClassMain {
+    padding-left: 25px !important;
+  }
+
   .cityreal2 div label,
   .cityreal3 div label {
     display: none;

--
Gitblit v1.9.3