xiangpei
2024-09-03 16eb67ab6b103663d30cad9ba74360f982e131cb
src/views/screen/components/screen-table/index.vue
@@ -1,129 +1,154 @@
<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-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.faceRate + '%' : '--' }}
                </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.carErrorNum }}
                    </div>
                  </div>
                </div>
                <div class="tip-num">75%</div>
                <div class="tip-num">
                  {{ scope.row.carRate ? scope.row.carRate + '%' : '--' }}
                </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.videoErrorNum }}
                    </div>
                  </div>
                </div>
                <div class="tip-num">75%</div>
                <div class="tip-num">
                  {{ scope.row.videoRate ? scope.row.videoRate + '%' : '--' }}
                </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 +156,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 +178,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 +202,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,
@@ -199,7 +219,7 @@
}
::v-deep .el-table th.el-table__cell>.cell {
  color: #447ED6;
  color: #447ed6;
}
::v-deep .el-scrollbar__bar.is-vertical {
@@ -239,4 +259,4 @@
    color: #e20c0c;
  }
}
</style>
</style>