南昌市物联网技防平台-前端
liuyg
2021-04-26 58c126c36954e438148d5f548d45ab1fdc0167b6
设备弹窗
2 files modified
177 ■■■■ changed files
src/api/client/client.js 25 ●●●●● patch | view | raw | blame | history
src/views/system/cs.vue 152 ●●●●● patch | view | raw | blame | history
src/api/client/client.js
@@ -18,10 +18,31 @@
    url: '/api/blade-jfpts/equipment/equipment/pageDept',
    method: 'get',
    params: {
      ...params,
      pid,
      current,
      size,
      pid,
      ...params,
    }
  })
}
// export const getListliuf = (current, size, params,pid) => {
//   return request({
//     url: '/api/blade-jfpts/equipment/equipment/pageDept',
//     method: 'get',
//     params: {
//       ...params,
//       current,
//       size,
//       pid,
//     }
//   })
// }
export const getListliuc = (parentId) => {
  return request({
    url: '/api/blade-system/dept/lazy-trees',
    method: 'get',
    params: {
      parentId,
    }
  })
}
src/views/system/cs.vue
@@ -120,7 +120,7 @@
</template>
<script>
import { getAll, getListliu } from "@/api/client/client";
import { getAll, getListliu, getListliuc } from "@/api/client/client";
import {
  getList,
  getDetail,
@@ -209,46 +209,21 @@
            prop: "deviceNumber",
            width: 110,
          },
          // {
          //   label: "使用方",
          //   search: true,
          //   // searchValue: this.getAnimalType(),
          //   prop: "deptId",
          //   width: 200,
          //   type: "select",
          //   dicUrl: "/api/blade-system/dept/trees",
          //   dicData: [], //getUser中直接赋值
          //   // [
          //   //   {
          //   //     label: "正常",
          //   //     value: 0
          //   //   },
          //   //   {
          //   //     label: "异常",
          //   //     value: 1
          //   //   }
          //   // ],
          // },
          {
              label: "使用方",
              prop: "deptId",
              width: 200,
              type: "tree",
              dicUrl: "/api/blade-system/dept/trees",
              multiple: true,
              dicData: [],
              checkStrictly:true,
              props: {
                label: "title"
              },
              rules: [
                {
                  required: true,
                  message: "请选择使用方",
                  trigger: "click"
                }
              ]
            },
            label: "使用方",
            prop: "pid",
            width: 200,
            search: true,
            hide: true,
            type: "select",
            // dicUrl: "/api/blade-system/dept/trees",
            dicData: [], //getUser中直接赋值
          },
          {
            label: "使用方",
            prop: "deptName",
            width: 200,
          },
          {
            label: "布撤防状态",
            prop: "stateSevicestate",
@@ -384,30 +359,30 @@
            labelWidth: "0",
            className: "cityClass3",
          },
           {
              label: "地址",
              prop: "address",
              span:10,
              // labelWidth: '60',
              hide: true,
            },
            {
              label: null,
              prop: "map",
              labelWidth: "0",
              searchSpan:0,
              maxlength:0,
              hide: true,
              span: 2,
              // display:false,
              component: "AvueMap"
            },
          {
            label: "地址",
            prop: "address",
            span: 10,
            // labelWidth: '60',
            hide: true,
          },
          {
            label: null,
            prop: "map",
            labelWidth: "0",
            searchSpan: 0,
            maxlength: 0,
            hide: true,
            span: 2,
            // display:false,
            component: "AvueMap",
          },
          {
            label: "纬度",
            hide: true,
            addDisplay: false,
            prop: "wd",
            span:6
            span: 6,
          },
          {
            label: "经度",
@@ -415,7 +390,7 @@
            hide: true,
            addDisplay: false,
            prop: "jd",
            span:5
            span: 5,
          },
          {
            label: "账号额度",
@@ -736,16 +711,22 @@
        if (val) {
          getDetail(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.address = address.substring(address.indexOf("县")+1,address.length);
          if (address.search("县") != -1) {
            this.form.address = address.substring(
              address.indexOf("县") + 1,
              address.length
            );
          }
          if(address.search("区") != -1){
            this.form.address = address.substring(address.indexOf("区")+1,address.length);
          if (address.search("区") != -1) {
            this.form.address = address.substring(
              address.indexOf("区") + 1,
              address.length
            );
          }
          //写入新的省市区
          that.form.province = val.addressComponent.province;
@@ -1166,19 +1147,22 @@
        }
      }
    },
    getMout(fid) {
      getListliuc(fid).then((res) => {
      // console.log(res.data.data);
        this.getUser(res.data.data);
      });
    },
    getUser(dat) {
      //建立使用方搜索关键词
      console.log(dat);
      if (dat.length > 0) {
        this.users = [];
        var a = null;
        for (var key in dat) {
          if (a != dat[key].ownership) {
            this.users.push({
              label: dat[key].ownership,
              value: dat[key].ownership,
            });
          }
          a = dat[key].ownership;
          this.users.push({
            label: dat[key].title,
            value: dat[key].id,
          });
        }
      }
      this.options.column[2].dicData = this.users;
@@ -1216,32 +1200,24 @@
      var useId = this.onceData.deptId;
      getListliu(pages.currentPage, pages.pageSize, values, useId).then(
        (res) => {
          // console.log(this.datas);
          // getListliu('1', '10', {}, '1353972967828533249').then((res) => {
          //拿到数据
          this.datas = res.data.data.records;
          console.log(res);
          console.log(pages.currentPage);
          console.log(pages.pageSize);
          console.log(values);
          console.log(this.onceData);
          // console.log(this.datas);
          // console.log(pages.currentPage);
          // console.log(pages.pageSize);
          // console.log(this.onceData);
          const data = res.data.data;
          this.pages.total = data.total;
          this.changeDataOpen(this.datas);
          this.getUser(this.datas);
          this.getMout(this.onceData.deptId);
          this.loadings = false;
        }
      );
    },
  },
  mounted() {
    // getAll().then((res) => {
    //   //测试数据
    //   this.datas = res.data.data;
    //   this.changeDataOpen(this.datas);
    //   this.getUser(this.datas)
    //   console.log(this.datas);
    // });
  },
  mounted() {},
};
</script>