龚焕茏
2024-08-16 c3631b3226f7355e376e68d46ffc04891b4618ba
src/views/screen/components/screen-table/index.vue
@@ -1,129 +1,175 @@
<template>
  <div class="table-container">
    <wrapper-title :title="'区域设备数据'" :path="'/monitorServe/recovery'"></wrapper-title>
    <!-- <wrapper-title
      :title="'区域设备数据'"
      :path="'/monitorServe/recovery'"
    ></wrapper-title> -->
    <div class="table-content" ref="tabContent">
      <div class="table-wrapper">
        <el-table :data="tableData" border :height="tableHeight" :max-height="tableHeight" class="rank-table">
          <el-table-column prop="name" label="地区" align="center" width="100">
        <el-table
          :data="tableData"
          border
          :height="tableHeight"
          :max-height="tableHeight"
          class="rank-table"
        >
          <el-table-column prop="area" label="地区" align="center" width="100">
          </el-table-column>
          <el-table-column label="人脸设备正常率" align="center">
          <el-table-column label="人脸设备" align="center">
            <template slot-scope="scope">
              <el-tooltip placement="top">
                <div slot="content">
                  <div class="tip-item">
                    <div class="tip-label">设备正常数:</div>
                    <div class="tip-info tip-success">12</div>
                    <div class="tip-info tip-success">
                      {{ scope.row.faceNormalNum }}
                    </div>
                  </div>
                  <div class="tip-item">
                    <div class="tip-label">设备异常数:</div>
                    <div class="tip-info tip-danger">4</div>
                    <div class="tip-info tip-danger">
                      {{ scope.row.faceErrorNum }}
                    </div>
                  </div>
                </div>
                <div class="tip-num">75%</div>
                <div class="tip-num">
                  {{
                    scope.row.faceRate?(
                      (scope.row.faceNormalNum / scope.row.faceRate) *
                      100
                    ).toFixed(0)+'%':'--'
                  }}
                </div>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column label="车辆设备正常率" align="center">
          <el-table-column label="车辆设备" align="center">
            <template slot-scope="scope">
              <el-tooltip placement="top">
                <div slot="content">
                  <div class="tip-item">
                    <div class="tip-label">设备正常数:</div>
                    <div class="tip-info tip-success">12</div>
                    <div class="tip-info tip-success">
                      {{ scope.row.carNormalNum }}
                    </div>
                  </div>
                  <div class="tip-item">
                    <div class="tip-label">设备异常数:</div>
                    <div class="tip-info tip-danger">4</div>
                    <div class="tip-info tip-danger">
                      {{ scope.row.carNormalNum }}
                    </div>
                  </div>
                </div>
                <div class="tip-num">75%</div>
                <div class="tip-num">
                  {{
                      scope.row.carRate?(
                      (scope.row.carNormalNum / scope.row.carRate) *
                      100
                    ).toFixed(0)+'%':'--'
                  }}
                </div>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column label="视频设备正常率" align="center">
          <el-table-column label="视频设备" align="center">
            <template slot-scope="scope">
              <el-tooltip placement="top">
                <div slot="content">
                  <div class="tip-item">
                    <div class="tip-label">设备正常数:</div>
                    <div class="tip-info tip-success">12</div>
                    <div class="tip-info tip-success">
                      {{ scope.row.videoNormalNum }}
                    </div>
                  </div>
                  <div class="tip-item">
                    <div class="tip-label">设备异常数:</div>
                    <div class="tip-info tip-danger">4</div>
                    <div class="tip-info tip-danger">
                      {{ scope.row.videoNormalNum }}
                    </div>
                  </div>
                </div>
                <div class="tip-num">75%</div>
                <div class="tip-num">
                  {{
                    scope.row.videoRate?(
                      (scope.row.videoNormalNum / scope.row.videoRate) *
                      100
                    ).toFixed(0)+'%':'--'
                  }}
                </div>
              </el-tooltip>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
<script>
import WrapperTitle from '../wrapper-title/index';
import WrapperTitle from "../wrapper-title/index";
export default {
  name: 'ScreenTable',
  name: "ScreenTable",
  props: {
    tableData: {
      type: Array,
      default: null,
    },
  },
  components: {
    WrapperTitle
    WrapperTitle,
  },
  data() {
    return {
      tableHeight: 40,
      tableData: [
        {
          name: '富顺县',
          data1: 1123,
          data2: 1123,
          data3: 1123
        },
        {
          name: '荣县',
          data1: 1123,
          data2: 1123,
          data3: 1123
        },
        {
          name: '高新区',
          data1: 1123,
          data2: 1123,
          data3: 1123
        },
        {
          name: '自流井区',
          data1: 1123,
          data2: 1123,
          data3: 1123
        },
        {
          name: '贡井区',
          data1: 1123,
          data2: 1123,
          data3: 1123
        },
        {
          name: '大安区',
          data1: 1123,
          data2: 1123,
          data3: 1123
        },
        {
          name: '沿滩区',
          data1: 1123,
          data2: 1123,
          data3: 1123
        },
      ]
    }
      // tableData: [
      //   {
      //     name: "富顺县",
      //     data1: 1123,
      //     data2: 1123,
      //     data3: 1123,
      //   },
      //   {
      //     name: "荣县",
      //     data1: 1123,
      //     data2: 1123,
      //     data3: 1123,
      //   },
      //   {
      //     name: "高新区",
      //     data1: 1123,
      //     data2: 1123,
      //     data3: 1123,
      //   },
      //   {
      //     name: "自流井区",
      //     data1: 1123,
      //     data2: 1123,
      //     data3: 1123,
      //   },
      //   {
      //     name: "贡井区",
      //     data1: 1123,
      //     data2: 1123,
      //     data3: 1123,
      //   },
      //   {
      //     name: "大安区",
      //     data1: 1123,
      //     data2: 1123,
      //     data3: 1123,
      //   },
      //   {
      //     name: "沿滩区",
      //     data1: 1123,
      //     data2: 1123,
      //     data3: 1123,
      //   },
      // ],
    };
  },
  methods: {
    computedHeight() {
@@ -131,21 +177,21 @@
        setTimeout(() => {
          const content = this.$refs.tabContent;
          this.tableHeight = content.offsetHeight;
        })
      })
    }
        });
      });
    },
  },
  mounted() {
    this.computedHeight();
  }
}
  },
};
</script>
<style lang="scss" scoped>
.table-container {
  width: 100%;
  // flex: 1;
  height: 350px;
  height: 240px;
  position: relative;
  display: flex;
@@ -153,16 +199,12 @@
  .table-content {
    flex: 1;
    background: rgba(67, 102, 155, 0.3);
    border: 1px solid rgba(47, 91, 157, 0.8);
    // position: absolute;
    // width: 100%;
    // top: 0;
    // bottom: 0;
    // background: url("../../../../assets/images/screen/cardBg.png");
    // background-size: cover !important;
    // background-repeat: no-repeat !important;
    // background-position: center center !important;
  }
}
.rank-table {
  background-color: transparent !important;
@@ -181,7 +223,6 @@
::v-deep .el-table .el-table__header-wrapper th,
.el-table .el-table__fixed-header-wrapper th {
  background-color: transparent !important;
}
::v-deep .el-table--group,
@@ -198,8 +239,8 @@
  border-color: #56739e99 !important;
}
::v-deep .el-table th.el-table__cell>.cell {
  color: #447ED6;
::v-deep .el-table th.el-table__cell > .cell {
  color: #447ed6;
}
::v-deep .el-scrollbar__bar.is-vertical {
@@ -212,7 +253,11 @@
  background-color: transparent !important;
}
::v-deep .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell {
::v-deep
  .el-table--enable-row-hover
  .el-table__body
  tr:hover
  > td.el-table__cell {
  background-color: #447ed648;
}
@@ -239,4 +284,4 @@
    color: #e20c0c;
  }
}
</style>
</style>