<template>
|
<div class="apply">
|
<EditForm
|
:inline="true"
|
:list="formList"
|
title="贷款信息"
|
@updateValue="updateValue"
|
ref="malApply"
|
:formType="isEdit ? 'info' : 'text'"
|
></EditForm>
|
</div>
|
</template>
|
<script>
|
// 贷款信息
|
import { mapState, mapMutations } from 'vuex'
|
import { dataSupplementInfo } from '@comprehensive/serve/public'
|
import EditForm from '../EditForm'
|
import {
|
creditBaseHeader,
|
creditCorporateHeader
|
} from '@comprehensive/utils/formHeaders'
|
import { malLoanInfoForm } from '@comprehensive/utils/formItems'
|
export default {
|
props: {
|
// 申请编号
|
info: {
|
type: Object,
|
default: () => ({})
|
}
|
},
|
components: {
|
EditForm
|
},
|
data() {
|
return {
|
detail: {},
|
valueInfo: {},
|
loading: false,
|
creditBaseHeader: [],
|
creditCorporateHeader: [],
|
formList: []
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
this.creditBaseHeader = [...creditBaseHeader]
|
this.creditCorporateHeader = [...creditCorporateHeader]
|
this.dataSupplementInfo()
|
},
|
async dataSupplementInfo() {
|
this.loading = true
|
const { applySerialNo } = this.$route.query
|
const res = await dataSupplementInfo({
|
applySerialNo
|
})
|
this.loading = false
|
const { result } = res
|
this.detail = result
|
this.SET_LoanInfo(result)
|
this.formList = malLoanInfoForm.map(item => ({
|
...item,
|
value: typeof result[item.name] !== 'undefined' ? result[item.name] : ''
|
}))
|
},
|
|
// 设置表单结果数据
|
setValueInfo(info = {}) {
|
this.valueInfo = info
|
},
|
|
// 更新数据
|
updateValue(value, item) {
|
let { name } = item
|
this.setOrGetFormInfo(name, { value })
|
},
|
|
// 更新表单数据或查找某项数据
|
setOrGetFormInfo(nameKey, newInfo) {
|
let { formList } = this
|
let index = formList.findIndex(({ name }) => name === nameKey)
|
let result = {}
|
if (!isNaN(index)) {
|
this.$set(this.formList, index, {
|
...formList[index],
|
...newInfo
|
})
|
result = this.formList[index]
|
}
|
if (typeof newInfo === 'undefined') {
|
return result
|
}
|
},
|
...mapMutations(['SET_LoanInfo'])
|
},
|
computed: {
|
...mapState({
|
isEdit: state => state.comprehensiveTransaction.isEdit
|
})
|
}
|
// watch: {
|
// serialNo() {
|
// this.init()
|
// }
|
// }
|
}
|
</script>
|