<template>
|
<div class="apply-info">
|
<CommForm
|
:inline="true"
|
:list="tempFormList"
|
ref="basicForm"
|
title="基本信息"
|
@updateValue="updateValue"
|
:formValues="formValues"
|
:formRules="formRules"
|
:formType="formType"
|
>
|
<!-- formType="info" -->
|
</CommForm>
|
<!-- <div class="tab-form-buttons" v-if="isShowFooterBtn">
|
<p>
|
<el-button class="comm-button" @click="$router.go(-1)">返回</el-button>
|
</p>
|
<p>
|
<el-button class="comm-button" @click="resetForm">重置</el-button>
|
</p>
|
<p>
|
<el-button class="comm-button" @click="checkData">核对</el-button>
|
</p>
|
<p>
|
<el-button class="comm-button" type="primary" @click="submit" :disabled="isCheck">提交</el-button>
|
</p>
|
</div>-->
|
<Dialog
|
v-model="isShowDialog"
|
icon="succ"
|
iconText="提交成功"
|
:buttons="[{text: '确定', type: 'primary'}]"
|
@handleClick="commitSuccess"
|
></Dialog>
|
</div>
|
</template>
|
<script>
|
import { mapMutations } from 'vuex'
|
import CommForm from '@/components/CommForm'
|
import Dialog from '@/components/Dialog'
|
import voucherDetailCheck from '@/controller/voucherDetailCheck' // 核对
|
import voucherDetailSubmit from '@/controller/voucherDetailSubmit' // 提交
|
import voucherDetailDetails from '@/controller/voucherDetailDetails' // 详情
|
import voucherDetailDelete from '@/controller/voucherDetailDelete' // 详情
|
// 下拉options
|
import queryCodeValueList from '@/controller/queryCodeValueList' // 公共下拉列表接口
|
import queryCodeObject from '@/controller/queryCodeObject' // 公共下拉列表接口
|
|
export default {
|
components: {
|
CommForm,
|
Dialog
|
},
|
props: {
|
conf: {
|
type: Object,
|
default: () => ({})
|
}
|
},
|
data() {
|
return {
|
serialNo: '',
|
info: {},
|
query: {},
|
formList: [],
|
model: null,
|
submitModel: null,
|
detailsModel: null,
|
deleteModel: null,
|
isShowDialog: false,
|
isCheck: true,
|
formInfoFilterPay: [
|
// 支付通道回款表单需要被过滤的字段
|
'收款账户账号',
|
'收款账户户名',
|
'放款账户账号',
|
'放款账户户名'
|
],
|
formInfoFilterCusDev: [
|
// 客户线下转账&开发商贴息转账表单信息需要被过滤的字段
|
'支付公司名称',
|
'商户号',
|
'放款账户账号',
|
'放款账户户名'
|
],
|
formInfoFilterLoan: [
|
// 放款表单信息需要被过滤的字段
|
'支付公司名称',
|
'商户号',
|
'收款账户账号',
|
'收款账户户名'
|
],
|
formInfoFilterBaisc: [
|
// 基础字段
|
'支付公司名称',
|
'商户号',
|
'收款账户账号',
|
'收款账户户名',
|
'放款账户账号',
|
'放款账户户名'
|
]
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
init() {
|
let { query } = this.$route
|
this.query = query
|
// console.log(query)
|
query = {
|
...query,
|
serialNo: ''
|
}
|
// console.log(query)
|
let model = voucherDetailCheck(query)
|
this.model = model
|
// this.model = queryCustomerInfoChange()
|
this.checkModel = voucherDetailCheck()
|
this.submitModel = voucherDetailSubmit()
|
this.detailsModel = voucherDetailDetails()
|
this.deleteModel = voucherDetailDelete()
|
this.getDetail()
|
this.setSelectOptions()
|
},
|
async getDetail() {
|
const { query, model, detailsModel } = this
|
const { command, serialNo } = query
|
if (serialNo) {
|
const info = await detailsModel.request({
|
serialNo
|
})
|
info.checkType = info.checkTypeName
|
this.formList = model.getFormList(info)
|
} else {
|
this.formList = model.getFormList(command)
|
}
|
},
|
async setSelectOptions() {
|
const { formList } = this
|
// formList.forEach(({ name }) => {
|
formList.forEach(item => {
|
if (item.name === 'checkType') {
|
this.queryCodeValueList(item.name, { codeNo: 'VoucherType' })
|
}
|
// 支付通道回款表单信息-支付公司名称
|
// console.log(item.name)
|
if (item.label === '支付公司名称' && item.type === 'select') {
|
this.queryCodeObject(
|
item.name,
|
{ codeno: 'incomeAccountType' },
|
item.label
|
)
|
}
|
if (item.label === '放款账户账号' && item.type === 'select') {
|
// if ( item.label === '放款账户账号' && item.type === 'select' ) {
|
this.queryCodeObjectIdent(
|
item.name,
|
{
|
codeno: 'ContraryAccountType'
|
},
|
item.label
|
)
|
}
|
|
if (item.label === '收款账户账号' && item.type === 'select') {
|
this.queryCodeObjectIdent(
|
item.name,
|
{
|
codeno: 'ContraryAccountType'
|
},
|
item.label
|
)
|
}
|
})
|
},
|
|
// 获取select中options数据
|
async queryCodeValueList(name, info = {}) {
|
const tempModel = queryCodeValueList()
|
const { list } = await tempModel.request(info)
|
this.updateValue(name, { options: list })
|
},
|
|
// 获取select中options数据
|
async queryCodeObject(name, info = {}, label) {
|
const tempModel = queryCodeObject()
|
const { list } = await tempModel.request(info)
|
let listArray = []
|
list.forEach(item => {
|
let obj = {}
|
obj.label = item.itemname
|
obj.value = item.attribute4
|
listArray.push(obj)
|
})
|
this.updateValue(name, { options: listArray }, label)
|
},
|
|
async queryCodeObjectIdent(name, info = {}, label) {
|
const tempModel = queryCodeObject()
|
const { list } = await tempModel.request(info)
|
let listArray = []
|
list.forEach(item => {
|
let obj = {}
|
obj.label = item.attribute1
|
obj.value = item.attribute1
|
obj.tempValue = item.attribute3
|
listArray.push(obj)
|
})
|
this.updateValue(name, { options: listArray }, label)
|
},
|
|
// 重置表单 => 控制核对后的小类消失,基本信息可编辑
|
async resetForm() {
|
const { deleteModel, serialNo } = this
|
if (serialNo) {
|
await deleteModel.request({
|
serialNo
|
})
|
}
|
this.isCheck = true
|
this.$emit('showCheck', true) // 按钮控制
|
const { model } = this
|
this.serialNo = ''
|
this.setSerialNo(this.serialNo)
|
this.setBasicInfo({})
|
this.formList = model.getFormList()
|
this.setSelectOptions()
|
},
|
|
// 核对 => 表单不可编辑,显示后面的小类信息
|
// 测试用
|
// async checkData() {
|
// this.isCheck = false
|
// this.serialNo = '201911051637502300597Y3M250000eb'
|
// this.$emit('showCheck', false)
|
// this.setSerialNo(this.serialNo)
|
// },
|
|
// 核对 => 表单不可编辑,显示后面的小类信息
|
async checkData() {
|
const { checkModel } = this
|
// console.log(this.formList)
|
const values = this.$refs.basicForm.validate()
|
// console.log(values)
|
// if (values) {
|
// try {
|
// const checkRes = await checkModel.request({
|
// ...values
|
// })
|
// const { serialNo } = checkRes
|
// this.serialNo = serialNo
|
// this.$emit('showCheck', false)
|
// this.setSerialNo(serialNo)
|
// this.setBasicInfo(checkRes)
|
// this.isCheck = false
|
// } catch (error) {
|
// this.$emit('showCheck', true)
|
// console.log(error)
|
// }
|
// } else {
|
// this.$message.warning('当前页面有数据未输入!')
|
// }
|
},
|
// 提交 => 初始不可点击/核对成功后科点击提交
|
async submit() {
|
const { submitModel, serialNo } = this
|
await submitModel.request({
|
serialNo
|
})
|
this.setSerialNo('')
|
this.$emit('showCheck', true) // 按钮控制
|
this.isShowDialog = true
|
},
|
|
// 提交成功后返回原列表页
|
commitSuccess() {
|
this.isShowDialog = false
|
this.$router.go(-1)
|
},
|
|
//
|
// setFormList() {
|
// const {
|
// formList,
|
// formInfoFilterPay,
|
// formInfoFilterCusDev,
|
// formInfoFilterLoan,
|
// formInfoFilterBaisc
|
// } = this
|
// const checkTypeIndex = formList.findIndex(
|
// item => item.name === 'checkType'
|
// )
|
// let dataList = null
|
// const { value } = formList[checkTypeIndex]
|
// if (value === 'TD') {
|
// dataList = formList.filter(
|
// ({ label }) => !formInfoFilterPay.includes(label)
|
// )
|
// this.queryCodeObject('institution', { codeno: 'incomeAccountType' }, '放款账户账号')
|
// } else if (value === 'KHZK' || value === 'KFSZK') {
|
// dataList = formList.filter(
|
// ({ label }) => !formInfoFilterCusDev.includes(label)
|
// )
|
// } else if (value === 'FK') {
|
// dataList = formList.filter(
|
// ({ label }) => !formInfoFilterLoan.includes(label)
|
// )
|
// } else {
|
// dataList = formList.filter(
|
// ({ label }) => !formInfoFilterBaisc.includes(label)
|
// )
|
// }
|
// // this.formList = dataList
|
// return dataList
|
// },
|
// 更新表单数据
|
updateValue(index, info, labelName = '') {
|
const { formList } = this
|
|
// const { value } = formList[index]
|
// console.log(index)
|
if (isNaN(index)) {
|
// index is name
|
index = formList.findIndex(({ name }) => name === index)
|
if (labelName) {
|
index = formList.findIndex(({ label }) => label === labelName)
|
}
|
}
|
if (!isNaN(index) && index > -1) {
|
const preInfo = formList[index]
|
this.$set(formList, index, { ...preInfo, ...info })
|
}
|
|
// 联动处理
|
// console.log(index)
|
// if (index === 3 && info.name === 'identifier') {
|
// const { options, value } = info
|
// // console.log(value)
|
// const institutionIndex = formList.findIndex(
|
// item => item.name === 'institution'
|
// )
|
// const targetIndex = options.findIndex(({ label }) => label === value)
|
// if (institutionIndex > -1) {
|
// if (value) {
|
// const { tempValue } = options[targetIndex]
|
// this.tempFormList[institutionIndex].value = tempValue
|
// } else {
|
// this.tempFormList[institutionIndex].value = ''
|
// }
|
// }
|
// }
|
},
|
...mapMutations(['setSerialNo', 'setBasicInfo'])
|
},
|
computed: {
|
// 表单值信息
|
formValues() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormValues(formList)
|
}
|
return {}
|
},
|
formRules() {
|
const { model, formList } = this
|
if (model) {
|
return model.getFormRules(formList)
|
}
|
return {}
|
},
|
tempFormList() {
|
let {
|
isCheck,
|
formList,
|
formInfoFilterPay,
|
formInfoFilterCusDev,
|
formInfoFilterLoan,
|
formInfoFilterBaisc
|
} = this
|
let tempList = [...formList]
|
const checkTypeIndex = formList.findIndex(
|
item => item.name === 'checkType'
|
)
|
if (isCheck) {
|
// const dataList = this.setFormList()
|
if (checkTypeIndex > -1) {
|
const { value } = formList[checkTypeIndex]
|
if (value === 'TD') {
|
tempList.map(item => {
|
if (formInfoFilterPay.includes(item.label)) {
|
item.value = ''
|
}
|
})
|
tempList = tempList.filter(
|
({ label }) => !formInfoFilterPay.includes(label)
|
)
|
} else if (value === 'KHZK' || value === 'KFSZK') {
|
tempList.map(item => {
|
if (formInfoFilterCusDev.includes(item.label)) {
|
item.value = ''
|
}
|
})
|
tempList = tempList.filter(
|
({ label }) => !formInfoFilterCusDev.includes(label)
|
)
|
} else if (value === 'FK') {
|
tempList.map(item => {
|
if (formInfoFilterLoan.includes(item.label)) {
|
item.value = ''
|
}
|
})
|
tempList = tempList.filter(
|
({ label }) => !formInfoFilterLoan.includes(label)
|
)
|
console.log(tempList)
|
} else {
|
tempList.map(item => {
|
if (formInfoFilterBaisc.includes(item.label)) {
|
item.value = ''
|
}
|
})
|
tempList = tempList.filter(
|
({ label }) => !formInfoFilterBaisc.includes(label)
|
)
|
}
|
}
|
return tempList
|
} else {
|
tempList.map(item => {
|
if (item.type === 'select' || item.type === 'daterange') {
|
item.attrs = [...item.attrs, 'disabled']
|
} else {
|
if (item.attrs) {
|
item.attrs =
|
item.attrs.indexOf('readonly') > -1
|
? item.attrs
|
: [...item.attrs, 'readonly']
|
} else {
|
item.attrs = ['readonly']
|
}
|
}
|
item.rules = []
|
})
|
return tempList
|
}
|
},
|
formType() {
|
const { query } = this.$route
|
const { isApplyPhase } = query
|
if (isApplyPhase === 2) {
|
return 'text'
|
} else {
|
return ''
|
}
|
},
|
isShowFooterBtn() {
|
const { isApplyPhase } = this.$route.query
|
if (isApplyPhase === 2) {
|
return false
|
} else {
|
return true
|
}
|
}
|
},
|
watch: {
|
$route() {
|
const { transLogSerialno } = this.$route.query
|
if (transLogSerialno) {
|
this.init()
|
}
|
}
|
// isCheck(val) {
|
// const { formList } = this
|
// if (!val) {
|
// formList.map(item => {
|
// if (item.attrs) {
|
// item.attrs =
|
// item.attrs.indexOf('readonly') > -1
|
// ? item.attrs
|
// : [...item.attrs, 'readonly']
|
// } else {
|
// item.attrs = ['readonly']
|
// }
|
// })
|
// }
|
// }
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.apply-info {
|
}
|
.tab-form-buttons {
|
display: flex;
|
justify-content: center;
|
padding: 20px 0 30px 0;
|
& p {
|
margin: 0 40px 0 0;
|
}
|
& p:last-child {
|
margin-right: 0;
|
}
|
}
|
</style>
|