<template>
  <div class="app-container">
    <h3 style="margin-bottom: 10px;text-align: right;">
      <el-button type="primary"  @click="$router.back()">
        返回
      </el-button>
    </h3>

    <!-- 上方表格 -->
    <div style="margin-top: 50px">
      <el-row class="title_box">
        <el-col :span="24" style="font-weight: 700;"> 岗位责任制检查问题表 </el-col>
      </el-row>
      <el-row class="title_box">
        <el-col :span="2"> 检查时间 </el-col>
        <el-col :span="12"> {{ formatTime(dataObj.checkTime) }}</el-col>
        <el-col :span="4"> 检查部门 </el-col>
        <el-col :span="6"> {{ dataObj.name }} </el-col>
      </el-row>
      <el-row class="title_box" style="font-weight: 700;">
        <el-col :span="2"> 序号 </el-col>
        <el-col :span="3"> 问题编号 </el-col>
        <el-col :span="3"> 检查人员 </el-col>
        <el-col :span="3"> 问题级别 </el-col>
        <el-col :span="3"> 职责类别 </el-col>
        <el-col :span="2"> 问题属性 </el-col>
        <el-col :span="2"> 问题类型 </el-col>
        <el-col :span="6"> 问题描述 </el-col>
      </el-row>
      <el-row
        class="title_box"
        v-for="(item, index) in oneList"
        :key="index"
        type="flex"
      >
        <el-col :span="2"> {{ index + 1 }} </el-col>
        <el-col :span="3"> {{ item.problemNo }} </el-col>
        <el-col :span="3"> {{ item.checkUserName }} </el-col>
        <el-col :span="3"> {{ levelData[item.problemLevel] }} </el-col>
        <el-col :span="3"> {{ dutyData[item.dutyType] }} </el-col>
        <el-col :span="2">
          {{ problematicData[item.problemAttribute] }}
        </el-col>
        <el-col :span="2"> {{ questionData[item.problemCategory] }} </el-col>
        <el-col :span="6"> {{ item.description }} </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
import { postCheckedProblemList } from '@/api/allApi/index.js'
import moment from 'moment'
export default {
  name: 'PostCheckWebLookDialogPage',

  data() {
    return {
      oneList: [
        {
          bianhao: 'GJMF5-2023-Z000001',
          ren: '张三',
          ji: '重要',
          lei: '业务职责',
          shu: '完整性',
          bie: '工作标准问题',
          miao: '内容'
        }
      ],
      queryForm: {
        checkTime: '',
        checkedDeptId: '',
        pageNum: 1,
        pageSize: 1000
      },
      dataObj: {},
      levelData: {
        1: '一般',
        2: '重要'
      },
      dutyData: {
        1: '业务职责',
        2: '党建及党风廉政建设职责',
        3: '安全环保职责',
        4: '合规与保密职责',
        5: '任职资格与能力素质要求'
      },
      problematicData: {
        1: '完整性',
        2: '适宜性',
        3: '有效性'
      },
      questionData: {
        1: '职责权限问题',
        2: '工作内容问题',
        3: '工作标准问题',
        4: '考核奖励问题',
        5: '任职资格问题',
        6: '其他'
      }
    }
  },

  mounted() {
    console.log(this.$route.query, 9999)
    this.dataObj = this.$route.query
    this.$nextTick(()=>{
      this.getList()
    })
  },

  methods: {
    /** 查询岗位列表 */
    getList() {
      this.queryForm.checkTime = this.$route.query.checkTime
      this.queryForm.checkedDeptId = this.$route.query.checkedDeptId
      postCheckedProblemList(this.queryForm).then((res) => {
        this.oneList = res.rows
      })
    },
    formatTime(time) {
      return time?.split('T')[0]
    }
  }
}
</script>

<style lang="scss" scoped>
.title_box {
  .el-col {
    text-align: center;
    padding: 10px;
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cacaca;
  }
}
</style>