Commit 1f7ca662 by yuzhenWang

合并代码,做到了预约附件

parent 3f5ee310
...@@ -143,3 +143,11 @@ export function getInsuranceCompany(data) { ...@@ -143,3 +143,11 @@ export function getInsuranceCompany(data) {
method: 'post' method: 'post'
}) })
} }
// 获取保险险种列表
export function getInsuranceCategory(data) {
return request({
url: '/insurance/base/api/insuranceCategory/page',
data: data,
method: 'post'
})
}
...@@ -62,14 +62,14 @@ const fnaForm = [ ...@@ -62,14 +62,14 @@ const fnaForm = [
} }
], ],
data: [ data: [
{ // {
brokerName: '', // brokerName: '',
brokerGender: '', // brokerGender: '',
brokerNumber: '', // brokerNumber: '',
brokerTeam: '', // brokerTeam: '',
brokerRatio: '', // brokerRatio: '',
remark: '' // remark: ''
} // }
] ]
}, },
// 受供养人信息 // 受供养人信息
...@@ -105,10 +105,10 @@ const fnaForm = [ ...@@ -105,10 +105,10 @@ const fnaForm = [
} }
], ],
data: [ data: [
{ // {
policyholderRel: '', // policyholderRel: '',
dependantAge: '' // dependantAge: ''
} // }
] ]
}, },
// 已生效仍在缴费期的保单情况 // 已生效仍在缴费期的保单情况
...@@ -157,24 +157,24 @@ const fnaForm = [ ...@@ -157,24 +157,24 @@ const fnaForm = [
type: 'datePicker', type: 'datePicker',
placeholder: '请选择日期', placeholder: '请选择日期',
required: true required: true
} },
// 有重疾险才让填写 // 有重疾险才让填写
// {
// label: '保额',
// prop: 'sumInsured',
// type: 'inputNumber',
// placeholder: '请输入保额',
// required: true
// },
],
data: [
{ {
insurer: '', label: '保额(重疾险填写)',
insuranceType: '', prop: 'sumInsured',
sumInsured: '', type: 'inputNumber',
currency: '', placeholder: '请输入保额',
policyIssueDate: '' required: true
} }
],
data: [
// {
// insurer: '',
// insuranceType: '',
// sumInsured: '',
// currency: '',
// policyIssueDate: ''
// }
] ]
}, },
// 不动产信息 // 不动产信息
...@@ -225,18 +225,18 @@ const fnaForm = [ ...@@ -225,18 +225,18 @@ const fnaForm = [
} }
], ],
data: [ data: [
{ // {
propertyType: '', // propertyType: '',
address: '', // address: '',
marketValue: '', // marketValue: '',
currency: '' // currency: ''
} // }
] ]
}, },
// 保费负担能力评估 // 保费负担能力评估
{ {
fatherTitle: '保费负担能力评估', fatherTitle: '保费负担能力评估',
type: 'object', keyType: 'Object',
key: 'premiumAffordability', key: 'premiumAffordability',
anchorKey: 'premiumAffordability', anchorKey: 'premiumAffordability',
showTable: false, showTable: false,
......
import { anchorKey } from 'element-plus/es/components/anchor/src/constants.mjs'
const productPlan = [ const productPlan = [
{ {
fatherTitle: '基础信息', fatherTitle: '基础信息',
...@@ -29,6 +27,7 @@ const productPlan = [ ...@@ -29,6 +27,7 @@ const productPlan = [
key: 'insuranceTypeName', key: 'insuranceTypeName',
domType: 'SearchSelect', domType: 'SearchSelect',
required: true, required: true,
maxLength: 30, maxLength: 30,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入',
...@@ -57,7 +56,6 @@ const productPlan = [ ...@@ -57,7 +56,6 @@ const productPlan = [
key: 'issueNumber', key: 'issueNumber',
domType: 'Select', domType: 'Select',
required: true, required: true,
disabled: false,
placeholder: '请选择', placeholder: '请选择',
dictType: 'issueNumber', dictType: 'issueNumber',
show: true, show: true,
...@@ -71,7 +69,7 @@ const productPlan = [ ...@@ -71,7 +69,7 @@ const productPlan = [
key: 'guaranteePeriod', key: 'guaranteePeriod',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'number',
required: true, required: false,
maxLength: 20, maxLength: 20,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入',
...@@ -95,21 +93,7 @@ const productPlan = [ ...@@ -95,21 +93,7 @@ const productPlan = [
sm: 12, //栅格布局份数 sm: 12, //栅格布局份数
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{
label: '保单额度(重疾)',
key: 'sumInsured',
domType: 'Input',
inputType: 'number',
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{ {
label: '付款频率', label: '付款频率',
key: 'paymentFrequency', key: 'paymentFrequency',
...@@ -251,36 +235,22 @@ const productPlan = [ ...@@ -251,36 +235,22 @@ const productPlan = [
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数 sm: 12, //栅格布局份数
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
},
{
label: '保单额度(重疾)',
key: 'sumInsured',
domType: 'Input',
inputType: 'number',
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: false,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
} }
// {
// label: '地区',
// key: 'region',
// domType: 'Input',
// inputType: 'text',
// required: false,
// maxLength: 20,
// disabled: true,
// placeholder: '请输入',
// show: true,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: '保单生效日',
// key: 'policyEffectiveDate',
// domType: 'DatePicker',
// required: false,
// disabled: false,
// placeholder: '请选择',
// show: false,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// }
] ]
}, },
//附加险 //附加险
...@@ -294,135 +264,53 @@ const productPlan = [ ...@@ -294,135 +264,53 @@ const productPlan = [
addChildren: true, addChildren: true,
addChildrenTxt: '新增附加险', addChildrenTxt: '新增附加险',
showTable: true, //是否展示表格 showTable: true, //是否展示表格
data: [ data: [],
// { columns: [
// id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识 {
// span: 24, //栅格布局份数 label: '产品名称',
// childTitle: '附加险', prop: 'productLaunchNameValue',
// deleteBtn: true, type: 'text'
// children: [ },
// { {
// label: '产品名称', label: '供款期数',
// key: 'addProductName', prop: 'issueNumber',
// domType: 'SearchSelect', type: 'text'
// required: true, },
// maxLength: 30, {
// disabled: false, label: '保障年期',
// placeholder: '请输入', prop: 'guaranteePeriod',
// show: true, type: 'text'
// labelWidth: '120px', //标签宽度 },
// sm: 12, //栅格布局份数 {
// labelPosition: 'top', //标签的位置 label: '保单币种',
// lg: 8 //栅格布局份数 prop: 'policyCurrency',
// }, type: 'text'
// { },
// label: '保额', {
// key: 'sumInsured', label: '保单额度',
// domType: 'Input', prop: 'sumInsured',
// inputType: 'number', type: 'text'
// required: true, },
// maxLength: 300, {
// disabled: false, label: '每期保费',
// placeholder: '请输入', prop: 'eachIssuePremium',
// show: true, type: 'text'
// labelPosition: 'top', //标签的位置 },
// labelWidth: '120px', //标签宽度 {
// sm: 12, //栅格布局份数 label: '保障级别',
// lg: 8 //栅格布局份数 prop: 'protectionLevel',
// }, type: 'text'
// { },
// label: '保费', {
// key: 'premium', label: '自付额',
// domType: 'Input', prop: 'deductibles',
// inputType: 'number', type: 'text'
// required: true, },
// maxLength: 300, {
// disabled: false, label: '附加保障',
// placeholder: '请输入', prop: 'additionalSafeguards',
// show: true, type: 'text'
// labelPosition: 'top', //标签的位置 }
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: '保障地区',
// key: 'guaranteeRegion',
// domType: 'Input',
// inputType: 'text',
// required: false,
// maxLength: 300,
// disabled: false,
// placeholder: '请输入',
// show: true,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: '货币',
// key: 'currency',
// domType: 'Select',
// inputType: 'text',
// required: false,
// maxLength: 300,
// disabled: false,
// placeholder: '请输入',
// show: true,
// dictType: 'bx_currency_type',
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: '等级',
// key: 'insuranceType',
// domType: 'Input',
// inputType: 'text',
// required: false,
// maxLength: 300,
// disabled: false,
// placeholder: '请输入',
// show: true,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: '自付额',
// key: 'deductibles',
// domType: 'Input',
// inputType: 'number',
// required: false,
// maxLength: 300,
// disabled: false,
// placeholder: '请输入',
// show: true,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: '附加保障',
// key: 'additionalSafeguards',
// domType: 'Input',
// inputType: 'textarea',
// required: false,
// maxLength: 300,
// disabled: false,
// placeholder: '请输入',
// show: true,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 24, //栅格布局份数
// lg: 24 //栅格布局份数
// }
// ]
// }
], ],
// 弹窗表单的配置 // 弹窗表单的配置
formItem: [ formItem: [
...@@ -499,7 +387,7 @@ const productPlan = [ ...@@ -499,7 +387,7 @@ const productPlan = [
maxLength: 300, maxLength: 300,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入',
show: true, show: false,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数 sm: 12, //栅格布局份数
......
const secondHolder = [ const secondHolder = [
// 基础信息
{ {
fatherTitle: '', fatherTitle: '是否有第二持有人',
type: 'object', keyType: 'Object', //用于表单收集值时,判断是数组还是对象
key: 'person', key: 'isSecond',
labelPosition: 'top', //标签的位置 anchorKey: 'isSecond',
showMoudle: true, //模块是否展示 showMoudle: true, //模块是否展示
// description: '证件信息至少填写一项', showTable: false, //是否展示表格
fatherRequired: true, //父级必填,代表个人资料这个模块有必填项
data: [
{
label: '是否有第二持有人',
key: 'isSecond',
domType: 'Select',
required: true,
disabled: false,
placeholder: '请选择',
dictType: 'sys_no_yes',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
}
]
},
//受益人
{
showMoudle: false, //模块是否展示
fatherTitle: '受益人',
keyType: 'Object', //用于表单收集值时,判断是数组还是对象
key: 'apiSecondHolderInfoDto',
anchorKey: 'apiSecondHolderInfoDto',
fatherRequired: true, //父级必填,代表个人资料这个模块有必填项
addChildren: true,
addChildrenTxt: '新增受益人',
showTable: false, //是否展示表格
data: [ data: [
{ {
label: '与受保人关系', label: '与受保人关系',
...@@ -23,30 +52,30 @@ const secondHolder = [ ...@@ -23,30 +52,30 @@ const secondHolder = [
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ {
label: '名字', label: '名字(中文)',
key: 'name', key: 'nameCn',
customerKey: 'name',
domType: 'Input', domType: 'Input',
unit: '历史客户',
unitColor: 'rgba(0, 82, 217, 1)',
inputType: 'text', inputType: 'text',
required: false, required: false,
maxLength: 20, maxLength: 15,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入2~6位汉字',
show: true, show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数 sm: 12, //栅格布局份数
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ {
label: '名字-英文', label: '姓名(拼音/英文)',
key: 'nameEn', key: 'namePyEn',
customerKey: 'firstNamePinyin',
showEn: true, //是否填写英文
domType: 'Input', domType: 'Input',
inputType: 'text', inputType: 'text',
required: false, required: false,
maxLength: 20, maxLength: 30,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入',
show: true, show: true,
...@@ -56,14 +85,13 @@ const secondHolder = [ ...@@ -56,14 +85,13 @@ const secondHolder = [
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ {
label: '性别', label: '证件类型',
key: 'gender', key: 'documentType',
customerKey: 'gender',
domType: 'Select', domType: 'Select',
required: false, required: false,
disabled: false, disabled: false,
placeholder: '请选择', placeholder: '请选择',
dictType: 'sys_gender', dictType: 'csf_id_type',
show: true, show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
...@@ -71,29 +99,29 @@ const secondHolder = [ ...@@ -71,29 +99,29 @@ const secondHolder = [
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ {
label: '出生日期', label: '证件号码',
key: 'birthTime', key: 'idNumber',
customerKey: 'birthdate', domType: 'Input',
domType: 'DatePicker', inputType: 'text',
required: false, required: false,
maxLength: 20,
disabled: false, disabled: false,
placeholder: '请选择', placeholder: '请输入',
show: true, show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数 sm: 12, //栅格布局份数
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ {
label: '年龄', label: '性别',
key: 'age', key: 'gender',
customerKey: 'age', domType: 'Select',
domType: 'Input',
inputType: 'number',
required: false, required: false,
maxLength: 20, disabled: false,
disabled: true, placeholder: '请选择',
placeholder: '请输入', dictType: 'sys_gender',
show: true, show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
...@@ -101,30 +129,28 @@ const secondHolder = [ ...@@ -101,30 +129,28 @@ const secondHolder = [
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ {
label: '证件类型', label: '生日',
key: 'documentType', key: 'birthday',
customerKey: 'idType', domType: 'DatePicker',
domType: 'Select',
required: false, required: false,
disabled: false, disabled: false,
placeholder: '请选择', placeholder: '请选择',
dictType: 'csf_id_type',
show: true, show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数 sm: 12, //栅格布局份数
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ {
label: '证件号码', label: '受益比例',
key: 'idNumber', key: 'benefitRatio',
customerKey: 'idCard',
domType: 'Input', domType: 'Input',
inputType: 'number', inputType: 'number',
required: false, required: false,
maxLength: 20, maxLength: 300,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入受益比例',
show: true, show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 labelWidth: '120px', //标签宽度
......
...@@ -87,8 +87,10 @@ ...@@ -87,8 +87,10 @@
v-if="child.domType === 'Select'" v-if="child.domType === 'Select'"
v-model="form[child.key]" v-model="form[child.key]"
:placeholder="child.placeholder" :placeholder="child.placeholder"
:data-key="child.key"
@change="handleSelectChange(child)" @change="handleSelectChange(child)"
:disabled="editStatus" :disabled="editStatus"
clearable
> >
<el-option <el-option
v-for="item in child.options" v-for="item in child.options"
...@@ -187,7 +189,6 @@ ...@@ -187,7 +189,6 @@
:disabled="editStatus" :disabled="editStatus"
>取消</el-button >取消</el-button
> >
<!-- @click="submitForm" -->
<el-button <el-button
type="primary" type="primary"
icon="Check" icon="Check"
...@@ -341,7 +342,8 @@ const props = defineProps({ ...@@ -341,7 +342,8 @@ const props = defineProps({
tabIndex: { type: [String, Number], default: '' }, //tab索引 tabIndex: { type: [String, Number], default: '' }, //tab索引
affixOffset: { type: Number, default: 250 }, //锚点吸顶距离 affixOffset: { type: Number, default: 250 }, //锚点吸顶距离
customerBizId: { type: String, default: '' }, //提交状态,新增、修改 customerBizId: { type: String, default: '' }, //提交状态,新增、修改
tabSource: { type: String, default: '' } //引用这个组件的页面来源,用于逻辑判断 tabSource: { type: String, default: '' },
idsObj: { type: Object, default: () => ({}) } //引用这个组件的页面来源,用于逻辑判断
}) })
const emit = defineEmits(['handleSuccess']) const emit = defineEmits(['handleSuccess'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
...@@ -361,6 +363,7 @@ const tableData = ref([]) ...@@ -361,6 +363,7 @@ const tableData = ref([])
const total = ref(0) const total = ref(0)
//计算默认显示的日期(18年前的今天) //计算默认显示的日期(18年前的今天)
const defaultDisplayDate = ref(dayjs().subtract(18, 'year').toDate()) const defaultDisplayDate = ref(dayjs().subtract(18, 'year').toDate())
// 地址组件菜单数据 // 地址组件菜单数据
const addressMenuList = ref([ const addressMenuList = ref([
{ {
...@@ -719,12 +722,6 @@ const processFormData = async () => { ...@@ -719,12 +722,6 @@ const processFormData = async () => {
] ]
} }
} }
// if (field.key === 'bmi') {
// rules.value[field.key] = [
// { required: false, trigger: 'change' },
// { validator: validateBMI,trigger: 'change' }
// ]
// }
} }
} }
} }
...@@ -734,12 +731,19 @@ const processFormData = async () => { ...@@ -734,12 +731,19 @@ const processFormData = async () => {
{ required: true, message: `与投保人关系不能为空`, trigger: 'blur' } { required: true, message: `与投保人关系不能为空`, trigger: 'blur' }
] ]
} }
if (props.customerBizId) { if (props.customerBizId && props.tabSource == 'customer') {
// 在客户资料中是编辑客户资料,需要回显客户资料
getCustomerInfo(props.customerBizId, processedData)
} else if (
props.customerBizId &&
(props.tabSource == 'policyholder' || props.tabSource == 'insurantInfo') &&
!props.idsObj.appointmentBizId
) {
//是投保人/受保人但是新增预约 需要引用客户资料的值
getCustomerInfo(props.customerBizId, processedData) getCustomerInfo(props.customerBizId, processedData)
} else { } else {
processedCustomerData.value = oldCustomerData.value = processedData processedCustomerData.value = oldCustomerData.value = processedData
} }
console.log('form', form.value)
} }
//弹出右侧抽屉 //弹出右侧抽屉
...@@ -899,6 +903,8 @@ const handleSelectChange = child => { ...@@ -899,6 +903,8 @@ const handleSelectChange = child => {
} }
break break
case 'policyholderRel': case 'policyholderRel':
// 强制同步:确保form.value.policyholderRel与当前选择的值一致
processedCustomerData.value.forEach(section => { processedCustomerData.value.forEach(section => {
if (form.value[child.key] == 'MYSELF') { if (form.value[child.key] == 'MYSELF') {
if (section.key == 'policyholderRel') { if (section.key == 'policyholderRel') {
...@@ -910,6 +916,8 @@ const handleSelectChange = child => { ...@@ -910,6 +916,8 @@ const handleSelectChange = child => {
section.showMoudle = true section.showMoudle = true
} }
}) })
console.log('下拉', form.value)
break break
default: default:
break break
...@@ -946,6 +954,9 @@ const setFormValue = (obj, formData, exportValue) => { ...@@ -946,6 +954,9 @@ const setFormValue = (obj, formData, exportValue) => {
phoneQuickList.value = [] phoneQuickList.value = []
// 深拷贝原始数据 // 深拷贝原始数据
form.value = JSON.parse(JSON.stringify(obj)) form.value = JSON.parse(JSON.stringify(obj))
if (props.activeName == 'insurantInfo' && !props.idsObj.appointmentBizId) {
form.value['policyholderRel'] = ''
}
// 深拷贝原始数据 // 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(formData)) const processedData = JSON.parse(JSON.stringify(formData))
for (const section of processedData) { for (const section of processedData) {
...@@ -1066,10 +1077,6 @@ const setFormValue = (obj, formData, exportValue) => { ...@@ -1066,10 +1077,6 @@ const setFormValue = (obj, formData, exportValue) => {
phoneQuickList.value = removeDuplicates(tempPhoneList, 'phoneString') phoneQuickList.value = removeDuplicates(tempPhoneList, 'phoneString')
addressQuickList.value = removeDuplicates(tempAddressList, 'addressString') addressQuickList.value = removeDuplicates(tempAddressList, 'addressString')
// if (!exportValue) {
// // 保存一份就得表单数据便于做撤销操作
// oldObjInfo.value = JSON.parse(JSON.stringify(form.value))
// }
processedCustomerData.value = processedData processedCustomerData.value = processedData
} }
// 数组去重 // 数组去重
...@@ -1136,59 +1143,38 @@ const resetShow = (key, status) => { ...@@ -1136,59 +1143,38 @@ const resetShow = (key, status) => {
} }
} }
// 方法1:使用 Promise 包装 validateField // 暴露一个同步获取数据的方法
const debugValidation = async () => { const getFormData = () => {
const fieldNames = Object.keys(rules.value) // 确保form对象包含所有必要的字段
console.log('开始验证以下字段:', fieldNames) const formData = { ...form.value }
// 1. 为每个字段创建验证Promise,并直接返回该字段的验证结果 // 如果policyholderRel不存在,尝试从select元素获取
const validationPromises = fieldNames.map(field => { if (!formData.hasOwnProperty('policyholderRel') || !formData.policyholderRel) {
return new Promise(resolve => { // 这里可以根据你的实际情况获取最新的值
if (!customerFormRef.value) { const selectElement = document.querySelector('[data-key="policyholderRel"]')
console.error(`[${field}] 表单实例不存在`) if (selectElement) {
resolve({ field, error: null, valid: false }) // 标记为无效 formData.policyholderRel = selectElement.value
return
} }
customerFormRef.value.validateField(field, errorMessage => {
console.log(`[${field}] 验证结果:`, errorMessage ? `失败 - ${errorMessage}` : '通过')
// 关键修改:只有当 errorMessage 存在(有错误)时,才携带错误信息
if (errorMessage) {
resolve({ field, error: errorMessage, valid: false })
} else {
resolve({ field, error: null, valid: true })
} }
})
})
})
// 2. 等待所有验证完成
const results = await Promise.all(validationPromises)
// 3. 筛选出所有验证失败的字段 return formData
const errors = results
.filter(result => !result.valid && result.error)
.map(result => ({ field: result.field, message: result.error }))
console.log('最终收集到的错误列表:', errors)
return errors
}
// 滚动到第一个错误字段
const scrollToFirstError = () => {
const firstError = document.querySelector('.el-form-item__error')
if (firstError) {
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' })
}
} }
const handleFormValues = () => { //source:因为这个组件是公共组件所以提交的时候要知道是哪里要获取表单的值
const handleFormValues = source => {
return new Promise(async resolve => { return new Promise(async resolve => {
let submitObj = { ...form.value } let submitObj = {}
// 因为投保人没有policyholderRel的校验会影响 受保人,所以暂时先赋值处理
if (source == 'policyHolderInfoRef') {
form.value['policyholderRel'] = '111' //因为校验在form上所以这句不能去除
submitObj = { ...policyholderForm.value }
} else if (source == 'insuredInfoRef') {
submitObj = { ...insuredForm.value }
} else {
submitObj = { ...form.value }
}
let addressList = [] let addressList = []
submitObj['birthday'] = proxy.formatToDate(submitObj['birthday']) submitObj['birthday'] = proxy.formatToDate(submitObj['birthday'])
customerFormRef.value.validate((valid, fields) => { customerFormRef.value.validate((valid, fields) => {
if (valid) { if (valid) {
errorFields.value = [] // 清空错误信息 errorFields.value = [] // 清空错误信息
//处理表单数据 //处理表单数据
...@@ -1269,6 +1255,7 @@ const handleFormValues = () => { ...@@ -1269,6 +1255,7 @@ const handleFormValues = () => {
} }
}) })
} }
resolve(errorFields.value.length == 0 ? submitObj : null) resolve(errorFields.value.length == 0 ? submitObj : null)
} else { } else {
errorFields.value = getInvalidFields(fields) errorFields.value = getInvalidFields(fields)
...@@ -1289,10 +1276,22 @@ const anchorList = computed(() => { ...@@ -1289,10 +1276,22 @@ const anchorList = computed(() => {
} }
return data return data
}) })
const policyholderForm = ref({}) //投保人表单值
const insuredForm = ref({}) //受保人表单值
watch( watch(
() => props.activeName, () => form.value,
newVal => { newVal => {
if (props.activeName == 'policyholder') {
policyholderForm.value = JSON.parse(JSON.stringify(newVal))
} else if (props.activeName == 'insurantInfo') {
insuredForm.value = JSON.parse(JSON.stringify(newVal))
}
},
{ immediate: true, deep: true }
)
watch(
() => props.activeName,
(newVal, oldVal) => {
editStatus.value = false editStatus.value = false
customerRightRef.value = null customerRightRef.value = null
if (newVal === 'customer' || newVal === 'policyholder' || newVal === 'insurantInfo') { if (newVal === 'customer' || newVal === 'policyholder' || newVal === 'insurantInfo') {
...@@ -1304,6 +1303,12 @@ watch( ...@@ -1304,6 +1303,12 @@ watch(
editStatus.value = false editStatus.value = false
} }
} }
// 切换tab要保存各自的表单值
if (oldVal == 'policyholder') {
policyholderForm.value = JSON.parse(JSON.stringify(form.value))
} else if (oldVal == 'insurantInfo') {
insuredForm.value = JSON.parse(JSON.stringify(form.value))
}
} }
) )
watch( watch(
...@@ -1315,7 +1320,8 @@ watch( ...@@ -1315,7 +1320,8 @@ watch(
// 暴露给父组件 // 暴露给父组件
defineExpose({ defineExpose({
handleFormValues, handleFormValues,
handleEditStatus handleEditStatus,
getRawForm: () => JSON.parse(JSON.stringify(form.value))
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
@handleSuccess="handleSuccess" @handleSuccess="handleSuccess"
:tabIndex="tabsList.findIndex(t => t.name === 'fnaform')" :tabIndex="tabsList.findIndex(t => t.name === 'fnaform')"
anchorContainer=".tabPaneBox" anchorContainer=".tabPaneBox"
tabSource="fnaform"
/> />
</div> </div>
<div v-if="tab.name === 'appointment'"> <div v-if="tab.name === 'appointment'">
......
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
</div> </div>
<!-- 投保人 --> <!-- 投保人 -->
<div v-if="tab.name === 'policyholder'"> <div v-if="tab.name === 'policyholder'">
<!-- :customerBizId="processInfo.customerBizId" @handleSuccess="handleSuccess"--> <!-- @handleSuccess="handleSuccess"-->
<Customer <Customer
:activeName="activeName" :activeName="activeName"
:fatherTabName="tabName" :fatherTabName="tabName"
...@@ -130,6 +130,10 @@ ...@@ -130,6 +130,10 @@
tabSource="policyholder" tabSource="policyholder"
ref="policyHolderInfoRef" ref="policyHolderInfoRef"
:fatherEditStatus="editStatus" :fatherEditStatus="editStatus"
:customerInfo="customerInfo"
:apiPolicyholderInfoDto="appointmentSummeryInfo.apiPolicyholderInfoDto"
:idsObj="idsObj"
:customerBizId="props.processDetail.customerBizId"
/> />
<!-- <PolicyHolderInfo <!-- <PolicyHolderInfo
:activeName="activeName" :activeName="activeName"
...@@ -157,6 +161,8 @@ ...@@ -157,6 +161,8 @@
tabSource="insurantInfo" tabSource="insurantInfo"
ref="insuredInfoRef" ref="insuredInfoRef"
:fatherEditStatus="editStatus" :fatherEditStatus="editStatus"
:idsObj="idsObj"
:customerBizId="props.processDetail.customerBizId"
/> />
<!-- <InsuredInfo <!-- <InsuredInfo
:activeName="activeName" :activeName="activeName"
...@@ -186,6 +192,10 @@ ...@@ -186,6 +192,10 @@
:pageSource="pageSource" :pageSource="pageSource"
:showSubmitBtn="showSubmitBtn" :showSubmitBtn="showSubmitBtn"
@policyEditSuccess="getPolicyDetail" @policyEditSuccess="getPolicyDetail"
:tabIndex="tabsList.findIndex(t => t.name === 'secondHolder')"
anchorContainer=".appointmentTabPaneBox"
:fatherTabName="tabName"
:editStatus="editStatus"
/> />
</div> </div>
<div v-if="tab.name === 'beneficiary'"> <div v-if="tab.name === 'beneficiary'">
...@@ -200,6 +210,10 @@ ...@@ -200,6 +210,10 @@
:pageSource="pageSource" :pageSource="pageSource"
:showSubmitBtn="showSubmitBtn" :showSubmitBtn="showSubmitBtn"
@policyEditSuccess="getPolicyDetail" @policyEditSuccess="getPolicyDetail"
:tabIndex="tabsList.findIndex(t => t.name === 'beneficiary')"
anchorContainer=".appointmentTabPaneBox"
:fatherTabName="tabName"
:editStatus="editStatus"
/> />
</div> </div>
<div v-if="tab.name === 'questionnaires'"> <div v-if="tab.name === 'questionnaires'">
...@@ -213,6 +227,10 @@ ...@@ -213,6 +227,10 @@
:pageSource="pageSource" :pageSource="pageSource"
:showSubmitBtn="showSubmitBtn" :showSubmitBtn="showSubmitBtn"
:foldInsurantInfo="foldInsurantInfo" :foldInsurantInfo="foldInsurantInfo"
:affixOffset="360"
:tabIndex="tabsList.findIndex(t => t.name === 'questionnaires')"
anchorContainer=".appointmentTabPaneBox"
:editStatus="editStatus"
/> />
</div> </div>
<div v-if="tab.name === 'fna'"> <div v-if="tab.name === 'fna'">
...@@ -805,12 +823,6 @@ const beforeTabLeave = (activeTabName, oldTabName) => { ...@@ -805,12 +823,6 @@ const beforeTabLeave = (activeTabName, oldTabName) => {
return true return true
} }
const handleBack = () => {
// 先手动清理状态
submitAppointmentObj.value = {}
appointmentSummeryInfo.value = {}
router.go(-1)
}
// 判断是否为数组 // 判断是否为数组
const isArray = value => { const isArray = value => {
return Array.isArray(value) return Array.isArray(value)
...@@ -829,24 +841,44 @@ const handleSubmit = async type => { ...@@ -829,24 +841,44 @@ const handleSubmit = async type => {
// } // }
// if (productPlanRef.value) { // if (productPlanRef.value) {
// submitAppointmentObj.value.apiProductPlanInfoDto = productPlanRef.value[0].handleSubmitForm() // submitAppointmentObj.value.apiProductPlanInfoDto =
// await productPlanRef.value[0].handleSubmitForm()
// if (!submitAppointmentObj.value.apiProductPlanInfoDto) return
// }
// 获取投保人form
// if (policyHolderInfoRef.value) {
// submitAppointmentObj.value.apiPolicyholderInfoDto =
// await policyHolderInfoRef.value[0].handleFormValues('policyHolderInfoRef')
// if (!submitAppointmentObj.value.apiPolicyholderInfoDto) return
// }
// 获取受保人form
// if (insuredInfoRef.value) {
// console.log('insuredInfoRef.value', insuredInfoRef.value)
// await nextTick() // 👈 加这一行!
// const result = await insuredInfoRef.value[0].handleFormValues('insuredInfoRef')
// console.log('result', result)
// if (!result) return
// submitAppointmentObj.value.apiInsurantInfoDto = result
// }
// if (secondHolderInfoRef.value) {
// submitAppointmentObj.value.apiSecondHolderInfoDto =
// await secondHolderInfoRef.value[0].handleFormValues()
// if (!submitAppointmentObj.value.apiSecondHolderInfoDto) return
// } // }
if (policyHolderInfoRef.value) {
submitAppointmentObj.value.apiPolicyholderInfoDto =
policyHolderInfoRef.value[0].handleFormValues()
}
if (insuredInfoRef.value) {
submitAppointmentObj.value.apiInsurantInfoDto = insuredInfoRef.value[0].handleFormValues()
}
return
if (secondHolderInfoRef.value) {
submitAppointmentObj.value.apiSecondHolderInfoDto =
secondHolderInfoRef.value[0].handleFormValues()
}
if (beneficiaryInfoRef.value) { if (beneficiaryInfoRef.value) {
submitAppointmentObj.value.apiBeneficiaryInfoDtoList = submitAppointmentObj.value.apiBeneficiaryInfoFzDto =
beneficiaryInfoRef.value[0].handleFormValues() await beneficiaryInfoRef.value[0].handleFormValues()
if (!submitAppointmentObj.value.apiBeneficiaryInfoFzDto) return
} }
if (questionnairesInfoRef.value && questionnairesInfoRef.value[0].questionLength > 0) {
submitAppointmentObj.value.questionnairesDetailResponse =
await questionnairesInfoRef.value[0].handleFormValues()
if (!submitAppointmentObj.value.questionnairesDetailResponse) return
}
console.log('大提交', submitAppointmentObj.value)
return return
// 代表新增预约 // 代表新增预约
if (formStatus.value == 'appointmentAdd' && !idsObj.value.appointmentBizId) { if (formStatus.value == 'appointmentAdd' && !idsObj.value.appointmentBizId) {
...@@ -1005,7 +1037,7 @@ watch( ...@@ -1005,7 +1037,7 @@ watch(
//代表是新增预约状态 //代表是新增预约状态
if (!idsObj.value.appointmentBizId) { if (!idsObj.value.appointmentBizId) {
formStatus.value = 'appointmentAdd' formStatus.value = 'appointmentAdd'
// getCustomerInfo(props.processDetail.customerBizId) getCustomerInfo(props.processDetail.customerBizId)
tabsList.value = [ tabsList.value = [
{ {
...@@ -1048,6 +1080,20 @@ watch( ...@@ -1048,6 +1080,20 @@ watch(
id: 5, id: 5,
status: '0', status: '0',
key: 'secondHolderBizId' key: 'secondHolderBizId'
},
{
label: '健康信息',
name: 'questionnaires',
id: 7,
status: '0',
key: 'questionnaireBizId'
},
{
label: '附件', //大提交的时候不用提交了,因为上传文件的时候已经入库了
name: 'accessories',
id: 10,
status: '0',
key: 'fnaBizId'
} }
] ]
nextTick(() => { nextTick(() => {
...@@ -1306,6 +1352,7 @@ const showSubmitBtn = computed(() => { ...@@ -1306,6 +1352,7 @@ const showSubmitBtn = computed(() => {
return false return false
} }
}) })
//刚进页面的编辑状态
if (route.query.appointmentNo && route.query.source == 'appointmentList') { if (route.query.appointmentNo && route.query.source == 'appointmentList') {
editStatus.value = true editStatus.value = true
} else if (route.query.source == 'policyList') { } else if (route.query.source == 'policyList') {
...@@ -1315,7 +1362,6 @@ if (route.query.appointmentNo && route.query.source == 'appointmentList') { ...@@ -1315,7 +1362,6 @@ if (route.query.appointmentNo && route.query.source == 'appointmentList') {
} else if (route.query.source == 'fnaList' && !idsObj.value.appointmentBizId) { } else if (route.query.source == 'fnaList' && !idsObj.value.appointmentBizId) {
editStatus.value = false editStatus.value = false
} }
console.log('editStatus.value ', editStatus.value, idsObj.value)
onUnmounted(() => { onUnmounted(() => {
// 彻底重置所有响应式数据 // 彻底重置所有响应式数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment