南昌市物联网技防平台-前端
zengh
2021-04-30 f0ca4d8ba074e441b85f4d689850f14c41bb229c
src/views/clientManagement/clientManagement.vue
@@ -28,7 +28,9 @@
                   @current-change="currentChange"
                   @size-change="sizeChange"
                   @refresh-change="refreshChange"
                   @on-load="onLoad">
                   @on-load="onLoad"
                   @row-click="rowClick">
          <template slot="menuLeft">
            <el-button type="danger"
                       size="mini"
@@ -41,7 +43,6 @@
              <Legend :datas="datalistLIU"></Legend>
            </span>
          </template>
          <template slot-scope="{ row }" slot="devicestate">
            <el-tag>{{
@@ -73,9 +74,9 @@
            </el-tag>
          </template>
          <template slot-scope="{ row }" slot="jfzt">
            <i class="el-icon-check client-jf" v-if="row.type == 0"></i>
            <i class="el-icon-close client-qf" v-else-if="row.type == 1"></i>
          <template slot-scope="{ row }" slot="type">
            <i class="el-icon-check client-jf" v-if="row.type == '0' "></i>
            <i class="el-icon-close client-qf" v-else-if="row.type == '1' "></i>
          </template>
        </avue-crud>
@@ -140,14 +141,15 @@
            </el-form-item>
          </el-col>
        </el-form>
      </el-dialog>
      <el-table
        :data="gridData"
        border
        style="width: 100%">
        style="width: 100%"
        >
        <el-table-column
          fixed
          prop="xb"
@@ -195,10 +197,12 @@
<script>
  import {getList, remove, update, add, getclient, getDeptLazyTree, getAll, updates,getBaTree} from "@/api/client/client";
  // import {getDeptTree} from "@/api/system/dept";
  import {mapGetters} from "vuex";
  import axios from "axios";
  import Legend from '../../components/liu-legend/Legend'
  import AvueMap from "avue-plugin-map";
  import website from '@/config/website';
  export default {
    components:{
@@ -265,9 +269,9 @@
        option: {
          height: 'auto',
          indexLabel: '序号',
          calcHeight: 80,
          calcHeight: 54,
          labelWidth: '125',
          dialogWidth: 960,
          dialogWidth: 1150,
          menuWidth: 150,
          align:"center",
          size: "mini",
@@ -332,13 +336,18 @@
            },
            {
              label: "使用方",
              prop: "deptName",
              display: false
            },
            {
              label: "使用方",
              prop: "deptId",
              width: 200,
              type: "tree",
              type: "cascader",
              dicUrl: "/api/blade-system/dept/trees",
              multiple: true,
              dicData: [],
              checkStrictly:true,
              hide:true,
              props: {
                label: "title"
              },
@@ -357,6 +366,7 @@
            //   type: "cascader",
            //   dicUrl: "/api/blade-system/dept/trees",
            //   multiple: true,
            //   checkStrictly:true,
            //   dicData: [],
            //   props: {
            //     label: "title"
@@ -396,10 +406,29 @@
              }],
            }, {
              label: "缴费状态",
              prop: "jfzt",
              prop: "type",
              slot: true,
              sortable:true,
              addDisplay: false,
              editDisplay: false,
            }, {
              label: "设备厂商",
              prop: "manufacturers",
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=manufacturers",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              search:true,
              type:"select",
              rules: [{
                required: true,
                message: "请选择设备厂商",
                trigger: "blur"
              }],
            }, {
              label: "布撤防状态",
              prop: "devicestate",
@@ -426,6 +455,7 @@
              label: "设备状态",
              prop: "dxzt",
              slot: true,
              sortable:true,
              addDisplay: false,
              editDisplay: false,
            },
@@ -441,13 +471,12 @@
              addDisplay: false,
              editDisplay: false
            },
            {
              label: "省份",
              prop: "province",
              search: true,
              searchSpan: 2,
              labelWidth: '112',
              labelWidth: '110',
              searchLabelWidth: 45,
              placeholder: "省份",
              type: "select",
@@ -457,7 +486,7 @@
              },
              cascaderItem: ["city", "district"],
              dicUrl: "/api/blade-system/region/select",
              span: 6,
              span: 8,
              className: "city1",
              hide: true,
              addDisplay: true,
@@ -478,7 +507,7 @@
                value: "code"
              },
              dicUrl: "/api/blade-system/region/select?code={{key}}",
              span: 3,
              span: 2,
              labelWidth: "0",
              className: "city2",
              hide: true,
@@ -500,7 +529,7 @@
                value: "code"
              },
              dicUrl: "/api/blade-system/region/select?code={{key}}",
              span: 3,
              span: 2,
              labelWidth: "0",
              className: "city3",
              hide: true,
@@ -510,10 +539,7 @@
            }, {
              label: "地址",
              prop: "street",
              // type:"map",
              span:10,
              labelWidth: '142',
              width:100,
              hide: true,
            },
            {
@@ -532,6 +558,8 @@
              hide: true,
              prop: "jd",
              searchSpan:2,
              width:"100",
              labelWidth: "120",
              formatter: (row,value,label,column)=>{
                  return value = value.substring(0,11);
              },
@@ -539,7 +567,7 @@
            },
            {
              label: "纬度",
              labelWidth:50,
              labelWidth: "45",
              hide: true,
              prop: "wd",
              formatter: (row,value,label,column) => {
@@ -547,20 +575,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",
@@ -574,12 +591,12 @@
              viewDisplay: true,
              rules: [{
                required: true,
                message: "请选择负责人",
                message: "请选择主要负责人",
                trigger: "blur"
              }],
            },
            {
              label: "负责人1电话",
              label: "主要负责人电话",
              prop: "onePhone",
              width: 110,
              hide: true,
@@ -592,7 +609,7 @@
                trigger: "blur"
              }],
            }, {
              label: "负责人2",
              label: "负责人1",
              prop: "twoId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
@@ -606,7 +623,7 @@
              viewDisplay: true,
            },
            {
              label: "负责人2电话",
              label: "负责人1电话",
              prop: "twoPhone",
              width: 110,
              hide: true,
@@ -614,7 +631,7 @@
              editDisplay: true,
              viewDisplay: true,
            }, {
              label: "负责人3",
              label: "负责人2",
              prop: "threeId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
@@ -628,7 +645,7 @@
              viewDisplay: true,
            },
            {
              label: "负责人3电话",
              label: "负责人2电话",
              prop: "threePhone",
              width: 110,
              hide: true,
@@ -665,6 +682,18 @@
              editDisplay: true,
              viewDisplay: true,
            },
            {
              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,
            }
          ]
        },
@@ -676,22 +705,30 @@
        // form是表单或者表格绑定的数据集,v-model='form'
        handler(val) {
          if (val) {
            console.log(val,111);
            this.form.wd = val.latitude.toString().substring(0,10);
            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);
            }
            // this.form.province = val.addressComponent.province;
            // console.log( val.addressComponent.city,123456)
            // this.form.city = val.addressComponent.city;
            // this.form.district = val.addressComponent.district;
            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(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;
            });
          }
        },
        immediate: true,
@@ -734,8 +771,15 @@
            });
          }
        },
      }
      },
      //随意一个
      // 'form.deviceName'() {
      //   if (this.initFlag) {
      //     this.initData();
      //   }
      // }
    },
    computed: {
      ...mapGetters(["permission"]),
@@ -755,6 +799,11 @@
        return ids.join(",");
      }
    },
    mounted(){
      // 租户模式默认加载管理组数据
      // var that = this;
      //that.tenantId = website.tenantId;
    },
    methods: {
      generate(row) {
        updates(row.expireTime, row.deviceNumber).then(() => {
@@ -769,12 +818,20 @@
          window.console.log(error);
        });
      },
      //初始化数据
      // initData() {
      //   //部门tree数据
      //   getDeptTree().then(res => {
      //     const column = this.findObject(this.option.column, "deptId");
      //     column.dicData = res.data.data;
      //   });
      // },
      handleClick(row) {
        this.form = row;
        this.dialogTableVisible = true;
        this.realjf = true;
      },
      nodeClick(data) {
        this.treeDeptId = data.id;
@@ -782,6 +839,7 @@
        this.onLoad(this.page);
      },
      rowSave(row, done, loading) {
        row.deptId = row.deptId.join(",");
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
@@ -795,10 +853,11 @@
        });
      },
      rowUpdate(row, index, done, loading) {
        debugger;
        row.jd=row.map.latitude;
        row.wd=row.map.longitude;
        row.deptId = row.deptId.join(",");
        // row.jd=row.map.latitude;
        // row.wd=row.map.longitude;
        update(row).then(() => {
          // this.initFlag = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
@@ -833,6 +892,7 @@
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        console.log(params,done)
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
@@ -873,6 +933,7 @@
            this.form = res.data.data;
          });
        }
        // this.initFlag = true;
        done();
      },
      currentChange(currentPage) {
@@ -915,7 +976,6 @@
        this.loading = true;
        getList(page.currentPage, page.pageSize, values, this.treeDeptId).then(res => {
          debugger;
          const data = res.data.data;
          this.page.total = data.total;
@@ -980,14 +1040,19 @@
        });
      }, handleStart(row) {
        console.log(row,11111111111);
        row = this.selectRow;
        console.log(row,22222222222);
        var arr = [];
        console.log(this.$store.state.tags.tagList,3333333);
        this.$store.state.tags.tagList.forEach(item => {
          if (item.label != "视频") {
            arr.push(item);
          }
        });
        this.$store.state.tags.tagList = arr;
        console.log(arr,444444444444);
        this.$router.push({
          path: `/real/video/`, query: row
        });
@@ -1022,6 +1087,10 @@
        }
        menu.style.left = event.clientX + 10 - (60) + 'px'
        document.addEventListener('click', this.foo); // 给整个document新增监听鼠标事件,点击任何位置执行foo方法
      },
      rowClick(val){//行点击事件
      // console.log(val);
      this.$router.push({ path: "/dataL/dataL", query: val });
      }
    }
  };