// 线上审核付款确认书信息
<template>
  <div>
    <dym-form :componentList="paymentConfirmationList" :formValue="dataForm"></dym-form>
    <div class="paymentConfirmationButton">
      <auth-button v-if="type === 'offline'" size="medium" type="primary" :label="$t('taskManage.todoTask.relevantFileDownload')" @click="relevantFileDownload"></auth-button>
      <auth-button v-if="type === 'offline'" size="medium" type="primary" :label="$t('taskManage.todoTask.downloadHandover')" @click="downloadHandover"></auth-button>
      <auth-button v-if="type === 'online'" size="medium" type="primary" :label="$t('taskManage.todoTask.fileAllDownload')" @click="fileAllDownload"></auth-button>
      <auth-button v-if="type === 'online'" size="medium" type="primary" :label="$t('taskManage.todoTask.newestFileDownload')" @click="newestFileDownload"></auth-button>
      <auth-button v-if="type === 'online'" size="medium" type="primary" :label="$t('taskManage.todoTask.fullTextRetrieval')" @click="fullTextRetrieval"></auth-button>
      <auth-button v-if="type === 'project'" size="medium" type="primary" :label="$t('taskManage.todoTask.eleSealFileDownload')" @click="eleSealFileDownload"></auth-button>
      <auth-button size="medium" type="primary" :label="$t('taskManage.todoTask.activeProcess')" @click="showEdit"></auth-button>
    </div>
    <processActivityEdit :visible.sync="showDetail" :editModel="editModel" :form="item"></processActivityEdit>
  </div>
</template>
<script>
import BasePage from '@/pages/basePage.js'
import { authButton, dymForm } from 'newepoch-components'
import processActivityEdit from '@/pages/dataAudit/taskManage/common/processActivityEdit.vue'
import taskManageApi from '@/api/dataAudit/taskManageApi.js'
import fileApi from '@/api/fileApi.js'
import { downFile } from '@/utils/devUtils.js'
import * as format from '@/filters/index'
export default {
  name: 'paymentConfirmation',
  extends: new BasePage(),
  components: {
    authButton,
    dymForm,
    processActivityEdit
  },
  props: {
    form: {
      type: Object,
      default: function () {
        return {}
      }
    },
    type: {
      type: String,
      default: function () {
        return ''
      }
    }
  },
  data () {
    return {
      dataForm: {},
      showDetail: false,
      editModel: '',
      item: {},
      paymentConfirmationList: [
        // 核心企业
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.coreEnterprise,
          value: 'coreEnterpriseName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '160px',
          prop: 'coreEnterpriseName'
        },
        // 付款确认书编号
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.payCode,
          value: 'assetCode',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '125px',
          prop: 'assetCode'
        },
        // 供应商名称
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.supplierName,
          value: 'creditor',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '110px',
          prop: 'creditor'
        },
        // 计划管理人
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.planningManagerName,
          value: 'planningManagerName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '160px',
          prop: 'planningManagerName'
        },
        // 项目公司名称
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.projectCompanyName,
          value: 'projectContractName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '125px',
          prop: 'projectContractName'
        },
        // 收款人名称
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.payeeName,
          value: 'receiverName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '110px',
          prop: 'receiverName'
        },
        // 期数
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.periods,
          value: 'specialPlanPeriods',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '160px',
          prop: 'specialPlanPeriods'
        },
        // BIP编码
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.BIPCode,
          value: 'regionCode',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '125px',
          prop: 'regionCode'
        },
        // 收款人开户行
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.payeeBank,
          value: 'receiverBank',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '110px',
          prop: 'receiverBank'
        },
        // 客服专员
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.customerCommissioner,
          value: 'customerService',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '160px',
          prop: 'customerService'
        },
        // 业务助理
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.businessAssistant,
          value: 'businessAssistant',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '125px',
          prop: 'businessAssistant'
        },
        // 收款人银行账号
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.payeeBankAccount,
          value: 'receiverBankAccount',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '110px',
          prop: 'receiverBankAccount'
        },
        // 费率
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.rate,
          value: 'rate',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '160px',
          prop: 'rate'
        },
        // 商务合同名称
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.businessContractName,
          value: 'bussContractName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '125px',
          prop: 'bussContractName'
        },
        // 商务合同编号
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.businessContractNumber,
          value: 'bussContractCode',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '110px',
          prop: 'bussContractCode'
        },
        // 签约主体
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.signingBody,
          value: 'initialOwnersName',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '160px',
          prop: 'initialOwnersName'
        },
        // 账款到期日
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.endDate,
          value: 'dueDate',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '125px',
          prop: 'dueDate'
        },
        // 应收账款金额
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.accountsReceivable,
          value: 'factoringMoney',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '110px',
          prop: 'factoringMoney'
        },
        // 供应商盖章方式
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.supplierStampWay,
          value: 'creditorStampWay',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '160px',
          prop: 'creditorStampWay'
        },
        // 项目公司盖章方式
        {
          label: this.$i18n.messages[this.$i18n.locale].taskManage.todoTask.projectCompanyStampWay,
          value: 'debtorStampWay',
          disabled: true,
          componentName: 'el-input',
          cols: [24, 24, 24, 8],
          labelWidth: '125px',
          prop: 'debtorStampWay'
        }
      ]
    }
  },
  activated () {},
  methods: {
    loadData (auditOfflineInfoId) {
      let _this = this
      taskManageApi.offLine.getPayCodeInfo({ auditOfflineInfoId: auditOfflineInfoId }).then(res => {
        if (res && res.data) {
          _this.dataForm = Object.assign({}, res.data)
          _this.dataForm.dueDate = format.formatDate(_this.dataForm.dueDate)
          _this.dataForm.factoringMoney = format.toThousandFilter(_this.dataForm.factoringMoney)
          _this.dataForm.creditorStampWay = _this.dataForm.creditorStampWay === 0 ? '' : format.formatDict(_this.dataForm.creditorStampWay, 'ZD0081')
          _this.dataForm.debtorStampWay = _this.dataForm.debtorStampWay === 0 ? '' : format.formatDict(_this.dataForm.debtorStampWay, 'ZD0081')
        }
      })
    },
    // 附件一键下载 废弃
    fileAllDownload () {},
    // 最新文件下载 废弃
    newestFileDownload () {},
    // 查看活动流程信息 todo
    showEdit () {
      this.editModel = 'V'
      this.showDetail = true
    },
    // 全文检索 废弃
    fullTextRetrieval () {},
    // 生成下载交接表 todo
    downloadHandover () {},
    // 相关文件下载 todo
    relevantFileDownload () {
      // let _this = this
      let paras = {
        assetInfoId: '',
        auditType: 1,
        stampWay: ''
      }
      taskManageApi.offLine.downloadFile(paras).then(res => {
        if (res && res.data) {
          fileApi.file.batchDownload({ keyId: res.data }).then(fileRes => {
            downFile(fileRes)
          })
        }
      })
    },
    // 电子章文件下载 todo
    eleSealFileDownload () {}
  },
  watch: {
  }
}
</script>
<style scoped lang="scss" src="@/styles/dataAudit/taskManage/paymentConfirmation.scss">
</style>
