he wei
2023-04-10 aaa8ffcb83ce577612d1c88a295db0e12f87a83c
src/views/home/home-admin.vue
@@ -27,6 +27,16 @@
        <div class="label">负载熔断:</div>
        <div class="value">{{ sum.fusing }}</div>
      </div>
      <!-- 停电放电 -->
      <div class="item cur-pointer" @click="getJcdisBatt">
        <div class="label">停电放电:</div>
        <div class="value">{{ sum.jcdisNum }}</div>
      </div>
      <!-- 年度已核容 -->
      <div class="item cur-pointer" v-if="isMain" @click="getHrYeardisBatt">
        <div class="label">年度已核容:</div>
        <div class="value">{{ sum.hrdisNum }}</div>
      </div>
      <!-- 按钮 -->
      <div class="btn-grp">
        <div class="loop-time" v-if="!isMain">
@@ -54,6 +64,8 @@
                  <div class="row">
                    <template v-for="(card, idx) in item.slice(0, 4)">
                      <card class="item" :key="'card_' + idx" v-if="card" :title="card.title" :vol="card.stationType"
                        @showinfo="showInfo(card)"
                        :problem="!!card.pwrinf.exceptionCause"
                        :is-node="!!card.nodeStation">
                        <info :data="card"></info>
                      </card>
@@ -63,6 +75,8 @@
                  <div class="row">
                    <template v-for="(card, idx) in item.slice(4)">
                      <card class="item" :key="'card1_' + idx" v-if="card" :title="card.title" :vol="card.stationType"
                        @showinfo="showInfo(card)"
                        :problem="!!card.pwrinf.exceptionCause"
                        :is-node="!!card.nodeStation">
                        <info :data="card"></info>
                      </card>
@@ -164,7 +178,10 @@
          <!-- <div class="btn" @click="view">查看</div> -->
        </div>
        <div class="res-wrap">
          <card class="item" :title="resCard.title" :vol="resCard.stationType" :is-node="!!resCard.nodeStation">
          <card class="item" :title="resCard.title" :vol="resCard.stationType"
          :problem="!!resCard.pwrinf && !!resCard.pwrinf.exceptionCause"
          @showinfo="showInfo(resCard)"
          :is-node="!!resCard.nodeStation">
            <info :data="resCard" v-if="resCard.stationId"></info>
            <div v-else class="empty">请选择要查看的机房</div>
          </card>
@@ -175,7 +192,7 @@
      </div>
    </el-dialog>
    <!--  -->
    <el-dialog :title="listTitle" width="500px" :visible.sync="listVisible" :close-on-click-modal="false" top="0"
    <el-dialog :title="listTitle" width="700px" :visible.sync="listVisible" :close-on-click-modal="false" top="0"
      class="dialog-center" :modal-append-to-body="false">
      <el-table height="400" :data="tableData" :show-header="false" style="width: 100%">
        <el-table-column type="index" width="50">
@@ -188,6 +205,7 @@
        </el-table-column>
      </el-table>
    </el-dialog>
    <power-remarks :visible.sync="powerRemarksDialog" v-if="powerRemarksDialog" :num="pwrNum"></power-remarks>
  </div>
</template>
@@ -197,12 +215,15 @@
import cardBox from '@/components/bigScreenPage/big_screen_card';
import MapChart from "@/components/myCharts/MapChart.vue";
import MapMarkList from "@/components/mapMarkList.vue";
import PowerRemarks from "@/views/dataMager/components/powerRemarks.vue";
import Timeout from '@/assets/js/tools/Timeout';
import formatSeconds from '@/assets/js/tools/formatSeconds';
import {
  searchAcdcModError,
  searchFuse
  searchFuse,
  getJcdisBatt,
  getHrYeardisBatt,
} from './js/api';
import createWs from "@/assets/js/websocket";
@@ -212,6 +233,8 @@
  mixins: [WSMixin],
  data() {
    return {
      pwrNum: '',
      powerRemarksDialog: false,
      slideName: "slide-left",
      tableData: [],
      listTitle: '相关站点',
@@ -232,7 +255,9 @@
        discharg: 0,
        float: 0,
        fault: 0,
        fusing: 0
        fusing: 0,
        jcdisNum: 0,
        hrdisNum: 0,
      },
      // 是否主视图
      isMain: true,
@@ -271,7 +296,8 @@
    card,
    info,
    cardBox,
    MapChart
    MapChart,
    PowerRemarks,
  },
  watch: {
    isMain(n) {
@@ -321,13 +347,17 @@
        data,
        errmap,
        fusemap,
        stationNum
        stationNum,
        hrdisNum,
        jcdisNum,
      } = res.data2;
      this.sum.station = stationNum;
      this.sum.discharg = battState.batt1;
      this.sum.float = battState.batt2;
      this.sum.discharg = battState.batt3;
      this.sum.float = battState.batt1;
      this.sum.fault = errmap.err1;
      this.sum.fusing = fusemap.fuse1;
      this.sum.hrdisNum = hrdisNum;
      this.sum.jcdisNum = jcdisNum;
      data.forEach((v) => {
        v.acdc = v.acdc || {
@@ -346,6 +376,10 @@
          dcoutVol: 0,
          dcoutCurr: 0,
        };
        v.pwrinf = v.pwrinf || {
          num: -1,
          routeNum: 1,
        };
      });
      this.stationList = data;
@@ -360,7 +394,8 @@
    format(data) {
      let {
        acdc,
        sgbList
        sgbList,
        pwrinf,
      } = data;
      let battList = sgbList.map((v) => {
        return {
@@ -375,12 +410,21 @@
      });
      battList.splice(2);
      let battAlm = battList.reduce((t, v) => t + v.battAlm * 1, 0);
      let isOne = 1 == pwrinf.routeNum;
      let acinA = acdc.acin1Vola + '/' + acdc.acin2Vola + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Curra + '&nbsp;(A)',
        acinB = acdc.acin1Volb + '/' + acdc.acin2Volb + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currb + '&nbsp;(A)',
        acinC = acdc.acin1Volc + '/' + acdc.acin2Volc + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currc + '&nbsp;(A)';
      if (isOne) {
        acinA = acdc.acin1Vola + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Curra + '&nbsp;(A)';
        acinB = acdc.acin1Volb + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currb + '&nbsp;(A)';
        acinC = acdc.acin1Volc + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currc + '&nbsp;(A)';
      }
      return {
        ...data,
        battList,
        acinA: acdc.acin1Vola + '/' + acdc.acin2Vola + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Curra + '/' + acdc.acin2Curra + '&nbsp;(A)',
        acinB: acdc.acin1Volb + '/' + acdc.acin2Volb + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currb + '/' + acdc.acin2Currb + '&nbsp;(A)',
        acinC: acdc.acin1Volc + '/' + acdc.acin2Volc + '&nbsp;(V)&emsp;&emsp;' + acdc.acin1Currc + '/' + acdc.acin2Currc + '&nbsp;(A)',
        acinA,
        acinB,
        acinC,
        dcout: acdc.dcoutVol + '&nbsp;(V)&emsp;&emsp;' + acdc.dcoutCurr + '&nbsp;(A)',
        battAlm
      }
@@ -398,12 +442,14 @@
          stationName3,
          stationName5,
          stationType,
          nodeStation
          nodeStation,
          pwrinf,
        } = v;
        v.sgbList.forEach(item => {
          list.push({
            battInf: item,
            acdc,
            pwrinf,
            devAlm,
            pwrAlm,
            stationId,
@@ -515,7 +561,7 @@
    goToWarn(type) {
      let mapStation = this.mapStation;
      let search = '?province=' + mapStation.stationName1 + '&city=' + mapStation.stationName2 + '&county=' + mapStation.stationName5 +
        '&home=' + mapStation.stationName3 + "&stationName=" + mapStation.stationName+'&fromType=fromIndex';
        '&home=' + mapStation.stationName3 + "&stationName=" + mapStation.stationName + '&fromType=fromIndex';
      // 1-电源告警 2-设备告警 3-电池告警
      switch (type) {
        case 1:
@@ -586,17 +632,79 @@
        "&home=" +
        obj.stationName3 +
        "&batt=" +
        (obj.battGroupId ? obj.battGroupId : obj.powerDeviceId) +
        // list组件重载
        "&listReload=1";
      this.$router.push("/dataTest/movingRingSystem/" + search);
        (obj.battGroupId ? obj.battGroupId : obj.powerDeviceId);
      // list组件重载
      // "&listReload=1";
      let url = '';
      if (obj.isHis) {
        url = '/dataTest/history' + search;
      } else {
        url = "/dataTest/movingRingSystem/" + search + "&listReload=1";
      }
      this.$router.push(url);
      this.listVisible = false;
      // if (obj.powerDeviceId) {
      //   this.$router.push("/dataTest/movingRingSystem/ele-info/" + obj.powerDeviceId);
      // } else {
      //   this.$router.push("/dataTest/movingRingSystem/" + search);
      // }
    }
    },
    // 年度核容电池组
    getHrYeardisBatt() {
      if (this.sum.hrdisNum == 0) {
        this.$message.success('没有相关电池组');
        return false;
      }
      this.listTitle = '本年度已核容放电电池组列表';
      this.tableData = [];
      let loading = this.$layer.loading();
      getHrYeardisBatt().then((res) => {
        let { code, data, data2 } = res.data;
        if (code && data) {
          this.$layer.close(loading);
          this.listVisible = true;
          this.tableData = data2.map(v => {
            v.isHis = true;
            v.stationName = v.stationName + ' ' + v.battGroupName;
            return v;
          });
        } else {
          this.$layer.close(loading);
          this.$message.error('查询失败');
        }
      }).catch((err) => {
        this.$message.error('异常');
        console.log(err);
      });
    },
    // 实时停电放电电池组列表
    getJcdisBatt() {
      if (this.sum.jcdisNum == 0) {
        this.$message.success('没有相关站点');
        return false;
      }
      this.listTitle = '实时停电放电站点列表';
      this.tableData = [];
      let loading = this.$layer.loading();
      getJcdisBatt().then((res) => {
        let { code, data, data2 } = res.data;
        if (code && data) {
          this.$layer.close(loading);
          this.listVisible = true;
          this.tableData = data2;
        } else {
          this.$layer.close(loading);
          this.$message.error('查询失败');
        }
      }).catch((err) => {
        this.$message.error('异常');
        console.log(err);
      });
    },
    showInfo(obj) {
      this.pwrNum = obj.pwrinf.num;
      this.powerRemarksDialog = true;
    },
  },
  mounted() {
@@ -627,7 +735,7 @@
      align-items: center;
      &:not(:first-child) {
        margin-left: 4.4em;
        margin-left: 1.4em;
      }
      .label {
@@ -930,11 +1038,12 @@
    margin-right: 8px;
  }
}
.row {
  .value {
    &.cur-pointer {
      cursor: pointer;
    }
  }
 }
}
</style>