zengh
2022-05-16 63ad2c3598400370dd7da5534659fd7e768a0a4a
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,9 +86,15 @@
      <template slot-scope="{ row }" slot="jtype">
        <el-tag
        >{{
          row.jtype == "0" || row.jtype == "" ? "未派发" : row.jtype == "1" && (row.securityId == null || row.securityId
          == "")
          ? "未接收" : row.jtype == "1" && (row.securityId != null || row.securityId != "") ? "已接收" : "已处置"
          row.jtype == "0" || row.jtype == ""
          ? "未派发"
          : row.jtype == "1" &&
          (row.securityId == null || row.securityId == "")
          ? "未接收"
          : row.jtype == "1" &&
          (row.securityId != null || row.securityId != "")
          ? "已接收"
          : "已处置"
          }}
        </el-tag>
      </template>
@@ -110,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
@@ -155,8 +171,8 @@
          labelWidth: "100",
          size: "mini",
          border: false,
          stripe: true,
          menuWidth: 240,
          //stripe:true,
          menuWidth: 260,
          dialogWidth: 950,
          tip: false,
          searchShow: true,
@@ -168,7 +184,7 @@
          dialogClickModal: false,
          column: [
            {
              label: "警情类型",
              label: "任务类型",
              prop: "alarmType",
              search: false,
              searchSpan: 3,
@@ -183,19 +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"
              }],
              rules: [
                {
                  required: true,
                  message: "请选择报警时间",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "报警时间",
@@ -218,7 +248,8 @@
                  trigger: "blur",
                },
              ],
            }, {
            },
            {
              label: "备注",
              prop: "bz",
              span: 24,
@@ -227,11 +258,13 @@
              label: "地址",
              prop: "place",
              span: 10,
              rules: [{
                required: true,
                message: "请选择地址",
                trigger: "blur"
              }],
              rules: [
                {
                  required: true,
                  message: "请选择地址",
                  trigger: "blur",
                },
              ],
            },
            {
              label: null,
@@ -252,7 +285,7 @@
              width: "100",
              labelWidth: "120",
              formatter: (row, value, label, column) => {
                return value = value.substring(0, 11);
                return (value = value.substring(0, 11));
              },
              span: 7,
            },
@@ -262,7 +295,7 @@
              hide: true,
              prop: "wd",
              formatter: (row, value, label, column) => {
                return value = value.substring(0, 10);
                return (value = value.substring(0, 10));
              },
              span: 5,
            },
@@ -270,6 +303,7 @@
              label: "省份",
              prop: "province",
              search: true,
              width: 100,
              searchSpan: 2,
              searchLabelWidth: 45,
              placeholder: "省份",
@@ -290,6 +324,7 @@
              label: "地市",
              prop: "city",
              type: "select",
              width: 100,
              searchPlaceholder: "地市",
              placeholder: "地市",
              searchLabelWidth: 1,
@@ -311,6 +346,7 @@
              label: "区县",
              searchSpan: 2,
              searchLabelWidth: 1,
              width: 100,
              searchPlaceholder: "区县",
              placeholder: "区县",
              search: true,
@@ -334,7 +370,7 @@
              width: 96,
              search: true,
              slot: true,
              addDisplay: false,
              value: "0",
              searchPlaceholder: "请选择",
              prop: "jtype",
              type: "select",
@@ -353,21 +389,21 @@
                },
              ],
            },
            // {
            //   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/catalogs/catalogs/getBigTree",
              props: {
                label: "title"
                label: "title",
              },
              width: 72,
              hide: true,
@@ -375,7 +411,27 @@
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
            }
            },
            {
              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: [],
@@ -392,7 +448,7 @@
            //重新加载一次页面详情数据,解决新的省市区无法写入问题
            //判断是新增还是修改
            if (that.isEdit) {
              getclient(this.form.id).then(res => {
              getclient(this.form.id).then((res) => {
                // that.province = res.data.data.province;
                // that.city = res.data.data.city;
                // that.district = res.data.data.district;
@@ -410,10 +466,16 @@
            var address = val.formattedAddress.toString();
            if (address.search("县") != -1) {
              this.form.place = address.substring(address.indexOf("县") + 1, address.length);
              this.form.place = address.substring(
                address.indexOf("县") + 1,
                address.length
              );
            }
            if (address.search("区") != -1) {
              this.form.place = address.substring(address.indexOf("区") + 1, address.length);
              this.form.place = address.substring(
                address.indexOf("区") + 1,
                address.length
              );
            }
            //写入新的省市区
            that.form.province = val.addressComponent.province;
@@ -426,20 +488,44 @@
          } else {
            that.form.map = {
              formattedAddress: "",
              latitude: 28.68235075592195,
              longitude: 115.9021417169273,
              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"]),
@@ -462,9 +548,17 @@
    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) {
        if (typeof row.securityArr != "string") {
          var security = "";
          row.securityArr.forEach((item) => {
@@ -473,17 +567,19 @@
          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.securityArr == "" || row.securityArr == null) {
          row.jtype = "0";
          row.alarmPeople = "";
        }else {
          row.jtype = "1";
          //已派发保安
          row.alarmPeople = userId;
        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(
          () => {
@@ -499,12 +595,20 @@
          }
        );
      },
      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.real_name;
          window.localStorage.getItem("洪城义警后台管理系统-userInfo")
        ).content.nick_name;
        if (typeof row.securityArr != "string") {
          var security = "";
          row.securityArr.forEach((item) => {
@@ -512,16 +616,16 @@
          });
          row.securityArr = security.substring(0, security.length - 1);
        }
        if (row.securityArr == "" || row.securityArr == null) {
          row.jtype = "0";
          row.alarmPeople = "";
        }else {
          row.jtype = "1";
          //已派发保安
          row.alarmPeople = userId;
        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(
          () => {
@@ -676,7 +780,6 @@
            };
          }
        }
        if (releaseTimeRange) {
          values = {
            ...params,
@@ -836,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 = {
@@ -844,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 = {
@@ -852,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;
@@ -887,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;
@@ -964,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,
            });
          };
        });
      },
@@ -1053,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();
      },
      //数据导出
@@ -1090,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>
@@ -1103,6 +1244,14 @@
    width: 12%;
  }
  .mapClass div label {
    display: none;
  }
  .mapClassMain {
    padding-left: 25px !important;
  }
  .cityreal2 div label,
  .cityreal3 div label {
    display: none;