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/activitys/real.vue |  519 +++++++++++++++++++++++++++-----------------------------
 1 files changed, 250 insertions(+), 269 deletions(-)

diff --git a/src/views/activitys/real.vue b/src/views/activitys/real.vue
index 75e30ca..36a7c89 100644
--- a/src/views/activitys/real.vue
+++ b/src/views/activitys/real.vue
@@ -1,5 +1,5 @@
 <template>
-  <basic-container>
+  <basic-container class="activitys">
     <avue-crud
       :option="option"
       :table-loading="loading"
@@ -20,13 +20,13 @@
       @selection-change="selectionChange"
       @current-change="currentChange"
       @size-change="sizeChange"
+      @row-click="rowClick"
       @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"
@@ -37,7 +37,7 @@
         </el-button>
       </template>
 
-      <template slot="menuLeft">
+      <!-- <template slot="menuLeft">
         <el-button
           v-bind:class="activeClass == 0 ? 'btn-color' : ''"
           size="mini"
@@ -62,9 +62,9 @@
           @click="getQBdata(3)"
           >全部
         </el-button>
-      </template>
+      </template> -->
 
-      <template slot="menuLeft">
+      <!-- <template slot="menuLeft">
         <el-button
           type="warning"
           size="mini"
@@ -81,7 +81,7 @@
           @click="handleExportStatis"
           >导出报表
         </el-button>
-      </template>
+      </template> -->
 
       <template slot-scope="{ row }" slot="jtype">
         <el-tag
@@ -187,10 +187,10 @@
         dialogClickModal: false,
         column: [
           {
-            label: "任务标题",
+            label: "巡查标题",
             prop: "rname",
-            search: false,
-            searchSpan: 3,
+            search: true,
+            searchSpan: 4,
             span: 12,
             rules: [
               {
@@ -201,7 +201,47 @@
             ],
           },
           {
-            label: "任务封面",
+            label: "开始时间",
+            type: "datetime",
+            prop: "time",
+            width: 160,
+            addDisplay: false,
+            viewDisplay: false,
+            editDisplay: false,
+            format: "yyyy-MM-dd HH:mm:ss",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+          },{
+            label: "结束时间",
+            type: "datetime",
+            prop: "endtime",
+            width: 160,
+            addDisplay: false,
+            viewDisplay: false,
+            editDisplay: false,
+            format: "yyyy-MM-dd HH:mm:ss",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+          },
+          {
+            label: "开始时间",
+            type: 'datetimerange',
+            hide: true,
+            prop: "timeList",
+            width: 160,
+            span: 12,
+            startPlaceholder: '任务开始时间',
+            endPlaceholder: '预估结束时间',
+            format: "yyyy-MM-dd HH:mm:ss",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            rules: [
+              {
+                required: true,
+                message: "请选择时间范围",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "封面",
             prop: "url",
             // align:'center',
             width: 80,
@@ -213,23 +253,7 @@
               url: "link",
             },
             // hide: true,
-            span: 12,
-          },
-          {
-            label: "下发时间",
-            type: "datetime",
-            prop: "time",
-            width: 160,
-            span: 12,
-            format: "yyyy-MM-dd HH:mm:ss",
-            valueFormat: "yyyy-MM-dd HH:mm:ss",
-            rules: [
-              {
-                required: true,
-                message: "请选择报警时间",
-                trigger: "blur",
-              },
-            ],
+            span: 24,
           },
           // {
           //   label: "报警时间",
@@ -254,7 +278,7 @@
           //   ],
           // },
           {
-            label: "任务内容",
+            label: "巡查内容",
             prop: "content",
             span: 24,
           },
@@ -304,90 +328,147 @@
           //   span: 5,
           // },
           {
-            label: "省份",
-            prop: "province",
+            label: "所属辖区",
+            prop: "jurisdiction",
+            searchLabelWidth: 80,
             search: true,
-            width: 100,
-            searchSpan: 2,
-            searchLabelWidth: 45,
-            placeholder: "省份",
-            type: "select",
-            value: "36",
+            searchSpan: 4,
+            overHidden: true,
+            parent: false,
+            type: "tree",
+            dicUrl: "/api/jurisdiction/lazy-tree",
             props: {
-              label: "name",
-              value: "code",
+              label: "title",
+              value: "id",
             },
-            cascaderItem: ["city", "district"],
-            dicUrl: "/api/blade-system/region/select",
-            span: 6,
-            className: "cityreal1",
-            addDisplay: true,
-            editDisplay: true,
-            viewDisplay: true,
+            checkStrictly: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择所属辖区",
+                trigger: "click",
+              },
+            ],
+          },
+          // {
+          //   label: "省份",
+          //   hide: true,
+          //   prop: "province",
+          //   // search: true,
+          //   width: 100,
+          //   searchSpan: 2,
+          //   searchLabelWidth: 45,
+          //   placeholder: "省份",
+          //   type: "select",
+          //   value: "36",
+          //   props: {
+          //     label: "name",
+          //     value: "code",
+          //   },
+          //   cascaderItem: ["city", "district"],
+          //   dicUrl: "/api/blade-system/region/select",
+          //   span: 6,
+          //   className: "cityreal1",
+          //   addDisplay: true,
+          //   editDisplay: true,
+          //   viewDisplay: true,
+          // },
+          // {
+          //   label: "地市",
+          //   hide: true,
+          //   prop: "city",
+          //   type: "select",
+          //   width: 100,
+          //   searchPlaceholder: "地市",
+          //   placeholder: "地市",
+          //   searchLabelWidth: 1,
+          //   value: "3601",
+          //   searchSpan: 2,
+          //   // search: true,
+          //   props: {
+          //     label: "name",
+          //     value: "code",
+          //   },
+          //   dicUrl: "/api/blade-system/region/select?code={{key}}",
+          //   span: 3,
+          //   labelWidth: "0",
+          //   className: "cityreal2",
+          //   addDisplay: true,
+          //   editDisplay: true,
+          //   viewDisplay: true,
+          // },
+          // {
+          //   label: "区县",
+          //   hide: true,
+          //   searchSpan: 2,
+          //   searchLabelWidth: 1,
+          //   width: 100,
+          //   searchPlaceholder: "区县",
+          //   placeholder: "区县",
+          //   // search: true,
+          //   prop: "district",
+          //   type: "select",
+          //   props: {
+          //     label: "name",
+          //     value: "code",
+          //   },
+          //   dicUrl: "/api/blade-system/region/select?code={{key}}",
+          //   span: 3,
+          //   labelWidth: "0",
+          //   className: "cityreal3",
+          //   addDisplay: true,
+          //   editDisplay: true,
+          //   viewDisplay: true,
+          // },
+          {
+            label: "集合点",
+            prop: "gathername",
+            labelWidth: 100,
+            span: 9,
+            overHidden: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择地址",
+                trigger: "blur",
+              },
+            ],
           },
           {
-            label: "地市",
-            prop: "city",
-            type: "select",
-            width: 100,
-            searchPlaceholder: "地市",
-            placeholder: "地市",
-            searchLabelWidth: 1,
-            value: "3601",
-            searchSpan: 2,
-            search: true,
-            props: {
-              label: "name",
-              value: "code",
-            },
-            dicUrl: "/api/blade-system/region/select?code={{key}}",
-            span: 3,
-            labelWidth: "0",
-            className: "cityreal2",
-            addDisplay: true,
-            editDisplay: true,
-            viewDisplay: true,
+            label: null,
+            prop: "map",
+            labelWidth: 10,
+            searchSpan: 0,
+            // maxlength: 5,
+            hide: true,
+            span: 2,
+            // display:false,
+            component: "AvueMap",
           },
           {
-            label: "区县",
-            searchSpan: 2,
-            searchLabelWidth: 1,
-            width: 100,
-            searchPlaceholder: "区县",
-            placeholder: "区县",
-            search: true,
-            prop: "district",
-            type: "select",
-            props: {
-              label: "name",
-              value: "code",
-            },
-            dicUrl: "/api/blade-system/region/select?code={{key}}",
-            span: 3,
-            labelWidth: "0",
-            className: "cityreal3",
-            addDisplay: true,
-            editDisplay: true,
-            viewDisplay: true,
-          },
-          {
-            label: "任务状态",
+            label: "巡查状态",
             prop: "rtype",
             type: "select",
-            span: 6,
-            value: "0",
+            value: "2",
+            rules: [
+              {
+                required: true,
+                message: "请选择巡查状态",
+                trigger: "blur",
+              },
+            ],
             dicData: [
               {
                 label: "任务开始",
-                value: "0",
-              },
-              {
-                label: "正在进行",
-                value: "1",
+                value: "2",
               },
               {
                 label: "任务结束",
-                value: "2",
+                value: "1",
+              },
+              {
+                label: "正在进行",
+                value: "0",
               },
             ],
             // label: "任务状态",
@@ -422,6 +503,21 @@
           //   editDisplay: false,
           // },
           {
+            label: "发布人",
+            prop: "fname",
+            // multiple: true,
+            // dicUrl: "/api/catalogs/catalogs/getBigTree",
+            // props: {
+            //   label: "title",
+            // },
+            width: 72,
+            // hide: true,
+            // leafOnly: "",
+            addDisplay: false,
+            editDisplay: false,
+            viewDisplay: false,
+          },
+          {
             label: "积分数值",
             prop: "integral",
             type: "number",
@@ -430,12 +526,12 @@
             // props: {
             //   label: "title",
             // },
-            span: 6,
             width: 72,
             // hide: true,
             minRows: 1,
-            value: 1,
+            value: 5,
             // leafOnly: "",
+            disabled: true,
             addDisplay: true,
             editDisplay: true,
             viewDisplay: true,
@@ -457,6 +553,13 @@
             addDisplay: true,
             editDisplay: true,
             viewDisplay: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入接收人数",
+                trigger: "blur",
+              },
+            ],
           },
           // {
           //   label: "巡逻路线",
@@ -472,7 +575,7 @@
           // },
           {
             label: "请在下方地图中,建立路径!",
-            labelWidth: "0",
+            labelWidth: 0,
             className: "mapClass",
             prop: "haveMap",
             hide: true,
@@ -537,15 +640,17 @@
           this.form.wd = val.latitude;
           this.form.jd = val.longitude;
 
+          this.form.gather = val.latitude + "," + val.longitude;
+
           var address = val.formattedAddress.toString();
           if (address.search("县") != -1) {
-            this.form.place = address.substring(
+            this.form.gathername = address.substring(
               address.indexOf("县") + 1,
               address.length
             );
           }
           if (address.search("区") != -1) {
-            this.form.place = address.substring(
+            this.form.gathername = address.substring(
               address.indexOf("区") + 1,
               address.length
             );
@@ -600,6 +705,7 @@
     },
     rotesData() {
       // console.log(this.rotesData, "rotesDatarotesDatarotesData");
+      // console.log(this.rotesData, "this.rotesDatathis.rotesData");
       if (this.rotesData) {
         // var haveMap = (this.option.column[9].value = "已选择路径!");
         // haveMap.value = "已选择路径!";
@@ -613,7 +719,7 @@
     },
   },
   computed: {
-    ...mapGetters(["permission", "flowRoutes", "rotesData"]),
+    ...mapGetters(["permission", "flowRoutes", "rotesData", "userInfo"]),
     permissionList() {
       return {
         addBtn: this.vaildData(this.permission.real_add, false),
@@ -645,12 +751,18 @@
   methods: {
     rowSave(row, done, loading) {
       // console.log(row);
+      // console.log(this.userInfo);
       // return;
+      var userId1 = this.userInfo.user_id;
+      var username = this.userInfo.nick_name;
+      var phone = this.userInfo.phone;
+      let latleng = row.map.latitude + "," + row.map.longitude;
       let d = {
         line: row.line, //路线
         rname: row.rname, //标题
         url: row.url, //封面
-        time: row.time, //下发时间
+        time: row.timeList[0], //下发时间
+        endtime: row.timeList[1], //结束时间
         province: row.$province, //省
         city: row.$city, //城市
         district: row.$district, //区县
@@ -658,10 +770,20 @@
         integral: row.integral + "", //积分
         content: row.content, //内容
         rtype: row.rtype, //任务状态
+        fid: userId1, //发起人id
+        serid: userId1, //发起人id
+        fname: username, //发起人id
+        captain: username, //队长
+        phone: phone, //发起人电话
+        jurisdiction: row.jurisdiction,
+        gather: row.gather, //地址经纬度
+        gathername: row.map.formattedAddress, //地址经纬度
+        tasktype: "0", //任务类型0:治安巡查 1:治安义务宣传 2:治安防范培训
       };
-      console.log(d);
+      // console.log(d);
       // done();
       // return;
+      let that = this;
       add(d).then(
         () => {
           this.onLoad(this.page);
@@ -676,93 +798,25 @@
         }
       );
       return;
-      // console.log(row, "rowrowrowrowrow");
-      // console.log(this.rotesData, "rowrowrowrowrow");
-      // if (!this.rotesData) {
-      //   this.$message({
-      //     message: "未绘制地图路径,请重试",
-      //     type: "warning",
-      //   });
-      //   done();
-      //   return;
-      // }
-      // done();
-      //结束后  需要把vuex中路径清除
-      // that.$store.commit("setRotesData", false);
-      // return;
-      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.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);
-          this.$message({
-            type: "success",
-            message: "操作成功!",
-          });
-          done();
-        },
-        (error) => {
-          loading();
-        }
-      );
     },
     getxllx(val) {
       var that = this;
       if (this.$refs.modalForm == undefined) {
         setTimeout(function () {
-          that.$refs.modalForm.addLinesDraw(val);
+          try {
+            that.$refs.modalForm.addLinesDraw(val);
+          } catch (error) {}
         }, 1500);
       } else {
-        that.$refs.modalForm.addLinesDraw(val);
+        try {
+          that.$refs.modalForm.addLinesDraw(val);
+        } catch (error) {}
       }
     },
     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 = "";
-      // console.log(row);
-      // row.province = row.$province; //省
-      // row.city = row.$city; //城市
-      // row.district = row.$district; //区县
-      // return;
+      let that = this;
+      row.time = row.timeList[0];
+      row.endtime = row.timeList[1];
       update(row).then(
         () => {
           this.onLoad(this.page);
@@ -840,6 +894,10 @@
         });
     },
     beforeOpen(done, type) {
+      this.form.timeList = [];
+      this.form["timeList"][0]= this.form["time"];
+      this.form["timeList"][1]= this.form["endtime"];
+      // console.log(type, "this.formthis.formthis.form");
       // console.log(type);
       // if (["edit", "view"].includes(type)) {
       //   getclient(this.form.id).then((res) => {
@@ -847,6 +905,11 @@
       //   });
       // }
       // console.log(this.form);
+      if (type == "add") {
+        this.$store.commit("setRotesData", false); //用vuex传最终数据 清除
+        done();
+        return;
+      }
       if (this.form.line != "" && this.form != undefined) {
         this.form["haveMap"] = "已绘制路径!";
       } else {
@@ -864,90 +927,8 @@
       this.onLoad(this.page, this.query);
     },
     onLoad(page, params = {}) {
-      // const { releaseTimeRange } = this.query;
-      // let values = {
-      //   ...params,
-      // };
-
-      // if (
-      //   this.$route.query.waringType &&
-      //   this.$route.query != undefined &&
-      //   this.$route.query != null &&
-      //   this.$route.query != ""
-      // ) {
-      //   if (
-      //     this.$route.query.status != undefined &&
-      //     this.$route.query.status != null &&
-      //     this.$route.query.status == ""
-      //   ) {
-      //     this.activeClass = this.$route.query.status;
-      //     this.page.currentPage = 1;
-      //     if (this.$route.query.status == 0) {
-      //       params = {
-      //         waringType: this.$route.query.waringType,
-      //         beginTime: this.dateTime.day.beginTime,
-      //         endTime: this.dateTime.day.endTime,
-      //       };
-      //     } else if (this.$route.query.status == 1) {
-      //       params = {
-      //         waringType: this.$route.query.waringType,
-      //         beginTime: this.dateTime.week.beginTime,
-      //         endTime: this.dateTime.week.endTime,
-      //       };
-      //     } else if (this.$route.query.status == 2) {
-      //       params = {
-      //         waringType: this.$route.query.waringType,
-      //         beginTime: this.dateTime.month.beginTime,
-      //         endTime: this.dateTime.month.endTime,
-      //       };
-      //     }
-      //   } else {
-      //     this.activeClass = 0;
-      //     this.page.currentPage = 1;
-      //     params = {
-      //       waringType: this.$route.query.waringType,
-      //       beginTime: this.dateTime.day.beginTime,
-      //       endTime: this.dateTime.day.endTime,
-      //     };
-      //   }
-
-      //   if (
-      //     this.$route.query.startTime != undefined &&
-      //     this.$route.query.startTime != null &&
-      //     this.$route.query.startTime != ""
-      //   ) {
-      //     params = {
-      //       waringType: this.$route.query.waringType,
-      //       beginTime: this.$route.query.startTime,
-      //       endTime: this.$route.query.endTime,
-      //     };
-      //   }
-      // }
-      // if (releaseTimeRange) {
-      //   values = {
-      //     ...params,
-      //     beginTime: releaseTimeRange[0],
-      //     endTime: releaseTimeRange[1],
-      //     ...this.query,
-      //   };
-      //   values.releaseTimeRange = null;
-      // } else {
-      //   values = {
-      //     ...params,
-      //     ...this.query,
-      //   };
-      // }
-
-      // if (this.$route.query.timeDesc) {
-      //   values = {
-      //     ...params,
-      //     timeDesc: this.$route.query.timeDesc,
-      //     ...this.query,
-      //   };
-      // }
-
-      // this.loading = true;
-      getList(page.currentPage, page.pageSize).then((res) => {
+      params["tasktype"] = "0"; // 治安巡查
+      getList(page.currentPage, page.pageSize, params).then((res) => {
         const data = res.data.data;
         this.page.total = data.total;
 
@@ -1325,13 +1306,13 @@
     PoliceTracking(row) {
       var arr = [];
       this.$store.state.tags.tagList.forEach((item) => {
-        if (item.label != "任务追踪") {
+        if (item.label != "任务详情") {
           arr.push(item);
         }
       });
       this.$store.state.tags.tagList = arr;
       //警情追踪
-      this.$router.push({ path: "/policeTracking/track", query: row });
+      this.$router.push({ path: "/policeTracking/details", query: row });
     },
     //打开新增窗体
     openAdd() {

--
Gitblit v1.9.3