zengh
2021-07-20 7e32d3d7ab3b116ceef1dfaa4a6216ed1d0fbf7b
位置选择
3 files modified
233 ■■■■ changed files
src/components/map/main.vue 10 ●●●● patch | view | raw | blame | history
src/views/feedbackReport/feedbackReport.vue 142 ●●●● patch | view | raw | blame | history
src/views/realTimePolice/real.vue 81 ●●●●● patch | view | raw | blame | history
src/components/map/main.vue
@@ -95,11 +95,11 @@
            // 注意地图控件的写法
            controls: defaults().extend([
                new FullScreen(),
                new ScaleLine(),
                new MousePosition(),
                new Rotate(),
                new Attribution()
                // new FullScreen(),
                // new ScaleLine(),
                // new MousePosition(),
                // new Rotate(),
                // new Attribution()
            ]),
            target: 'map',
            view: new OlView({
src/views/feedbackReport/feedbackReport.vue
@@ -50,6 +50,7 @@
  } from "@/api/feedback/feedback";
  import {getBaTree} from "@/api/client/client";
  import {mapGetters} from "vuex";
  import AvueMap from "avue-plugin-map";
  export default {
    data() {
@@ -112,36 +113,6 @@
              ],
            },
            {
              label: "上报地址",
              prop: "place",
              rules: [
                {
                  required: true,
                  message: "请输入事发地址",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "经度",
              prop: "jd",
            },
            {
              label: "纬度",
              prop: "wd",
            },
            {
              label: "备注",
              prop: "result",
              rules: [
                {
                  required: true,
                  message: "请输入处理结果",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "上报时间",
              prop: "stime",
              type: "datetime",
@@ -166,6 +137,62 @@
                {
                  required: true,
                  message: "请选择上报时间",
                  trigger: "blur",
                },
              ],
            },
            {
              label: "地址",
              prop: "place",
              span: 10,
              rules: [
                {
                  required: true,
                  message: "请选择地址",
                  trigger: "blur",
                },
              ],
            },
            {
              label: null,
              prop: "map",
              labelWidth: "0",
              searchSpan: 0,
              maxlength: 0,
              hide: true,
              span: 2,
              // display:false,
              component: "AvueMap",
            },
            {
              label: "经度",
              hide: true,
              prop: "jd",
              searchSpan: 2,
              width: "100",
              labelWidth: "120",
              formatter: (row, value, label, column) => {
                return (value = value.substring(0, 11));
              },
              span: 7,
            },
            {
              label: "纬度",
              labelWidth: "45",
              hide: true,
              prop: "wd",
              formatter: (row, value, label, column) => {
                return (value = value.substring(0, 10));
              },
              span: 5,
            },
            {
              label: "备注",
              prop: "result",
              rules: [
                {
                  required: true,
                  message: "请输入处理结果",
                  trigger: "blur",
                },
              ],
@@ -208,6 +235,61 @@
      };
    },
    watch: {
      "form.map": {
        // form是表单或者表格绑定的数据集,v-model='form'
        handler(val) {
          var that = this;
          if (val) {
            //重新加载一次页面详情数据,解决新的省市区无法写入问题
            //判断是新增还是修改
            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;
              });
            }
            //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
            if (val.formattedAddress == "") {
              return;
            }
            //经纬度替换
            this.form.wd = val.latitude;
            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
              );
            }
            //写入新的省市区
            that.form.province = val.addressComponent.province;
            if (val.addressComponent.city == "") {
              that.form.city = val.addressComponent.province;
            } else {
              that.form.city = val.addressComponent.city;
            }
            that.form.district = val.addressComponent.district;
          } else {
            that.form.map = {
              formattedAddress: "",
              latitude: 28.699957,
              longitude: 115.862118,
            };
          }
        },
        immediate: true,
      },
      handler(val) {
        var that = this;
        if (val != null && val != "") {
src/views/realTimePolice/real.vue
@@ -116,7 +116,17 @@
        >派发
        </el-button>
      </template>
      <template slot-scope="{type,disabled}" slot="xllxzsForm">
        <div style="width: 200px;height: 200px">
          <Map ref="modalForm" />
        </div>
      </template>
    </avue-crud>
    <real-popup ref="realPopupView"></real-popup>
    <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
      <iframe
@@ -400,18 +410,26 @@
              editDisplay: true,
              viewDisplay: true,
            },
            // {
            //   label: "巡逻路线",
            //   prop: "xllx",
            //   hide: true,
            //   display: true,
            //   type: "tree",
            //   filter: false,
            //   dicUrl: "/api/routeIn/routein/tree",
            //   props: {
            //     label: "title",
            //   },
            // },
            {
              label: "巡逻路线",
              prop: "xllx",
              hide: true,
              display: true,
              type: "tree",
              dicUrl: "/api/routeIn/routein/tree",
              props: {
                label: "title",
              },
            },
            {
              label: "路线展示",
              labelWidth: "0",
              prop: "xllxzs",
              className: "cityreal3",
              hide: true,
              display: true,
              formslot:true,
            },
          ],
        },
        data: [],
@@ -475,25 +493,25 @@
        },
        immediate: true,
      },
      // "form.alarmType": {
      //   handler(val) {
      //     var xllx = this.findObject(this.option.column, "xllx");
      //     if (val === "巡逻任务") {
      //       xllx.display = true;
      //       xllx.rules = [
      //         {
      //           required: true,
      //           message: "请选择巡逻路线",
      //           trigger: "blur",
      //         },
      //       ];
      //     } else {
      //       xllx.display = false;
      //       xllx.rules = [];
      //     }
      //   },
      //   immediate: true,
      // },
      "form.alarmType": {
        handler(val) {
          var xllx = this.findObject(this.option.column, "xllx");
          if (val === "巡逻任务") {
            xllx.display = true;
            xllx.rules = [
              {
                required: true,
                message: "请选择巡逻路线",
                trigger: "blur",
              },
            ];
          } else {
            xllx.display = false;
            xllx.rules = [];
          }
        },
        immediate: true,
      },
    },
    computed: {
      ...mapGetters(["permission", "flowRoutes"]),
@@ -517,7 +535,6 @@
      this.dateTime = this.getDate();
    },
    mounted(){
      debugger
      var xb = JSON.parse(window.sessionStorage.getItem('sjsb'));
      var data = this.$route.query;
      if (xb == 1){