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'
})
}
const beneficiary = [ const beneficiary = [
{ {
bigTitle: '受益人', fatherTitle: '是否法定受益人',
deleteIcon: true, keyType: 'Object', //用于表单收集值时,判断是数组还是对象
id: 1, //唯一标识,用于删除 key: 'isLegalBeneficiary',
children: [ anchorKey: 'isLegalBeneficiary',
// 客户信息 此模块始终展示 showMoudle: true, //模块是否展示
showTable: false, //是否展示表格
fatherRequired: true, //父级必填,代表个人资料这个模块有必填项
data: [
{ {
fatherTitle: '客户信息', label: '是否法定受益人',
type: 'object', key: 'isLegalBeneficiary',
key: 'customer', domType: 'Select',
showMoudle: true, //模块是否展示 required: true,
data: [ disabled: false,
{ placeholder: '请选择',
label: '客户类型', dictType: 'sys_no_yes',
key: 'customerType', show: true,
customerKey: 'customerType', labelPosition: 'top', //标签的位置
domType: 'Select', labelWidth: '120px', //标签宽度
required: true, sm: 12, //栅格布局份数
disabled: false, lg: 8 //栅格布局份数
placeholder: '请选择', }
dictType: 'csf_customer_type', ]
show: true, },
labelPosition: 'top', //标签的位置 //受益人
labelWidth: '120px', //标签宽度 {
sm: 12, //栅格布局份数 showMoudle: false, //模块是否展示
lg: 8 //栅格布局份数 fatherTitle: '受益人',
}, keyType: 'Array', //用于表单收集值时,判断是数组还是对象
{ key: 'apiBeneficiaryInfoDtoList',
label: '与受保人关系', anchorKey: 'apiBeneficiaryInfoDtoList',
key: 'insurantRel', fatherRequired: true, //父级必填,代表个人资料这个模块有必填项
domType: 'Select', addChildren: true,
required: true, addChildrenTxt: '新增受益人',
disabled: false, showTable: true, //是否展示表格
placeholder: '请选择', columns: [
dictType: 'csf_ap_rel', {
show: true, label: '与受保人关系',
labelPosition: 'top', //标签的位置 prop: 'insurantRelName',
labelWidth: '120px', //标签宽度 type: 'text'
sm: 12, //栅格布局份数 },
lg: 8 //栅格布局份数 {
} label: '姓名(中文)',
] prop: 'nameCn',
type: 'text'
},
{
label: '姓名(拼音/英文)',
prop: 'namePyEn',
type: 'text'
},
{
label: '证件类型',
prop: 'documentTypeName',
type: 'text'
},
{
label: '证件号码',
prop: 'idNumber',
type: 'text'
},
{
label: '性别',
prop: 'genderName',
type: 'text'
},
{
label: '出生日期',
prop: 'birthday',
type: 'text'
},
{
label: '国籍',
prop: 'nationality',
type: 'text'
},
{
label: '受益比例',
prop: 'benefitRatio',
type: 'text'
}
],
data: [],
// 弹窗表单的配置
formItem: [
{
label: '与受保人关系',
key: 'insurantRel',
domType: 'Select',
required: false,
disabled: false,
placeholder: '请选择',
dictType: 'csf_ap_rel',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
}, },
// 基础信息
{ {
fatherTitle: '基础信息', label: '名字(中文)',
type: 'object', key: 'nameCn',
key: 'person', domType: 'Input',
unit: '历史客户',
unitColor: 'rgba(0, 82, 217, 1)',
inputType: 'text',
required: false,
maxLength: 15,
disabled: false,
placeholder: '请输入2~6位汉字',
show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
showMoudle: true, //模块是否展示 labelWidth: '120px', //标签宽度
// description: '证件信息至少填写一项', sm: 12, //栅格布局份数
data: [ lg: 8 //栅格布局份数
{ },
label: '名字',
key: 'name',
customerKey: 'name',
domType: 'Input',
inputType: 'text',
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '名字-英文',
key: 'nameEn',
customerKey: 'firstNamePinyin',
showEn: true, //是否填写英文
domType: 'Input',
inputType: 'text',
required: true,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '性别',
key: 'gender',
customerKey: 'gender',
domType: 'Select',
required: true,
disabled: false,
placeholder: '请选择',
dictType: 'sys_gender',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{ {
label: '证件类型', label: '姓名(拼音/英文)',
key: 'documentType', key: 'namePyEn',
customerKey: 'idType', domType: 'Input',
domType: 'Select', inputType: 'text',
required: true, required: false,
disabled: false, maxLength: 30,
placeholder: '请选择', disabled: false,
dictType: 'csf_id_type', placeholder: '请输入',
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: 'documentType',
customerKey: 'idCard', domType: 'Select',
domType: 'Input', required: false,
inputType: 'number', disabled: false,
required: true, placeholder: '请选择',
maxLength: 20, dictType: 'csf_id_type',
disabled: false, show: true,
placeholder: '请输入', labelPosition: 'top', //标签的位置
show: true, labelWidth: '120px', //标签宽度
labelPosition: 'top', //标签的位置 sm: 12, //栅格布局份数
labelWidth: '120px', //标签宽度 lg: 8 //栅格布局份数
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '出生日期',
key: 'birthTime',
customerKey: 'birthdate',
domType: 'DatePicker',
required: false,
disabled: false,
placeholder: '请选择',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
}
]
}, },
// 公司信息
{ {
fatherTitle: '公司信息', label: '证件号码',
type: 'object', key: 'idNumber',
key: 'company', domType: 'Input',
inputType: 'text',
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
showMoudle: false, //模块是否展示 labelWidth: '120px', //标签宽度
data: [ sm: 12, //栅格布局份数
{ lg: 8 //栅格布局份数
label: '公司名称', },
key: 'companyName',
customerKey: '',
domType: 'Input',
inputType: 'text',
required: true,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '公司名称(英文)',
key: 'companyNameEn',
customerKey: 'companyNameEn',
showEn: true, //是否填写英文
domType: 'Input',
inputType: 'text',
required: true,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '公司商业登记号码',
key: 'companyBusinessNo',
customerKey: 'companyBusinessNo',
domType: 'Input',
inputType: 'text',
required: true,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '公司注册日期',
key: 'companyRegisterTime',
customerKey: '',
domType: 'DatePicker',
required: true,
disabled: false,
placeholder: '请选择',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '公司注册地区',
key: 'companyRegisterRegion',
customerKey: '',
domType: 'Select',
required: true,
disabled: false,
placeholder: '请选择',
dictType: 'csf_ap_registration',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '公司电话',
key: 'companyMobile',
customerKey: '',
domType: 'arrowRight',
required: true,
disabled: false,
placeholder: '请填写',
show: true,
drawerType: 'phone',
companyMobile: {}, //带有区号得电话一定要有一个和key一样得对象用于收集区号和号码
code: 'companyMobileCode',
maxLength: 20,
labelPosition: 'top', //标签的位置
labelWidth: '180px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{ {
label: '公司邮箱', label: '性别',
key: 'companyEmail', key: 'gender',
customerKey: '', domType: 'Select',
domType: 'Input', required: false,
inputType: 'text', disabled: false,
required: false, placeholder: '请选择',
maxLength: 20, dictType: 'sys_gender',
disabled: false, show: true,
placeholder: '请输入', labelPosition: 'top', //标签的位置
show: true, labelWidth: '120px', //标签宽度
labelPosition: 'top', //标签的位置 sm: 12, //栅格布局份数
labelWidth: '120px', //标签宽度 lg: 8 //栅格布局份数
sm: 12, //栅格布局份数 },
lg: 8 //栅格布局份数 {
}, label: '生日',
{ key: 'birthday',
label: '公司登记地址', domType: 'DatePicker',
key: 'companyEnterAddress', required: false,
customerKey: '', disabled: false,
domType: 'arrowRight', placeholder: '请选择',
required: false, show: true,
disabled: false, labelPosition: 'top', //标签的位置
placeholder: '请填写', labelWidth: '120px', //标签宽度
show: true, sm: 12, //栅格布局份数
drawerType: 'address', lg: 8 //栅格布局份数
companyEnterAddress: {},
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '通讯地址',
key: 'txAddress',
customerKey: '',
domType: 'arrowRight',
required: false,
disabled: false,
placeholder: '请填写',
show: true,
drawerType: 'address',
txAddress: {},
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '授权代表姓名中文-名字',
key: 'authNameCn',
customerKey: '',
domType: 'Input',
inputType: 'text',
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '授权代表姓名英文-名字',
key: 'authNameEn',
customerKey: '',
showEn: true, //是否填写英文
domType: 'Input',
inputType: 'text',
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '授权代表职称',
key: 'authProfessional',
customerKey: '',
domType: 'Input',
inputType: 'text',
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '授权代表电话',
key: 'authMobile',
customerKey: '',
domType: 'arrowRight',
required: false,
disabled: false,
placeholder: '请填写',
show: true,
drawerType: 'phone',
authMobile: {}, //带有区号得电话一定要有一个和key一样得对象用于收集区号和号码
code: 'authMobileCode',
maxLength: 20,
labelPosition: 'top', //标签的位置
labelWidth: '180px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
}
]
}, },
// 其他信息
{ {
fatherTitle: '其他信息', label: '国籍(国家/地区)',
type: 'object', key: 'nationality',
key: 'customer', domType: 'arrowRight',
showMoudle: true, //模块是否展示 required: false,
data: [ disabled: false,
{ placeholder: '请填写',
label: '受益比例(%)', show: true,
key: 'benefitRatio', drawerType: 'country',
customerKey: 'idCard', labelPosition: 'top', //标签的位置
domType: 'Input', labelWidth: '120px', //标签宽度
inputType: 'number', sm: 12, //栅格布局份数
required: false, lg: 8 //栅格布局份数
maxLength: 20, },
disabled: false, {
placeholder: '请输入', label: '受益比例',
show: true, key: 'benefitRatio',
labelPosition: 'top', //标签的位置 domType: 'Input',
labelWidth: '120px', //标签宽度 inputType: 'number',
sm: 12, //栅格布局份数 required: false,
lg: 8 //栅格布局份数 maxLength: 300,
}, disabled: false,
{ placeholder: '请输入受益比例',
label: '备注', show: true,
key: 'remark', labelPosition: 'top', //标签的位置
customerKey: 'idCard', labelWidth: '120px', //标签宽度
domType: 'Input', sm: 12, //栅格布局份数
inputType: 'textarea', lg: 8 //栅格布局份数
required: false,
maxLength: 20,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 24, //栅格布局份数
lg: 24 //栅格布局份数
}
]
} }
] ]
} }
......
...@@ -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,并直接返回该字段的验证结果
const validationPromises = fieldNames.map(field => {
return new Promise(resolve => {
if (!customerFormRef.value) {
console.error(`[${field}] 表单实例不存在`)
resolve({ field, error: null, valid: false }) // 标记为无效
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. 筛选出所有验证失败的字段
const errors = results
.filter(result => !result.valid && result.error)
.map(result => ({ field: result.field, message: result.error }))
console.log('最终收集到的错误列表:', errors) // 如果policyholderRel不存在,尝试从select元素获取
return errors if (!formData.hasOwnProperty('policyholderRel') || !formData.policyholderRel) {
} // 这里可以根据你的实际情况获取最新的值
const selectElement = document.querySelector('[data-key="policyholderRel"]')
// 滚动到第一个错误字段 if (selectElement) {
const scrollToFirstError = () => { formData.policyholderRel = selectElement.value
const firstError = document.querySelector('.el-form-item__error') }
if (firstError) {
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' })
} }
return formData
} }
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 = [] // 清空错误信息
//处理表单数据 //处理表单数据
...@@ -1239,7 +1225,7 @@ const handleFormValues = () => { ...@@ -1239,7 +1225,7 @@ const handleFormValues = () => {
proxy.$message.error(errorFields.value[0].message) proxy.$message.error(errorFields.value[0].message)
return undefined return undefined
} }
if (props.customerBizId && props.activeName == 'customer') { if (props.customerBizId && props.activeName == 'customer') {
editCustomer(submitObj).then(res => { editCustomer(submitObj).then(res => {
if (res.code == 200) { if (res.code == 200) {
...@@ -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>
......
<template> <template>
<div v-if="processedFanFormData.length > 0"> <div v-if="processedFanFormData.length > 0">
<div ref="fanContainerRef"> <div ref="fanContainerRef">
<!-- <el-row> <div class="editBtn">
<el-col :span="24"> <el-button
<div class="topBtn"> v-if="props.fnaFormBizId && props.tabSource == 'fnaform'"
<el-button type="primary"
v-if="props.fnaFormBizId" icon="EditPen"
type="primary" @click="handleEditStatus"
icon="EditPen" >编辑</el-button
@click="handleEditStatus" >
>编辑</el-button </div>
>
</div>
</el-col>
</el-row> -->
<CommonForm <CommonForm
:anchorList="anchorList" :anchorList="anchorList"
:affixOffset="250" :affixOffset="250"
...@@ -32,9 +29,12 @@ ...@@ -32,9 +29,12 @@
<template #mainTitCustom> <template #mainTitCustom>
<div <div
class="dependNum" class="dependNum"
v-if="father.key == 'dependantList' && father.data.length > 0" v-if="
father.key == 'dependantList' &&
father.data.filter(item => !item.unSave).length > 0
"
> >
受供养人数目:{{ father.data.length }} 受供养人数目:{{ father.data.filter(item => !item.unSave).length }}
</div> </div>
</template> </template>
<template #content> <template #content>
...@@ -48,7 +48,18 @@ ...@@ -48,7 +48,18 @@
? '' ? ''
: child.label : child.label
" "
:prop="child.key" :prop="father.key + '.' + child.key"
:rules="
child.required
? [
{
required: true,
message: `${child.label}不能为空`,
trigger: child.domType === 'Select' ? 'change' : 'blur'
}
]
: undefined
"
:key="child.key" :key="child.key"
:label-width="child.labelWidth" :label-width="child.labelWidth"
:label-position="child.labelPosition" :label-position="child.labelPosition"
...@@ -71,7 +82,7 @@ ...@@ -71,7 +82,7 @@
<el-input <el-input
v-if="child.domType === 'Input'" v-if="child.domType === 'Input'"
:type="child.inputType" :type="child.inputType"
v-model="child.value" v-model="form[father.key][child.key]"
:placeholder="child.placeholder" :placeholder="child.placeholder"
maxlength="30" maxlength="30"
:disabled="editStatus" :disabled="editStatus"
...@@ -82,7 +93,7 @@ ...@@ -82,7 +93,7 @@
</el-input> </el-input>
<el-select <el-select
v-if="child.domType === 'Select'" v-if="child.domType === 'Select'"
v-model="child.value" v-model="form[father.key][child.key]"
:placeholder="child.placeholder" :placeholder="child.placeholder"
@change="handleSelectChange(child)" @change="handleSelectChange(child)"
:disabled="editStatus" :disabled="editStatus"
...@@ -97,7 +108,7 @@ ...@@ -97,7 +108,7 @@
<el-date-picker <el-date-picker
style="width: 100%" style="width: 100%"
v-if="child.domType === 'DatePicker'" v-if="child.domType === 'DatePicker'"
v-model="child.value" v-model="form[father.key][child.key]"
type="date" type="date"
format="YYYY-MM-DD" format="YYYY-MM-DD"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
...@@ -110,7 +121,7 @@ ...@@ -110,7 +121,7 @@
<el-input <el-input
v-if="child.domType === 'arrowRight'" v-if="child.domType === 'arrowRight'"
v-model="child.value" v-model="form[father.key][child.key]"
:placeholder="child.placeholder" :placeholder="child.placeholder"
@click="handleFoucs(child)" @click="handleFoucs(child)"
:suffix-icon="ArrowRight" :suffix-icon="ArrowRight"
...@@ -120,7 +131,7 @@ ...@@ -120,7 +131,7 @@
</el-input> </el-input>
<el-checkbox-group <el-checkbox-group
v-if="child.domType === 'Checkbox'" v-if="child.domType === 'Checkbox'"
v-model="child.value" v-model="form[father.key][child.key]"
:disabled="editStatus" :disabled="editStatus"
> >
<template class="customCheckBox"> <template class="customCheckBox">
...@@ -136,9 +147,11 @@ ...@@ -136,9 +147,11 @@
style="width: 250px" style="width: 250px"
v-if=" v-if="
child.key === 'liquidAssetType' && child.key === 'liquidAssetType' &&
child.value.filter(item => item == 'G').length > 0 form[father.key][child.key] &&
form[father.key][child.key].filter(item => item == 'G')
.length > 0
" "
v-model="child.otherLiquidAsset" v-model="form[father.key]['otherLiquidAsset']"
placeholder="请输入说明" placeholder="请输入说明"
:disabled="editStatus" :disabled="editStatus"
/> />
...@@ -179,17 +192,29 @@ ...@@ -179,17 +192,29 @@
remote remote
reserve-keyword reserve-keyword
:placeholder="column.placeholder" :placeholder="column.placeholder"
:remote-method="query => searchSelectList(query, column.searchType)" :remote-method="
query => searchSelectList(query, column.searchType, scope.row)
"
:loading="searchLoadingStates[column.searchType]" :loading="searchLoadingStates[column.searchType]"
:disabled="editStatus" :disabled="editStatus"
@change="handleRemoteSelectChange(scope.row, column)" @change="handleRemoteSelectChange(scope.row, column, father)"
> >
<el-option <template v-if="column.searchType !== 'insuranceType'">
v-for="item in searchOptions[column.searchType] || []" <el-option
:key="item.id" v-for="item in searchOptions[column.searchType] || []"
:label="item.label" :key="item.id"
:value="item.value" :label="item.label"
/> :value="item.value"
/>
</template>
<template v-else>
<el-option
v-for="item in scope.row.insuranceTypeOption || []"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</template>
</el-select> </el-select>
<!-- 普通选择框 --> <!-- 普通选择框 -->
...@@ -221,7 +246,20 @@ ...@@ -221,7 +246,20 @@
<!-- 数字输入框 --> <!-- 数字输入框 -->
<el-input <el-input
v-else-if="column.type === 'inputNumber'" v-else-if="
column.type === 'inputNumber' && !!scope.row.showSumInsured
"
v-model.number="scope.row[column.prop]"
:placeholder="column.placeholder"
:disabled="editStatus"
type="number"
>
<template v-if="column.unit" #append>
<span>{{ column.unit }}</span>
</template>
</el-input>
<el-input
v-else-if="column.type === 'inputNumber' && scope.row.showSumInsured"
v-model.number="scope.row[column.prop]" v-model.number="scope.row[column.prop]"
:placeholder="column.placeholder" :placeholder="column.placeholder"
:disabled="editStatus" :disabled="editStatus"
...@@ -231,10 +269,9 @@ ...@@ -231,10 +269,9 @@
<span>{{ column.unit }}</span> <span>{{ column.unit }}</span>
</template> </template>
</el-input> </el-input>
<!-- 普通输入框(默认) --> <!-- 普通输入框(默认) -->
<el-input <el-input
v-else v-else-if="column.prop !== 'sumInsured'"
v-model="scope.row[column.prop]" v-model="scope.row[column.prop]"
:placeholder="column.placeholder" :placeholder="column.placeholder"
:disabled="editStatus" :disabled="editStatus"
...@@ -243,13 +280,27 @@ ...@@ -243,13 +280,27 @@
</el-table-column> </el-table-column>
<!-- 操作列(固定) --> <!-- 操作列(固定) -->
<el-table-column width="60px" align="center" label="操作"> <el-table-column
:width="father.key == 'dependantList' ? 150 : 80"
align="center"
label="操作"
>
<template #default="scope"> <template #default="scope">
<el-icon <el-button
class="deleteIcon" type="primary"
size="small"
v-if="father.key == 'dependantList'"
@click="saveTableData(father, scope.row)"
>
{{ scope.row.unSave ? '未保存' : '已保存' }}
</el-button>
<el-button
type="danger"
size="small"
@click="deleteChildren(father, scope.$index)" @click="deleteChildren(father, scope.$index)"
><Delete >
/></el-icon> 删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -295,7 +346,12 @@ import useDictStore from '@/store/modules/dict' ...@@ -295,7 +346,12 @@ import useDictStore from '@/store/modules/dict'
import fanFormDomData from '@/formJson/fnaForm' import fanFormDomData from '@/formJson/fnaForm'
import { watch, nextTick } from 'vue' import { watch, nextTick } from 'vue'
import { addfanForm, getfanFormDetail, editFanForm, getCustomerList } from '@/api/sign/fna' import { addfanForm, getfanFormDetail, editFanForm, getCustomerList } from '@/api/sign/fna'
import { getUserSaleExpandList, getAllTeam, getInsuranceCompany } from '@/api/common' import {
getUserSaleExpandList,
getAllTeam,
getInsuranceCompany,
getInsuranceCategory
} from '@/api/common'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
const dictStore = useDictStore() //获取字典数据 const dictStore = useDictStore() //获取字典数据
...@@ -307,7 +363,8 @@ const props = defineProps({ ...@@ -307,7 +363,8 @@ const props = defineProps({
customerBizId: { type: String, default: '' }, //提交状态,新增、修改 customerBizId: { type: String, default: '' }, //提交状态,新增、修改
dictTypeLists: { type: Array, default: () => [] }, //多个字典值数据 dictTypeLists: { type: Array, default: () => [] }, //多个字典值数据
anchorContainer: { type: String, default: '' }, //锚点滚动容器 anchorContainer: { type: String, default: '' }, //锚点滚动容器
tabIndex: { type: [String, Number], default: '' } //tab索引 tabIndex: { type: [String, Number], default: '' }, //tab索引
tabSource: { type: String, default: '' } //引用这个组件的页面来源,用于逻辑判断
}) })
const emit = defineEmits(['handleSuccess']) const emit = defineEmits(['handleSuccess'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
...@@ -342,14 +399,37 @@ const { ...@@ -342,14 +399,37 @@ const {
tempFanFormValue, tempFanFormValue,
tempFanFormData tempFanFormData
} = toRefs(data) } = toRefs(data)
const handleRemoteSelectChange = (row, column) => { const handleRemoteSelectChange = async (row, column, father) => {
console.log(row, column) console.log(row, column)
// 通过保险公司查保险种类 row中收集了insurer的值 // 通过保险公司查保险种类 row中收集了insurer的值
if (column.prop == 'insurer') { if (column.prop == 'insurer') {
const params1 = {
pageNo: 1,
pageSize: 10
}
const response1 = await getInsuranceCategory(params1)
if (response1.code == 200) {
response1.data.records = response1.data.records.map(item => {
return {
...item,
label: item.name,
value: item.insuranceCategoryBizId
}
})
row.insuranceTypeOption = response1.data.records
}
}
if (column.prop == 'insuranceType' && row.insuranceType) {
//如果险种选择了重疾险,则显示重疾险的输入框
row.insuranceTypeOption.forEach(item => {
if (item.value == row.insuranceType && item.code == 'CI') {
row.showSumInsured = true
}
})
} }
} }
// 搜索方法 // 搜索方法
const searchSelectList = async (query, fieldKey) => { const searchSelectList = async (query, fieldKey, row) => {
// 设置该字段的加载状态 // 设置该字段的加载状态
searchLoadingStates.value[fieldKey] = true searchLoadingStates.value[fieldKey] = true
let queryString = query.trim() let queryString = query.trim()
...@@ -406,6 +486,31 @@ const searchSelectList = async (query, fieldKey) => { ...@@ -406,6 +486,31 @@ const searchSelectList = async (query, fieldKey) => {
}) })
searchOptions.value[fieldKey] = response9.data.records searchOptions.value[fieldKey] = response9.data.records
} }
} else if (fieldKey == 'insuranceType') {
if (!row.insurer) {
proxy.$modal.confirm(`请先选择保险公司`, {
showCancel: '0',
title: '填写提示'
})
row.insuranceType = ''
return
}
const params1 = {
pageNo: 1,
pageSize: 10,
name: queryString
}
const response1 = await getInsuranceCategory(params1)
if (response1.code == 200) {
response1.data.records = response1.data.records.map(item => {
return {
...item,
label: item.name,
value: item.insuranceCategoryBizId
}
})
row.insuranceTypeOption = response1.data.records
}
} }
} catch (error) { } catch (error) {
console.error(`${fieldKey} 搜索失败`, error) console.error(`${fieldKey} 搜索失败`, error)
...@@ -450,46 +555,21 @@ const processFormData = async () => { ...@@ -450,46 +555,21 @@ const processFormData = async () => {
rules.value[section.key] = {} rules.value[section.key] = {}
} }
//给表单赋值各模块key,对应表单的father.key便于收集值 //给表单赋值各模块key,对应表单的father.key便于收集值
if (section.keyType == 'Array') { if (section.keyType == 'Object') {
form.value[section.key] = []
if (section.key == 'familyMembers') {
form.value[section.key] = section.data
}
} else if (section.keyType == 'Object') {
form.value[section.key] = {} form.value[section.key] = {}
} }
if (section.data) { if (section.data) {
for (const field of section.data) { for (const field of section.data) {
// 为下拉搜索框加options
// if (field.domType == 'SearchSelect') {
// if (field.key == 'accountName') {
// searchOptions.value[field.key] = dictStore.tenantUserList
// }
// }
if (field.dictType) { if (field.dictType) {
// 获取字典数据 // 获取字典数据
field.options = fetchDictData(field.dictType) field.options = fetchDictData(field.dictType)
if (field.dictType == 'sys_no_yes') {
noYesList.value = field.options
}
}
if (field.required) {
rules.value[field.key] = [
{ required: true, message: `${field.label}不能为空`, trigger: 'blur' }
]
}
if (props.fnaFormBizId) {
field.disabled = true
} else {
field.disabled = false
} }
} }
} }
} }
if (props.fnaFormBizId) { if (props.fnaFormBizId) {
// getFanformInfo(props.fnaFormBizId, processedData) getFanformInfo(props.fnaFormBizId, processedData)
// editStatus.value = true editStatus.value = true
} else { } else {
// tab切走在切回来时,表单会重置,所以这里需要把表单的值赋回去 // tab切走在切回来时,表单会重置,所以这里需要把表单的值赋回去
if (Object.keys(tempFanFormValue.value).length > 0) { if (Object.keys(tempFanFormValue.value).length > 0) {
...@@ -504,7 +584,6 @@ const processFormData = async () => { ...@@ -504,7 +584,6 @@ const processFormData = async () => {
} }
editStatus.value = false editStatus.value = false
loading.value = false loading.value = false
console.log('processedFanFormData.value', processedFanFormData.value)
} }
processedFanFormData.value = oldFanFormData.value = processedData processedFanFormData.value = oldFanFormData.value = processedData
} }
...@@ -522,15 +601,16 @@ const addChildren = father => { ...@@ -522,15 +601,16 @@ const addChildren = father => {
let obj2 = { let obj2 = {
id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识 id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
policyholderRel: '', policyholderRel: '',
dependantAge: '' dependantAge: '',
unSave: true //新增受供养人的时候是未保存状态
} }
let obj3 = { let obj3 = {
id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识 id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
insurer: '', insurer: '',
insuranceType: '', insuranceType: '',
sumInsured: '',
currency: '', currency: '',
policyIssueDate: '' policyIssueDate: '',
showSumInsured: false //重疾险显示保额输入框
} }
let obj4 = { let obj4 = {
propertyType: '', propertyType: '',
...@@ -544,7 +624,14 @@ const addChildren = father => { ...@@ -544,7 +624,14 @@ const addChildren = father => {
section.data.push(obj1) section.data.push(obj1)
} }
if (father.key == 'dependantList' && section.key == father.key) { if (father.key == 'dependantList' && section.key == father.key) {
section.data.push(obj2) if (father.data.length == 0 || father.data.filter(item => item.unSave).length == 0) {
section.data.push(obj2)
} else if (father.data.filter(item => item.unSave).length > 0) {
proxy.$modal.confirm(`请先保存‘新增的受供养人’信息再添加`, {
showCancel: '0',
title: '填写提示'
})
}
} }
if (father.key == 'existingSecurityOwner' && section.key == father.key) { if (father.key == 'existingSecurityOwner' && section.key == father.key) {
section.data.push(obj3) section.data.push(obj3)
...@@ -555,6 +642,7 @@ const addChildren = father => { ...@@ -555,6 +642,7 @@ const addChildren = father => {
} }
processedFanFormData.value = processedData processedFanFormData.value = processedData
} }
const deleteChildren = (father, childIndex) => { const deleteChildren = (father, childIndex) => {
if (editStatus.value) { if (editStatus.value) {
proxy.$modal.confirm(`请先点击编辑再进行删除操作`, { showCancel: '0', title: '填写提示' }) proxy.$modal.confirm(`请先点击编辑再进行删除操作`, { showCancel: '0', title: '填写提示' })
...@@ -562,31 +650,33 @@ const deleteChildren = (father, childIndex) => { ...@@ -562,31 +650,33 @@ const deleteChildren = (father, childIndex) => {
} }
const processedData = JSON.parse(JSON.stringify(processedFanFormData.value)) const processedData = JSON.parse(JSON.stringify(processedFanFormData.value))
for (const section of processedData) { for (const section of processedData) {
if (father.key == 'familyMembers' && section.key == father.key) { if (father.key == 'brokerList' && section.key == father.key) {
section.data.splice(childIndex, 1) section.data.splice(childIndex, 1)
} }
if (father.key == 'taxList' && section.key == father.key) { if (father.key == 'dependantList' && section.key == father.key) {
section.data.splice(childIndex, 1) section.data.splice(childIndex, 1)
} }
if ( if (father.key == 'existingSecurityOwner' && section.key == father.key) {
(father.key == 'existingSecurityOwner' || father.key == 'existingSecurityInsured') &&
section.key == father.key
) {
section.data.splice(childIndex, 1) section.data.splice(childIndex, 1)
} }
if ( if (father.key == 'primaryResidence' && section.key == father.key) {
(father.key == 'investment' || father.key == 'primaryResidence') &&
section.key == father.key
) {
section.data.splice(childIndex, 1) section.data.splice(childIndex, 1)
} }
} }
//更新form表单对应的数据,以便收集填写的值
form.value[father.key].splice(childIndex, 1)
processedFanFormData.value = processedData processedFanFormData.value = processedData
} }
// 根据联动重置表单项的显示与否 // 保存表格数据
const saveTableData = (father, row) => {
if (father.key == 'dependantList') {
console.log(!row.policyholderRel && !row.dependantAge)
if (!row.policyholderRel && !row.dependantAge) {
proxy.$modal.confirm(`请先填写受供养人信息再保存`, { showCancel: '0', title: '填写提示' })
return
}
row.unSave = false
}
}
const resetShow = (childKey, status) => { const resetShow = (childKey, status) => {
console.log(childKey, status) console.log(childKey, status)
...@@ -650,171 +740,22 @@ const handleEditStatus = () => { ...@@ -650,171 +740,22 @@ const handleEditStatus = () => {
} }
//给表单赋值 方便表单回显 obj 为表单数据 //给表单赋值 方便表单回显 obj 为表单数据
const setFormValue = (obj, formData) => { const setFormValue = (obj, formData) => {
loading.value = true console.log('回显值', obj)
let newForm = JSON.parse(JSON.stringify(form.value)) loading.value = true
// 1.先正确的拿到表单的回显值 let processedData = JSON.parse(JSON.stringify(formData))
for (const key in newForm) {
for (const key2 in obj) {
if (isObject(newForm[key]) && key == key2) {
newForm[key] = obj[key2]
}
if (isArray(newForm[key]) && key == key2 && obj[key2] && obj[key2].length > 0) {
newForm[key] = obj[key2]
}
}
}
// 2.根据最新的表单数据更新processedFanFormData的值,因为有些模块是多项的,所以表单数据要和dom对应上,防止dom有form表单里没有对应的数据会报错
let newChildren = {
type: '4',
childTitle: '儿女',
delete: true, //是否显示删除按钮
age: '',
needProvide: '',
options: noYesList.value
}
// 深拷贝原始表单dom数据
const processedData = JSON.parse(JSON.stringify(formData))
for (const section of processedData) {
for (const key in newForm) {
//回显的数据有的没填写就会是null,收集表单值得时候和dom对应不上,对于null值得项要根据section得keyType给form正确得数据类型
if (!newForm[key]) {
if (section.keyType == 'Array' && key == section.key) {
newForm[key] = []
} else if (section.keyType == 'Object' && key == section.key) {
newForm[key] = {}
}
}
if (section.data) {
if (section.key == 'familyMembers' && section.key == key) {
// 根据家人得type对应,如果填写得有儿女processedFanFormData和form应该加上对应得值
newForm[key].forEach((item, index) => {
// 儿女特殊处理,因为可能有多个儿女为了区分是哪个儿女,所以加上id
if (item.type == '4') {
item.id = index + 1
section.data.push({ id: index + 1, ...newChildren })
form.value[key].push({ id: index + 1, ...newChildren })
}
})
} else if (key !== 'familyMembers' && section.key == key) {
if (isArray(newForm[key]) && newForm[key].length <= section.dataLength) {
let num = section.dataLength - newForm[key].length
for (let i = 0; i < num; i++) {
newForm[key].push(section.data[0])
}
}
}
if (section.key == 'personalData' && key == section.key) {
if (isObject(newForm[key])) {
for (const key2 in newForm[key]) {
// 如果就业情况为其他,显示其他就业情况
if (key2 == 'employment' && newForm[key][key2] == 'OTHER') {
for (const item of section.data) {
if (item.key == 'otherEmployment') {
item.show = true
}
}
}
}
}
}
}
}
}
// 回显表单值特殊处理
for (const key in form.value) {
for (const key2 in newForm) {
if (key == key2 && key == 'familyMembers') {
if (newForm[key2].length > 0) {
form.value[key] = form.value[key].map(item1 => {
newForm[key2].forEach(item2 => {
if (item1.type == '4' && item1.id == item2.id) {
item1.age = item2.age
item1.needProvide = item2.needProvide
} else {
if (item1.type == item2.type && !item2.id) {
item1.age = item2.age
item1.needProvide = item2.needProvide
}
}
})
return item1
})
}
} else if (key == key2 && key !== 'familyMembers') {
if (isArray(newForm[key2]) && newForm[key].length > 0) {
form.value[key] = newForm[key2]
} else if (isObject(newForm[key2])) {
for (const key3 in newForm[key2]) {
if (!newForm[key2][key3]) {
if (key3 == 'premiumFundingSource' || key3 == 'liquidAssetType') {
newForm[key2][key3] = []
} else {
newForm[key2][key3] = ''
}
} else {
if (key3 == 'premiumFundingSource' || key3 == 'liquidAssetType') {
newForm[key2][key3] = newForm[key2][key3].split(',')
}
}
}
form.value[key] = newForm[key2]
}
}
}
}
for (const section of processedData) { for (const section of processedData) {
for (const key1 in obj) { if (section.keyType == 'Array') {
if (section.data) { section.data = obj[section.key] ? obj[section.key] : []
if ( } else if (section.keyType == 'Object') {
obj[key1] && obj[section.key].premiumFundingSource = obj[section.key].premiumFundingSource
key1 !== 'familyMembers' && ? obj[section.key].premiumFundingSource.split(',')
key1 == section.key && : []
section.keyType == 'Array' obj[section.key].liquidAssetType = obj[section.key].liquidAssetType
) { ? obj[section.key].liquidAssetType.split(',')
section.data = obj[key1].map(item => { : []
for (const key2 in item) { form.value[section.key] = obj[section.key]
if (key2 == 'currency') {
item.options = fetchDictData('bx_currency_type')
} else if (key2 == 'needProvide') {
item.options = fetchDictData('sys_no_yes')
}
}
return {
...item
}
})
} else if (
key1 == 'familyMembers' &&
key1 == section.key &&
section.keyType == 'Array' &&
obj[key1]
) {
section.data = form.value[key1].map(item => {
for (const key2 in item) {
if (key2 == 'needProvide') {
item.options = fetchDictData('sys_no_yes')
}
}
return {
...item
}
})
}
// 流动资产包含其他的时候,显示其他说明
if (section.key == 'liquidAssets') {
for (const field of section.data) {
if (
field.key == 'otherLiquidAsset' &&
obj[section.key]['liquidAssetType'] &&
obj[section.key]['liquidAssetType'].includes('G')
) {
field.show = true
}
}
}
}
} }
} }
...@@ -850,64 +791,58 @@ const isObject = value => { ...@@ -850,64 +791,58 @@ const isObject = value => {
// 表单提交 // 表单提交
const submitForm = saveType => { const submitForm = saveType => {
let oldForm = JSON.parse(JSON.stringify(form.value))
// 深拷贝原始数据 // 深拷贝原始数据
let result = JSON.parse(JSON.stringify(form.value))
let resDom = JSON.parse(JSON.stringify(processedFanFormData.value)) let resDom = JSON.parse(JSON.stringify(processedFanFormData.value))
console.log('result', result) let result = {}
// return // return
proxy.$refs['fanFormRef'].validate((valid, fields) => { proxy.$refs['fanFormRef'].validate((valid, fields) => {
if (valid) { if (valid) {
for (const section of resDom) { for (const section of resDom) {
for (const key1 in result) { if (section.keyType == 'Array' && section.data.length > 0) {
// key1 !== 'familyMembers' && section.data.forEach(item => {
if (section.key == key1 && section.keyType == 'Array') { if (item.brokerName) {
result[key1] = section.data dictStore.userSaleExpandList.forEach(item2 => {
} if (item2.value == item.brokerName) {
} item.brokerName = item2.label
} }
for (const key in result) { })
if (isObject(result[key])) { }
for (const key2 in result[key]) { if (item.brokerTeam) {
if (isArray(result[key][key2])) { dictStore.allTeaList.forEach(item2 => {
if ( if (item2.value == item.brokerTeam) {
key == 'liquidAssets' && item.brokerTeam = item2.label
key2 == 'liquidAssetType' && }
!result[key][key2].includes('G') })
) { }
result[key]['otherLiquidAsset'] = '' if (item.insurer) {
} dictStore.allInsuranceCompanyList.forEach(item2 => {
result[key][key2] = result[key][key2].join(',') if (item2.value == item.insurer) {
item.insurer = item2.label
}
})
}
if (item.insuranceType) {
item.insuranceTypeOption.forEach(item2 => {
if (item2.value == item.insuranceType) {
item.insuranceType = item2.label
}
})
} }
}
}
if (isArray(result[key])) {
result[key] = result[key]
.map(item => {
// 删除指定字段
delete item.childTitle
delete item.children
delete item.disabled
delete item.id
delete item.span
delete item.dictType
delete item.options
delete item.delete
delete item.subTitle
if (item.policyIssueDate) {
item.policyIssueDate = proxy.formatToDate(item.policyIssueDate)
}
return item
})
.filter(item => Object.keys(item).length > 0) // 过滤空对象
}
if (key == 'familyMembers') {
result[key] = result[key].filter(item => {
if (item.age || item.needProvide) return item
}) })
result[section.key] = section.data
} }
} }
result.premiumAffordability = JSON.parse(JSON.stringify(form.value.premiumAffordability))
result.premiumAffordability.liquidAssetType =
result.premiumAffordability.liquidAssetType.join(',')
result.premiumAffordability.premiumFundingSource =
result.premiumAffordability.premiumFundingSource.join(',')
if (result.premiumAffordability.liquidAssetType.includes('G')) {
result.premiumAffordability.otherLiquidAsset = oldForm.premiumAffordability.otherLiquidAsset
}
result.saveType = saveType result.saveType = saveType
result.customerBizId = props.customerBizId result.customerBizId = props.customerBizId
console.log('====================================') console.log('====================================')
...@@ -991,6 +926,12 @@ watch( ...@@ -991,6 +926,12 @@ watch(
) )
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.editBtn {
position: fixed;
right: 3.5%;
top: 22%;
z-index: 999;
}
.dependNum { .dependNum {
font-size: 14px; font-size: 14px;
font-weight: none; font-weight: none;
......
...@@ -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(() => {
// 彻底重置所有响应式数据 // 彻底重置所有响应式数据
......
<template> <template>
<!-- v-if="processedBeneficiaryData.length > 0" -->
<div> <div>
<div v-if="processedBeneficiaryData.length > 0"> <div ref="beneficiaryRef">
<el-row> <CommonForm :showAnchor="false">
<el-col :span="24"> <template #form-right>
<div class="topBtn"> <el-form ref="beneficiaryInfoFormRef" :model="form" :rules="rules">
<el-button <el-row v-for="father in processedBeneficiaryData" style="margin-bottom: 10px">
type="warning" <div class="formBox formFna">
icon="DocumentAdd" <CardOne :title="father.fatherTitle" v-if="father.showMoudle">
@click="addBeneficiary" <template #content>
:disabled="editStatus" <el-row v-if="!father.showTable" :gutter="20">
>新增受益人</el-button <template v-for="child in father.data" :key="child.key">
> <el-col :sm="child.sm" :lg="child.lg" class="formItem" v-if="child.show">
<el-button <div>
v-if="props.showSubmitBtn" <el-form-item
type="primary" :label="child.label"
icon="EditPen" :prop="child.key"
@click="handleEditStatus(!editStatus)" :key="child.key"
style="margin-left: 10px" :label-width="child.labelWidth"
>编辑</el-button :label-position="child.labelPosition"
> >
</div> <el-input
</el-col> v-if="child.domType === 'Input'"
</el-row> :type="child.inputType"
<el-form ref="beneficiaryInfoFormRef" :model="form" label-width="120px"> v-model="form[child.key]"
<div v-for="(level1, l1) in processedBeneficiaryData" :key="level1.id"> :placeholder="child.placeholder"
<el-row style="margin-bottom: 10px"> maxlength="30"
<div class="formBox"> :disabled="editStatus"
<div class="level1Label"> :style="{ width: child.inputWidth ? child.inputWidth : '100%' }"
<span>{{ level1.bigTitle }}-{{ l1 + 1 }}</span> />
<el-icon <el-select
@click="deleteBeneficiary(l1, level1)" v-if="child.domType === 'Select'"
v-if="level1.deleteIcon && processedBeneficiaryData.length > 1" v-model="form[child.key]"
style="color: red; font-size: 18px; margin-left: 10px" :placeholder="child.placeholder"
><Delete @change="handleSelectChange(father, child)"
/></el-icon> :disabled="editStatus"
</div> >
<div v-for="(level2, l2) in level1.children" :key="level2.key"> <el-option
<div class="fatherLable" v-if="level2.showMoudle">{{ level2.fatherTitle }}</div> v-for="item in child.options"
<el-row :gutter="20" v-if="level2.showMoudle"> :key="item.value"
<template v-for="child in level2.data" :key="child.key"> :label="item.label"
<el-col :sm="child.sm" :lg="child.lg" class="formItem" v-if="child.show"> :value="item.value"
<div> />
<!-- :rules=" </el-select>
child.required <el-date-picker
? [ style="width: 100%"
{ v-if="child.domType === 'DatePicker'"
required: true, v-model="form[child.key]"
message: `${child.label}不能为空`, type="date"
trigger: 'blur' :placeholder="child.placeholder"
} :disabled="editStatus"
] />
: [] <el-checkbox-group
" --> v-if="child.domType === 'Checkbox'"
<el-form-item v-model="form[child.key]"
:label-width="child.labelWidth" :disabled="editStatus"
:label="child.label" >
:prop="`apiBeneficiaryInfoDtoList.${l1}.${child.key}`" <el-checkbox
:key="child.key" v-for="item in child.options"
:label-position="child.labelPosition" :key="item.value"
:rules="getRules(child)" :label="item.value"
>
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
<el-select
v-model="form[child.key]"
v-if="child.domType === 'SearchSelect'"
filterable
remote
reserve-keyword
placeholder="请输入关键词搜索"
:remote-method="query => searchSelectList(query, child.key)"
:loading="searchLoadingStates[child.key]"
:disabled="editStatus"
@change="handleSearchSelectChange(child.key)"
>
<el-option
v-for="item in searchOptions[child.key] || []"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</div>
</el-col>
</template>
</el-row>
<!-- 是表格数据 -->
<el-row v-if="father.showTable">
<el-col :span="24" v-if="father.addChildren">
<el-button
:disabled="editStatus"
type="primary"
icon="Plus"
size="small"
style="margin-bottom: 10px"
@click="addChildren(father)"
>{{ father.addChildrenTxt }}</el-button
>
</el-col>
<el-table :data="father.data" border v-if="father.data.length > 0">
<!-- 动态渲染列 -->
<el-table-column
v-for="column in father.columns"
:key="column.prop"
:label="column.label"
:prop="column.prop"
align="center"
> >
<!-- @input="handleInputChange(father, child, l1)" --> <template #default="scope">
<el-input <span v-if="column.type === 'text'">{{ scope.row[column.prop] }}</span>
v-if="child.domType === 'Input'" </template>
:type="child.inputType" </el-table-column>
v-model="form['apiBeneficiaryInfoDtoList'][l1][child.key]"
:placeholder="child.placeholder" <!-- 操作列(固定) -->
maxlength="30" <el-table-column align="center" label="操作" width="150">
:disabled="child.disabled" <template #default="scope">
/> <el-button
<el-select type="primary"
v-if="child.domType === 'Select'" size="small"
v-model="form['apiBeneficiaryInfoDtoList'][l1][child.key]" @click="updateChildren(father, scope.row)"
:placeholder="child.placeholder" >
@change="handleSelectChange(child, l1, l2)" 修改
:disabled="child.disabled" </el-button>
> <el-button
<el-option type="danger"
v-for="item in child.options" size="small"
:key="item.value" @click="deleteChildren(father, scope.$index)"
:label="item.label" >
:value="item.value" 删除
/> </el-button>
</el-select> </template>
<el-date-picker </el-table-column>
v-model="form['apiBeneficiaryInfoDtoList'][l1][child.key]" </el-table>
style="width: 100%" </el-row>
v-if="child.domType === 'DatePicker'"
type="date"
:placeholder="child.placeholder"
:disabled="child.disabled"
:disabled-date="disabledDate"
/>
<el-input
v-if="child.domType === 'arrowRight'"
v-model="form['apiBeneficiaryInfoDtoList'][l1][child.key]"
:placeholder="child.placeholder"
@click="handleFoucs(child, l1, level1)"
:suffix-icon="ArrowRight"
readonly
:disabled="child.disabled"
>
</el-input>
</el-form-item>
</div>
</el-col>
</template> </template>
</el-row> </CardOne>
</div> </div>
</div> </el-row>
</el-row>
</div>
<el-row v-if="props.showSubmitBtn">
<el-col>
<div class="tabButton">
<!-- <el-button
type="primary"
icon="RefreshRight"
@click="resetForm"
size="large"
:disabled="editStatus"
>重置</el-button
> -->
<el-button
type="primary"
icon="Check"
@click="submitForm"
size="large"
:disabled="editStatus"
>提交</el-button
>
</div>
</el-col>
</el-row>
</el-form>
<el-dialog title="联系人信息" v-model="openList" width="600px" append-to-body>
<div>
<el-form :model="queryParams" ref="queryRef" :inline="true" label-width="85px">
<el-form-item label="联系人姓名" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入姓名" @input="customerList" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" circle @click="customerList" />
<el-button type="info" icon="Refresh" circle @click="resetCustomerList" />
</el-form-item>
</el-form> </el-form>
<div class="customerBox"> </template>
<div class="customerItem" v-for="item in tableData" :key="item.id"> </CommonForm>
<div class="top">
<div class="right"> <CommonDialog
<el-button type="primary" size="small" @click="handleExport(item)" :dialogTitle="dialogTitle"
>导入联系人</el-button confirmText="确定"
cancleText="关闭"
dialogWidth="70%"
:showClose="true"
:openDialog="dialogVisible"
@close="dialogVisible = false"
@confirm="dialogConfirm"
>
<div class="dialogBox">
<el-form :model="dialogForm" ref="dialogFormRef">
<el-row :gutter="20">
<template v-for="(child, dIndex) in addBeneficiaryForm">
<el-col :sm="child.sm" :lg="child.lg" class="formItem">
<el-form-item
:label="child.label"
:prop="child.key"
:key="child.key"
:label-width="child.labelWidth"
:label-position="child.labelPosition"
:rules="getRules(child)"
> >
</div> <el-input
</div> v-if="child.domType === 'Input'"
<div class="bottom"> :type="child.inputType"
<div class="left"> v-model="dialogForm[child.key]"
<div class="infoItem"> :placeholder="child.placeholder"
<span>姓名:</span> maxlength="30"
<span> {{ item.name || '暂无' }}</span> @blur="handleInputBlur(child)"
</div> />
<div class="infoItem">
<span>性别:</span> <el-select
<span> v-if="child.domType === 'Select'"
<dict-tag :options="fetchDictData('sys_gender')" :value="item.gender" v-model="dialogForm[child.key]"
/></span> :placeholder="child.placeholder"
</div> >
<div class="infoItem"> <el-option
<span>年龄:</span> v-for="item in child.options"
<span> {{ item.age || '暂无' }}</span> :key="item.value"
</div> :label="item.label"
</div> :value="item.value"
</div> />
</div> </el-select>
</div> <el-date-picker
style="width: 100%"
v-if="child.domType === 'DatePicker'"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
v-model="dialogForm[child.key]"
type="date"
:placeholder="child.placeholder"
/>
<el-input
v-if="child.domType === 'arrowRight'"
v-model="dialogForm[child.key]"
:placeholder="child.placeholder"
@click="handleFoucs(child)"
:suffix-icon="ArrowRight"
readonly
:disabled="editStatus"
>
</el-input>
</el-form-item>
</el-col>
</template>
</el-row>
</el-form>
</div> </div>
</el-dialog> </CommonDialog>
</div> </div>
<!-- <div v-else class="domEmpty" v-loading="loading"></div> -->
<Phone <Phone
@close="handleCloseDrawer" @close="handleCloseDrawer"
:showDrawer="showPhoneDrawer" :showDrawer="showPhoneDrawer"
...@@ -202,6 +239,11 @@ ...@@ -202,6 +239,11 @@
</div> </div>
</template> </template>
<script setup name="beneficiaryInfo"> <script setup name="beneficiaryInfo">
import { getCustomerList, calculateFieldValue } from '@/api/sign/fna'
import CommonDialog from '@/components/commonDialog'
import CardOne from '@/components/formCard/cardOne'
import CommonForm from '@/views/components/commonForm'
import { validateEnglish } from '@/utils/validate' import { validateEnglish } from '@/utils/validate'
import { ArrowRight } from '@element-plus/icons-vue' import { ArrowRight } from '@element-plus/icons-vue'
import beneficiaryDomData from '@/formJson/beneficiary' import beneficiaryDomData from '@/formJson/beneficiary'
...@@ -210,7 +252,6 @@ import Phone from '@/views/components/phone' ...@@ -210,7 +252,6 @@ import Phone from '@/views/components/phone'
import Address from '@/views/components/address' import Address from '@/views/components/address'
import { watch, nextTick } from 'vue' import { watch, nextTick } from 'vue'
import { getCustomerList } from '@/api/sign/fna'
import { updatePolicyBeneficiary, delPolicyBeneficiary } from '@/api/sign/underwritingMain' import { updatePolicyBeneficiary, delPolicyBeneficiary } from '@/api/sign/underwritingMain'
import { editBeneficiaryInfo, delBeneficiary } from '@/api/sign/appointment' import { editBeneficiaryInfo, delBeneficiary } from '@/api/sign/appointment'
import useDictStore from '@/store/modules/dict' import useDictStore from '@/store/modules/dict'
...@@ -225,7 +266,11 @@ const props = defineProps({ ...@@ -225,7 +266,11 @@ const props = defineProps({
appointmentStatus: { type: Number }, //父组件传递过来的预约的状态 appointmentStatus: { type: Number }, //父组件传递过来的预约的状态
customerInfo: { type: Object, default: () => ({}) }, //客户详情回显表单用 customerInfo: { type: Object, default: () => ({}) }, //客户详情回显表单用
showSubmitBtn: { type: Boolean, default: false }, //父组件状态,新增、修改 showSubmitBtn: { type: Boolean, default: false }, //父组件状态,新增、修改
pageSource: { type: String, default: false } //页面来源 pageSource: { type: String, default: false }, //页面来源
fatherTabName: { type: String, default: '' }, //一级tab名称
anchorContainer: { type: String, default: '' }, //锚点滚动容器
editStatus: { type: Boolean, default: true }, //编辑状态
tabIndex: { type: [String, Number], default: '' } //tab索引
}) })
const emit = defineEmits(['handleSuccessEdit', 'policyEditSuccess']) const emit = defineEmits(['handleSuccessEdit', 'policyEditSuccess'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
...@@ -237,7 +282,7 @@ const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输 ...@@ -237,7 +282,7 @@ const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输
const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
const tempSaveKey = ref({}) // 用于tab切换的时候保存一份临时的值,防止切换的时候数据丢失 const tempSaveKey = ref({}) // 用于tab切换的时候保存一份临时的值,防止切换的时候数据丢失
const errorFields = ref([]) // 存储校验失败的字段信息 const errorFields = ref([]) // 存储校验失败的字段信息
const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑 // const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑
const openList = ref(false) // 客户列表弹窗 const openList = ref(false) // 客户列表弹窗
const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作 const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作
const phoneOraddressKey = ref([]) // 存储当前点击的drawer框返回的对象,修改的时候回显值也要存key const phoneOraddressKey = ref([]) // 存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
...@@ -301,6 +346,10 @@ const tempAddressQuickList = ref([]) ...@@ -301,6 +346,10 @@ const tempAddressQuickList = ref([])
const tempPhoneQuickList = ref([]) const tempPhoneQuickList = ref([])
const personalObj = ref({}) //存储个人key const personalObj = ref({}) //存储个人key
const companyObj = ref({}) //存储公司key const companyObj = ref({}) //存储公司key
const dialogVisible = ref(false) //新增受益人弹窗
const addBeneficiaryForm = ref([]) //新增受益人表单
const dialogTitle = ref('') //新增受益人弹窗标题
const dialogKey = ref('') //新增受益人弹窗标题
const deleteKeyList = ref([ const deleteKeyList = ref([
'objType', 'objType',
'mailingAddress', 'mailingAddress',
...@@ -319,6 +368,7 @@ const data = reactive({ ...@@ -319,6 +368,7 @@ const data = reactive({
tempBeneficiaryDomData: [], //保存旧的表单Dom,便于撤销操作 tempBeneficiaryDomData: [], //保存旧的表单Dom,便于撤销操作
oldAppointmentData: [], // 保存旧的表单Dom,便于撤销操作 oldAppointmentData: [], // 保存旧的表单Dom,便于撤销操作
rules: {}, //表单验证规则, rules: {}, //表单验证规则,
dialogForm: {},
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 4, pageSize: 4,
...@@ -332,8 +382,108 @@ const { ...@@ -332,8 +382,108 @@ const {
queryParams, queryParams,
oldAppointmentData, oldAppointmentData,
tempBeneficiaryForm, tempBeneficiaryForm,
tempBeneficiaryDomData tempBeneficiaryDomData,
dialogForm
} = toRefs(data) } = toRefs(data)
const deleteChildren = (father, index) => {
if (father.key == 'apiBeneficiaryInfoDtoList') {
father.data.splice(index, 1)
proxy.$message.success('受益人删除成功')
}
}
const updateChildren = (father, row) => {
dialogForm.value = JSON.parse(JSON.stringify(row))
if (father.key == 'apiBeneficiaryInfoDtoList') {
dialogTitle.value = '修改受益人'
dialogKey.value = 'apiBeneficiaryInfoDtoList'
addBeneficiaryForm.value = JSON.parse(JSON.stringify(father.formItem))
}
dialogVisible.value = true
}
const dialogConfirm = () => {
let newDOM = JSON.parse(JSON.stringify(processedBeneficiaryData.value))
proxy.$refs['dialogFormRef'].validate((valid, fields) => {
if (valid) {
for (const section of newDOM) {
if (section.key == dialogKey.value) {
// 处理下拉值得显示
for (const child of section.formItem) {
if (child.domType == 'Select' && dialogForm.value[child.key]) {
child.options.forEach(item => {
if (item.value == dialogForm.value[child.key]) {
dialogForm.value[child.key + 'Name'] = item.label
}
})
}
}
let index = section.data.findIndex(item => item.id == dialogForm.value.id)
if (index == -1) {
section.data.push(dialogForm.value)
} else {
section.data[index] = JSON.parse(JSON.stringify(dialogForm.value))
}
}
}
processedBeneficiaryData.value = newDOM
dialogVisible.value = false
dialogForm.value = {}
}
})
}
// 添加表单子级dom
const addChildren = father => {
if (props.editStatus) {
proxy.$message.warning('请先点击编辑')
return
}
dialogForm.value = { id: Date.now() + Math.floor(Math.random()) }
if (father.key == 'apiBeneficiaryInfoDtoList') {
dialogTitle.value = '新增受益人'
dialogKey.value = 'apiBeneficiaryInfoDtoList'
addBeneficiaryForm.value = JSON.parse(JSON.stringify(father.formItem))
dialogVisible.value = true
}
}
const handleInputBlur = child => {
if (dialogForm.value['documentType'] == 'idCard' && child.key == 'idNumber') {
getFieldValue(child.key)
} else if (child.key == 'nameCn' && dialogForm.value['nameCn']) {
getFieldValue(child.key)
}
}
const getFieldValue = key => {
let obj = {}
if (dialogForm.value['documentType'] == 'idCard' && key == 'idNumber') {
obj = {
calculateType: 6,
requestValue: dialogForm.value['idNumber']
}
} else if (key == 'nameCn') {
obj = {
calculateType: 1,
requestValue: dialogForm.value['nameCn']
}
}
calculateFieldValue(obj).then(res => {
if (res.code == 200) {
res.data.forEach(item => {
if (obj.calculateType == 6) {
if (item.calculateType == 2) {
dialogForm.value['gender'] = item.responseKey
} else if (item.calculateType == 3) {
dialogForm.value['birthday'] = item.requestValue
} else if (item.calculateType == 4) {
dialogForm.value['age'] = item.requestValue
}
} else if (obj.calculateType == 1) {
dialogForm.value['namePyEn'] = item.responseValue
}
})
}
})
}
// 获取表单项的校验规则 // 获取表单项的校验规则
const getRules = child => { const getRules = child => {
const rules = [] const rules = []
...@@ -347,80 +497,12 @@ const getRules = child => { ...@@ -347,80 +497,12 @@ const getRules = child => {
}) })
} }
// 为英文姓名添加自定义校验
if (child.key === 'nameEn') {
rules.push({
validator: validateEnglish,
trigger: 'change'
})
}
return rules return rules
} }
// 新增受益人
const addBeneficiary = () => {
let oneMoudle = JSON.parse(JSON.stringify(processedBeneficiaryData.value[0]))
oneMoudle.id = Date.now() + Math.floor(Math.random() * 1000) //唯一标识,用于删除
processedBeneficiaryData.value.push(oneMoudle)
form.value.apiBeneficiaryInfoDtoList.push({ id: oneMoudle.id })
}
// 删除受益人
const deleteBeneficiary = (l1, level1) => {
console.log('====================================')
console.log('l1', form.value.apiBeneficiaryInfoDtoList[l1])
console.log('====================================')
if (editStatus.value) {
proxy.$modal.confirm(`编辑状态下才能删除`, { showCancel: '0', title: '填写提示' })
return
}
if (processedBeneficiaryData.value.length == 1) {
proxy.$modal.confirm(`至少保留一个受益人`, { showCancel: '0', title: '填写提示' })
return
}
if (
level1.beneficiaryBizId &&
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList')
) {
delBeneficiary(level1.beneficiaryBizId).then(res => {
if (res.code == 200) {
proxy.$message.success('预约-受益人删除成功')
processedBeneficiaryData.value.splice(l1, 1)
form.value.apiBeneficiaryInfoDtoList.splice(l1, 1)
emit('handleSuccessEdit')
}
})
} else if (
form.value.apiBeneficiaryInfoDtoList[l1].policyBeneficiaryBizId &&
props.pageSource == 'policyList'
) {
delPolicyBeneficiary(form.value.apiBeneficiaryInfoDtoList[l1].policyBeneficiaryBizId).then(
res => {
if (res.code == 200) {
proxy.$message.success('新单跟进-受益人删除成功')
processedBeneficiaryData.value.splice(l1, 1)
form.value.apiBeneficiaryInfoDtoList.splice(l1, 1)
emit('policyEditSuccess')
}
}
)
} else {
proxy.$message.success('受益人删除成功')
processedBeneficiaryData.value.splice(l1, 1)
form.value.apiBeneficiaryInfoDtoList.splice(l1, 1)
}
}
const disabledDate = time => { const disabledDate = time => {
return time.getTime() > Date.now() return time.getTime() > Date.now()
} }
const exportInfo = () => {
if (props.customerBizId && editStatus.value) {
proxy.$modal.confirm(`请先点击编辑在导入客户信息`, { showCancel: '0', title: '填写提示' })
return
}
openList.value = true
customerList()
}
const customerList = () => { const customerList = () => {
console.log('触发了') console.log('触发了')
...@@ -477,29 +559,23 @@ const fetchDictData = dictType => { ...@@ -477,29 +559,23 @@ const fetchDictData = dictType => {
const processFormData = async obj => { const processFormData = async obj => {
// 深拷贝原始数据 // 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(obj.domdata)) const processedData = JSON.parse(JSON.stringify(obj.domdata))
for (const item of processedData) { for (const section of processedData) {
if (tempBeneficiaryDomData.value.length == 0) { if (section.data) {
form.value.apiBeneficiaryInfoDtoList.push({ id: item.id }) for (const field of section.data) {
rules.value[field.key] = [
{ required: true, message: `${field.label}不能为空`, trigger: 'blur' }
]
if (field.dictType) {
// 获取字典数据
field.options = fetchDictData(field.dictType)
}
}
} }
if (item.children) { if (section.formItem) {
for (const section of item.children) { for (const field of section.formItem) {
if (section.data) { if (field.dictType) {
for (const field of section.data) { // 获取字典数据
if (section.key == 'customer' || section.key == 'other') { field.options = fetchDictData(field.dictType)
personalObj.value[field.key] = field.key
companyObj.value[field.key] = field.key
}
// 收集key,区分个人和企业
if (section.key == 'person') {
personalObj.value[field.key] = field.key
} else if (section.key == 'company') {
companyObj.value[field.key] = field.key
}
if (field.dictType) {
// 获取字典数据
field.options = fetchDictData(field.dictType)
}
}
} }
} }
} }
...@@ -517,50 +593,46 @@ const processFormData = async obj => { ...@@ -517,50 +593,46 @@ const processFormData = async obj => {
} else { } else {
processedBeneficiaryData.value = oldAppointmentData.value = processedData processedBeneficiaryData.value = oldAppointmentData.value = processedData
} }
if (props.showSubmitBtn) { // if (props.showSubmitBtn) {
editStatus.value = true // } else {
} else { // processedBeneficiaryData.value = oldAppointmentData.value = processedData
editStatus.value = false // }
// processedBeneficiaryData.value = oldAppointmentData.value = processedData
}
} }
//弹出右侧抽屉 //弹出右侧抽屉
const handleFoucs = (child, l1, level1) => { const handleFoucs = (child, l1, level1) => {
if (child.disabled) return if (child.disabled) return
child.l1 = l1
child.id = level1.id
drawerInfo.value = JSON.parse(JSON.stringify(child)) drawerInfo.value = JSON.parse(JSON.stringify(child))
console.log('drawerInfo', drawerInfo.value) console.log('drawerInfo', drawerInfo.value)
switch (child.drawerType) { switch (child.drawerType) {
case 'phone': // case 'phone':
phoneMenuList.value[0].key = child.code // phoneMenuList.value[0].key = child.code
phoneMenuList.value[1].key = child.key // phoneMenuList.value[1].key = child.key
phoneMenuList.value.forEach(item => { // phoneMenuList.value.forEach(item => {
item.value = '' // item.value = ''
}) // })
let phoneString = form.value.apiBeneficiaryInfoDtoList[l1][child.key] // let phoneString = form.value.apiBeneficiaryInfoDtoList[l1][child.key]
if (phoneString) { // if (phoneString) {
phoneMenuList.value[0].value = phoneString.split(' ')[0] // phoneMenuList.value[0].value = phoneString.split(' ')[0]
phoneMenuList.value[1].value = phoneString.split(' ')[1] // phoneMenuList.value[1].value = phoneString.split(' ')[1]
} // }
showPhoneDrawer.value = true // showPhoneDrawer.value = true
break // break
case 'address': // case 'address':
addressMenuList.value.forEach(item => { // addressMenuList.value.forEach(item => {
item.value = '' // item.value = ''
phoneOraddressKey.value.forEach(item1 => { // phoneOraddressKey.value.forEach(item1 => {
if (item1.id == level1.id && item1.type == child.key) { // if (item1.id == level1.id && item1.type == child.key) {
for (const key in item1) { // for (const key in item1) {
if (item.key == key) { // if (item.key == key) {
item.value = item1[key] // item.value = item1[key]
} // }
} // }
} // }
}) // })
}) // })
showAddressDrawer.value = true // showAddressDrawer.value = true
break // break
case 'country': case 'country':
showCountryDrawer.value = true showCountryDrawer.value = true
break break
...@@ -651,7 +723,7 @@ const confirmDrawer = info => { ...@@ -651,7 +723,7 @@ const confirmDrawer = info => {
break break
case 'country': case 'country':
// info.objType = drawerInfo.value.drawerType // info.objType = drawerInfo.value.drawerType
// form.value[drawerInfo.value.key] = info.name dialogForm.value[drawerInfo.value.key] = info.name
// saveKey.value[drawerInfo.value.key] = info // saveKey.value[drawerInfo.value.key] = info
break break
default: default:
...@@ -692,85 +764,15 @@ const resetShow = obj => { ...@@ -692,85 +764,15 @@ const resetShow = obj => {
break break
} }
} }
console.log('更新', processedBeneficiaryData.value)
} }
const handleSelectChange = (child, l1, l2) => { const handleSelectChange = (father, child) => {
let customerType = form.value['apiBeneficiaryInfoDtoList'][l1]['customerType']
let insurantRel = form.value['apiBeneficiaryInfoDtoList'][l1]['insurantRel']
switch (child.key) { switch (child.key) {
case 'customerType': case 'isLegalBeneficiary':
const newDOM = JSON.parse(JSON.stringify(processedBeneficiaryData.value)) if (form.value[child.key] == '0') {
//这里存在一个对index得问题,暂不解决先放在这 resetShow({ type: 'father', key: 'apiBeneficiaryInfoDtoList', status: true })
for (const section of newDOM[l1].children) {
if (
(customerType == 'COMPANY' || customerType == 'INDIVIDUAL') &&
insurantRel &&
insurantRel == 'MYSELF' &&
section.key == 'customer'
) {
section.showMoudle = true
} else if (customerType == 'COMPANY' && insurantRel && insurantRel !== 'MYSELF') {
if (section.key == 'person') {
section.showMoudle = false
} else {
section.showMoudle = true
}
} else if (customerType == 'INDIVIDUAL' && insurantRel && insurantRel !== 'MYSELF') {
if (section.key == 'company') {
section.showMoudle = false
} else {
section.showMoudle = true
}
} else if (customerType == 'COMPANY' && !insurantRel) {
if (section.key == 'company') {
section.showMoudle = true
} else if (section.key == 'person') {
section.showMoudle = false
}
} else if (customerType == 'INDIVIDUAL' && !insurantRel) {
if (section.key == 'company') {
section.showMoudle = false
} else if (section.key == 'person') {
section.showMoudle = true
}
}
}
processedBeneficiaryData.value = newDOM
break
case 'insurantRel':
const newDOM1 = JSON.parse(JSON.stringify(processedBeneficiaryData.value))
for (const child of newDOM1[l1].children) {
if (insurantRel == 'MYSELF') {
if (child.key == 'customer') {
child.showMoudle = true
} else {
child.showMoudle = false
}
} else {
if (customerType == 'COMPANY') {
if (child.key == 'company') {
child.showMoudle = true
} else if (child.key == 'person') {
child.showMoudle = false
}
} else {
if (child.key == 'company') {
child.showMoudle = false
} else {
child.showMoudle = true
}
}
}
}
processedBeneficiaryData.value = newDOM1
break
case 'smokingAllowed':
// 选择吸烟,展示吸烟数量
if (form.value[child.key] == '1') {
resetShow({ type: 'child', key: 'smokingVolume', status: true })
} else { } else {
resetShow({ type: 'child', key: 'smokingVolume', status: false }) resetShow({ type: 'father', key: 'apiBeneficiaryInfoDtoList', status: false })
} }
break break
...@@ -965,139 +967,37 @@ const getInvalidFields = fields => { ...@@ -965,139 +967,37 @@ const getInvalidFields = fields => {
// 处理表单填写得数据 // 处理表单填写得数据
const handleFormValues = () => { const handleFormValues = () => {
//提交的时候记得填写区号的电话,把相对应的区号字段加上 return new Promise(async resolve => {
//地址相关的还没处理 let submitObj = { ...form.value }
// 因为投保人没有policyholderRel的校验会影响 受保人,所以暂时先赋值处理
let submitForm = [] proxy.$refs['beneficiaryInfoFormRef'].validate((valid, fields) => {
let result = {} if (valid) {
if (props.activeName == 'beneficiary') { errorFields.value = [] // 清空错误信息
result = JSON.parse(JSON.stringify(form.value)) //处理表单数据
} else { processedBeneficiaryData.value.forEach(item => {
result = JSON.parse(JSON.stringify(tempBeneficiaryForm.value)) if (item.keyType == 'Array') {
} submitObj[item.key] = item.data
const pattern = /Time$/ // 以Time结尾
for (const section of result['apiBeneficiaryInfoDtoList']) {
let submitObj = {}
if (
props.pageSource == 'policyList' &&
props.idsObj.policyBizId &&
section.policyBeneficiaryBizId
) {
submitObj['policyBeneficiaryBizId'] = section.policyBeneficiaryBizId
submitObj['policyBizId'] = section.policyBizId
}
if (phoneOraddressKey.value.length > 0) {
submitObj.addressList = []
}
for (const key in section) {
if (pattern.test(key) && section[key]) {
section[key] = proxy.formatToDateTime(section[key])
}
//客户类型为个人的时候
if (section['customerType'] == 'INDIVIDUAL' && section[key]) {
for (const key1 in personalObj.value) {
if (key == key1) {
submitObj[key1] = section[key]
} }
}
}
// 客户类型为公司的时候
if (section['customerType'] == 'COMPANY' && section[key]) {
for (const key2 in companyObj.value) {
if (key == key2) {
submitObj[key2] = section[key]
}
}
}
}
if (submitObj['companyMobile']) {
submitObj['companyMobileCode'] = submitObj['companyMobile'].split(' ')[0]
submitObj['companyMobile'] = submitObj['companyMobile'].split(' ')[1]
}
if (submitObj['mobile']) {
submitObj['mobileCode'] = submitObj['mobile'].split(' ')[0]
submitObj['mobile'] = submitObj['mobile'].split(' ')[1]
}
if (submitObj['authMobile']) {
submitObj['authMobileCode'] = submitObj['authMobile'].split(' ')[0]
submitObj['authMobile'] = submitObj['authMobile'].split(' ')[1]
}
phoneOraddressKey.value.forEach(item => {
if (item.drawerType == 'address' && item.id === section.id) {
submitObj.addressList.push({
type: item.type,
location: item.location,
street: item.street,
city: item.city,
region: item.region
}) })
}
})
deleteKeyList.value.forEach(item => {
delete submitObj[item]
})
submitForm.push(submitObj)
// if (Object.keys(submitObj).length > 0) {
// submitForm.push(submitObj)
// }
}
console.log('====================================')
console.log('提交受益人', submitForm)
console.log('====================================')
// 删除多余字段
return submitForm if (errorFields.value.length > 0) {
} proxy.$message.error(errorFields.value[0].message)
// 表单提交 return undefined
const submitForm = () => { }
proxy.$refs['beneficiaryInfoFormRef'].validate((valid, fields) => {
if (valid) {
let submitObj = handleFormValues()
// return
if ( resolve(errorFields.value.length == 0 ? submitObj : null)
props.idsObj.appointmentBizId && } else {
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList') errorFields.value = getInvalidFields(fields)
) { if (errorFields.value.length > 0) {
editBeneficiaryInfo({ proxy.$message.error(errorFields.value[0].message)
appointmentBizId: props.idsObj.appointmentBizId, }
apiBeneficiaryInfoDtoList: submitObj resolve(undefined)
}).then(res => {
if (res.code == 200) {
handleEditStatus(true)
proxy.$message.success('受益人修改成功')
emit('handleSuccessEdit')
}
})
}
if (props.idsObj.policyBizId && props.pageSource == 'policyList') {
updatePolicyBeneficiary({
policyBizId: props.idsObj.policyBizId,
policyBeneficiaryList: submitObj
}).then(res => {
if (res.code == 200) {
handleEditStatus(true)
proxy.$message.success('新单跟进-受益人修改成功')
emit('policyEditSuccess')
}
})
}
errorFields.value = [] // 清空错误信息
} else {
// 获取校验失败的字段信息
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
} }
} })
}) })
} }
const resetForm = () => { const resetForm = () => {
proxy.$modal proxy.$modal
.confirm('是否确认撤销所作操作?') .confirm('是否确认撤销所作操作?')
...@@ -1127,18 +1027,15 @@ watch( ...@@ -1127,18 +1027,15 @@ watch(
if (newVal === 'beneficiary') { if (newVal === 'beneficiary') {
openList.value = false openList.value = false
setTimeout(() => { if (props.showSubmitBtn) {
// 修改状态 setFormValue()
if (props.showSubmitBtn) { } else {
setFormValue() // 新增状态
} else { processFormData({
// 新增状态 domdata: beneficiaryDomData,
processFormData({ exportValue: null
domdata: beneficiaryDomData, })
exportValue: null }
})
}
}, 500)
} }
} }
) )
......
<template> <template>
<div> <div>
<div v-if="questionnairesDom.length > 0"> <div v-if="questionnairesDom.length > 0" ref="questionRef">
<el-row> <CommonForm
<el-col :span="24"> :anchorList="anchorList"
<div class="topBtn"> :affixOffset="affixOffset"
<!-- <el-button type="warning" icon="DocumentAdd" @click="exportInfo" v-if="showContacts" :anchorOffset="10"
>导入联系人</el-button :scrollContainerSelector="anchorContainer"
> --> :scrollOffset="10"
<el-button :domIndex="tabIndex"
v-if="props.idsObj.appointmentBizId" :activeName="activeName"
type="primary" v-if="questionRef"
icon="EditPen" >
@click="handleEditStatus(!editStatus)" <template #form-right>
>编辑</el-button <el-form ref="heathFormRef" :model="form" :rules="rules">
<div
v-for="(level1, l1) in questionnairesDom"
:key="level1.firstCategory"
:id="level1.firstCategory"
> >
</div> <el-row style="margin-bottom: 10px">
</el-col> <div class="formBox">
</el-row> <CardOne :title="level1.firstCategoryName">
<el-form ref="heathFormRef" :model="form" :rules="rules"> <template #content>
<div v-for="(level1, l1) in questionnairesDom" :key="level1.firstCategory"> <el-row :gutter="20" v-if="level1.showMoudle">
<el-row style="margin-bottom: 10px"> <template
<div class="formBox"> v-for="(level2, l2) in level1.secondCategoryDtoList"
<div class="fatherLable"> :key="level2.secondCategory"
<span>{{ level1.firstCategoryName }}</span>
<div class="openCon" v-if="level1.showIcon" @click="changeOpenStatus(level1)">
<el-icon v-if="!level1.showMoudle"><Hide /></el-icon>
<el-icon v-else><View /></el-icon>
</div>
</div>
<el-row :gutter="20" v-if="level1.showMoudle">
<template
v-for="(level2, l2) in level1.secondCategoryDtoList"
:key="level2.secondCategory"
>
<el-col :sm="level2.sm" :lg="level2.lg" class="formItem">
<div class="level2Title">
{{ level2.secondCategoryName }}
</div>
<div>
<div class="level2Content" v-for="(level3, l3) in level2.questionsDtoList">
<div
class="level2Left"
v-if="level2.secondCategory !== 'MEDICAL_CONDITION'"
> >
{{ l3 + 1 }}/{{ level2.questionsDtoList.length }} <el-col :sm="level2.sm" :lg="level2.lg" class="formItem">
</div> <div class="level2Title">
<div class="level2Right"> {{ level2.secondCategoryName }}
<div </div>
class="level3Title" <div>
v-if="level2.secondCategory !== 'MEDICAL_CONDITION'" <div
> class="level2Content"
{{ level3.text }} v-for="(level3, l3) in level2.questionsDtoList"
</div>
<div
class="level3Content"
v-if="level2.secondCategory !== 'MEDICAL_CONDITION'"
>
<!-- 回显得时候拿不到optionBizId -->
<el-radio-group
v-model="
form[l1]['secondCategoryDtoList'][l2]['questionsDtoList'][l3][
'answerSessionsDto'
]['optionBizId']
"
@change="handleRadioChange(l1, l2, l3, level3)"
:disabled="editStatus"
>
<el-radio
v-for="dict in level3.optionsDtoList"
:key="dict.optionBizId"
:value="dict.optionBizId"
>{{ dict.text }}</el-radio
> >
</el-radio-group> <div
<!--选择是才展示附加条件 --> class="level2Left"
<div v-if="level2.secondCategory !== 'MEDICAL_CONDITION'"
v-if="
form[l1]['secondCategoryDtoList'][l2]['questionsDtoList'][l3][
'answerSessionsDto'
]['optionBizId'] == 'option_1002'
"
style="width: 100%"
>
<!-- 附加问题 -->
<div v-for="(level4, l4) in level3.addQuestionsDtoList">
<el-form-item
label-position="top"
:key="level4.addQuestionsBizId"
:label="level4.text"
:rules="
level4.isRequired
? [
{
required: true,
message: `${level4.text}不能为空`,
trigger: 'blur'
}
]
: []
"
> >
<div class="level4Content"> {{ l3 + 1 }}/{{ level2.questionsDtoList.length }}
<el-input </div>
v-if="level4.type === 'TEXT'" <div class="level2Right">
:type="level4.type" <div
class="level3Title"
v-if="level2.secondCategory !== 'MEDICAL_CONDITION'"
>
{{ level3.text }}
</div>
<div
class="level3Content"
v-if="level2.secondCategory !== 'MEDICAL_CONDITION'"
>
<el-radio-group
v-model=" v-model="
form[l1]['secondCategoryDtoList'][l2]['questionsDtoList'][ form[l1]['secondCategoryDtoList'][l2]['questionsDtoList'][
l3 l3
]['addQuestionsDtoList'][l4]['content'] ]['answerSessionsDto']['optionBizId']
" "
placeholder="请输入" @change="handleRadioChange(l1, l2, l3, level3)"
maxlength="30"
style="width: 50%"
:disabled="editStatus" :disabled="editStatus"
/> >
<el-date-picker <el-radio
style="width: 50%" v-for="dict in level3.optionsDtoList"
v-if="level4.type === 'DATE'" :key="dict.optionBizId"
:disabled="editStatus" :value="dict.optionBizId"
v-model=" >{{ dict.text }}</el-radio
>
</el-radio-group>
<!--选择是才展示附加条件 -->
<div
v-if="
form[l1]['secondCategoryDtoList'][l2]['questionsDtoList'][ form[l1]['secondCategoryDtoList'][l2]['questionsDtoList'][
l3 l3
]['addQuestionsDtoList'][l4]['content'] ]['answerSessionsDto']['optionBizId'] == 'option_1002'
" "
type="date" style="width: 100%"
placeholder="请输入" >
:disabled-date="disabledDate" <!-- 附加问题 -->
@change="handleDateChange(l1, l2, l3, l4)" <div v-for="(level4, l4) in level3.addQuestionsDtoList">
/> <el-form-item
label-position="top"
:key="level4.addQuestionsBizId"
:label="level4.text"
:rules="
level4.isRequired
? [
{
required: true,
message: `${level4.text}不能为空`,
trigger: 'blur'
}
]
: []
"
>
<div class="level4Content">
<el-input
v-if="level4.type === 'TEXT'"
:type="level4.type"
v-model="
form[l1]['secondCategoryDtoList'][l2][
'questionsDtoList'
][l3]['addQuestionsDtoList'][l4]['content']
"
placeholder="请输入"
maxlength="30"
style="width: 50%"
:disabled="editStatus"
/>
<el-date-picker
style="width: 50%"
v-if="level4.type === 'DATE'"
:disabled="editStatus"
v-model="
form[l1]['secondCategoryDtoList'][l2][
'questionsDtoList'
][l3]['addQuestionsDtoList'][l4]['content']
"
type="date"
placeholder="请输入"
:disabled-date="disabledDate"
@change="handleDateChange(l1, l2, l3, l4)"
/>
</div>
</el-form-item>
</div>
</div>
</div> </div>
</el-form-item> <div v-if="level2.secondCategory == 'MEDICAL_CONDITION'">
</div> <el-button
</div> style="margin-bottom: 10px"
</div> class="addBtn"
<div v-if="level2.secondCategory == 'MEDICAL_CONDITION'"> type="primary"
<div :icon="Plus"
v-for="(question, q4) in level3.answerSessionsDto size="small"
.questionTextJsonDtoList" @click="addMedical(l1, l2, l3)"
style="margin-bottom: 10px" :disabled="editStatus"
> >继续添加</el-button
<div class="questionContent"> >
<div class="questionTitle">{{ `${question.title}${q4 + 1}` }}</div> <div
<el-input v-for="(question, q4) in level3.answerSessionsDto
type="text" .questionTextJsonDtoList"
:disabled="editStatus" style="margin-bottom: 10px"
v-model=" >
form[l1]['secondCategoryDtoList'][l2]['questionsDtoList'][l3][ <div class="questionContent">
'answerSessionsDto' <div class="questionTitle">
]['questionTextJsonDtoList'][q4]['content'] {{ `${question.title}${q4 + 1}` }}
" </div>
placeholder="请输入" <el-input
maxlength="300" type="text"
style="width: 70%" :disabled="editStatus"
/> v-model="
<el-icon class="deleteIcon" @click="deleteMedical(l1, l2, l3, q4)" form[l1]['secondCategoryDtoList'][l2][
><Remove 'questionsDtoList'
/></el-icon> ][l3]['answerSessionsDto']['questionTextJsonDtoList'][
q4
]['content']
"
placeholder="请输入"
maxlength="300"
style="width: 70%"
/>
<el-icon
class="deleteIcon"
@click="deleteMedical(l1, l2, l3, q4)"
><Remove
/></el-icon>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<el-button </el-col>
class="addBtn" </template>
type="primary" </el-row>
:icon="Plus" </template>
size="small" </CardOne>
@click="addMedical(l1, l2, l3)" </div>
:disabled="editStatus"
>继续添加</el-button
>
</div>
</div>
</div>
</div>
</el-col>
</template>
</el-row> </el-row>
</div> </div>
</el-row> <!-- <el-row>
</div> <el-col>
<el-row> <div class="tabButton">
<el-col> <el-button
<div class="tabButton"> type="primary"
<!-- <el-button icon="Check"
type="primary" @click="submitForm"
icon="RefreshRight" :disabled="editStatus"
@click="resetForm" size="large"
size="large" >提交</el-button
:disabled="editStatus" >
>重置</el-button </div>
> --> </el-col>
<el-button </el-row> -->
type="primary" </el-form>
icon="Check" </template>
@click="submitForm" </CommonForm>
:disabled="editStatus"
size="large"
>提交</el-button
>
</div>
</el-col>
</el-row>
</el-form>
</div> </div>
<div v-else class="domEmpty" v-loading="loading"></div> <div v-else class="domEmpty" v-loading="loading"></div>
</div> </div>
</template> </template>
<script setup name="secondHolderInfo"> <script setup name="secondHolderInfo">
import { Plus } from '@element-plus/icons-vue' import { Plus } from '@element-plus/icons-vue'
import CommonForm from '@/views/components/commonForm'
import CardOne from '@/components/formCard/cardOne'
import { watch } from 'vue' import { watch } from 'vue'
import { getQuestionnaires, saveQuestionnaires } from '@/api/sign/appointment' import { getQuestionnaires, saveQuestionnaires } from '@/api/sign/appointment'
import useDictStore from '@/store/modules/dict' import useDictStore from '@/store/modules/dict'
...@@ -216,28 +215,34 @@ import useDictStore from '@/store/modules/dict' ...@@ -216,28 +215,34 @@ import useDictStore from '@/store/modules/dict'
const dictStore = useDictStore() //获取字典数据 const dictStore = useDictStore() //获取字典数据
const props = defineProps({ const props = defineProps({
activeName: { type: String, default: '' }, //tab名称 activeName: { type: String, default: '' }, //tab名称
fearthStatus: { type: String, default: '' }, //父组件状态,新增、修改 editStatus: {
type: Boolean,
default: false
}, //父组件状态,新增、修改
formStatus: { type: String, default: '' }, //父组件状态,新增、修改 formStatus: { type: String, default: '' }, //父组件状态,新增、修改
idsObj: { type: Object, default: () => ({}) }, //父组件传递过来的id对象 idsObj: { type: Object, default: () => ({}) }, //父组件传递过来的id对象
appointmentStatus: { type: Number }, //父组件传递过来的预约的状态 appointmentStatus: { type: Number }, //父组件传递过来的预约的状态
customerInfo: { type: Object, default: () => ({}) }, customerInfo: { type: Object, default: () => ({}) },
//客户详情回显表单用 //客户详情回显表单用
showSubmitBtn: { type: Boolean, default: false }, //父组件状态,新增、修改 showSubmitBtn: { type: Boolean, default: false }, //父组件状态,新增、修改
foldInsurantInfo: { type: Boolean, default: false }, //是否隐藏受保人信息 foldInsurantInfo: { type: Boolean, default: false }, //是否隐藏受保人信息
pageSource: { type: String, default: '' } //页面来源 pageSource: { type: String, default: '' }, //页面来源
anchorContainer: { type: String, default: '' }, //锚点滚动容器
tabIndex: { type: [String, Number], default: '' }, //tab索引
affixOffset: { type: Number, default: 250 } //锚点吸顶距离
}) })
const emit = defineEmits(['handleSuccessEdit']) const emit = defineEmits(['handleSuccessEdit'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const loading = ref(false) const loading = ref(false)
const errorFields = ref([]) // 存储校验失败的字段信息 const errorFields = ref([]) // 存储校验失败的字段信息
const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑 const questionRef = ref(null)
const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作 const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作
const showInsurant = ref(false) //是否显示受保人信息 const showInsurant = ref(false) //是否显示受保人信息
const questionnairesDom = ref([])
const data = reactive({ const data = reactive({
form: [], form: [],
tempSecondHolderForm: [], //由于切换tab的时候,表单数据会重置,所以需要 tempSecondHolderForm: [], //由于切换tab的时候,表单数据会重置,所以需要
questionnairesDom: [], // 处理后的表单数据 // questionnairesDom: [], // 处理后的表单数据
oldAppointmentData: [], // 保存旧的表单Dom,便于撤销操作 oldAppointmentData: [], // 保存旧的表单Dom,便于撤销操作
rules: {}, //表单验证规则, rules: {}, //表单验证规则,
queryParams: { queryParams: {
...@@ -246,8 +251,7 @@ const data = reactive({ ...@@ -246,8 +251,7 @@ const data = reactive({
name: undefined name: undefined
} }
}) })
const { form, rules, questionnairesDom, queryParams, oldAppointmentData, tempSecondHolderForm } = const { form, rules, queryParams, oldAppointmentData, tempSecondHolderForm } = toRefs(data)
toRefs(data)
const changeOpenStatus = level1 => { const changeOpenStatus = level1 => {
console.log('level1', level1) console.log('level1', level1)
let newDom = JSON.parse(JSON.stringify(questionnairesDom.value)) let newDom = JSON.parse(JSON.stringify(questionnairesDom.value))
...@@ -267,7 +271,7 @@ const addMedical = (l1, l2, l3) => { ...@@ -267,7 +271,7 @@ const addMedical = (l1, l2, l3) => {
}) })
} }
const deleteMedical = (l1, l2, l3, index) => { const deleteMedical = (l1, l2, l3, index) => {
if (editStatus.value) { if (props.editStatus) {
proxy.$modal.confirm(`请先点击编辑在删除病况`, { showCancel: '0', title: '填写提示' }) proxy.$modal.confirm(`请先点击编辑在删除病况`, { showCancel: '0', title: '填写提示' })
return return
} }
...@@ -304,9 +308,7 @@ const handleRadioChange = (l1, l2, l3, level3) => { ...@@ -304,9 +308,7 @@ const handleRadioChange = (l1, l2, l3, level3) => {
}) })
} }
} }
console.log('====================================')
console.log('answer', answer)
console.log('====================================')
let optionItem = level3.optionsDtoList.filter(item => item.optionBizId === answer.optionBizId) let optionItem = level3.optionsDtoList.filter(item => item.optionBizId === answer.optionBizId)
let newObj = { let newObj = {
...@@ -380,61 +382,77 @@ const getInvalidFields = fields => { ...@@ -380,61 +382,77 @@ const getInvalidFields = fields => {
// 处理表单填写得数据 // 处理表单填写得数据
const handleFormValues = () => { const handleFormValues = () => {
let submitObj = [] return new Promise(async resolve => {
if (props.activeName == 'questionnaires') { proxy.$refs['heathFormRef'].validate((valid, fields) => {
submitObj = JSON.parse(JSON.stringify(form.value)) if (valid) {
console.log('1111', submitObj) errorFields.value = [] // 清空错误信息
} else { let submitObj = []
// submitObj = JSON.parse(JSON.stringify(tempSecondHolderForm.value)) if (props.activeName == 'questionnaires') {
// console.log('2222', submitObj) submitObj = JSON.parse(JSON.stringify(form.value))
} console.log('1111', submitObj)
} else {
// submitObj = JSON.parse(JSON.stringify(tempSecondHolderForm.value))
// console.log('2222', submitObj)
}
let answerSessionsDtoList = [] let answerSessionsDtoList = []
// 处理表单数据 // 处理表单数据
submitObj.forEach(level1 => { submitObj.forEach(level1 => {
level1.secondCategoryDtoList.forEach(level2 => { level1.secondCategoryDtoList.forEach(level2 => {
// 修正:应该是 questionsDtoList 而不是 questionDtoList // 修正:应该是 questionsDtoList 而不是 questionDtoList
if (level2.questionsDtoList && level2.questionsDtoList.length > 0) { if (level2.questionsDtoList && level2.questionsDtoList.length > 0) {
level2.questionsDtoList.forEach(level3 => { level2.questionsDtoList.forEach(level3 => {
// 检查是否有答案数据和附加问题 // 检查是否有答案数据和附加问题
// //
if (level3.answerSessionsDto) { if (level3.answerSessionsDto) {
// 问题选择了是 // 问题选择了是
if ( if (
level3.answerSessionsDto.optionJsonDtoList && level3.answerSessionsDto.optionJsonDtoList &&
level3.answerSessionsDto.optionBizId && level3.answerSessionsDto.optionBizId &&
level3.answerSessionsDto.optionBizId == 'option_1002' level3.answerSessionsDto.optionBizId == 'option_1002'
) { ) {
level3.answerSessionsDto.optionJsonDtoList.forEach(level4 => { level3.answerSessionsDto.optionJsonDtoList.forEach(level4 => {
level4.addQuestionsJsonDtoList = JSON.parse( level4.addQuestionsJsonDtoList = JSON.parse(
JSON.stringify(level3.addQuestionsDtoList) JSON.stringify(level3.addQuestionsDtoList)
) )
})
}
answerSessionsDtoList.push({
questionBizId: level3.questionBizId,
...level3.answerSessionsDto
})
}
}) })
} }
answerSessionsDtoList.push({ })
questionBizId: level3.questionBizId,
...level3.answerSessionsDto
})
}
}) })
let objectBizId = ''
if (
props.idsObj.appointmentBizId &&
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList')
) {
objectBizId = props.idsObj.appointmentBizId
} else if (props.idsObj.policyBizId && props.pageSource == 'policyList') {
objectBizId = props.idsObj.policyBizId
}
resolve(
errorFields.value.length == 0
? {
questionnaireBizId: 'questionnaires_1001',
objectBizId: objectBizId,
answerSessionsDtoList
}
: null
)
} else {
// 获取校验失败的字段信息
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
}
} }
}) })
}) })
let objectBizId = ''
if (
props.idsObj.appointmentBizId &&
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList')
) {
objectBizId = props.idsObj.appointmentBizId
} else if (props.idsObj.policyBizId && props.pageSource == 'policyList') {
objectBizId = props.idsObj.policyBizId
}
return {
questionnaireBizId: 'questionnaires_1001',
objectBizId: objectBizId,
answerSessionsDtoList
}
} }
// 表单提交 // 表单提交
const submitForm = () => { const submitForm = () => {
...@@ -449,16 +467,6 @@ const submitForm = () => { ...@@ -449,16 +467,6 @@ const submitForm = () => {
getQuestionnairesInfo() getQuestionnairesInfo()
} }
}) })
// if (props.idsObj.appointmentBizId || props.idsObj.policyBizId) {
// saveQuestionnaires(submitObj).then(res => {
// if (res.code == 200) {
// handleEditStatus(true)
// proxy.$message.success('健康信息修改成功')
// emit('handleSuccessEdit')
// getQuestionnairesInfo()
// }
// })
// }
errorFields.value = [] // 清空错误信息 errorFields.value = [] // 清空错误信息
} else { } else {
...@@ -506,7 +514,7 @@ const getQuestionnairesInfo = () => { ...@@ -506,7 +514,7 @@ const getQuestionnairesInfo = () => {
level1.showMoudle = true level1.showMoudle = true
} else if (level1.firstCategory == 'INSURED_PERSON') { } else if (level1.firstCategory == 'INSURED_PERSON') {
level1.showIcon = true level1.showIcon = true
level1.showMoudle = false level1.showMoudle = true
} }
level1.secondCategoryDtoList.forEach((level2, l2) => { level1.secondCategoryDtoList.forEach((level2, l2) => {
level2.sm = 24 level2.sm = 24
...@@ -581,10 +589,19 @@ const getQuestionnairesInfo = () => { ...@@ -581,10 +589,19 @@ const getQuestionnairesInfo = () => {
questionnairesDom.value = form.value = result questionnairesDom.value = form.value = result
loading.value = false loading.value = false
console.log('questionnairesDom.value', questionnairesDom.value)
} }
}) })
} }
const anchorList = computed(() => {
let data = []
for (const section of questionnairesDom.value) {
if (section.showMoudle) {
data.push({ title: section.firstCategory, name: section.firstCategoryName })
}
}
return data
})
watch( watch(
() => props.activeName, () => props.activeName,
newVal => { newVal => {
...@@ -596,9 +613,7 @@ watch( ...@@ -596,9 +613,7 @@ watch(
props.idsObj.appointmentBizId && props.idsObj.appointmentBizId &&
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList') (props.pageSource == 'fnaList' || props.pageSource == 'appointmentList')
) { ) {
editStatus.value = true
} else if (props.idsObj.policyBizId && props.pageSource == 'policyList') { } else if (props.idsObj.policyBizId && props.pageSource == 'policyList') {
editStatus.value = true
} }
getQuestionnairesInfo() getQuestionnairesInfo()
console.log('foldInsurantInfo', props.foldInsurantInfo) console.log('foldInsurantInfo', props.foldInsurantInfo)
...@@ -609,7 +624,11 @@ watch( ...@@ -609,7 +624,11 @@ watch(
// 暴露给父组件 // 暴露给父组件
defineExpose({ defineExpose({
handleFormValues, handleFormValues,
handleEditStatus handleEditStatus,
questionLength: computed(() => {
return questionnairesDom.value.length
})
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -663,6 +682,7 @@ defineExpose({ ...@@ -663,6 +682,7 @@ defineExpose({
.level2Left { .level2Left {
margin-right: 15px; margin-right: 15px;
margin-top: 3px; margin-top: 3px;
color: #0052d9;
} }
.level2Right { .level2Right {
width: calc(100% - 30px); width: calc(100% - 30px);
......
<template> <template>
<!-- 只画好了样式具体的逻辑还没处理 --> <!-- v-if="processedProductData.length > 0" -->
<div v-if="processedProductData.length > 0"> <div>
<div ref="productRef"> <div ref="productRef">
<CommonForm <CommonForm
:anchorList="anchorList" :anchorList="anchorList"
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
:remote-method="query => searchSelectList(query, child.key)" :remote-method="query => searchSelectList(query, child.key)"
:loading="searchLoadingStates[child.key]" :loading="searchLoadingStates[child.key]"
:disabled="editStatus" :disabled="editStatus"
@change="handleSearchSelectChange(father, child)" @change="handleSearchSelectChange(child.key)"
> >
<el-option <el-option
v-for="item in searchOptions[child.key] || []" v-for="item in searchOptions[child.key] || []"
...@@ -115,18 +115,38 @@ ...@@ -115,18 +115,38 @@
> >
</el-col> </el-col>
<el-table :data="father.data" border v-if="father.data.length > 0"> <el-table :data="father.data" border v-if="father.data.length > 0">
<template v-if="father.key == 'apiProductPlanAdditionalInfoDtoList'"> <!-- 动态渲染列 -->
<el-table-column label="姓名" prop="realName" align="center" /> <el-table-column
<el-table-column width="60px" align="center" label="操作"> v-for="column in father.columns"
<template #default="scope"> :key="column.prop"
<el-icon :label="column.label"
class="deleteIcon" :prop="column.prop"
@click="deleteChildren(father, scope.$index)" align="center"
><Delete >
/></el-icon> <template #default="scope">
</template> <span v-if="column.type === 'text'">{{ scope.row[column.prop] }}</span>
</el-table-column> </template>
</template> </el-table-column>
<!-- 操作列(固定) -->
<el-table-column align="center" label="操作" width="150" fixed="right">
<template #default="scope">
<el-button
type="primary"
size="small"
@click="updateChildren(father, scope.row)"
>
修改
</el-button>
<el-button
type="danger"
size="small"
@click="deleteChildren(father, scope.$index)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table> </el-table>
</el-row> </el-row>
</template> </template>
...@@ -145,9 +165,10 @@ ...@@ -145,9 +165,10 @@
:showClose="true" :showClose="true"
:openDialog="dialogVisible" :openDialog="dialogVisible"
@close="dialogVisible = false" @close="dialogVisible = false"
@confirm="dialogProductConfirm"
> >
<div class="dialogBox"> <div class="dialogBox">
<el-form> <el-form :model="dialogForm" ref="dialogFormRef">
<el-row :gutter="20"> <el-row :gutter="20">
<template v-for="(child, dIndex) in additionalProductForm"> <template v-for="(child, dIndex) in additionalProductForm">
<el-col :sm="child.sm" :lg="child.lg" class="formItem"> <el-col :sm="child.sm" :lg="child.lg" class="formItem">
...@@ -161,14 +182,14 @@ ...@@ -161,14 +182,14 @@
<el-input <el-input
v-if="child.domType === 'Input'" v-if="child.domType === 'Input'"
:type="child.inputType" :type="child.inputType"
v-model="child.value" v-model="dialogForm[child.key]"
:placeholder="child.placeholder" :placeholder="child.placeholder"
maxlength="30" maxlength="30"
/> />
<el-select <el-select
v-if="child.domType === 'Select'" v-if="child.domType === 'Select'"
v-model="child.value" v-model="dialogForm[child.key]"
:placeholder="child.placeholder" :placeholder="child.placeholder"
> >
<el-option <el-option
...@@ -181,12 +202,12 @@ ...@@ -181,12 +202,12 @@
<el-date-picker <el-date-picker
style="width: 100%" style="width: 100%"
v-if="child.domType === 'DatePicker'" v-if="child.domType === 'DatePicker'"
v-model="child.value" v-model="dialogForm[child.key]"
type="date" type="date"
:placeholder="child.placeholder" :placeholder="child.placeholder"
/> />
<el-select <el-select
v-model="child.value" v-model="dialogForm[child.key]"
v-if="child.domType === 'SearchSelect'" v-if="child.domType === 'SearchSelect'"
filterable filterable
remote remote
...@@ -224,7 +245,9 @@ import { watch } from 'vue' ...@@ -224,7 +245,9 @@ import { watch } from 'vue'
import { import {
getInsuranceProductList, getInsuranceProductList,
getAdditionalProductList, getAdditionalProductList,
secondAdditonalList secondAdditonalList,
getInsuranceCategory,
getInsuranceCompany
} from '@/api/common' } from '@/api/common'
import { editProductPlanInfo, delAdditional } from '@/api/sign/appointment' import { editProductPlanInfo, delAdditional } from '@/api/sign/appointment'
import { updatePolicyProduct, delPolicyAdditional } from '@/api/sign/underwritingMain' import { updatePolicyProduct, delPolicyAdditional } from '@/api/sign/underwritingMain'
...@@ -252,11 +275,11 @@ const emit = defineEmits(['handleSuccessEdit', 'policyEditSuccess']) ...@@ -252,11 +275,11 @@ const emit = defineEmits(['handleSuccessEdit', 'policyEditSuccess'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
// const { sys_no_yes } = proxy.useDict('sys_no_yes') // const { sys_no_yes } = proxy.useDict('sys_no_yes')
const dialogTitle = ref('新增') const dialogTitle = ref('新增')
const dialogKey = ref('')
const dialogVisible = ref(false) const dialogVisible = ref(false)
const productRef = ref(null) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key const productRef = ref(null) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
const errorFields = ref([]) // 存储校验失败的字段信息 const errorFields = ref([]) // 存储校验失败的字段信息
// const anchorList = ref([]) // 存储校验失败的字段信息
// const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑
const openList = ref(false) // 客户列表弹窗 const openList = ref(false) // 客户列表弹窗
const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作 const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作
const currencyType = ref([]) // 是否列表 const currencyType = ref([]) // 是否列表
...@@ -269,86 +292,89 @@ const data = reactive({ ...@@ -269,86 +292,89 @@ const data = reactive({
processedProductData: [], // 处理后的表单数据 processedProductData: [], // 处理后的表单数据
oldProductDomData: [], // 保存旧的表单Dom,便于撤销操作 oldProductDomData: [], // 保存旧的表单Dom,便于撤销操作
rules: {}, //表单验证规则, rules: {}, //表单验证规则,
dialogForm: {},
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 4, pageSize: 4,
name: undefined name: undefined
} }
}) })
const { form, rules, processedProductData, queryParams, oldProductDomData, tempForm } = toRefs(data) const { form, rules, processedProductData, queryParams, oldProductDomData, tempForm, dialogForm } =
// 添加表单子级dom toRefs(data)
const addChildren = father => { const deleteChildren = (father, index) => {
if (props.editStatus) { if (father.key == 'apiProductPlanAdditionalInfoDtoList') {
proxy.$message.warning('请先点击编辑') father.data.splice(index, 1)
return proxy.$message.success('附加计划删除成功')
} }
}
const updateChildren = (father, row) => {
dialogForm.value = JSON.parse(JSON.stringify(row))
if (father.key == 'apiProductPlanAdditionalInfoDtoList') { if (father.key == 'apiProductPlanAdditionalInfoDtoList') {
dialogTitle.value = '新增附加计划' dialogTitle.value = '修改附加计划'
dialogKey.value = 'apiProductPlanAdditionalInfoDtoList'
additionalProductForm.value = JSON.parse(JSON.stringify(father.formItem)) additionalProductForm.value = JSON.parse(JSON.stringify(father.formItem))
dialogVisible.value = true
} }
dialogVisible.value = true
} }
const deleteChildren = (father, childIndex) => { const dialogProductConfirm = () => {
if (editStatus.value) { proxy.$refs['dialogFormRef'].validate((valid, fields) => {
proxy.$message.warning('编辑状态下才能删除') if (valid) {
return let newDOM = JSON.parse(JSON.stringify(processedProductData.value))
} for (const section of newDOM) {
return if (section.key == dialogKey.value) {
const processedData = JSON.parse(JSON.stringify(processedProductData.value)) // 处理下拉值得显示
if ( for (const child of section.formItem) {
props.idsObj.appointmentBizId && if (child.domType == 'Select' && dialogForm.value[child.key]) {
form.value[father.key][childIndex].additionalBizId && child.options.forEach(item => {
(props.pageSource == 'appointmentList' || props.pageSource == 'fnaList') if (item.value == dialogForm.value[child.key]) {
) { dialogForm.value[child.key + 'Value'] = item.label
delAdditional(form.value[father.key][childIndex].additionalBizId).then(res => { }
if (res.code == 200) { })
proxy.$message.success('附加险删除成功') }
for (const section of processedData) { if (child.domType == 'SearchSelect' && dialogForm.value[child.key]) {
if (father.key == 'apiProductPlanAdditionalInfoDtoList' && section.key == father.key) { if (child.key == 'productLaunchName') {
section.data.splice(childIndex, 1) dictStore.productAdditionalList.forEach(item => {
if (item.value == dialogForm.value[child.key]) {
dialogForm.value[child.key + 'Value'] = item.label
}
})
}
}
} }
} let index = section.data.findIndex(item => item.id == dialogForm.value.id)
//更新form表单对应的数据,以便收集填写的值 if (index == -1) {
form.value[father.key].splice(childIndex, 1) section.data.push(dialogForm.value)
emit('handleSuccessEdit') } else {
} section.data[index] = JSON.parse(JSON.stringify(dialogForm.value))
})
} else if (
props.idsObj.policyBizId &&
form.value[father.key][childIndex].id &&
props.pageSource == 'policyList'
) {
delPolicyAdditional(form.value[father.key][childIndex].id).then(res => {
if (res.code == 200) {
proxy.$message.success('附加险删除成功')
for (const section of processedData) {
if (father.key == 'apiProductPlanAdditionalInfoDtoList' && section.key == father.key) {
section.data.splice(childIndex, 1)
} }
} }
//更新form表单对应的数据,以便收集填写的值
form.value[father.key].splice(childIndex, 1)
emit('policyEditSuccess')
}
})
} else {
for (const section of processedData) {
if (father.key == 'apiProductPlanAdditionalInfoDtoList' && section.key == father.key) {
section.data.splice(childIndex, 1)
} }
processedProductData.value = newDOM
dialogVisible.value = false
dialogForm.value = {}
} }
//更新form表单对应的数据,以便收集填写的值 })
form.value[father.key].splice(childIndex, 1) }
// 添加表单子级dom
const addChildren = father => {
if (props.editStatus) {
proxy.$message.warning('请先点击编辑')
return
}
dialogForm.value = { id: Date.now() + Math.floor(Math.random()) }
if (father.key == 'apiProductPlanAdditionalInfoDtoList') {
dialogTitle.value = '新增附加计划'
dialogKey.value = father.key
additionalProductForm.value = JSON.parse(JSON.stringify(father.formItem))
dialogVisible.value = true
} }
processedProductData.value = processedData
} }
const handleSearchSelectChange = (key, index) => { const handleSearchSelectChange = (key, index) => {
// 附加计划选择产品后,给供款期数下拉框赋值 // 附加计划选择产品后,给供款期数下拉框赋值
if (key == 'productLaunchName') { if (key == 'productLaunchName') {
additionalProductForm.value.forEach(item => { additionalProductForm.value.forEach(item => {
searchOptions.value['productLaunchName'].forEach(item1 => { searchOptions.value['productLaunchName'].forEach(item1 => {
if (item1.value == additionalProductForm.value[index]['value']) { if (item1.value == dialogForm.value['productLaunchName']) {
item1.apiAttributeSettingDtoList.forEach(item2 => { item1.apiAttributeSettingDtoList.forEach(item2 => {
if ( if (
item2.attributeSettingBizId == 'attribute_setting_okpcuc8tlXRfVIAy' && item2.attributeSettingBizId == 'attribute_setting_okpcuc8tlXRfVIAy' &&
...@@ -371,6 +397,17 @@ const handleSearchSelectChange = (key, index) => { ...@@ -371,6 +397,17 @@ const handleSearchSelectChange = (key, index) => {
}) })
}) })
} }
if (key == 'insuranceTypeName') {
searchOptions.value['insuranceTypeName'].forEach(item => {
if (item.value == form.value['apiProductPlanMainInfoDto']['insuranceTypeName']) {
if (item.code == 'CI') {
resetShow('sumInsured', true)
} else {
resetShow('sumInsured', false)
}
}
})
}
} }
// 下拉框搜索方法 // 下拉框搜索方法
// 搜索方法 // 搜索方法
...@@ -423,6 +460,48 @@ const searchSelectList = async (query, fieldKey) => { ...@@ -423,6 +460,48 @@ const searchSelectList = async (query, fieldKey) => {
}) })
searchOptions.value[fieldKey] = response.data.records searchOptions.value[fieldKey] = response.data.records
} }
} else if (fieldKey === 'companyName') {
const params9 = {
pageNo: 1,
pageSize: 10,
queryContent: query.trim()
}
const response9 = await getInsuranceCompany(params9)
if (response9.code == 200) {
response9.data.records = response9.data.records.map(item => {
return {
...item,
label: item.fullName,
value: item.insuranceCompanyBizId
}
})
searchOptions.value[fieldKey] = response9.data.records
}
} else if (fieldKey == 'insuranceTypeName') {
if (!form.value['apiProductPlanMainInfoDto'].companyName) {
proxy.$modal.confirm(`请先选择保险公司`, {
showCancel: '0',
title: '填写提示'
})
// row.insuranceType = ''
return
}
const params1 = {
pageNo: 1,
pageSize: 10,
name: query.trim()
}
const response1 = await getInsuranceCategory(params1)
if (response1.code == 200) {
response1.data.records = response1.data.records.map(item => {
return {
...item,
label: item.name,
value: item.insuranceCategoryBizId
}
})
searchOptions.value[fieldKey] = response1.data.records
}
} }
} catch (error) { } catch (error) {
console.error(`${fieldKey} 搜索失败`, error) console.error(`${fieldKey} 搜索失败`, error)
...@@ -453,7 +532,6 @@ const processFormData = async () => { ...@@ -453,7 +532,6 @@ const processFormData = async () => {
const processedData = JSON.parse(JSON.stringify(productDomData)) const processedData = JSON.parse(JSON.stringify(productDomData))
for (const section of processedData) { for (const section of processedData) {
// anchorList.value.push({ title: section.anchorKey, name: section.fatherTitle })
if (section.fatherRequired) { if (section.fatherRequired) {
rules.value[section.key] = {} rules.value[section.key] = {}
} }
...@@ -493,11 +571,6 @@ const processFormData = async () => { ...@@ -493,11 +571,6 @@ const processFormData = async () => {
currencyType.value = child.options currencyType.value = child.options
} }
} }
if (props.fnaFormBizId) {
child.disabled = true
} else {
child.disabled = false
}
} }
} }
if (field.dictType) { if (field.dictType) {
...@@ -513,11 +586,6 @@ const processFormData = async () => { ...@@ -513,11 +586,6 @@ const processFormData = async () => {
{ required: true, message: `${field.label}不能为空`, trigger: 'blur' } { required: true, message: `${field.label}不能为空`, trigger: 'blur' }
] ]
} }
if (props.showSubmitBtn) {
field.disabled = true
} else {
field.disabled = false
}
} }
} }
} }
...@@ -548,13 +616,14 @@ const processFormData = async () => { ...@@ -548,13 +616,14 @@ const processFormData = async () => {
// idsObj.appointmentBizId // idsObj.appointmentBizId
// 证明是修改 // 证明是修改
if (props.showSubmitBtn) { if (props.showSubmitBtn) {
// editStatus.value = true
// processedProductData.value = processedData
//在流程和预约的时候要调用这个方法回显修改数据 //在流程和预约的时候要调用这个方法回显修改数据
setFormValue(props.apiProductPlanInfoDto, processedData) setFormValue(props.apiProductPlanInfoDto, processedData)
} else { } else {
// editStatus.value = false if (oldProductDomData.value.length > 0) {
processedProductData.value = processedData processedProductData.value = JSON.parse(JSON.stringify(oldProductDomData.value))
} else {
processedProductData.value = processedData
}
} }
} }
...@@ -564,7 +633,7 @@ const resetShow = (childKey, status) => { ...@@ -564,7 +633,7 @@ const resetShow = (childKey, status) => {
for (const section of processedProductData.value) { for (const section of processedProductData.value) {
// 暂时没考虑data里嵌套children的情况 // 暂时没考虑data里嵌套children的情况
if (section.data) { if (section.data && section.data.length > 0) {
for (const field of section.data) { for (const field of section.data) {
if (field.key == childKey) { if (field.key == childKey) {
// 获取字典数据 // 获取字典数据
...@@ -834,7 +903,7 @@ const getInvalidFields = fields => { ...@@ -834,7 +903,7 @@ const getInvalidFields = fields => {
if (fields[field] && fields[field].length > 0) { if (fields[field] && fields[field].length > 0) {
errors.push({ errors.push({
field: field, field: field,
message: fields[field][0].message message: `产品计划模块-${fields[field][0].message}`
}) })
} }
} }
...@@ -850,105 +919,57 @@ const isObject = value => { ...@@ -850,105 +919,57 @@ const isObject = value => {
return typeof value === 'object' && value !== null && !Array.isArray(value) return typeof value === 'object' && value !== null && !Array.isArray(value)
} }
const handleSubmitForm = () => { const handleSubmitForm = () => {
let result = {} let submitObj = {}
if (props.activeName == 'productPlan') { if (props.activeName == 'productPlan') {
result = JSON.parse(JSON.stringify(form.value)) submitObj = JSON.parse(JSON.stringify(form.value))
} else { } else {
result = JSON.parse(JSON.stringify(tempForm.value)) submitObj = JSON.parse(JSON.stringify(tempForm.value))
} }
for (const key in result) { let resDom = JSON.parse(JSON.stringify(processedProductData.value))
if (isObject(result[key])) { return new Promise(async resolve => {
for (const key2 in result[key]) { proxy.$refs['productFormRef'].validate((valid, fields) => {
if (key2 == 'isBacktrack' && result[key][key2] == '0') { if (valid) {
result[key]['policyEffectiveDate'] = null errorFields.value = [] // 清空错误信息
} resDom.forEach(section => {
if (key2 == 'policyEffectiveDate' && result[key][key2]) { if (section.keyType == 'Array' && section.data.length > 0) {
result[key][key2] = proxy.formatToDateTime(result[key][key2]) submitObj[section.key] = JSON.parse(JSON.stringify(section.data))
}
for (const section of dictStore.insureProductList) {
if (key2 == 'productName' && section.productBizId == result[key][key2]) {
result[key][key2] = section.productName
result[key]['productBizId'] = section.productBizId
result[key]['companyName'] = section.ssDeptName
} }
}
}
}
if (isArray(result[key])) {
result[key] = result[key]
.map(item => {
// 删除指定字段
delete item.childTitle
delete item.children
delete item.disabled
delete item.id
delete item.span
delete item.deleteBtn
return item
}) })
.filter(item => Object.keys(item).length > 0) // 过滤空对象 // 保险公司名称转换
} dictStore.allInsuranceCompanyList.forEach(item => {
if (key == 'apiProductPlanAdditionalInfoDtoList') { if (submitObj.apiProductPlanMainInfoDto.companyName == item.value) {
if (result[key].length > 0) { submitObj.apiProductPlanMainInfoDto.companyName = item.label
result[key] = result[key].filter(item => {
for (const key4 in item) {
for (const section of dictStore.additionalProductList) {
if (key4 == 'addProductName' && section.additionalProductBizId == item[key4]) {
item[key4] = section.productName
item['additionalProductBizId'] = section.additionalProductBizId
}
}
if (item[key4]) return item
} }
}) })
} searchOptions.value['insuranceTypeName'].forEach(item => {
} if (submitObj.apiProductPlanMainInfoDto.insuranceTypeName == item.value) {
} submitObj.apiProductPlanMainInfoDto.insuranceTypeName = item.label
console.log('新单提交产品计划', result)
return result
}
// 表单提交
const submitForm = saveType => {
// return
proxy.$refs['productFormRef'].validate((valid, fields) => {
if (valid) {
let result = handleSubmitForm()
if (
props.idsObj.appointmentBizId &&
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList')
) {
editProductPlanInfo(result).then(res => {
if (res.code == 200) {
handleEditStatus(true)
proxy.$message.success('预约-产品计划修改成功')
emit('handleSuccessEdit')
} }
}) })
} searchOptions.value['productLaunchName'].forEach(item => {
if (props.idsObj.policyBizId && props.pageSource == 'policyList') { if (submitObj.apiProductPlanMainInfoDto.productLaunchName == item.value) {
result.policyBizId = props.idsObj.policyBizId submitObj.apiProductPlanMainInfoDto.productLaunchName = item.label
updatePolicyProduct(result).then(res => {
if (res.code == 200) {
handleEditStatus(true)
proxy.$message.success('新单跟进-产品计划修改成功')
emit('policyEditSuccess')
} }
}) })
console.log('产品计划', submitObj)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
return undefined
}
resolve(errorFields.value.length == 0 ? submitObj : null)
} else {
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
}
resolve(undefined)
} }
errorFields.value = [] // 清空错误信息 })
} else {
// 获取校验失败的字段信息
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
}
}
}) })
} }
const anchorList = computed(() => { const anchorList = computed(() => {
let data = [] let data = []
for (const section of processedProductData.value) { for (const section of processedProductData.value) {
...@@ -972,6 +993,7 @@ watch( ...@@ -972,6 +993,7 @@ watch(
newVal => { newVal => {
productRef.value = null productRef.value = null
tempForm.value = { ...form.value } tempForm.value = { ...form.value }
oldProductDomData.value = JSON.parse(JSON.stringify(processedProductData.value))
if (newVal === 'productPlan') { if (newVal === 'productPlan') {
openList.value = false openList.value = false
processFormData() processFormData()
......
<template> <template>
<!-- v-if="processedSecondHolderData.length > 0" -->
<div> <div>
<div v-if="processedSecondHolderData.length > 0"> <div>
<el-row> <CommonForm :showAnchor="false">
<el-col :span="24"> <template #form-right>
<div class="topBtn"> <el-form ref="secondHolderFormRef" :model="form" :rules="rules">
<!-- <el-button type="warning" icon="DocumentAdd" @click="exportInfo" v-if="showContacts" <el-row v-for="father in processedSecondHolderData" style="margin-bottom: 10px">
>导入联系人</el-button <div class="formBox formFna">
> --> <CardOne :title="father.fatherTitle" v-if="father.showMoudle">
<el-button <template #content>
v-if="props.showSubmitBtn" <el-row v-if="!father.showTable" :gutter="20">
type="primary" <template v-for="child in father.data" :key="child.key">
icon="EditPen" <el-col :sm="child.sm" :lg="child.lg" class="formItem" v-if="child.show">
@click="handleEditStatus(!editStatus)" <div>
>编辑</el-button <el-form-item
> :label="child.label"
</div> :prop="child.key"
</el-col> :key="child.key"
</el-row> :label-width="child.labelWidth"
<el-form ref="secondHolderFormRef" :model="form" :rules="rules" label-width="120px"> :label-position="child.labelPosition"
<div v-for="father in processedSecondHolderData"> >
<el-row style="margin-bottom: 10px" v-if="father.showMoudle"> <el-input
<div class="formBox"> v-if="child.domType === 'Input'"
<div class="fatherLable">{{ father.fatherTitle }}</div> :type="child.inputType"
<div class="fatherDes">{{ father.description }}</div> v-model="form[child.key]"
:placeholder="child.placeholder"
<el-row :gutter="20"> maxlength="30"
<template v-for="child in father.data" :key="child.key"> :disabled="editStatus"
<el-col :sm="child.sm" :lg="child.lg" class="formItem" v-if="child.show"> :style="{ width: child.inputWidth ? child.inputWidth : '100%' }"
<div> />
<el-form-item <el-select
:label-width="child.labelWidth" v-if="child.domType === 'Select'"
:label="child.label" v-model="form[child.key]"
:prop="child.key" :placeholder="child.placeholder"
:key="child.key" @change="handleSelectChange(father, child)"
:label-position="child.labelPosition" :disabled="editStatus"
> >
<el-input <el-option
v-if="child.domType === 'Input'" v-for="item in child.options"
:type="child.inputType" :key="item.value"
v-model="form[child.key]" :label="item.label"
:placeholder="child.placeholder" :value="item.value"
maxlength="30" />
:disabled="child.disabled" </el-select>
@input="handleInputChange(father, child)" <el-date-picker
/> style="width: 100%"
<el-select v-if="child.domType === 'DatePicker'"
v-if="child.domType === 'Select'" v-model="form[child.key]"
v-model="form[child.key]" type="date"
:placeholder="child.placeholder" :placeholder="child.placeholder"
@change="handleSelectChange(father, child)" :disabled="editStatus"
:disabled="child.disabled" />
<el-checkbox-group
v-if="child.domType === 'Checkbox'"
v-model="form[child.key]"
:disabled="editStatus"
>
<el-checkbox
v-for="item in child.options"
:key="item.value"
:label="item.value"
>
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
<!-- <el-select
v-model="form[child.key]"
v-if="child.domType === 'SearchSelect'"
filterable
remote
reserve-keyword
placeholder="请输入关键词搜索"
:remote-method="query => searchSelectList(query, child.key)"
:loading="searchLoadingStates[child.key]"
:disabled="editStatus"
@change="handleSearchSelectChange(child.key)"
>
<el-option
v-for="item in searchOptions[child.key] || []"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select> -->
</el-form-item>
</div>
</el-col>
</template>
</el-row>
<!-- 是表格数据 -->
<el-row v-if="father.showTable">
<el-col :span="24" v-if="father.addChildren">
<el-button
:disabled="editStatus"
type="primary"
icon="Plus"
size="small"
style="margin-bottom: 10px"
@click="addChildren(father)"
>{{ father.addChildrenTxt }}</el-button
> >
<el-option </el-col>
v-for="item in child.options" <el-table :data="father.data" border v-if="father.data.length > 0">
:key="item.value" <!-- 动态渲染列 -->
:label="item.label" <el-table-column
:value="item.value" v-for="column in father.columns"
/> :key="column.prop"
</el-select> :label="column.label"
<el-date-picker :prop="column.prop"
v-model="form[child.key]" align="center"
style="width: 100%"
v-if="child.domType === 'DatePicker'"
type="date"
:placeholder="child.placeholder"
:disabled="child.disabled"
:disabled-date="disabledDate"
@change="handleDateChange(child)"
/>
<el-input
v-if="child.domType === 'arrowRight'"
v-model="form[child.key]"
:placeholder="child.placeholder"
@click="handleFoucs(child)"
:suffix-icon="ArrowRight"
readonly
:disabled="child.disabled"
> >
</el-input> <template #default="scope">
<el-button v-if="child.domType === 'button'" :type="child.buttonType">{{ <span v-if="column.type === 'text'">{{ scope.row[column.prop] }}</span>
child.buttonTxt </template>
}}</el-button> </el-table-column>
</el-form-item>
</div> <!-- 操作列(固定) -->
</el-col> <el-table-column align="center" label="操作" width="150">
</template> <template #default="scope">
</el-row> <el-button
</div> type="primary"
</el-row> size="small"
</div> @click="updateChildren(father, scope.row)"
<el-row v-if="props.showSubmitBtn"> >
<el-col> 修改
<div class="tabButton"> </el-button>
<!-- <el-button <el-button
type="primary" type="danger"
icon="RefreshRight" size="small"
@click="resetForm" @click="deleteChildren(father, scope.$index)"
size="large" >
:disabled="editStatus" 删除
>重置</el-button </el-button>
> --> </template>
<el-button </el-table-column>
type="primary" </el-table>
icon="Check" </el-row>
@click="submitForm" </template>
size="large" </CardOne>
:disabled="editStatus" </div>
>提交</el-button </el-row>
> </el-form>
</div> </template>
</el-col> </CommonForm>
</el-row>
</el-form>
<el-dialog title="联系人信息" v-model="openList" width="600px" append-to-body> <el-dialog title="联系人信息" v-model="openList" width="600px" append-to-body>
<div> <div>
<el-form :model="queryParams" ref="queryRef" :inline="true" label-width="85px"> <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="85px">
...@@ -179,6 +211,8 @@ ...@@ -179,6 +211,8 @@
</div> </div>
</template> </template>
<script setup name="secondHolderInfo"> <script setup name="secondHolderInfo">
import CardOne from '@/components/formCard/cardOne'
import CommonForm from '@/views/components/commonForm'
import { calculateExactAge } from '@/utils/date' import { calculateExactAge } from '@/utils/date'
import { ArrowRight } from '@element-plus/icons-vue' import { ArrowRight } from '@element-plus/icons-vue'
import secondHolderDomData from '@/formJson/secondHolder' import secondHolderDomData from '@/formJson/secondHolder'
...@@ -202,7 +236,11 @@ const props = defineProps({ ...@@ -202,7 +236,11 @@ const props = defineProps({
appointmentStatus: { type: Number }, //父组件传递过来的预约的状态 appointmentStatus: { type: Number }, //父组件传递过来的预约的状态
customerInfo: { type: Object, default: () => ({}) }, //客户详情回显表单用 customerInfo: { type: Object, default: () => ({}) }, //客户详情回显表单用
showSubmitBtn: { type: Boolean, default: false }, //父组件状态,新增、修改 showSubmitBtn: { type: Boolean, default: false }, //父组件状态,新增、修改
pageSource: { type: String, default: false } //页面来源 pageSource: { type: String, default: false }, //页面来源
fatherTabName: { type: String, default: '' }, //一级tab名称
anchorContainer: { type: String, default: '' }, //锚点滚动容器
editStatus: { type: Boolean, default: false }, //编辑状态
tabIndex: { type: [String, Number], default: '' } //tab索引
}) })
const emit = defineEmits(['handleSuccessEdit', 'policyEditSuccess']) const emit = defineEmits(['handleSuccessEdit', 'policyEditSuccess'])
...@@ -214,7 +252,7 @@ const showCountryDrawer = ref(false) //国家/地区抽屉开关 ...@@ -214,7 +252,7 @@ const showCountryDrawer = ref(false) //国家/地区抽屉开关
const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输入值 const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输入值
const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
const errorFields = ref([]) // 存储校验失败的字段信息 const errorFields = ref([]) // 存储校验失败的字段信息
const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑 // const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑
const openList = ref(false) // 客户列表弹窗 const openList = ref(false) // 客户列表弹窗
const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作 const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作
const showContacts = ref(true) const showContacts = ref(true)
...@@ -317,14 +355,7 @@ const handleDateChange = child => { ...@@ -317,14 +355,7 @@ const handleDateChange = child => {
const disabledDate = time => { const disabledDate = time => {
return time.getTime() > Date.now() return time.getTime() > Date.now()
} }
const exportInfo = () => {
if (props.customerBizId && editStatus.value) {
proxy.$modal.confirm(`请先点击编辑在导入客户信息`, { showCancel: '0', title: '填写提示' })
return
}
openList.value = true
customerList()
}
const customerList = () => { const customerList = () => {
tableLoading.value = true tableLoading.value = true
getCustomerList(queryParams.value).then(res => { getCustomerList(queryParams.value).then(res => {
...@@ -397,16 +428,9 @@ const processFormData = async obj => { ...@@ -397,16 +428,9 @@ const processFormData = async obj => {
field.options = fetchDictData(field.dictType) field.options = fetchDictData(field.dictType)
} }
if (field.required) { if (field.required) {
if (field.showEn) { rules.value[field.key] = [
rules.value[field.key] = [ { required: true, message: `${field.label}不能为空`, trigger: 'blur' }
{ required: true, message: `${field.label}不能为空`, trigger: 'blur' }, ]
{ validator: validateEnglish, trigger: 'change' }
]
} else {
rules.value[field.key] = [
{ required: true, message: `${field.label}不能为空`, trigger: 'blur' }
]
}
} }
if (obj.customerInfo) { if (obj.customerInfo) {
for (const key1 in obj.customerInfo) { for (const key1 in obj.customerInfo) {
...@@ -419,10 +443,6 @@ const processFormData = async obj => { ...@@ -419,10 +443,6 @@ const processFormData = async obj => {
} }
} }
} }
if (props.showSubmitBtn) {
field.disabled = true
}
} }
} }
} }
...@@ -437,9 +457,7 @@ const processFormData = async obj => { ...@@ -437,9 +457,7 @@ const processFormData = async obj => {
} }
if (props.showSubmitBtn) { if (props.showSubmitBtn) {
form.value = { ...props.apiSecondHolderInfoDto } form.value = { ...props.apiSecondHolderInfoDto }
editStatus.value = true
} else { } else {
editStatus.value = false
} }
processedSecondHolderData.value = oldAppointmentData.value = processedData processedSecondHolderData.value = oldAppointmentData.value = processedData
} }
...@@ -559,43 +577,39 @@ const resetShow = obj => { ...@@ -559,43 +577,39 @@ const resetShow = obj => {
} }
} }
const handleSelectChange = (father, child) => { const handleSelectChange = (father, child) => {
const processData = JSON.parse(JSON.stringify(processedSecondHolderData.value)) switch (child.key) {
for (const section of processData) { case 'isSecond':
switch (child.key) { if (form.value[child.key] == '1') {
case 'insurantRel': resetShow({ type: 'father', key: 'apiSecondHolderInfoDto', status: true })
for (const field of section.data) { } else {
for (const key1 in field) { resetShow({ type: 'father', key: 'apiSecondHolderInfoDto', status: false })
for (const key2 in props.customerInfo) { }
//当选择得关系是本人 用dom得key和用户信息得key做对比,给表单赋值 break
if (key1 == 'customerKey' && field[key1] == key2) { case 'insurantRel':
form.value[field.key] = props.customerInfo[key2] // 是本人自动带入信息
} if (form.value[child.key] == 'MYSELF') {
for (const section of father.data) {
for (const cKey in props.customerInfo) {
if (section.key == cKey) {
form.value[cKey] = props.customerInfo[cKey]
} }
} }
} }
if (form.value['birthTime']) { } else {
let age = calculateExactAge(proxy.formatToDate(form.value.birthTime)) // 不是本人清空信息
if (age >= 0) { for (const section of father.data) {
form.value.age = age if (section.key !== 'insurantRel') {
form.value[section.key] = ''
} }
} }
break }
default:
break
}
}
}
const handleInputChange = (father, child) => {
switch (child.key) {
case 'nameEn':
validateEnglish(form.value[child.key], child.key)
break break
default: default:
break break
} }
} }
// 改变编辑状态 // 改变编辑状态
const handleEditStatus = status => { const handleEditStatus = status => {
editStatus.value = status editStatus.value = status
...@@ -646,19 +660,42 @@ const getInvalidFields = fields => { ...@@ -646,19 +660,42 @@ const getInvalidFields = fields => {
// 处理表单填写得数据 // 处理表单填写得数据
const handleFormValues = () => { const handleFormValues = () => {
let submitObj = {} return new Promise(async resolve => {
if (props.activeName == 'secondHolder') { let submitObj = {}
submitObj = JSON.parse(JSON.stringify(form.value)) if (props.activeName == 'secondHolder') {
} else { submitObj = JSON.parse(JSON.stringify(form.value))
submitObj = JSON.parse(JSON.stringify(tempSecondHolderForm.value)) } else {
} submitObj = JSON.parse(JSON.stringify(tempSecondHolderForm.value))
//处理表单数据
for (const key1 in submitObj) {
if (key1 == 'birthTime') {
submitObj[key1] = proxy.formatToDateTime(submitObj[key1])
} }
}
proxy.$refs['secondHolderFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
if (submitObj.isSecond && submitObj.isSecond == '0') {
for (const key in submitObj) {
if (key !== 'isSecond') {
submitObj[key] = ''
}
}
}
if (submitObj['birthday']) {
submitObj['birthday'] = proxy.formatToDate(submitObj['birthday'])
}
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
return undefined
}
resolve(errorFields.value.length == 0 ? submitObj : null)
} else {
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
}
resolve(undefined)
}
})
})
return submitObj return submitObj
} }
...@@ -726,12 +763,10 @@ watch( ...@@ -726,12 +763,10 @@ watch(
if (newVal === 'secondHolder') { if (newVal === 'secondHolder') {
openList.value = false openList.value = false
setTimeout(() => { processFormData({
processFormData({ domdata: secondHolderDomData,
domdata: secondHolderDomData, exportValue: null
exportValue: null })
})
}, 500)
} }
} }
) )
......
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