<template>
 <div>
   <el-form ref="form" class="el-form-box" :model="form" label-width="100px">
     <headerTitle title="基本信息"></headerTitle>
     <el-row >
       <el-col :span="8">
         <el-form-item
           label="单据类型"
           prop="documentType">
           <dict-selection dict-name="单据类型" v-model="form.documentType" disabled
           ></dict-selection>
         </el-form-item>
       </el-col>
       <el-col :span="8">
         <el-form-item
           label="申请部门"
           prop="applyDeptId"
         >
           <el-input v-model="form.applyDeptName" disabled></el-input>
         </el-form-item>
       </el-col>
       <el-col :span="8">
         <el-form-item
           label="申请人"
           prop="applyUserId"
         >
           <el-input v-model="form.applyUserName" disabled></el-input>

         </el-form-item>
       </el-col>
     </el-row>
     <el-row>
       <el-col :span="8">
         <el-form-item
           label="收款名称"
         >
           <el-input v-model="form.collectionName" clearable disabled></el-input>
         </el-form-item>
       </el-col>
       <el-col :span="8">
         <el-form-item
           label="开户行"
         >
           <el-input v-model="form.bankAccount" disabled></el-input>
         </el-form-item>
       </el-col>
       <el-col :span="8">
         <el-form-item
           label="账户"
         >
           <el-input v-model="form.bankName" disabled></el-input>
         </el-form-item>
       </el-col>
       <!--        <el-col :span="8">-->
       <!--          <el-form-item-->
       <!--            label="费用类型"-->
       <!--            prop="feeTypeId"-->
       <!--           -->
       <!--          >-->
       <!--            <ele-tree-select-->
       <!--              clearable-->
       <!--              filterable-->
       <!--              ref="feeTypeTree"-->
       <!--              :data="feeTypeList"-->
       <!--              v-model="form.feeTypeId"-->
       <!--              valueKey="id"-->
       <!--              labelKey="name"-->
       <!--              placeholder="请选择"-->
       <!--              @change="changeFeeTypeInfo"-->
       <!--              default-expand-all-->
       <!--            />-->
       <!--          </el-form-item>-->
       <!--        </el-col>-->
       <!--        <el-col :span="8">-->
       <!--          <el-form-item-->
       <!--            label="金额"-->
       <!--            prop="amount"-->
       <!--           >-->
       <!--            <el-input-number v-model="form.amount" :precision="2" :controls="false" style="width: 100%"-->
       <!--                             :min="0"></el-input-number>-->
       <!--          </el-form-item>-->
       <!--        </el-col>-->
     </el-row>
     <!--        <el-col :span="12">-->
     <!--          <el-form-item-->
     <!--            label="会计科目"-->
     <!--            prop="accountingSubjectId"-->
     <!--           -->
     <!--          >-->
     <!--            <ele-tree-select-->
     <!--              clearable-->
     <!--              filterable-->
     <!--              ref="treeSelect"-->
     <!--              :data="accountingSubjectList"-->
     <!--              v-model="form.accountingSubjectId"-->
     <!--              valueKey="id"-->
     <!--              labelKey="name"-->
     <!--              placeholder="请选择"-->
     <!--              @change="changeSubjectInfo"-->
     <!--              default-expand-all-->
     <!--            />-->
     <!--          </el-form-item>-->
     <!--        </el-col>-->

     <el-row>
       <el-col :span="8">
         <el-row style="display: flex;flex-direction: column">
           <el-col :span="24">
             <el-form-item
               label="金额"
             >
               <el-input v-model="form.amount" disabled></el-input>
             </el-form-item>
           </el-col>
<!--           <el-col :span="24">-->
<!--             <el-form-item-->
<!--               label="会计科目：">-->
<!--               <el-input v-model="form.accountingSubjectName" disabled></el-input>-->

<!--             </el-form-item>-->
<!--           </el-col>-->
           <el-col :span="24">
             <el-form-item prop="repliedFiles" label="附件">
               <el-link
                 v-if="form.files.length"
                 v-for="item in form.files"
                 type="primary"
                 :underline="false"
                 @click="downloadFile(item)">
                 {{ item.name }}
               </el-link>
             </el-form-item>
           </el-col>

         </el-row>
       </el-col>
       <el-col :span="16">
         <el-form-item
           label="备注"
         >
           <el-input :rows="3" v-model="form.remark" type="textarea" disabled></el-input>
         </el-form-item>
       </el-col>

     </el-row>
     <el-row>

     </el-row>
   </el-form>
   <headerTitle title="关联信息"></headerTitle>
   <fee-related-info-table ref="feeRelatedInfoTable" :dialogType="dialogType" v-if="form.link.length" :link.sync="form.link"></fee-related-info-table>
 </div>
</template>

<script>
import {getFile} from '@/api/system/file';
import dictMixins from '@/mixins/dictMixins';
import bpmDetail from '@/views/bpm/processInstance/detail.vue';
import fileUpload from "@/components/upload/fileUpload.vue";
import {getFeeApplyInfoAPI} from "@/api/bpm/components/financialManage/fee-manage/fee-application";
import feeRelatedInfoTable from "@/views/bpm/handleTask/components/financialManage/components/feeRelatedInfoTable.vue";

export default {
  mixins: [dictMixins],
  components: {
    fileUpload,
    bpmDetail,
    feeRelatedInfoTable
  },
  props:{
    businessId: {
      default: ''
    }
  },
  data() {
    return {
      title: '详情',
      dialogType: 'view',
      form: {},
    };
  },
  async created() {
    await this.getFeeApplyInfoInfo(this.businessId)
  },
  methods: {
    //获取详情
    async getFeeApplyInfoInfo(id) {
      this.form = await getFeeApplyInfoAPI(id)
    },
    downloadFile(file) {
      getFile({objectName: file.storePath}, file.name);
    },
  }
};
</script>

<style scoped lang="scss">
.ele-dialog-form {
  .el-form-item {
    margin-bottom: 10px;
  }
}

.headbox {
  display: flex;
  justify-content: flex-start;
  align-items: center;

  .amount {
    font-size: 14px;
    font-weight: bold;
    margin-right: 20px;
  }
}
</style>
