南昌市物联网技防平台-前端
Administrator
2021-04-26 6ea9d061b33f9e411bb847ffcf7dd7908ba508a9
客户管理,设备管理编辑页面选择坐标后省市区不会改变bug修复
2 files modified
100 ■■■■ changed files
src/views/clientManagement/clientManagement.vue 93 ●●●● patch | view | raw | blame | history
src/views/system/cs.vue 7 ●●●●● patch | view | raw | blame | history
src/views/clientManagement/clientManagement.vue
@@ -270,8 +270,8 @@
          height: 'auto',
          indexLabel: '序号',
          calcHeight: 80,
          labelWidth: '105',
          dialogWidth: 1040,
          labelWidth: '125',
          dialogWidth: 1150,
          menuWidth: 150,
          align:"center",
          size: "mini",
@@ -450,14 +450,24 @@
              prop: "reason",
              addDisplay: false,
              editDisplay: false
            },{
              label: "心跳时间",
              prop: "heartbeat",
              type: "datetime",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              width: 130,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
            },
            {
              label: "省份",
              prop: "province",
              search: true,
              searchSpan: 2,
              labelWidth: '100',
              labelWidth: '110',
              searchLabelWidth: 45,
              placeholder: "省份",
              type: "select",
@@ -467,7 +477,7 @@
              },
              cascaderItem: ["city", "district"],
              dicUrl: "/api/blade-system/region/select",
              span: 7,
              span: 8,
              className: "city1",
              hide: true,
              addDisplay: true,
@@ -510,7 +520,7 @@
                value: "code"
              },
              dicUrl: "/api/blade-system/region/select?code={{key}}",
              span: 3,
              span: 2,
              labelWidth: "0",
              className: "city3",
              hide: true,
@@ -520,9 +530,7 @@
            }, {
              label: "地址",
              prop: "street",
              // type:"map",
              span:11,
              labelWidth: '160',
              span:10,
              hide: true,
            },
            {
@@ -532,7 +540,7 @@
              searchSpan:0,
              maxlength:0,
              hide: true,
              span: 1,
              span: 2,
              // display:false,
              component: "AvueMap"
            },
@@ -542,7 +550,7 @@
              prop: "jd",
              searchSpan:2,
              width:"100",
              labelWidth: "110",
              labelWidth: "120",
              formatter: (row,value,label,column)=>{
                  return value = value.substring(0,11);
              },
@@ -558,20 +566,9 @@
              },
              span:5,
            },
             {
              label: "心跳时间",
              prop: "heartbeat",
              type: "datetime",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              width: 130,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
            },
            {
              label: "负责人1",
              label: "主要负责人",
              prop: "oneId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
@@ -585,12 +582,12 @@
              viewDisplay: true,
              rules: [{
                required: true,
                message: "请选择负责人",
                message: "请选择主要负责人",
                trigger: "blur"
              }],
            },
            {
              label: "负责人1电话",
              label: "主要负责人电话",
              prop: "onePhone",
              width: 110,
              hide: true,
@@ -603,7 +600,7 @@
                trigger: "blur"
              }],
            }, {
              label: "负责人2",
              label: "负责人1",
              prop: "twoId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
@@ -617,7 +614,7 @@
              viewDisplay: true,
            },
            {
              label: "负责人2电话",
              label: "负责人1电话",
              prop: "twoPhone",
              width: 110,
              hide: true,
@@ -625,7 +622,7 @@
              editDisplay: true,
              viewDisplay: true,
            }, {
              label: "负责人3",
              label: "负责人2",
              prop: "threeId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
@@ -639,7 +636,7 @@
              viewDisplay: true,
            },
            {
              label: "负责人3电话",
              label: "负责人2电话",
              prop: "threePhone",
              width: 110,
              hide: true,
@@ -688,22 +685,25 @@
        handler(val) {
          if (val) {
            var that = this;
            this.form.wd = val.latitude;
            // this.form.wd = val.latitude.toString().substring(0,10);
            this.form.jd = val.longitude;
            // this.form.jd = val.longitude.toString().substring(0,11);
            //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
            var address = val.formattedAddress.toString();
            if(address.search("县") != -1){
                this.form.street = address.substring(address.indexOf("县")+1,address.length);
            }
            if(address.search("区") != -1){
              this.form.street = address.substring(address.indexOf("区")+1,address.length);
            }
            // that.form.province = val.addressComponent.province;
            //  that.form.city = val.addressComponent.city;
            //  that.form.district = val.addressComponent.district;
            //重新加载一次页面详情数据,解决新的省市区无法写入问题
            getclient(this.form.id).then(res => {
              this.form = res.data.data;
              //经纬度替换
              this.form.wd = val.latitude;
              this.form.jd = val.longitude;
              //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
              var address = val.formattedAddress.toString();
              if(address.search("县") != -1){
                  this.form.street = address.substring(address.indexOf("县")+1,address.length);
              }
              if(address.search("区") != -1){
                this.form.street = address.substring(address.indexOf("区")+1,address.length);
              }
              //写入新的省市区
              that.form.province = val.addressComponent.province;
              that.form.city = val.addressComponent.city;
              that.form.district = val.addressComponent.district;
            });
          }
        },
        immediate: true,
@@ -900,6 +900,7 @@
          });
      },
      beforeOpen(done, type) {
        debugger;
        if (["edit", "view"].includes(type)) {
          getclient(this.form.id).then(res => {
            this.form = res.data.data;
src/views/system/cs.vue
@@ -714,6 +714,9 @@
      // form是表单或者表格绑定的数据集,v-model='form'
      handler(val) {
        if (val) {
          getDetail(this.form.id).then((res) => {
            this.form = res.data.data;
          })
          this.form.wd = val.latitude;
          this.form.jd = val.longitude;
          //地址截取,从县/区开始截取,并且取从县区第一个出现的位置开始
@@ -724,6 +727,10 @@
          if(address.search("区") != -1){
            this.form.address = address.substring(address.indexOf("区")+1,address.length);
          }
          //写入新的省市区
          that.form.province = val.addressComponent.province;
          that.form.city = val.addressComponent.city;
          that.form.district = val.addressComponent.district;
        }
      },
      immediate: true,