<template>
|
<div class="apply-info">
|
<SectionTitle :title="'基本信息'"></SectionTitle>
|
<CommForm
|
:inline="true"
|
:list="formList"
|
@updateValue="updateValue"
|
:ref="refId"
|
:formValues="formValues"
|
:formRules="formRules"
|
formType="info"
|
></CommForm>
|
<SectionTitle :title="'放款约束'"></SectionTitle>
|
<CommForm
|
:inline="true"
|
:list="dCFormList"
|
@updateValue="dcUpdateValue"
|
:ref="dcRefId"
|
:formValues="dcFormValues"
|
:formRules="dcFormRules"
|
formType="info"
|
></CommForm>
|
<!-- 确认字段后,添加CommForm系列数据 -->
|
<cardIdTable
|
:conf="conf"
|
:tableMark="tableMark"
|
@sendTableList="sendTableList"
|
></cardIdTable>
|
<div class="title" v-if="hideTabel">
|
<PersonPayTable
|
:conf="conf"
|
:tableMark="tableMark"
|
@sendTable="sendTable"
|
></PersonPayTable>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { mapMutations } from 'vuex'
|
import SectionTitle from '@/components/SectionTitle'
|
import CommForm from '@/components/CommForm'
|
import CommTable from '@/components/CommTable'
|
|
import PersonPayTable from '@/components/tabsLoad/PersonPayTable'
|
import cardIdTable from '@/components/tabsLoad/cardIdTable'
|
|
import loanOrgPutoutConstraintInfo from '@/controller/loanOrgPutoutConstraintInfo'
|
import loanOrgBankChargeList from '@/controller/loanOrgBankChargeList'
|
import queryCodeValueList from '@/controller/queryCodeValueList'
|
|
const normalButtons = [
|
{ text: '修改', prop: 'updateButton' },
|
{ text: '删除', prop: 'deleteButton' },
|
]
|
|
const addButtons = [
|
{ text: '取消', prop: 'cancleButton' },
|
{ text: '保存', prop: 'addButton' },
|
]
|
|
const editButtons = [
|
{ text: '取消', prop: 'cancleButton' },
|
{ text: '保存', prop: 'submitButton' },
|
]
|
export default {
|
components: {
|
SectionTitle,
|
CommForm,
|
CommTable,
|
PersonPayTable,
|
cardIdTable,
|
},
|
props: {
|
conf: {
|
type: Object,
|
default: () => ({}),
|
},
|
typeId: {
|
type: Number,
|
required: true,
|
},
|
},
|
data() {
|
return {
|
info: {},
|
query: {},
|
formList: [], //基本信息字段数据
|
tableHeader: [],
|
loanOrgPutoutConstraintSubmitListReqs: [], // 放款约束放款支持银行清单
|
loanOrgRepaymentChargeListSubmitReqs: [], // 放款约束代付收费标准
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
},
|
tableMark: 'loads',
|
total: 0,
|
list: [],
|
selectModel: null,
|
model: null,
|
disburseConstraintModel: null,
|
tableModel: null,
|
isDoingAdd: false,
|
serialNo: '',
|
dCFormList: [], //放款约束字段数据
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
const { $route, typeId, isEdit } = this
|
const { query } = $route
|
this.query = query
|
let tableModel = null
|
if (typeId === 1) {
|
this.model = loanOrgPutoutConstraintInfo(1)
|
this.disburseConstraintModel = loanOrgPutoutConstraintInfo(2)
|
this.tableModel = tableModel = loanOrgBankChargeList()
|
}
|
const tabList = tableModel.getTableList()
|
this.tableHeader = isEdit
|
? tabList
|
: tabList.filter(({ type }) => type !== 'buttons')
|
this.selectModel = queryCodeValueList()
|
this.getDetail()
|
},
|
|
async getDetail() {
|
const { query, model, disburseConstraintModel } = this
|
const { serialNo: loanOrgSerialNo = '' } = query
|
const info = await model.request({ loanOrgSerialNo })
|
if (info.serialNo) {
|
this.serialNo = info.serialNo
|
this.setLoadSerialNo(info.serialNo)
|
} else {
|
this.setLoadSerialNo('')
|
}
|
this.formList = model.getFormList(info)
|
this.dCFormList = disburseConstraintModel.getFormList(info)
|
this.setForm({ ...info })
|
},
|
|
setForm(info = {}) {
|
const { isEdit, formList, dCFormList } = this
|
if (isEdit) {
|
this.setSelectOptions()
|
} else {
|
this.formList = formList.map((item) => {
|
let { name, descName, value, type, attrs = [] } = item
|
if (type === 'select' && descName) {
|
if (attrs.includes('multiple')) {
|
// 多选处理
|
value = info[descName].join()
|
} else {
|
value = info[descName]
|
}
|
}
|
return {
|
...item,
|
type: 'input',
|
value,
|
attrs: [...attrs, 'readonly'],
|
rules: [],
|
}
|
})
|
this.dCFormList = dCFormList.map((item) => {
|
let { name, descName, value, type, attrs = [] } = item
|
|
if (type === 'select' && descName) {
|
if (attrs.includes('multiple')) {
|
// 多选处理
|
value = info[descName].join()
|
} else {
|
value = info[descName]
|
}
|
}
|
if (type === 'timeRange') {
|
if (name === 'blackCredit') {
|
value = `${info.blackStartCredit} - ${info.blackEndCredit}`
|
}
|
if (name === 'blackLoan') {
|
value = `${info.blackStartLoan} - ${info.blackEndLoan}`
|
}
|
}
|
return {
|
...item,
|
type: 'input',
|
value,
|
attrs: [...attrs, 'readonly'],
|
rules: [],
|
}
|
})
|
}
|
},
|
setSelectOptions() {
|
const { formList } = this
|
formList.forEach(({ name }) => {
|
if (
|
name === 'queryPutout' ||
|
name === 'cardCheck' ||
|
name === 'secondAccount' ||
|
name === 'isCreateSchedule'
|
) {
|
this.queryCodeValueList(name, { codeNo: 'YesNo' })
|
}
|
if (name === 'payFeeRule') {
|
this.queryCodeValueList(name, { codeNo: 'PayChargeStand' })
|
}
|
})
|
},
|
async queryCodeValueList(name, info = {}) {
|
const tempModel = queryCodeValueList()
|
const { list } = await tempModel.request(info)
|
this.updateValue(name, { options: list })
|
},
|
|
// 更新表单数据
|
updateValue(index, info) {
|
const { formList } = this
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index)
|
}
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index]
|
this.$set(formList, index, { ...preInfo, ...info })
|
}
|
},
|
// 放款约束 更新表单数据
|
dcUpdateValue(index, info) {
|
const { dCFormList } = this
|
if (isNaN(index)) {
|
// index is name
|
index = dCFormList.findIndex(({ name }) => name === index)
|
}
|
if (!isNaN(index) && index > -1) {
|
const preInfo = dCFormList[index]
|
this.$set(dCFormList, index, { ...preInfo, ...info })
|
}
|
},
|
|
submit() {
|
const {
|
refId,
|
dcRefId,
|
loanOrgPutoutConstraintSubmitListReqs,
|
loanOrgRepaymentChargeListSubmitReqs,
|
serialNo = '',
|
} = this
|
const values = this.$refs[refId].validate()
|
const dcValues = this.$refs[dcRefId].validate()
|
console.log('submit dcValues', dcValues)
|
if (values) {
|
this.setLoanOrgPutoutConstraintSubmitReq({
|
...values,
|
...dcValues,
|
serialNo,
|
loanOrgPutoutConstraintSubmitListReqs,
|
loanOrgRepaymentChargeListSubmitReqs,
|
})
|
}
|
},
|
|
sendTable(list) {
|
this.loanOrgRepaymentChargeListSubmitReqs = [...list]
|
},
|
|
sendTableList(list) {
|
this.loanOrgPutoutConstraintSubmitListReqs = [...list]
|
},
|
|
// 表格按钮事件处理
|
doAction(item, record, index) {
|
const { prop } = item
|
this.currentIndex = index
|
this.buttonProp = prop
|
this.tempRecord = record
|
if (prop === 'updateButton') {
|
this.updateRecord()
|
}
|
if (prop === 'deleteButton') {
|
this.isShowDel = true
|
}
|
if (prop === 'cancleButton') {
|
this.changeList()
|
}
|
if (prop === 'addButton') {
|
this.toSubmit(true)
|
}
|
if (prop === 'submitButton') {
|
this.toSubmit()
|
}
|
},
|
...mapMutations(['setLoanOrgPutoutConstraintSubmitReq', 'setLoadSerialNo']),
|
},
|
computed: {
|
isEdit() {
|
const { conf } = this
|
return conf.edit === 'Y'
|
},
|
refId() {
|
const { typeId } = this
|
return `repaymentForm${typeId}`
|
},
|
dcRefId() {
|
return `dcRefForm`
|
},
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
return model ? model.getFormValues(formList) : {}
|
},
|
formRules() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormRules(formList)
|
}
|
return {}
|
},
|
// 放款约束 表单信息
|
dcFormValues() {
|
const { disburseConstraintModel, dCFormList } = this
|
return disburseConstraintModel
|
? disburseConstraintModel.getFormValues(dCFormList)
|
: {}
|
},
|
dcFormRules() {
|
const { disburseConstraintModel, dCFormList } = this
|
if (disburseConstraintModel) {
|
return disburseConstraintModel.getFormRules(dCFormList)
|
}
|
return {}
|
},
|
hideTabel() {
|
const { formValues } = this
|
const { payFeeRule } = formValues
|
return payFeeRule === '01' || payFeeRule === '' ? false : true
|
},
|
},
|
}
|
</script>
|
|
<style scoped>
|
</style>
|