<template>
  <!-- 任务审核记录 -->
  <div class="auditRecords">
    <el-dialog title="查看审核记录" :visible.sync="dialogVisible" width="1000px" :before-close="handleClose" :append-to-body="true"
      :close-on-click-modal="false">
      <el-table :data="tableData" style="width: 100%;" border header-row-class-name="custom-table-header"
        @sort-change="sortChange">
        <el-table-column label="#" align="center" width="60px">
          <template slot-scope="scope">
            <div>
              {{ (queryParams.current - 1) * queryParams.size + scope.$index + 1 }}
            </div>
          </template>
        </el-table-column>

        <el-table-column v-for="item in columnList2" :key="item.value" :prop="item.value"
          :render-header="$commonJS.renderHeaderMethods" :label="item.name" sortable="custom" align="center">
          <template slot-scope="scope">
            <div v-html="$commonJS.getColumnData(scope.row, item)"></div>
          </template>
        </el-table-column>
        
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleClose">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { column } from '../mixins/index2'
export default {
  mixins: [column],
  data() {
    return {
      // 审核记录数据
      tableData: [],
      dialogVisible: false,
      // 审核记录分页信息
      queryParams: {
        current: 1,
        size: 10,
        total: 0,
      },
      // 排序
      sort:[{ "orderBy": "createTime", "orderType": 1 }],
    }
  },
  mounted() {

  },
  methods: {
    //排序
    sortChange({ column, prop, order }) {
      //如需要多个字段排序，则不需要清空
      var params = {
        sort: this.sort,
        column,
        prop,
        order,
      }
      this.sort = this.$commonJS.getSortData(params)
      this.queryParams.current = 1
      this.getList()
    },
    getList(row) {
      let params = {
        taskId: row.id
      }
      this.$api.queryAuditHistory(params).then(res => {
        if (res.code == 200) {
          // this.detailsMessage = res.data.projectTaskVO//分配任务信息
          // this.tableData = res.data.systemFileList//文件
          for (let i = 0; i < res.data.auditHistoryVOS.length ; i++){
            if (res.data.auditHistoryVOS[i].taskHandleResultVO) {
              this.tableData.push(res.data.auditHistoryVOS[i].taskHandleResultVO)
            }
          }
        }
      })
    },
    // 打开弹窗
    open(row) {
      this.getList(row)
      this.dialogVisible = true
    },
    handleClose() {
      this.dialogVisible = false
    },
    // 分页查询
    handleCurrentChange(val) {
      this.queryParams.current = val
      this.getList()
    },

  },
}
</script>

<style lang="scss" scoped></style>