<template>
  <div>
    <el-table border v-loading="loading" :data="tableData">
      <el-table-column
        label="序号"
        align="center"
        width="80"
        type="index"
      ></el-table-column>
      <el-table-column label="排名" align="center" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>{{ scope.row.rating ? scope.row.rating : '-' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="部门" align="center" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>{{ scope.row.deptName ? scope.row.deptName : '-' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="问题数量" align="center" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>{{ scope.row.problemCount ? scope.row.problemCount : '0' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="已整改数量" align="center" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>{{ scope.row.problemFinishCount ? scope.row.problemFinishCount : '0' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="整改率" align="center" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>{{ scope.row.problemRate ? scope.row.problemRate * 100 + "%": '0%' }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        width="120"
      >
        <template slot-scope="scope">
          <el-button
            type="text"
            @click="
              $router.push(
                `/checkStatistics/PostCheckWebLookDialogPage?checkedDeptId=${scope.row.deptId}&checkTime=${scope.row.statisticsTime}&name=${scope.row.deptName}`
              )
            "
            >查看</el-button
          >
        </template>
      </el-table-column> -->
    </el-table>
  </div>
</template>

<script>
import { deptDetaailView3, deptDetaailView4 } from '@/api/allApi/index.js'
import moment from 'moment'
export default {
  name: 'PostCheckWebAtopForm',
  props: {
    type: {
      type: Number,
      default: 3
    },
    queryParams: {
      type: Object,
      default: {}
    }
  },
  data() {
    return {
      loading: false,
      tableData: [],
      ratingTime: []
    }
  },

  mounted() {
    this.getList()
  },

  methods: {
    /** 查询岗位列表 */
    getList() {
      this.loading = true
      if (this.type == 3) {
        deptDetaailView3(this.queryParams).then((res) => {
          this.tableData = res.data
          this.loading = false
        })
      } else if (this.type == 4) {
        deptDetaailView4(this.queryParams).then((res) => {
          this.tableData = res.data
          this.loading = false
        })
      }
    },
    handleQuery() {
      this.getList()
    },
    initType(val) {
      switch (val) {
        case 1:
          return '业务职责'
        case 2:
          return '党建及党风廉政'
        case 3:
          return '安全环保职责'
        case 4:
          return '合规保密职'
        case 5:
          return '任职资格与能力素质要求'
      }
    },
    formatTime(time) {
      return moment(time).format('YYYY-MM-DD')
    },
    formatNumber(num) {
      if (!num && num != 0) return ''
      if (Number.isInteger(num)) {
        return num
      } else {
        return num.toFixed(2)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.border_box {
  padding: 5px 0;
  margin: 0;
  min-height: 35px;
  box-sizing: border-box;
  border-bottom: 1px solid #dfe6ec;
}
</style>