南昌市物联网技防平台-前端
liuyg
2021-05-06 338deda86b1496870cd843e0bff835de897c3fb2
src/views/clientManagement/clientManagement.vue
@@ -30,7 +30,7 @@
                   @refresh-change="refreshChange"
                   @on-load="onLoad"
                   @row-click="rowClick">
          <template slot="menuLeft">
            <el-button type="danger"
                       size="mini"
@@ -69,7 +69,7 @@
          <template slot-scope="{ row }" slot="dxzt">
            <el-tag>{{
              row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "在线" : "无"
              row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "正常" :row.dxzt == "2" ? "报警":row.dxzt == "3" ? "故障":"无"
              }}
            </el-tag>
          </template>
@@ -141,7 +141,7 @@
            </el-form-item>
          </el-col>
        </el-form>
      </el-dialog>
@@ -231,6 +231,7 @@
        initFlag: true,
        loading: true,
        menuVisible:false,
        isEdit:false,
        page: {
          pageSize: 10,
          currentPage: 1,
@@ -463,7 +464,8 @@
              label: "故障状态",
              prop: "state",
              addDisplay: false,
              editDisplay: false
              editDisplay: false,
              hide:true
            },
            {
              label: "故障原因",
@@ -575,7 +577,7 @@
              },
              span:5,
            },
            {
              label: "主要负责人",
              prop: "oneId",
@@ -707,28 +709,38 @@
          if (val) {
            var that = this;
            //重新加载一次页面详情数据,解决新的省市区无法写入问题
            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(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(address.search("区") != -1){
                this.form.street = 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;
            });
            //经纬度替换
            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 = "11";
            that.form.city = "1101";
            that.form.district = "110101";
            // 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;
            //调用接口获取省市区编号
          }
        },
        immediate: true,
@@ -779,7 +791,7 @@
      //     this.initData();
      //   }
      // }
    },
    computed: {
      ...mapGetters(["permission"]),
@@ -819,7 +831,7 @@
        });
      },
      //初始化数据
      //初始化数据
      // initData() {
      //   //部门tree数据
      //   getDeptTree().then(res => {
@@ -827,7 +839,7 @@
      //     column.dicData = res.data.data;
      //   });
      // },
      handleClick(row) {
        this.form = row;
        this.dialogTableVisible = true;
@@ -839,6 +851,7 @@
        this.onLoad(this.page);
      },
      rowSave(row, done, loading) {
        row.deptId = row.deptId.join(",");
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
@@ -852,8 +865,6 @@
        });
      },
      rowUpdate(row, index, done, loading) {
        // row.jd=row.map.latitude;
        // row.wd=row.map.longitude;
        update(row).then(() => {
          // this.initFlag = false;
          this.onLoad(this.page);
@@ -929,7 +940,11 @@
        if (["edit", "view"].includes(type)) {
          getclient(this.form.id).then(res => {
            this.form = res.data.data;
            this.isEdit=true;
          });
        }
        if (["add"].includes(type)) {
          this.isEdit=false;
        }
        // this.initFlag = true;
        done();
@@ -986,7 +1001,7 @@
            } else if (data.records[i].heartbeat == "") {
              data.records[i].dxzt = 0;
            } else {
              data.records[i].dxzt = 1;
              data.records[i].dxzt = data.records[i].dtype;
            }
          }