Newer
Older
smart-metering-front / src / views / measure / bench / bench.vue
MrTan on 14 Dec 2022 6 KB 工作台折线图组件封装
<script lang="ts" setup name="bench">
import { ref } from 'vue'
import { getStaffSStatistic, getStatistic } from '@/api/system/bench'
import { getPlanList } from '@/api/system/plan'
import { listPageApi } from '@/api/measure/file'
import Echarts from '@/components/echarts/index.vue'
const buttomTypes = ref([
  { id: '1', text: '培训记录', url: '/train/trainLog' },
  { id: '2', text: '证书到期提醒', url: '/person/remind' },
  { id: '3', text: '溯源供方', url: '/source/list' },
  { id: '4', text: '实验室', url: '/measureDept/ks' },
  { id: '5', text: '工程组', url: '/measureDept/gcz' },
  { id: '6', text: '计量人员', url: '/person/list' },
])
const tableData = ref([])
const meterageTableData = ref([])
const columns = ref([
  { text: '培训名称', value: 'planName', width: '150' },
  { text: '负责人', value: 'director', width: '150' },
  { text: '培训时间', value: 'trainTime', width: '180' },
])
const meterageColumns = ref([
  { text: '文件名称', value: 'fileName', width: '150' },
  { text: '类别', value: 'fileTypeName', width: '150' },
  { text: '发布时间', value: 'publishTime', width: '180' },
])
const StatisticyAxis = ref([])
const StatisticXAxis = ref([])
const StaffSStatisticyAxis = ref([])
const StaffSStatisticxAxis = ref([])
const getStatisticList = () => {
  const params = {
    createTime: '',
    deptId: 0,
    director: '',
    effectiveCompany: '',
    trainTime: '',
    offset: 1,
    limit: 10000,
  }
  getPlanList(params).then((res) => {
    tableData.value = res.data.rows
  })
  getStatistic().then(async (res) => {
    StatisticyAxis.value = await res.data.map((item) => {
      return item.date
    })
    StatisticXAxis.value = await res.data.map((item) => {
      return Number(item.count)
    })
  })
  getStaffSStatistic().then(async (res) => {
    StaffSStatisticyAxis.value = await res.data.map(item => item.date)
    StaffSStatisticxAxis.value = await res.data.map(item => Number(item.count))
  })
}
const getmeterageList = () => {
  const params = {
    fileNo: '', // 编号
    fileName: '', // 名称
    publishTime: '', // 发布时间
    fileCode: '', // 文件号
    effectiveTime: '', // 实施时间
    effectiveStatus: '', // 实施状态
    limit: 10,
    offset: 1,
    fileType: '', // 类型
  }
  listPageApi(params).then((res) => {
    meterageTableData.value = res.data.rows
  })
}
getmeterageList()
getStatisticList()
</script>

<template>
  <app-container>
    <div class="bench">
      <div class="bench-left">
        <div class="bench-left-top">
          <div class="bench-title">
            <h3>培训计划</h3>
            <i>字体图标</i>
          </div>
          <el-table :data="tableData" style="width: 100%;height: 80%; border-radius: 10px;">
            <el-table-column v-for="item in columns" :key="item.value" :prop="item.value" :label="item.text" :width="item.width" />
          </el-table>
        </div>
        <div class="bench-left-buttom">
          <div class="bench-title">
            <h3>计量文件</h3>
          </div>
          <el-table :data="meterageTableData" style="width: 100%;height: 80%; border-radius: 10px;">
            <el-table-column v-for="item in meterageColumns" :key="item.value" :prop="item.value" :label="item.text" :width="item.width" />
          </el-table>
        </div>
      </div>
      <div class="bench-center">
        <div class="bench-center-top">
          <div class="bench-title">
            <h3>培训计划</h3>
          </div>
          <echarts :id="Math.random()" title="培训计划" :x-axis-data="StatisticXAxis" :y-axis-data="StatisticyAxis" />
        </div>
        <div class="bench-center-buttom">
          <div class="bench-title">
            <h3>我的证书</h3>
          </div>
          <div class="bench-center-content">
            <table class="table" cellpadding="13">
              <tr>
                <th>证书名称</th>
                <th>到期时间</th>
              </tr>
              <tr>
                <td>证书名称</td>
                <td>到期时间</td>
              </tr>
              <tr>
                <td>证书名称</td>
                <td>到期时间</td>
              </tr>
            </table>
            <div>最近到期时间</div>
          </div>
        </div>
      </div>
      <div class="bench-right">
        <div class="bench-right-top">
          <div v-for="item in buttomTypes" :key="item.id" class="right-top-box" @click="$router.push(item.url)">
            {{ item.text }}
          </div>
        </div>
        <div class="bench-right-center">
          <div class="bench-title">
            <h3>我的培训考核</h3>
          </div>
        </div>
        <div class="bench-right-buttom">
          <div class="bench-title">
            <h3>计量人员</h3>
          </div>
          <echarts :id="Math.random()" title="人数" :x-axis-data="StaffSStatisticxAxis" :y-axis-data="StaffSStatisticyAxis" />
        </div>
      </div>
    </div>
  </app-container>
</template>

<style lang="scss" scoped>
.bench {
  display: flex;

  .bench-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1vw;
    height: 20%;
  }

  .bench-left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 38%;
    height: 90vh;

    .bench-left-top {
      height: 48%;
      border: 1px solid #000;
      border-radius: 10px;
      margin: 2%;
    }

    .bench-left-buttom {
      height: 48%;
      margin: 2%;
      border: 1px solid #000;
      border-radius: 10px;
    }
  }

  .bench-center {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 38%;
    height: 90vh;

    .bench-center-top {
      height: 45%;
      border: 1px solid #000;
      border-radius: 10px;
      margin: 2%;
    }

    .bench-center-buttom {
      height: 48%;
      margin: 2%;
      border: 1px solid #000;
      border-radius: 10px;

      .bench-center-content {
        height: 80%;
        display: flex;
        align-items: center;
        justify-content: space-around;
      }
    }
  }

  .bench-right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24%;
    height: 90vh;

    .bench-right-top {
      height: 30%;
      border: 1px solid #000;
      border-radius: 10px;
      padding: 5%;
      margin: 2%;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-around;

      .right-top-box {
        width: 29%;
        margin: 1%;
        height: 40%;
        border-radius: 5px;
        text-align: center;
        line-height: 8vh;
        color: #fff;
        cursor: pointer;
        background-color: rgb(40 184 228);
      }
    }

    .bench-right-center {
      height: 34%;
      border: 1px solid #000;
      border-radius: 10px;
      margin: 2%;
    }

    .bench-right-buttom {
      height: 30%;
      margin: 2%;
      border: 1px solid #000;
      border-radius: 10px;
    }
  }
}
</style>