<template>
  <div class="offlineAuditOpinionHistory">
    <data-table :api="api" :handleFlag.sync="handleFlag" :queryParas="queryParas" :sourceData.sync="sourceData" :toolMenuFlag="false"
                :loadCount.sync="loadCount" operateBtnLayout="" :columns="columns" :loadPage="loadPage" ref="historyTable">
      <!-- 操作 -->
      <el-table-column :label="$t('common.operate')" align="center">
        <template slot-scope="scope">
          <auth-button class="iconCircle" icon="iconfont iconxiangqing" :title="$t('common.detail')" @click="showEdit(scope.row)"></auth-button>
        </template>
      </el-table-column>
    </data-table>
    <auditHistoryEdit :visible.sync="showDetail" :editModel="showModel" :form="auditHistoryForm"></auditHistoryEdit>
  </div>
</template>
<script>
import BasePage from '@/pages/basePage.js'
import { DataTable, authButton } from 'newepoch-components'
import auditHistoryEdit from '@/pages/dataAudit/certificateAudit/auditHistoryEdit.vue'
import projCommonFileApi from '@/api/dataAudit/projCommonFileApi.js'
export default {
  extends: new BasePage(),
  components: {
    DataTable,
    authButton,
    auditHistoryEdit
  },
  props: {
    assetInfoId: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      loadPage: 'getHistoryOpinion',
      queryParas: {
        pageIndex: 1,
        pageSize: 10,
        enterpriseId: ''
      },
      showDetail: false,
      showModel: '',
      auditHistoryForm: {},
      sourceData: [],
      columns: [
        // 审核项目
        {
          prop: 'fileName',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditProject
        },
        // 有效份数
        {
          prop: 'effectiveCopies',
          align: 'right',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.effectiveNumbers
        },
        // 审核意见
        {
          prop: 'auditOpinions',
          align: 'left',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditOpinion
        }
      ]
    }
  },
  computed: {
    api () {
      return projCommonFileApi.projComFile
    }
  },
  methods: {
    loadData (enterpriseId) {
      let _this = this
      _this.queryParas.enterpriseId = enterpriseId
      _this.$refs.historyTable.loadTableData()
    },
    showEdit (data) {
      // assetInfoId: this.assetInfoId
      this.auditHistoryForm = Object.assign({}, data)
      this.showModel = 'V'
      this.showDetail = true
    }
  }
}
</script>
