<template>
|
<div class="apply-info">
|
<div class="title" v-if="title">
|
<SectionTitle :title="title"></SectionTitle>
|
</div>
|
<CommForm
|
:inline="true"
|
:list="formList"
|
@updateValue="updateValue"
|
:ref="refId"
|
:formValues="formValues"
|
:formRules="formRules"
|
formType="info"
|
></CommForm>
|
|
<cardIdTable :conf="conf" :tableMark="tableMark" @sendTableList="sendTableList"></cardIdTable>
|
|
<LedgerOrgTable :conf="conf" :tableMark="tableMark" @sendTableList="sendLedgerList"></LedgerOrgTable>
|
|
<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 LedgerOrgTable from '@/components/tabsLoad/LedgerOrgTable'
|
|
import loanOrgRepaymentConstraintInfo from '@/controller/loanOrgRepaymentConstraintInfo'
|
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,
|
LedgerOrgTable
|
},
|
props: {
|
conf: {
|
type: Object,
|
default: () => ({})
|
},
|
typeId: {
|
type: Number,
|
required: true
|
}
|
},
|
data() {
|
return {
|
info: {},
|
query: {},
|
formList: [],
|
tableHeader: [],
|
loanOrgPaymentChargeListSubmitRsps: [], // 还款约束代扣收费标准列表
|
loanOrgPaymentConstraintSubmitListReqs: [], // 还款约束放款支持银行清单
|
loanOrgRepaymentLedgerReqs: [], // 还款约束-还款分账清单
|
tableMark: 'repeat',
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10
|
},
|
total: 0,
|
list: [],
|
selectModel: null,
|
model: null,
|
tableModel: null,
|
isDoingAdd: false,
|
repaymentSerialNo: '',
|
serialNo: ''
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
const { $route, typeId, isEdit } = this
|
const { query } = $route
|
this.query = query
|
let tableModel = null
|
if (typeId === 1) {
|
this.model = loanOrgRepaymentConstraintInfo()
|
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 } = this
|
const { serialNo: loanOrgSerialNo = '' } = query
|
const info = await model.request({ loanOrgSerialNo })
|
if (info.serialNo) {
|
this.serialNo = info.serialNo
|
this.setRepaymentSerialNo(info.serialNo)
|
} else {
|
this.setRepaymentSerialNo('')
|
}
|
this.formList = model.getFormList(info)
|
this.setForm({ ...info })
|
},
|
|
setForm(info = {}) {
|
const { isEdit, formList } = 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]
|
}
|
}
|
if (type === 'timeRange') {
|
if (name === 'blackRepayment') {
|
value = `${info.blackStartRepayment} - ${info.blackEndRepayment}`
|
}
|
}
|
return {
|
...item,
|
type: 'input',
|
value,
|
attrs: [...attrs, 'readonly'],
|
rules: []
|
}
|
})
|
}
|
},
|
setSelectOptions() {
|
const { formList } = this
|
formList.forEach(({ name }) => {
|
if (name === 'cardCheck') {
|
this.queryCodeValueList(name, { codeNo: 'YesNo' })
|
}
|
if (name === 'payFeeRule') {
|
this.queryCodeValueList(name, { codeNo: 'PayChargeStand' })
|
}
|
if (name === 'repaymentTogether') {
|
this.queryCodeValueList(name, { codeNo: 'RepaymentTogetherType' })
|
}
|
if (
|
name === 'sameDay' ||
|
name === 'compensatory' ||
|
name === 'buyBack'
|
) {
|
this.queryCodeValueList(name, { codeNo: 'SupportFlag' })
|
}
|
if (name === 'repaymentType') {
|
this.queryCodeValueList(name, { codeNo: 'SLRepaymentType' })
|
}
|
if (name === 'chargeType') {
|
this.queryCodeValueList(name, { codeNo: 'BankChargeType' })
|
}
|
if (name === 'compensatoryOrgId') {
|
this.queryCodeValueList(name, { codeNo: 'RepaymentAccessOrgType' })
|
}
|
if (name === 'accessOrgId') {
|
this.queryCodeValueList(name, { codeNo: 'RepaymentAccessOrgType' })
|
}
|
})
|
},
|
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 })
|
}
|
},
|
|
submit() {
|
const {
|
refId,
|
loanOrgPaymentConstraintSubmitListReqs,
|
loanOrgPaymentChargeListSubmitRsps,
|
serialNo
|
} = this
|
const values = this.$refs[refId].validate()
|
if (values) {
|
this.setLoanOrgRepaymentConstraintSubmitReq({
|
...values,
|
serialNo,
|
loanOrgPaymentConstraintSubmitListReqs,
|
loanOrgPaymentChargeListSubmitRsps
|
})
|
}
|
},
|
|
sendTableList(list) {
|
this.loanOrgPaymentConstraintSubmitListReqs = [...list]
|
},
|
|
sendTable(list) {
|
this.loanOrgPaymentChargeListSubmitRsps = [...list]
|
},
|
sendLedgerList(list) {
|
this.loanOrgRepaymentLedgerReqs = [...list]
|
this.setLoanOrgRepaymentLedgerReqs([...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([
|
'setRepaymentSerialNo',
|
'setLoanOrgRepaymentConstraintSubmitReq',
|
'setLoanOrgRepaymentLedgerReqs'
|
])
|
},
|
computed: {
|
isEdit() {
|
const { conf } = this
|
return conf.edit === 'Y'
|
},
|
title() {
|
const { typeId } = this
|
let tempTitle = ''
|
if (typeId === 1) {
|
tempTitle = '基本信息'
|
}
|
return tempTitle
|
},
|
refId() {
|
const { typeId } = this
|
return `repaymentForm${typeId}`
|
},
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
return model ? model.getFormValues(formList) : {}
|
},
|
formRules() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormRules(formList)
|
}
|
return {}
|
},
|
hideTabel() {
|
const { formValues } = this
|
const { chargeType } = formValues
|
return chargeType === '01' || chargeType === '' ? false : true
|
}
|
},
|
watch: {}
|
}
|
</script>
|
|
<style scoped>
|
</style>
|