南昌市物联网技防平台-前端
shuishen
2021-04-26 ea1d5d98f246db71c8ef1b1e63ef5ed4e363881f
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>{{
@@ -140,13 +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"
@@ -194,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,8 +270,8 @@
          height: 'auto',
          indexLabel: '序号',
          calcHeight: 80,
          labelWidth: '100',
          dialogWidth: 950,
          labelWidth: '105',
          dialogWidth: 1040,
          menuWidth: 150,
          align:"center",
          size: "mini",
@@ -289,6 +294,11 @@
              searchPlaceholder: "设备名称/编号",
              search: true,
              sortable:true,
              rules: [{
                required: true,
                message: "请输入设备名称",
                trigger: "blur"
              }],
            },
            {
              label: "到期时间",
@@ -318,7 +328,7 @@
              width: 130,
              rules: [
                {
                  required: false,
                  required: true,
                  message: "请输入设备编号",
                  trigger: "click"
                }
@@ -326,21 +336,50 @@
            },
            {
              label: "使用方",
              prop: "deptName",
              display: false
            },
            {
              label: "使用方",
              prop: "deptId",
              width: 200,
              type: "tree",
              dicUrl: "/api/blade-system/dept/trees",
              multiple: true,
              dicData: [],
              checkStrictly:true,
              hide:true,
              props: {
                label: "title"
              },
              rules: [
                {
                  required: false,
                  required: true,
                  message: "请选择使用方",
                  trigger: "click"
                }
              ]
            },
            // {
            //   label: "使用方",
            //   prop: "deptId",
            //   width: 200,
            //   type: "cascader",
            //   dicUrl: "/api/blade-system/dept/trees",
            //   multiple: true,
            //   checkStrictly:true,
            //   dicData: [],
            //   props: {
            //     label: "title"
            //   },
            //   rules: [
            //     {
            //       required: true,
            //       message: "请选择使用方",
            //       trigger: "click"
            //     }
            //   ]
            // },
            {
              label: "序列号",
              prop: "serialNumber",
@@ -348,6 +387,11 @@
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "请输入序列号",
                trigger: "blur"
              }],
            },
            {
              label: "通道号",
@@ -356,6 +400,11 @@
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "请输入通道号",
                trigger: "blur"
              }],
            }, {
              label: "缴费状态",
              prop: "jfzt",
@@ -408,7 +457,8 @@
              label: "省份",
              prop: "province",
              search: true,
              searchSpan: 3,
              searchSpan: 2,
              labelWidth: '100',
              searchLabelWidth: 45,
              placeholder: "省份",
              type: "select",
@@ -418,10 +468,9 @@
              },
              cascaderItem: ["city", "district"],
              dicUrl: "/api/blade-system/region/select",
              span: 6,
              span: 7,
              className: "city1",
              hide: true,
              // width: 10,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
@@ -440,7 +489,7 @@
                value: "code"
              },
              dicUrl: "/api/blade-system/region/select?code={{key}}",
              span: 3,
              span: 2,
              labelWidth: "0",
              className: "city2",
              hide: true,
@@ -470,34 +519,93 @@
              editDisplay: true,
              viewDisplay: true,
            }, {
              label: "街道",
              label: "地址",
              prop: "street",
              width: 200,
              // type:"map",
              span:11,
              labelWidth: '160',
              hide: true,
            },
            {
              label: null,
              prop: "map",
              labelWidth: "0",
              searchSpan:0,
              maxlength:0,
              hide: true,
              span: 1,
              // display:false,
              component: "AvueMap"
            },
            {
              label: "经度",
              hide: true,
              prop: "jd",
              searchSpan:2,
              width:"100",
              labelWidth: "110",
              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: "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: "map",
              hide: true,
              span: 24,
              component: "AvueMap",
            },
            {
              label: "经度",
              hide: true,
              prop: "jd",
            },
            {
              label: "纬度",
              hide: true,
              prop: "wd",
            },
            {
              label: "负责人",
              label: "负责人1",
              prop: "oneId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
              props: {
                label: "title"
              },
              width: 72,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "请选择负责人",
                trigger: "blur"
              }],
            },
            {
              label: "负责人1电话",
              prop: "onePhone",
              width: 110,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "请输入负责人电话",
                trigger: "blur"
              }],
            }, {
              label: "负责人2",
              prop: "twoId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
              props: {
@@ -510,8 +618,30 @@
              viewDisplay: true,
            },
            {
              label: "负责人电话",
              prop: "onePhone",
              label: "负责人2电话",
              prop: "twoPhone",
              width: 110,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
            }, {
              label: "负责人3",
              prop: "threeId",
              type: "tree",
              dicUrl: "/api/blade-system/dept/Batrees",
              props: {
                label: "title"
              },
              width: 72,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
            },
            {
              label: "负责人3电话",
              prop: "threePhone",
              width: 110,
              hide: true,
              addDisplay: true,
@@ -546,17 +676,6 @@
              addDisplay: true,
              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,
            },
          ]
@@ -568,11 +687,24 @@
      "form.map": {
        // form是表单或者表格绑定的数据集,v-model='form'
        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.street = val.formattedAddress;
            // 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;
          }
        },
        immediate: true,
@@ -589,7 +721,41 @@
            });
          }
        },
      }
      },
      "form.twoId":{
        handler(val) {
          var that = this;
          if (val != null && val !=""){
            getBaTree(val).then(res => {
              if (res) {
                that.form.twoPhone = res.data.data.records[0].phone;
                that.form.twoContacts = res.data.data.records[0].name;
              }
            });
          }
        },
      },
      "form.threeId":{
        handler(val) {
          var that = this;
          if (val != null && val !=""){
            getBaTree(val).then(res => {
              if (res) {
                that.form.threePhone = res.data.data.records[0].phone;
                that.form.threeContacts = res.data.data.records[0].name;
              }
            });
          }
        },
      },
      //随意一个
      // 'form.deviceName'() {
      //   if (this.initFlag) {
      //     this.initData();
      //   }
      // }
    },
    computed: {
      ...mapGetters(["permission"]),
@@ -609,6 +775,11 @@
        return ids.join(",");
      }
    },
    mounted(){
      // 租户模式默认加载管理组数据
      // var that = this;
      //that.tenantId = website.tenantId;
    },
    methods: {
      generate(row) {
        updates(row.expireTime, row.deviceNumber).then(() => {
@@ -623,11 +794,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;
@@ -648,7 +828,10 @@
        });
      },
      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);
          this.$message({
            type: "success",
@@ -723,6 +906,7 @@
            this.form = res.data.data;
          });
        }
        // this.initFlag = true;
        done();
      },
      currentChange(currentPage) {
@@ -871,6 +1055,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 });
      }
    }
  };
@@ -1017,4 +1205,21 @@
    padding-right: 5px;
  }
</style>
<style>
  .avue-map input{
    position: relative !important;
    left: 30px !important;
  }
  .avue-map .el-input-group__append{
    position: relative !important;
    left: -51px !important;
  }
</style>