<template>
  <dialog-edit :visible.sync="dialogVisible" :title="$t('taskManage.todoTask.auditHistoryTitle')" width="1480px"
               :form="form" :api="api" :editModel="editModel" :append-to-body="true">
    <dym-form :componentList="auditHistoryList" :formValue="form"></dym-form>
    <data-table :api="api" :loadPage="loadPage" :queryParas="queryParas" :sourceData.sync="sourceData"
                operateBtnLayout="" :columns="auditHistoryColumns" ref="detailTable">
    </data-table>
  </dialog-edit>
</template>
<script>
import BaseEdit from '@/pages/baseEditPage.js'
import { DialogEdit, DataTable, dymForm } from 'newepoch-components'
import taskManageApi from '@/api/dataAudit/taskManageApi.js'
import * as format from '@/filters/index'
export default {
  name: 'auditHistoryEdit',
  extends: new BaseEdit(),
  components: {
    DialogEdit,
    DataTable,
    dymForm
  },
  data () {
    return {
      loadPage: 'getHistoryDetail',
      sourceData: [],
      queryParas: {
        pageIndex: 1,
        pageSize: 10,
        assetInfoId: '',
        fileCode: ''
      },
      auditHistoryList: [
        // 文件名
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.file,
          value: 'fileName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '70px',
          prop: 'fileName'
        }
      ],
      auditHistoryColumns: [
        // 审核人
        {
          prop: 'auditorName',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditPerson
        },
        // 审核时间
        {
          prop: 'auditTime',
          align: 'center',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditDate,
          format: (row) => { return format.formatDatetime(row.auditTime) }
        },
        // 审核份数
        {
          prop: 'effectiveNumber',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditNumber
        },
        // 审核意见
        {
          prop: 'auditOpinions',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditOpinion
        }
      ]
    }
  },
  computed: {
    api () {
      return taskManageApi.offLine
    }
  },
  methods: {},
  watch: {
    visible (val) {
      let _this = this
      if (val) {
        _this.$nextTick(() => {
          _this.queryParas.assetInfoId = _this.form.assetInfoId
          _this.queryParas.fileCode = _this.form.fileCode
          _this.$refs.detailTable.loadTableData()
        })
      }
    }
  }
}
</script>
