南昌市物联网技防平台-前端
zengh
2023-01-16 8aa3edd56c279100c9053576f3e90fa55459fe77
src/views/clientManagement/clientManagement.vue
@@ -67,16 +67,33 @@
<!--            </el-button>-->
<!--          </template>-->
          <template slot-scope="{ row }" slot="dxzt">
            <el-tag>{{
              row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "正常" :row.dxzt == "2" ? "报警":row.dxzt == "3" ? "故障":"无"
          <template class="tdtype" slot-scope="{ row }" slot="dxzt">
            <el-tag class="dtype">
              {{
              row.dxzt == "0" ? "掉线" : row.dxzt == "1" ? "正常" :row.dxzt == "2" ? "预警":row.dxzt == "3" ? "故障":"无"
              }}
              <i class="dx" v-if="row.dxzt == '0' "></i>
              <i class="zc" v-if="row.dxzt == '1' "></i>
              <i class="yj" v-if="row.dxzt == '2' "></i>
              <i class="gz" v-if="row.dxzt == '3' "></i>
            </el-tag>
          </template>
          <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>
          <template slot-scope="{ type, size, row }" slot="menu">
            <el-button
              v-if="row.dtype == 2"
              icon="el-icon-s-order"
              :size="size"
              :type="type"
              @click.stop="updateDtype(row)"
            >办结
            </el-button>
          </template>
        </avue-crud>
@@ -87,6 +104,7 @@
            <li class="menu_item" @click.stop="handleMap">定位</li>
          </ul>
        </div>
        <el-drawer
          title="电子地图"
@@ -213,6 +231,9 @@
    },
    data() {
      return {
        dataLIU:{
          color:"#DFDFDF"
        },
        //legend-liu数据
        datalistLIU:[
                {
@@ -281,7 +302,7 @@
          calcHeight: 54,
          labelWidth: '125',
          dialogWidth: 1150,
          menuWidth: 150,
          menuWidth: 200,
          align:"center",
          size: "mini",
          tip: false,
@@ -342,6 +363,16 @@
                  trigger: "click"
                }
              ]
            },
            {
              label: "设备类型",
              prop: "deviceType",
              width: 150,
              rules: [{
                required: true,
                message: "请输入设备类型",
                trigger: "blur"
              }]
            },
            {
              label: "使用方",
@@ -426,6 +457,7 @@
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              searchSpan: 3,
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=manufacturers",
              props: {
                label: "dictValue",
@@ -716,35 +748,18 @@
        handler(val) {
          if (val) {
            var that = this;
            //重新加载一次页面详情数据,解决新的省市区无法写入问题
            //判断是新增还是修改
            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;
                });
              }
            //经纬度替换
            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;
            this.form.street = address;
            // 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);
            // }
          }
        },
        immediate: true,
@@ -885,6 +900,20 @@
          loading();
        });
      },
      updateDtype(row){
        row.dtype = "0";
        update(row).then(() => {
          // this.initFlag = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.onLoad(this.page);
        }, error => {
          window.console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
@@ -1003,13 +1032,8 @@
          for (var i = 0; i < data.records.length; i++) {
            var date = new Date(data.records[i].heartbeat).getTime();
            if ((Dqdate - date) >= (60 * 60 * 24 * 1000)) {
              data.records[i].dxzt = 0;
            } else if (data.records[i].heartbeat == "") {
              data.records[i].dxzt = 0;
            } else {
              if(data.records[i].dtype==1){
                  data.records[i].dxzt = data.records[i].dtype;
                  data.records[i].dxzt = 1;
              }
              if(data.records[i].dtype==2){
                  data.records[i].dxzt = 2;
@@ -1018,15 +1042,9 @@
                  data.records[i].dxzt = 3;
              }
              if(data.records[i].dtype=="" || data.records[i].dtype==0){
                  data.records[i].dxzt = 1;
                  data.records[i].dxzt = 0;
              }
            }
          }
          // data.records.sort((a, b) => {
          //   return a.dxzt - b.dxzt;
          // });
          this.data = data.records;
          this.loading = false;
@@ -1049,26 +1067,26 @@
        // }
        if(row.dtype!=null && row.dtype!=""){
          if(row.dtype=='0'){
            return {
              color: "#DFDFDF"
            };
          }
          if(row.dtype=='1'){
            return {
              color: "#29C093"
            };
          }
          // if(row.dtype=='0'){
          //   return {
          //     color: "#DFDFDF"
          //   };
          // }
          // if(row.dtype=='1'){
          //   return {
          //     color: "#29C093"
          //   };
          // }
          if(row.dtype=='2'){
            return {
              color: "#F34A4A"
            };
          }
          if(row.dtype=='3'){
            return {
              color: "#F48F57"
            };
          }
          // if(row.dtype=='3'){
          //   return {
          //     color: "#F48F57"
          //   };
          // }
        }
      },
      handleManage(row) {
@@ -1116,7 +1134,7 @@
        this.showMap = true;
        this.$nextTick(() => {
          this.$refs.mapDiv.onload = () => {
            window.frames[0].init("equipment", {x: row.jd, y: row.wd});
            window.frames[1].init("equipment", {x: row.jd, y: row.wd});
          };
        })
      },rightClick(row, event) {
@@ -1251,6 +1269,51 @@
    color: red;
  }
  .dtype{
    width: 80px;
  }
  .dx{
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #DFDFDF;
  }
  .zc{
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #29C093;
  }
  .yj{
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #F34A4A;
  }
  .gz{
    position: absolute;
    top: 50%;
    margin-top: -5px;
    margin-left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 30%;
    background: #F48F57;
  }
  .tabFontSize{
    font-size: 15px;
  }