<!-- 线上审核 -->
<template>
  <dialog-edit :visible.sync="dialogVisible" :title="$t('taskManage.todoTask.todoTaskTitle')" width="1480px" :appendToBody="true"
               :form="form" :api="api" :editModel="editModel" :footerBtnShow="false" :formRules="formRules" ref="dialog">
    <el-tabs v-model="activityName" type="card" @tab-click="tabClick">

      <div class="title">
        <span>{{$t('taskManage.todoTask.' + tabsTitle)}}</span>
      </div>
      <el-divider></el-divider>

      <!-- 付款确认书 -->
      <el-tab-pane :label="$t('taskManage.todoTask.paymentConfirmation')" name="paymentConfirmation">
        <paymentConfirmation :form.sync="form" :type="'online'"></paymentConfirmation>
      </el-tab-pane>

      <!-- 供应商信息 -->
      <el-tab-pane :label="$t('taskManage.todoTask.supplierInfo')" name="supplierInfo">
        <supplierInfo :form.sync="form" type="online" @clearValidate="clearValidate"  :formRules.sync="formRules"></supplierInfo>
      </el-tab-pane>

      <!-- 付款确认书信息变更 -->
      <el-tab-pane :label="$t('taskManage.todoTask.paymentConfirmationChange')" name="paymentConfirmationChange">
        <paymentConfirmationChange :form.sync="form"></paymentConfirmationChange>
      </el-tab-pane>

      <!-- 合同发票信息 -->
      <el-tab-pane :label="$t('taskManage.todoTask.contractInvoice')" name="contractInvoice">
        <contractInvoice :form.sync="form" :sourceData.sync="sourceData"></contractInvoice>
      </el-tab-pane>

      <!-- 线上历史审核意见 -->
      <el-tab-pane :label="$t('taskManage.todoTask.onlineAuditOpinionHistory')" name="onlineAuditOpinionHistory">
        <onlineAuditOpinionHistory :sourceData.sync="sourceData"></onlineAuditOpinionHistory>
      </el-tab-pane>
    </el-tabs>

    <div class="coll-title coll-body">
      <el-collapse v-model="activityNames">
        <el-collapse-item :title="$t('taskManage.todoTask.auditList')" name="auditList">
          <!-- 审核信息列表 -->
          <auditList sourceData.sync="sourceData"></auditList>
        </el-collapse-item>

        <el-collapse-item :title="$t('taskManage.todoTask.otherFile')" name="otherFile">
          <!-- 另需供应商或项目公司提供文件 -->
          <otherFile :sourceData="sourceData"></otherFile>
        </el-collapse-item>
      </el-collapse>
    </div>
    <template slot="footer">
      <auth-button :type="'primary'" size="" :label="$t('common.submit')" @click="submit"></auth-button>
      <auth-button size="" :label="$t('common.close')" @click="close"></auth-button>
    </template>
    <prompt :visible.sync="promptVisible" editModel="V" :form="item"></prompt>
  </dialog-edit>
</template>
<script>
import BaseEdit from '@/pages/baseEditPage.js'
import { DialogEdit, authButton } from 'newepoch-components'
import paymentConfirmation from '@/pages/dataAudit/taskManage/common/paymentConfirmation.vue'
import supplierInfo from '@/pages/dataAudit/taskManage/common/supplierInfo.vue'
import paymentConfirmationChange from '@/pages/dataAudit/taskManage/common/paymentConfirmationChange.vue'
import contractInvoice from '@/pages/dataAudit/taskManage/onlineAudit/contractInvoice.vue'
import onlineAuditOpinionHistory from '@/pages/dataAudit/taskManage/common/onlineAuditOpinionHistory.vue'
import auditList from '@/pages/dataAudit/taskManage/onlineAudit/auditList.vue'
import otherFile from '@/pages/dataAudit/taskManage/onlineAudit/otherFile.vue'
import prompt from '@/pages/dataAudit/taskManage/onlineAudit/prompt.vue'
export default {
  name: 'onlineAuditEdit',
  extends: new BaseEdit(),
  components: {
    DialogEdit,
    authButton,
    paymentConfirmation,
    supplierInfo,
    paymentConfirmationChange,
    contractInvoice,
    onlineAuditOpinionHistory,
    auditList,
    otherFile,
    prompt
  },
  data () {
    const { common, taskManage: { todoTask } } = this.$i18n.messages[this.$i18n.locale]
    return {
      item: {},
      sourceData: [],
      activityName: 'paymentConfirmation',
      activityNames: ['auditList', 'otherFile'],
      processActivityVisible: false,
      promptVisible: false,
      tabsTitle: 'paymentConfirmation',
      fileFlag: false,
      formRules: {
        threeCertificatesNumber: [{ required: false, trigger: 'blur', message: common.input + todoTask.threeCertificatesNumber }],
        businessLicenseNumber: [{ required: true, trigger: 'blur', message: common.input + todoTask.businessLicenseNumber }],
        organizationNumber: [{ required: true, trigger: 'blur', message: common.input + todoTask.organizationNumber }],
        contractName: [{ required: true, trigger: 'blur', message: common.input + todoTask.contractName1 }]
      }
    }
  },
  computed: {
    api () {
      return {}
    }
  },
  methods: {
    // todo 调用api查询
    tabClick (val) {
      this.tabsTitle = val.name
    },
    // 提交
    submit () {
      this.$refs['dialog'].$refs['editForm'].validate((valid) => {
        if (valid) {
          // todo调用api保存
        } else {
          this.error(this.$i18n.messages[this.$i18n.locale].message.formError)
        }
      })
      // 账户提醒
      // this.promptVisible = true
    },
    // 关闭
    close () {
      this.dialogVisible = false
    },
    fileAllDownload () {
      alert('开发中')
    },
    newestFileDownload () {
      alert('开发中')
    },
    activeProcess () {
      alert('开发中')
    },
    fullTextRetrieval () {
      alert('开发中')
    },
    showProcessActivity () {
      this.processActivityVisible = true
    },
    clearValidate () {
      this.$refs['dialog'].$refs['editForm'].clearValidate()
    }
  },
  watch: {}
}
</script>
<style scoped lang="scss" src="@/styles/dataAudit/taskManage/onlineTaskManageEdit.scss">
</style>
