南昌市物联网技防平台-前端
liuyg
2021-05-07 4ae45298acf05aa0b8e126c72725b6111406c1f3
设备状态区分调整
2 files modified
115 ■■■■ changed files
src/views/dataL/dataL.vue 47 ●●●● patch | view | raw | blame | history
src/views/supervisoryConsole/card.vue 68 ●●●● patch | view | raw | blame | history
src/views/dataL/dataL.vue
@@ -1015,31 +1015,30 @@
      //   jtype != 2
      //   ]
      var states,
        o = this.a.onlineStatus,
        s = this.a.state,
        j = this.a.jtype;
      // if (o == 0) {
      //   states = "掉线";
      // } else if (o == 1) {
      //   states = "在线";
      // } else if (s != "") {
      //   states = "故障";
      // } else if (j != 2) {
      //   states = "预警";
      // }
      if (s != "") {
        d = this.a.dtype;
      if (d == 0) {
        states = "掉线";
      } else if (d == 1) {
        states = "正常";
      } else if (d == 3) {
        states = "故障";
      } else {
        if (j != 1) {
          if (o == 1) {
            states = "正常";
          } else {
            states = "掉线";
          }
        } else {
          states = "预警";
        }
      } else if (d == 2) {
        states = "预警";
      }
      // if (s != "") {
      //   states = "故障";
      // } else {
      //   if (j != 1) {
      //     if (o == 1) {
      //       states = "正常";
      //     } else {
      //       states = "掉线";
      //     }
      //   } else {
      //     states = "预警";
      //   }
      // }
      // console.log(o, 1000);
      // console.log(s, 1000);
      // console.log(j, 1000);
@@ -1283,7 +1282,7 @@
      this.a =  this.$route.query;
    this.$store.commit("SET_DATAL", this.a);//每次都缓存在vuex中,如果没有从正确路径进来,则使用缓存
    }
    console.log(this.a);
    // console.log(this.a);
    this.baseUrl = `/map/index.html?ISinit=1&openid=DetailMap&jd=${this.a.jd}&wd=${this.a.wd}`;
    this.myDeviceNumber = this.a.deviceNumber;
    // console.log(this.a);
src/views/supervisoryConsole/card.vue
@@ -40,7 +40,7 @@
        :key="index"
      >
        <a href="javascript:void(0);" @click.stop="goToDetails(item)">
          <el-card
          <!-- <el-card
            :style="
              item.jtype == 1
                ? 'background: #F34A4Ae6'
@@ -50,11 +50,24 @@
                  : 'background: #C9C9C9e6'
                : 'background: #F48F57e6'
            "
          > -->
          <el-card
            :style="
              item.dtype == 0
                ? 'background: #C9C9C9e6'
                : item.dtype == 1
                ? 'background: #1DBB99e6'
                : item.dtype == 2
                ? 'background: #F34A4Ae6'
                : item.dtype == 3
                ? 'background: #F48F57e6'
                : ''
            "
          >
            <div>{{ item.deviceName }}</div>
            <div style="width: 80%">{{ item.street }}</div>
            <div class="cet">
            <!-- <div class="cet">
              {{
                item.jtype == 1
                  ? "设备预警"
@@ -63,6 +76,20 @@
                    ? "设备正常"
                    : "设备掉线"
                  : "设备故障"
              }}
            </div> -->
            <div class="cet">
              {{
                item.dtype == 0
                  ? "设备掉线"
                  : item.dtype == 1
                  ? "设备正常"
                  : item.dtype == 2
                  ? "设备预警"
                  : item.dtype == 3
                  ? "设备故障"
                  : ""
              }}
            </div>
@@ -147,27 +174,50 @@
          f = [];
        if (this.radio == "全部") {
          res.data.data.forEach((item) => {
            if (item.jtype == 1) {
            if (item.dtype == 1) {
              f.push(item);
            } else {
              if (item.state != "") a.push(item);
              if (item.state == "" && item.onlineStatus == 1) c.push(item);
              if (item.state == "" && item.onlineStatus != 1) b.push(item);
              if (item.dtype == 0) a.push(item);
              if (item.dtype == 2) c.push(item);
              if (item.dtype == 3) b.push(item);
            }
          });
        } else if (this.radio == "仅显示预警设备") {
          res.data.data.forEach((item) => {
            if (item.jtype == 1) c.push(item);
            if (item.dtype == 2) c.push(item);
          });
        } else if (this.radio == "仅显示设备掉线") {
          res.data.data.forEach((item) => {
            if (item.onlineStatus != 1) b.push(item);
            if (item.dtype == 0) b.push(item);
          });
        } else if (this.radio == "仅显示设备故障") {
          res.data.data.forEach((item) => {
            if (item.state != "") a.push(item);
            if (item.dtype == 3) a.push(item);
          });
        }
        //  if (this.radio == "全部") {
        //   res.data.data.forEach((item) => {
        //     if (item.jtype == 1) {
        //       f.push(item);
        //     } else {
        //       if (item.state != "") a.push(item);
        //       if (item.state == "" && item.onlineStatus == 1) c.push(item);
        //       if (item.state == "" && item.onlineStatus != 1) b.push(item);
        //     }
        //   });
        // } else if (this.radio == "仅显示预警设备") {
        //   res.data.data.forEach((item) => {
        //     if (item.jtype == 1) c.push(item);
        //   });
        // } else if (this.radio == "仅显示设备掉线") {
        //   res.data.data.forEach((item) => {
        //     if (item.onlineStatus != 1) b.push(item);
        //   });
        // } else if (this.radio == "仅显示设备故障") {
        //   res.data.data.forEach((item) => {
        //     if (item.state != "") a.push(item);
        //   });
        // }
        var d = f.concat(a.concat(c.concat(b)));