<template>
 <div>
   <el-form ref="form" :model="form" label-width="100px">
     <headerTitle title="基本信息"></headerTitle>
     <el-row :gutter="12">
       <el-col :span="12">
         <el-form-item
           label="申请部门："
           prop="applyDeptId"

         >
           {{ form.applyDeptName }}
         </el-form-item>
       </el-col>
       <el-col :span="12">
         <el-form-item
           label="申请人："
           prop="applyUserId"

         >
           {{ form.applyUserName }}
         </el-form-item>
       </el-col>
     </el-row>
     <el-row :gutter="12">
       <el-col :span="12">
         <el-form-item
           label="费用类型："
           prop="feeTypeId"

         >
           {{ form.feeTypeName }}
         </el-form-item>
       </el-col>
       <el-col :span="12">
         <el-form-item
           label="金额："
           prop="amount"
         >
           {{ form.amount }}
         </el-form-item>
       </el-col>
     </el-row>
     <el-row :gutter="12">
       <el-col :span="12">
         <el-form-item
           label="会计科目："
         >
           {{ form.accountingSubjectName }}
         </el-form-item>
       </el-col>
       <el-col :span="12">
         <el-form-item
           label="备注：">
           {{ form.remark }}
         </el-form-item>
       </el-col>
     </el-row>
     <el-row :gutter="12">
       <el-col :span="12">
         <el-form-item prop="" 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-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>
