<!-- 线下审核本次审核信息 -->
<template>
  <div class="table-form">
    <data-table :handleFlag.sync="handleFlag" :showPage="false" :queryParas="queryParas"
                :sourceData.sync="sourceData" :selectedRows.sync="selectedRows" :menuFlag="true"
                :loadCount.sync="loadCount" :columns="columns" operateBtnLayout="">
      <template slot="headButton">
        <div class="headButton">
          <auth-button type="primary" size="medium" icon="iconfont iconzancun"
                       :label="$t('common.staging')" @click="tempSave"></auth-button>
          <auth-button type="primary" size="medium" icon="iconfont iconxiazai12"
                       :label="$t('taskManage.todoTask.fileAllDownload')" @click="fileAllDownload"></auth-button>
          <auth-button type="primary" size="medium" icon="iconfont iconfuzhi1"
                       :label="$t('taskManage.todoTask.copyLastAuditOpinion')" @click="copy"></auth-button>
        </div>
      </template>

      <!-- 本次有效份数 -->
      <template slot="effectiveNumber" slot-scope="scope">
        <el-form-item v-if="true" label-width="0">
          <el-input v-model.trim="scope.data.row.effectiveNumber" :placeholder="$t('common.pleaseInput')"></el-input>
        </el-form-item>
        <spam v-else>{{scope.data.row.effectiveNumber}}</spam>
      </template>

      <!-- 扫描件是否有效 -->
      <template slot="effectiveScan" slot-scope="scope">
        <el-form-item v-if="true" label-width="0">
          <select-dictionary v-model="scope.data.row.effectiveScan" dictTypeCode="ZDZD0024"></select-dictionary>
        </el-form-item>
        <span v-else>{{scope.data.row.effectiveScan}}</span>
      </template>

      <!-- 是否另需扫描件 -->
      <template slot="otherScanhead" slot-scope="scope">
        {{scope.data.column.label}}
        <select-dictionary size="mini" class="table_head_dict" v-model="search" dictTypeCode="ZDZD0024"></select-dictionary>
      </template>
      <template slot="otherScan" slot-scope="scope">
        <el-form-item v-if="true" label-width="0">
          <select-dictionary v-model="scope.data.row.otherScan" dictTypeCode="ZDZD0024"></select-dictionary>
        </el-form-item>
        <span v-else>{{scope.data.row.otherScan}}</span>
      </template>

      <!-- 审核意见 -->
      <template slot="auditOpinion" slot-scope="scope">
        <el-input v-model.trim="scope.data.row.auditOpinion" :placeholder="$t('taskManage.todoTask.auditOpinionMsg')"></el-input>
      </template>

      <!-- 操作 -->
      <el-table-column :label="$t('common.operate')" align="center" fixed="right" width="150px">
        <template slot-scope="scope">
          <div>
            <btn-upload :uploadApi="uploadApi" :classType="true" :fileID="scope.row.fileId" :openPerms="false"></btn-upload>
            <btn-download :openPerms="false" v-if="!UtilJs.isEmpty(scope.row.fileId)" :fileID="scope.row.fileId"></btn-download>
            <auth-button class="iconCircleDel" icon="iconfont iconjian" v-if="!UtilJs.isEmpty(scope.row.fileId)" :title="$t('common.del')" @click="del"></auth-button>
          </div>
        </template>
      </el-table-column>
      <!-- 显示总数项 -->
      <template slot="paginationLeft">
        <span>{{$t('common.viewTip1')}}{{startNum}}{{$t('common.viewTip2')}}{{endNum}}{{$t('common.viewTip3')}}{{endNum}}{{$t('common.viewTip4')}}</span>
      </template>
    </data-table>
  </div>
</template>
<script>
import BasePage from '@/pages/basePage.js'
import { DataTable, authButton, btnUpload, btnDownload, SelectDictionary } from 'newepoch-components'
import * as format from '@/filters/index'
import { UPLOAD_API } from '@/constant.js'
// import taskManageApi from '@/api/dataAudit/taskManageApi.js'
export default {
  extends: new BasePage(),
  components: {
    DataTable,
    authButton,
    btnUpload,
    btnDownload,
    SelectDictionary
  },
  props: {
    auditOfflineInfoId: {
      type: String,
      default: ''
    },
    type: {
      type: String,
      default: function () {
        return 'offline'
      }
    },
    sourceData: {
      type: Array,
      default: () => [
        {
          auditFile: '进度款申请书',
          neededNumber: '30',
          existNumber: '20',
          scan: '否',
          receivedNumber: '10',
          effectiveScan: '',
          fileId: ''
        },
        {
          auditFile: '供应商营业执照',
          neededNumber: '30',
          existNumber: '20',
          scan: '否',
          receivedNumber: '—',
          effectiveScan: '',
          fileId: '1'
        }
      ]
    }
  },
  data () {
    return {
      startNum: 0,
      endNum: 0,
      search: '',
      uploadApi: UPLOAD_API,
      columns: [
        // 审核文件名称
        {
          prop: 'auditFile',
          align: 'left',
          width: '200px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditFile
        },
        // 需求份数
        {
          prop: 'neededNumber',
          align: 'right',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.neededNumber
        },
        // 已有份数
        {
          prop: 'existNumber',
          align: 'right',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.existNumber
        },
        // 是否扫描件
        {
          prop: 'scan',
          align: 'center',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.scan,
          format: (row) => { return format.formatDict(row.scan, '') }
        },
        // 本次接收份数
        {
          prop: 'receivedNumber',
          align: 'right',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.receivedNumber
        },
        // 本次有效份数
        {
          prop: 'effectiveNumber',
          align: 'right',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.effectiveNumber,
          slot: true
        },
        // 扫描件是否有效
        {
          prop: 'effectiveScan',
          align: 'center',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.effectiveScan,
          slot: true
        },
        // 是否另需扫描件
        {
          prop: 'otherScan',
          align: 'center',
          width: '150px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.otherScan,
          headslot: true,
          slot: true
        },
        // 审核意见
        {
          prop: 'auditOpinion',
          align: 'left',
          width: '250px',
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.auditOpinion,
          slot: true
        }
      ]
    }
  },
  methods: {
    tempSave () {},
    copy () {
      // let _this = this
      // taskManageApi.offLine.getPreviousAudit({ auditOfflineInfoId: _this.auditOfflineInfoId })
    },
    del () {},
    chooseFile () {},
    // 附件一键下载
    fileAllDownload () {},
    // 上传文件
    importSuccess () {}
  }
}
</script>
<style scoped lang="scss" src="@/styles/dataAudit/taskManage/auditList.scss">
</style>
