Commit 17384168 by yuzhenWang

做到了预约列表发布测试

parent 6bbe241c
......@@ -197,3 +197,19 @@ export function uploadOssFileList(data) {
method: 'post'
})
}
// 提交附件
export function uploadOssFileSubmit(data) {
return request({
url: '/oss/api/relObjectMaterial/upload/submit',
data: data,
method: 'post'
})
}
// 下载材料包
export function downloadCompressedFile(data) {
return request({
url: '/oss/api/material/download/compressed/file',
data: data,
method: 'post'
})
}
......@@ -223,3 +223,34 @@ export function delSigleAppointment(appointmentBizId) {
})
}
// 签约历史记录列表
export function getAppointmentlog(data) {
return request({
url: '/csf/api/appointment/log/page',
method: 'post',
data: data
})
}
// 查看签约历史记录详情
export function getAppointmentlogDetail(appointmentLogBizId) {
return request({
url: '/csf/api/appointment/log/detail?appointmentLogBizId=' + appointmentLogBizId,
method: 'get'
})
}
// 编辑状态预约暂存
export function appointmentEditStorage(data) {
return request({
url: '/csf/api/appointment/edit/storage',
method: 'put',
data: data
})
}
// 编辑状态预约取消申请
export function appointmentEditStatus(data) {
return request({
url: '/csf/api/appointment/edit/status',
method: 'put',
data: data
})
}
......@@ -23,7 +23,7 @@
<!-- 取消按钮 -->
<el-button type="info" plain v-if="showCancle" @click="close">{{ cancleText }}</el-button>
<!-- 确认按钮 -->
<el-button type="primary" v-if="showConfirm" @click="confirm">{{
<el-button :loading="confirmLoading" type="primary" v-if="showConfirm" @click="confirm">{{
confirmText
}}</el-button>
</div>
......@@ -81,6 +81,11 @@ const props = defineProps({
center: {
type: Boolean,
default: true
},
// 打开弹窗
confirmLoading: {
type: Boolean,
default: false
}
})
const showDialog = ref(props.openDialog)
......@@ -115,7 +120,7 @@ watch(
justify-content: center;
align-items: center;
padding: 15px 0;
color: rgba(0,0,0,0.9);
color: rgba(0, 0, 0, 0.9);
}
.content {
padding: 0 15px;
......@@ -127,5 +132,4 @@ watch(
align-items: center;
padding: 20px 0;
}
</style>
......@@ -26,7 +26,7 @@
<el-card class="cardStyle">
<el-row>
<!-- 按钮区域 -->
<el-col :span="24" class="operationBtn">
<el-col :span="24" class="operationBtn" v-if="showOperationBtn">
<div class="operationLeft">
<!-- 左侧按钮 -->
<template v-for="btn in leftButtons" :key="btn.key || btn.label">
......@@ -131,6 +131,8 @@ interface Props {
showSearchForm?: boolean
// 是否显示分页
showPagination?: boolean
// 是否显示操作按钮
showOperationBtn?: boolean
// 总条数
total?: number
// 当前页码
......@@ -153,6 +155,7 @@ const props = withDefaults(defineProps<Props>(), {
operationBtnList: () => [],
showSearchForm: true,
showPagination: false,
showOperationBtn: true,
total: 0,
currentPage: 1,
pageSize: 10,
......@@ -489,6 +492,5 @@ onMounted(() => {
.cardStyle {
margin-bottom: 8px;
}
}
</style>
......@@ -22,8 +22,8 @@ const appointmentInfo = [
lg: 8 //栅格布局份数
},
{
label: '意向签单日',
key: 'intentionAppointmentTime',
label: '签单日',
key: 'signDate',
domType: 'DatePicker',
required: true,
disabled: false,
......@@ -76,58 +76,6 @@ const appointmentInfo = [
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
}
// {
// label: '预约时间',
// key: 'confirmAppointmentTime',
// domType: 'datetimePicker',
// required: false,
// disabled: true,
// placeholder: '请选择',
// show: false,
// labelPosition: 'top', //标签的位置
// labelWidth: '120px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// },
// {
// label: ' ',
// key: 'newPolicyButton',
// domType: 'button',
// buttonTxt: '生成新单跟进记录',
// buttonType: 'primary',
// required: false,
// maxLength: 10,
// disabled: false,
// show: false,
// // labelPosition: 'top', //标签的位置
// labelWidth: '0px', //标签宽度
// sm: 12, //栅格布局份数
// lg: 8 //栅格布局份数
// }
]
},
// 陪同转介人信息
{
fatherTitle: '陪同转介人',
keyType: 'Array', //用于表单收集值时,判断是数组还是对象
key: 'referrerDtoList',
anchorKey: 'referrerDtoList',
moudleType: 'referrerDtoList',
dataLength: 1, //设置dataLength,用于控制子级dom的个数,子级保存一个样例数据,便于加子级数据
showTable: true,
showMoudle: false, //模块是否展示
addChildren: true, //是否可以新增子级dom
addChildrenTxt: '陪同转介人', //新增按钮得文本
fatherRequired: false, //父级必填,代表个人资料这个模块有必填项
isOpen: false, //dom是否展开
data: [
// {
// id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
// span: 24, //栅格布局份数
// email: '',
// phone: '',
// realName: ''
// }
]
},
// 到港信息
......@@ -145,7 +93,7 @@ const appointmentInfo = [
dateValue: '', //YYYY-MM-DD
timeValue: '', //HH:mm
compositionTime: true, //是否组合时间
finishTime: '',
required: false,
disabled: false,
placeholder: '请选择',
......@@ -161,6 +109,7 @@ const appointmentInfo = [
domType: 'datetimePicker',
dateValue: '', //YYYY-MM-DD
timeValue: '', //HH:mm
finishTime: '',
compositionTime: true, //是否组合时间
required: false,
disabled: false,
......@@ -222,6 +171,31 @@ const appointmentInfo = [
},
// 陪同转介人信息
{
fatherTitle: '陪同转介人',
keyType: 'Array', //用于表单收集值时,判断是数组还是对象
key: 'referrerDtoList',
anchorKey: 'referrerDtoList',
moudleType: 'referrerDtoList',
dataLength: 1, //设置dataLength,用于控制子级dom的个数,子级保存一个样例数据,便于加子级数据
showTable: true,
showMoudle: false, //模块是否展示
addChildren: true, //是否可以新增子级dom
addChildrenTxt: '陪同转介人', //新增按钮得文本
fatherRequired: false, //父级必填,代表个人资料这个模块有必填项
isOpen: false, //dom是否展开
data: [
// {
// id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
// span: 24, //栅格布局份数
// email: '',
// phone: '',
// realName: ''
// }
]
},
// 陪同转介人信息
{
fatherTitle: '签单员',
keyType: 'Array', //用于表单收集值时,判断是数组还是对象
key: 'userSignDtoList',
......
......@@ -39,7 +39,7 @@ const productPlan = [
},
{
label: '产品名称',
key: 'productLaunchName',
key: 'productLaunchMainName',
domType: 'SearchSelect',
required: true,
maxLength: 30,
......
{
"isCopyAddress": [
true
],
"nameCn": "王玉珍",
"namePyEn": "WANGYUZHEN",
"documentType": "idCard",
"idNumber": "411424199704041622",
"gender": "2",
"birthday": "1997-04-04",
"age": "28",
"nationality": "中国澳门",
"birthplace": "111111",
"isOtherCountry": "1",
"smokingStatus": "1",
"maritalStatus": "SINGLE",
"educationLevel": "SECONDARY",
"isRetirement": "1",
"retirementAge": "55",
"riskAppetite": "LOW",
"weight": "51",
"height": "160",
"bmi": "19.92",
"mobile": "11111",
"residenceMobile": "2222",
"landline": "22222",
"email": "33333",
"mailingAddressCode": "55555",
"employmentStatus": "1",
"csName": "33333",
"industry": "44444",
"currentMonthlyIncome": "5555",
"totalWorkingYears": "12",
"currentTenure": "12",
"position": "哇哇哇哇",
"companyMobile": "4444",
"companyAddressCode": "7777",
"monthIncome": "222",
"monthExpenditure": "333",
"totalCurrentAssets": "12222",
"totalDebt": "1",
"travel": "111",
"exercise": "GOLF",
"game": "OTHER",
"movieDrama": "HORROR",
"delicacy": "111",
"certificateAddress": "1111111",
"country": "MACAO",
"countryName": "中国澳门",
"mobileCode": "+1",
"phoneString": "+355 4444",
"key": "companyMobile",
"residenceMobileCode": "+1284",
"companyMobileCode": "+355",
"addressList": [
{
"region": "111",
"city": "222",
"street": "333",
"location": "444",
"objType": "address",
"type": "mailingAddress",
"addressString": "111222333444"
"apiAppointmentInfoDto": {
"appointmentBizId": "appointment_lrEyN7kxrSU2YZLt",
"appointmentNo": "Y2601082985339",
"customerBizId": "customer_iNeCSyIKYrjXVTXa",
"customerNo": null,
"fnaBizId": "fna_nWhIilamRAqCV27g",
"fnaNo": "CSF-B-20260107-0906",
"proposalBizId": null,
"proposalNo": null,
"applyType": "INVESTMENT",
"signDate": "2026-01-14 00:00:00",
"arrivalTime": "2026-01-08 00:00:00",
"departureTime": "2026-01-14 00:00:00",
"meetingPoint": "INSURANCE_COMPANY",
"signingAddress": "6666",
"hkMobileCode": "+81",
"hkMobile": "5556",
"isOpenAccount": 0,
"bankId": null,
"policyTransfer": null,
"isUseCar": 0,
"isReferrerAccompany": 0,
"creatorName": "zs",
"referrerDtoList": [],
"userSignDtoList": [
{
"appointmentUserSignBizId": "appointment_user_sign_1x7bWfRC8YkmpiL4",
"userSignBizId": "user_sign_rrrrsae445556er",
"userBizId": "user_HNpzB3A0A72JMLVN",
"name": "SW",
"practiceCode": "6666",
"phone": "6666",
"cardType": "household_register",
"cardNo": "6666",
"email": "6666"
}
]
},
"apiProductPlanInfoDto": {
"apiProductPlanMainInfoDto": {
"planBizId": "product_plan_aMNtyxS4lQp3Dou3",
"companyId": "insurance_company_7dtUJyhgDk6v5Eva",
"companyName": "上海测试有限公司",
"insuranceTypeId": "e67a90222b654545a5778df3fcc8ced3",
"insuranceTypeName": "重疾险",
"productLaunchBizId": "product_launch_1LcCgSXEsf0KfmQM",
"productLaunchMainName": "附加产品001",
"issueNumber": "3",
"guaranteePeriod": "6666",
"policyCurrency": "SGD",
"sumInsured": 6666,
"paymentFrequency": "QUARTER",
"eachIssuePremium": 6666,
"initialPaymentMethod": "UNIONPAY",
"policyLevy": 6666,
"isPrepay": 0,
"isTraceable": 1,
"isBacktrack": 1,
"isJoin": 0,
"dividendDistributionMethod": "BREATH",
"renewalPaymentMethod": "UNIONPAY"
},
{
"region": "111",
"city": "222",
"street": "333",
"location": "444",
"objType": "address",
"type": "residentialAddress",
"addressString": "111222333444"
},
{
"region": "555",
"city": "555",
"street": "666",
"location": "666",
"objType": "address",
"type": "companyAddress",
"addressString": "555555666666"
}
],
"apiTaxationDtoList": [
{
"id": 1766714955566,
"span": 24,
"taxCountry": "1111",
"taxId": "22222"
}
]
"apiProductPlanAdditionalInfoDtoList": [
{
"additionalBizId": "additional_zriaqQRTuqwhFPON",
"planBizId": "product_plan_aMNtyxS4lQp3Dou3",
"productLaunchBizId": "product_launch_1LcCgSXEsf0KfmQM",
"productLaunchName": "附加产品001",
"paymentFrequency": null,
"issueNumber": "3",
"guaranteePeriod": "6666",
"policyCurrency": "USD",
"sumInsured": 6666,
"eachIssuePremium": 6666,
"protectionLevel": "6666",
"guaranteeRegion": "6666",
"deductibles": "6666",
"additionalSafeguards": "6666",
"policyLevy": 0
}
]
},
"apiPolicyholderInfoDto": {
"policyholderBizId": "policyholder_uMqoYsDOOQ3AOpu9",
"customerBizId": "customer_iNeCSyIKYrjXVTXa",
"customerNo": null,
"nameCn": "最新的投保人",
"namePyEn": "ZUIXINDE",
"documentType": "idCard",
"idNumber": "411424199604041622",
"gender": "2",
"birthday": "2007-01-01 00:00:00",
"age": "19",
"nationality": "英属处女群岛",
"birthplace": "1284",
"isOtherCountry": 0,
"smokingStatus": "1",
"maritalStatus": "SINGLE",
"educationLevel": "UNIVERSITY",
"isRetirement": 0,
"retirementAge": null,
"height": "158",
"weight": "50",
"bmi": "20.03",
"riskAppetite": "CHINESE",
"dependentsNum": 1,
"mobileCode": "+81",
"mobile": "1284",
"residenceMobileCode": "+886",
"residenceMobile": "1284",
"landlineCode": null,
"landline": "1284",
"email": "1284",
"certificateAddress": "1284",
"mailingAddress": null,
"residentialAddress": null,
"mailingAddressCode": "1284",
"employmentStatus": "1",
"csName": "1284",
"industry": "1284",
"currentMonthlyIncome": null,
"totalWorkingYears": 1284,
"currentTenure": null,
"position": "1284",
"companyAddress": null,
"companyMobileCode": null,
"companyMobile": null,
"companyAddressCode": "1284",
"monthIncome": 1284,
"monthExpenditure": 1284,
"totalCurrentAssets": 1284,
"totalDebt": 1284,
"travel": "1284",
"exercise": "BICYCLE",
"game": "STIMULATE",
"movieDrama": "HISTORY",
"delicacy": "1284",
"addressList": [
{
"type": "mailingAddress",
"region": "1284",
"city": "1284",
"street": "1284",
"location": "1284"
},
{
"type": "residentialAddress",
"region": "1284",
"city": "1284",
"street": "1284",
"location": "1284"
},
{
"type": "companyAddress",
"region": "1284",
"city": "1284",
"street": "1284",
"location": "1284"
}
],
"apiTaxationDtoList": null,
"birthdayValid": true
},
"apiInsurantInfoDto": {
"insurantBizId": "insurant_eH5N7m2YyVHQ54H3",
"customerBizId": "customer_iNeCSyIKYrjXVTXa",
"customerNo": null,
"policyholderRel": "PARENTS",
"nameCn": "最新的受保",
"namePyEn": "ZUIXINDESHOUBAO",
"documentType": "idCard",
"idNumber": "411424199604041622",
"gender": "2",
"birthday": "2007-01-01 00:00:00",
"age": "19",
"nationality": "英属处女群岛",
"birthplace": "1284",
"isOtherCountry": 0,
"smokingStatus": "1",
"maritalStatus": "SINGLE",
"educationLevel": "UNIVERSITY",
"isRetirement": 0,
"retirementAge": null,
"height": "158",
"weight": "50",
"bmi": "20.03",
"riskAppetite": "CHINESE",
"dependentsNum": 1,
"mobileCode": "+81",
"mobile": "1284",
"residenceMobileCode": "+886",
"residenceMobile": "1284",
"landlineCode": null,
"landline": "1284",
"email": "1284",
"certificateAddress": "1284",
"mailingAddress": null,
"residentialAddress": null,
"mailingAddressCode": "1284",
"employmentStatus": "1",
"csName": "1284",
"industry": "1284",
"currentMonthlyIncome": null,
"totalWorkingYears": 1284,
"currentTenure": null,
"position": "1284",
"companyAddress": null,
"companyMobileCode": null,
"companyMobile": null,
"companyAddressCode": "1284",
"monthIncome": 1284,
"monthExpenditure": 1284,
"totalCurrentAssets": 1284,
"totalDebt": 1284,
"travel": "1284",
"exercise": "BICYCLE",
"game": "STIMULATE",
"movieDrama": "HISTORY",
"delicacy": "1284",
"addressList": [
{
"type": "mailingAddress",
"region": "1284",
"city": "1284",
"street": "1284",
"location": "1284"
},
{
"type": "residentialAddress",
"region": "1284",
"city": "1284",
"street": "1284",
"location": "1284"
},
{
"type": "companyAddress",
"region": "1284",
"city": "1284",
"street": "1284",
"location": "1284"
}
],
"apiTaxationDtoList": null,
"self": false,
"birthdayValid": true
},
"apiSecondHolderInfoDto": {},
"apiBeneficiaryInfoFzDto": {
"apiBeneficiaryInfoDtoList": [
{
"id": 1767840050795,
"appointmentBizId": "appointment_lrEyN7kxrSU2YZLt",
"beneficiaryBizId": "beneficiary_rJq87qgQKrTnHLIZ",
"insurantRel": "PARENTS",
"nameCn": "受益人",
"namePyEn": "SHOUYIREN",
"documentType": "idCard",
"idNumber": "411414199604041234",
"gender": "1",
"birthday": "1996-04-04 00:00:00",
"nationality": "中国澳门",
"benefitRatio": 6666
}
],
"isLegalBeneficiary": 0
},
"materialDtoList": []
}
<template>
<div class="formContainer">
<div class="formLeft" v-if="showAnchor">
<div class="formLeft" v-if="showAnchor && scrollContainerSelector">
<el-affix :offset="affixOffset">
<el-anchor
:direction="direction"
......
......@@ -105,7 +105,7 @@
v-model="form[child.key]"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="child.placeholder"
:disabled="editStatus"
:disabled-date="time => disabledDate(time, child)"
......@@ -337,13 +337,15 @@ import useDictStore from '@/store/modules/dict'
const dictStore = useDictStore() //获取字典数据
const props = defineProps({
activeName: { type: String, default: '' }, //tab名称
fatherEditStatus: { type: Boolean, default: true }, //因为嵌套了双层tab,所以需要父组件传值控制子组件的编辑状态
fatherEditStatus: { type: Boolean, default: false }, //因为嵌套了双层tab,所以需要父组件传值控制子组件的编辑状态
anchorContainer: { type: String, default: '' }, //锚点滚动容器
tabIndex: { type: [String, Number], default: '' }, //tab索引
affixOffset: { type: Number, default: 250 }, //锚点吸顶距离
customerBizId: { type: String, default: '' }, //提交状态,新增、修改
tabSource: { type: String, default: '' },
idsObj: { type: Object, default: () => ({}) } //引用这个组件的页面来源,用于逻辑判断
idsObj: { type: Object, default: () => ({}) }, //引用这个组件的页面来源,用于逻辑判断
apiPolicyholderInfoDto: { type: Object, default: () => ({}) }, //投保人编辑状态详情
apiInsurantInfoDto: { type: Object, default: () => ({}) } //受保人编辑状态详情
})
const emit = defineEmits(['handleSuccess'])
const { proxy } = getCurrentInstance()
......@@ -362,7 +364,7 @@ const tableLoading = ref(false)
const tableData = ref([])
const total = ref(0)
//计算默认显示的日期(18年前的今天)
const defaultDisplayDate = ref(dayjs().subtract(18, 'year').toDate())
const defaultDisplayDate = ref(dayjs().subtract(19, 'year').toDate())
// 地址组件菜单数据
const addressMenuList = ref([
......@@ -610,7 +612,7 @@ const handleDateChange = child => {
const disabledDate = (time, child) => {
if (child.key == 'birthday') {
// 计算18年前的今天
const eighteenYearsAgo = dayjs().subtract(18, 'year')
const eighteenYearsAgo = dayjs().subtract(19, 'year')
// 禁用今天之后的日期和18年前的今天之后的日期
return time.getTime() > Date.now() || time.getTime() > eighteenYearsAgo.valueOf()
} else {
......@@ -646,8 +648,6 @@ const customerList = () => {
const handleExport = row => {
oldCustomerData.value = JSON.parse(JSON.stringify(processedCustomerData.value)) // 修改时存储原始数据,便于撤销操作
oldObjInfo.value = JSON.parse(JSON.stringify(form.value)) // 修改时存储原始数据,便于撤销操作
console.log('导入前form', oldObjInfo.value)
console.log('导入前dom', oldCustomerData.value)
setFormValue(row, processedCustomerData.value, true)
openList.value = false
......@@ -679,20 +679,6 @@ const processFormData = async () => {
const processedData = JSON.parse(JSON.stringify(customerDomData))
rules.value = {}
for (const section of processedData) {
// 如果在受保人中,与投保人关系已填写,根据填写内容展示对应的模块
if (
props.activeName == 'insurantInfo' &&
form.value['policyholderRel'] &&
form.value['policyholderRel'] == 'MYSELF'
) {
if (section.key == 'policyholderRel') {
section.showMoudle = true
} else {
section.showMoudle = false
}
} else {
section.showMoudle = true
}
if (props.activeName == 'insurantInfo' && section.key == 'policyholderRel') {
section.showMoudle = true
} else if (props.activeName !== 'insurantInfo' && section.key == 'policyholderRel') {
......@@ -741,6 +727,12 @@ const processFormData = async () => {
) {
//是投保人/受保人但是新增预约 需要引用客户资料的值
getCustomerInfo(props.customerBizId, processedData)
} else if (props.tabSource == 'policyholder' && props.idsObj.appointmentBizId) {
// 投保人回显值
setFormValue(props.apiPolicyholderInfoDto, processedData)
} else if (props.tabSource == 'insurantInfo' && props.idsObj.appointmentBizId) {
// 投保人回显值
setFormValue(props.apiInsurantInfoDto, processedData)
} else {
processedCustomerData.value = oldCustomerData.value = processedData
}
......@@ -954,9 +946,6 @@ const setFormValue = (obj, formData, exportValue) => {
phoneQuickList.value = []
// 深拷贝原始数据
form.value = JSON.parse(JSON.stringify(obj))
if (props.activeName == 'insurantInfo' && !props.idsObj.appointmentBizId) {
form.value['policyholderRel'] = ''
}
// 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(formData))
for (const section of processedData) {
......@@ -971,11 +960,24 @@ const setFormValue = (obj, formData, exportValue) => {
) {
section.data = JSON.parse(JSON.stringify(obj.apiTaxationDtoList))
}
// 编辑状态当tab为受保人时,与投保人关系为本人控制受保人信息模块隐藏
if (
props.activeName == 'insurantInfo' &&
props.idsObj.appointmentBizId &&
obj.policyholderRel == 'MYSELF' &&
section.key !== 'policyholderRel'
) {
section.showMoudle = false
}
if (section.data) {
for (const field of section.data) {
if (obj.isRetirement && obj.isRetirement == '1' && field.key == 'retirementAge') {
field.show = true
}
if (obj.isRetirement || obj.isRetirement == 0) {
form.value['isRetirement'] = String(obj.isRetirement)
}
//要判断drawerType,因为抽屉要回显数据
switch (field.drawerType) {
case 'phone':
......@@ -1078,6 +1080,7 @@ const setFormValue = (obj, formData, exportValue) => {
addressQuickList.value = removeDuplicates(tempAddressList, 'addressString')
processedCustomerData.value = processedData
console.log('processedCustomerData.value', processedCustomerData.value)
}
// 数组去重
function removeDuplicates(arr, key) {
......@@ -1100,7 +1103,12 @@ const getInvalidFields = fields => {
if (fields[field] && fields[field].length > 0) {
errors.push({
field: field,
message: fields[field][0].message
message:
props.activeName == 'policyHolderInfo'
? `投保人模块-${fields[field][0].message}`
: props.activeName == 'insuredInfo'
? `受保人模块-${fields[field][0].message}`
: fields[field][0].message
})
}
}
......@@ -1143,128 +1151,151 @@ const resetShow = (key, status) => {
}
}
// 暴露一个同步获取数据的方法
const getFormData = () => {
// 确保form对象包含所有必要的字段
const formData = { ...form.value }
// 如果policyholderRel不存在,尝试从select元素获取
if (!formData.hasOwnProperty('policyholderRel') || !formData.policyholderRel) {
// 这里可以根据你的实际情况获取最新的值
const selectElement = document.querySelector('[data-key="policyholderRel"]')
if (selectElement) {
formData.policyholderRel = selectElement.value
}
}
return formData
}
//source:因为这个组件是公共组件所以提交的时候要知道是哪里要获取表单的值
const handleFormValues = source => {
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 processedData = JSON.parse(JSON.stringify(processedCustomerData.value))
return new Promise(async resolve => {
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 }
// 如果没有点击受保人这个tab页就进行填写提醒,
if (
source == 'insuredInfoRef' &&
!props.idsObj.appointmentBizId &&
!form.value['policyholderRel']
) {
resolve(undefined)
return
}
let addressList = []
submitObj['birthday'] = proxy.formatToDate(submitObj['birthday'])
customerFormRef.value.validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
//处理表单数据
for (const key1 in form.value) {
for (const key2 in saveKey.value) {
//要判断drawerType
switch (saveKey.value[key2].objType) {
case 'phone':
if (key1 == key2) {
for (const key3 in saveKey.value[key2]) {
submitObj[key3] = saveKey.value[key2][key3]
if (processedData.length > 0) {
customerFormRef.value.validate((valid, fields) => {
if (valid) {
if (source == 'insuredInfoRef') {
console.log('====================================')
console.log('submitObj', form.value['policyholderRel'])
console.log('====================================')
}
let addressList = []
if (submitObj['birthday']) {
if (source == 'insuredInfoRef' || source == 'policyHolderInfoRef') {
submitObj['birthday'] = proxy.formatToDateTime(submitObj['birthday'])
} else {
submitObj['birthday'] = proxy.formatToDate(submitObj['birthday'])
}
}
errorFields.value = [] // 清空错误信息
//处理表单数据
for (const key1 in form.value) {
for (const key2 in saveKey.value) {
//要判断drawerType
switch (saveKey.value[key2].objType) {
case 'phone':
if (key1 == key2) {
for (const key3 in saveKey.value[key2]) {
submitObj[key3] = saveKey.value[key2][key3]
}
}
}
break
case 'address':
if (key1 == key2) {
addressList.push(saveKey.value[key2])
}
break
case 'country':
if (key1 == key2) {
submitObj['country'] = saveKey.value[key2]['countryCode']
submitObj['countryName'] = saveKey.value[key2]['name']
}
break
default:
break
break
case 'address':
if (key1 == key2) {
addressList.push(saveKey.value[key2])
}
break
case 'country':
if (key1 == key2) {
submitObj['country'] = saveKey.value[key2]['countryCode']
submitObj['countryName'] = saveKey.value[key2]['name']
}
break
default:
break
}
}
}
}
submitObj['birthday'] = proxy.formatToDate(submitObj['birthday'])
submitObj['addressList'] = addressList
processedCustomerData.value.forEach(item => {
if (item.key == 'apiTaxationDtoList' && item.data.length > 0) {
submitObj['apiTaxationDtoList'] = item.data.filter(item => {
return item.taxCountry && item.taxCountry.trim() && item.taxId && item.taxId.trim()
})
if (addressList.length > 0) {
submitObj['addressList'] = addressList
}
})
// 删除多余字段
deleteKeyList.value.forEach(item => {
delete submitObj[item]
})
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
return undefined
}
if (props.customerBizId && props.activeName == 'customer') {
editCustomer(submitObj).then(res => {
if (res.code == 200) {
handleEditStatus()
proxy.$message.success('客户修改成功')
emit('handleSuccess', {
tab: 'customer',
customerBizId: props.customerBizId,
type: 'edit'
processedCustomerData.value.forEach(item => {
if (item.key == 'apiTaxationDtoList' && item.data.length > 0) {
submitObj['apiTaxationDtoList'] = item.data.filter(item => {
return item.taxCountry && item.taxCountry.trim() && item.taxId && item.taxId.trim()
})
}
})
} else if (!props.customerBizId && props.activeName == 'customer') {
addFna({ remark: '' }).then(response => {
if (response.code == 200) {
addCustomer(submitObj).then(res => {
if (res.code == 200) {
proxy.$message.success('客户新增成功')
emit('handleSuccess', {
tab: 'customer',
customerBizId: res.data.customerBizId,
fnaBizId: response.data.fnaBizId,
type: 'add'
})
}
})
}
// 删除多余字段
deleteKeyList.value.forEach(item => {
delete submitObj[item]
})
}
resolve(errorFields.value.length == 0 ? submitObj : null)
} else {
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
return undefined
}
if (props.customerBizId && props.activeName == 'customer') {
editCustomer(submitObj).then(res => {
if (res.code == 200) {
handleEditStatus()
proxy.$message.success('客户修改成功')
emit('handleSuccess', {
tab: 'customer',
customerBizId: props.customerBizId,
type: 'edit'
})
}
})
} else if (!props.customerBizId && props.activeName == 'customer') {
addFna({ remark: '' }).then(response => {
if (response.code == 200) {
addCustomer(submitObj).then(res => {
if (res.code == 200) {
proxy.$message.success('客户新增成功')
emit('handleSuccess', {
tab: 'customer',
customerBizId: res.data.customerBizId,
fnaBizId: response.data.fnaBizId,
type: 'add'
})
}
})
}
})
}
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)
}
})
} else {
// 编辑状态
if (props.idsObj.appointmentBizId) {
if (source == 'policyHolderInfoRef') {
resolve(props.apiPolicyholderInfoDto)
} else if (source == 'insuredInfoRef') {
resolve(props.apiInsurantInfoDto)
}
} else {
// 新增状态
// 因为这两个在同一个大提交里,所以要判断是哪个提交,方便这两个都有自己独立的提交验证
resolve(undefined)
}
})
}
})
}
const anchorList = computed(() => {
......@@ -1302,6 +1333,9 @@ watch(
} else if (props.tabSource == 'customer' && !props.customerBizId) {
editStatus.value = false
}
if (newVal === 'policyholder' || newVal === 'insurantInfo') {
editStatus.value = props.fatherEditStatus
}
}
// 切换tab要保存各自的表单值
if (oldVal == 'policyholder') {
......
......@@ -420,10 +420,14 @@ const handleRemoteSelectChange = async (row, column, father) => {
}
}
if (column.prop == 'insuranceType' && row.insuranceType) {
// 改变险种的时候逻辑还未处理
//如果险种选择了重疾险,则显示重疾险的输入框
row.insuranceTypeOption.forEach(item => {
if (item.value == row.insuranceType && item.code == 'CI') {
row.showSumInsured = true
if (item.value == row.insuranceType) {
if (item.code == 'CI') {
row.showSumInsured = true
}
row.insuranceType = item.label
}
})
}
......@@ -823,13 +827,13 @@ const submitForm = saveType => {
}
})
}
if (item.insuranceType) {
item.insuranceTypeOption.forEach(item2 => {
if (item2.value == item.insuranceType) {
item.insuranceType = item2.label
}
})
}
// if (item.insuranceType) {
// item.insuranceTypeOption.forEach(item2 => {
// if (item2.value == item.insuranceType) {
// item.insuranceType = item2.label
// }
// })
// }
})
result[section.key] = section.data
}
......
......@@ -131,7 +131,6 @@ import useDictStore from '@/store/modules/dict'
import { addFna, getProcessDetail, updateProcess, getCustomerDetail } from '@/api/sign/fna'
import {
listTenantUser,
getInsuranceProductList,
getAdditionalProductList,
getBankList,
getUserSaleExpandList,
......@@ -230,17 +229,6 @@ const getDictsData = async () => {
pageSize: 10
}
// const response2 = await getInsuranceProductList(params2)
// if (response2.code == 200) {
// response2.data.records = response2.data.records.map(item => {
// return {
// ...item,
// label: item.productName,
// value: item.productBizId
// }
// })
// dictStore.setInsureProductList(response2.data.records)
// }
const params3 = {
pageNo: 1,
pageSize: 10
......@@ -399,7 +387,7 @@ const processUpdate = (data, status) => {
}
// 获取流程详情
function getProcessInfo(fnaBizId, changeTab) {
function getProcessInfo(fnaBizId, changeTab, currentTab) {
getProcessDetail(fnaBizId).then(res => {
if (res.code == 200) {
processInfo.value = res.data
......@@ -415,7 +403,9 @@ function getProcessInfo(fnaBizId, changeTab) {
processInfo.value.status = item.label
}
})
if (changeTab) {
if (currentTab == 'appointment' && changeTab == 'appointment') {
router.push({ path: '/sign/appointment' })
} else if (changeTab) {
activeName.value = changeTab
}
}
......@@ -524,7 +514,7 @@ const handleSuccess = info => {
break
case 'appointment':
if (info.type == 'add') {
getProcessInfo(processInfo.value.fnaBizId, 'newpolicy')
getProcessInfo(processInfo.value.fnaBizId, 'appointment', 'appointment')
} else {
}
break
......
......@@ -290,7 +290,13 @@ function handleAdd() {
function handleUpdate(row) {
router.push({
path: '/sign/FnaList/edit',
query: { fnaBizId: row.fnaBizId, type: 'edit', status: row.status, source: 'fnaList' }
query: {
fnaBizId: row.fnaBizId,
type: 'edit',
status: row.status,
source: 'fnaList',
appointmentBizId: row.appointmentBizId
}
})
}
......
......@@ -30,13 +30,52 @@
</div>
</div>
<div class="right">
<el-button type="success" :icon="Check" @click="handleSubmit('submit')">提交</el-button>
<el-button
v-if="idsObj.appointmentBizId"
type="primary"
icon="Plus"
@click="handleAddExecl"
>上传EXECL</el-button
<div v-if="appointmentSummeryInfo.status == '2'">
<el-button
v-if="pageSource !== 'policyList' && idsObj.appointmentBizId"
type="warning"
:icon="Edit"
@click="handleCancel('appoint')"
>取消预约</el-button
>
</div>
<div v-else="appointmentSummeryInfo.status !== '2'" style="margin-right: 10px">
<el-button
v-if="pageSource !== 'policyList' && editStatus"
type="primary"
:icon="Edit"
@click="handleEdit"
>编辑</el-button
>
<el-button type="primary" v-if="!editStatus" @click="handleSubmit('editStorage')"
>暂存</el-button
>
<el-button
v-if="!editStatus"
type="success"
:icon="Check"
@click="handleSubmit('submit')"
>提交</el-button
>
<el-button
v-if="
pageSource !== 'policyList' &&
appointmentSummeryInfo.status == '1' &&
idsObj.appointmentBizId
"
type="warning"
:icon="Edit"
@click="handleCancel('apply')"
>取消申请</el-button
>
</div>
<el-button v-if="idsObj.appointmentBizId" type="primary" @click="assetVerification"
>投保人资产验证</el-button
>
<el-button v-if="idsObj.appointmentBizId" type="primary" @click="assetVerification"
>投保人收支验证</el-button
>
</div>
</div>
......@@ -52,12 +91,13 @@
>上传EXECL</el-button
> -->
<el-button
v-if="pageSource !== 'policyList'"
v-if="pageSource !== 'policyList' && idsObj.appointmentBizId"
type="primary"
:icon="Edit"
@click="handleEdit"
>编辑</el-button
>
<el-button
v-if="pageSource !== 'policyList'"
type="success"
......@@ -72,6 +112,12 @@
@click="handleSubmit('storage')"
>暂存</el-button
>
<el-button v-if="idsObj.appointmentBizId" type="primary" @click="assetVerification"
>投保人资产验证</el-button
>
<el-button v-if="idsObj.appointmentBizId" type="primary" @click="assetVerification"
>投保人收支验证</el-button
>
</div>
</el-col>
</el-row>
......@@ -91,12 +137,12 @@
:idsObj="idsObj"
:apiAppointmentInfoDto="appointmentSummeryInfo.apiAppointmentInfoDto"
:appointmentStatus="appointmentSummeryInfo.status"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="appointmentInfoRef"
:tabIndex="tabsList.findIndex(t => t.name === 'appointmentInfo')"
anchorContainer=".appointmentTabPaneBox"
:fatherTabName="tabName"
:editStatus="editStatus"
:affixOffset="pageSource == 'fnaList' ? 360 : 250"
/>
</div>
<div v-if="tab.name === 'productPlan'">
......@@ -106,7 +152,6 @@
:idsObj="idsObj"
:apiProductPlanInfoDto="appointmentSummeryInfo.apiProductPlanInfoDto"
:appointmentStatus="appointmentSummeryInfo.status"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="productPlanRef"
@policyEditSuccess="getPolicyDetail"
:pageSource="pageSource"
......@@ -115,16 +160,16 @@
anchorContainer=".appointmentTabPaneBox"
:fatherTabName="tabName"
:editStatus="editStatus"
:affixOffset="pageSource == 'fnaList' ? 360 : 250"
/>
</div>
<!-- 投保人 -->
<div v-if="tab.name === 'policyholder'">
<!-- @handleSuccess="handleSuccess"-->
<Customer
:activeName="activeName"
:fatherTabName="tabName"
:fatherStatus="editStatus"
:affixOffset="360"
:affixOffset="pageSource == 'fnaList' ? 360 : 250"
:tabIndex="tabsList.findIndex(t => t.name === 'policyholder')"
anchorContainer=".appointmentTabPaneBox"
tabSource="policyholder"
......@@ -135,27 +180,13 @@
:idsObj="idsObj"
:customerBizId="props.processDetail.customerBizId"
/>
<!-- <PolicyHolderInfo
:activeName="activeName"
:formStatus="formStatus"
:customerInfo="customerInfo"
:idsObj="idsObj"
:apiPolicyholderInfoDto="appointmentSummeryInfo.apiPolicyholderInfoDto"
:appointmentStatus="appointmentSummeryInfo.status"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="policyHolderInfoRef"
:pageSource="pageSource"
:showSubmitBtn="showSubmitBtn"
@policyEditSuccess="getPolicyDetail"
/> -->
</div>
<div v-if="tab.name === 'insurantInfo'">
<!-- :customerBizId="processInfo.customerBizId" @handleSuccess="handleSuccess"-->
<Customer
:activeName="activeName"
:fatherTabName="tabName"
:fatherStatus="editStatus"
:affixOffset="360"
:affixOffset="pageSource == 'fnaList' ? 360 : 250"
:tabIndex="tabsList.findIndex(t => t.name === 'insurantInfo')"
anchorContainer=".appointmentTabPaneBox"
tabSource="insurantInfo"
......@@ -163,21 +194,8 @@
:fatherEditStatus="editStatus"
:idsObj="idsObj"
:customerBizId="props.processDetail.customerBizId"
/>
<!-- <InsuredInfo
:activeName="activeName"
:formStatus="formStatus"
:customerInfo="customerInfo"
:idsObj="idsObj"
:apiInsurantInfoDto="appointmentSummeryInfo.apiInsurantInfoDto"
:currentPolicyholderInfo="currentPolicyholderInfo"
:appointmentStatus="appointmentSummeryInfo.status"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="insuredInfoRef"
:pageSource="pageSource"
:showSubmitBtn="showSubmitBtn"
@policyEditSuccess="getPolicyDetail"
/> -->
/>
</div>
<div v-if="tab.name === 'secondHolder'">
<SecondHolderInfo
......@@ -187,7 +205,6 @@
:apiSecondHolderInfoDto="appointmentSummeryInfo.apiSecondHolderInfoDto"
:appointmentStatus="appointmentSummeryInfo.status"
:customerInfo="customerInfo"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="secondHolderInfoRef"
:pageSource="pageSource"
:showSubmitBtn="showSubmitBtn"
......@@ -196,6 +213,7 @@
anchorContainer=".appointmentTabPaneBox"
:fatherTabName="tabName"
:editStatus="editStatus"
:affixOffset="pageSource == 'fnaList' ? 360 : 250"
/>
</div>
<div v-if="tab.name === 'beneficiary'">
......@@ -203,9 +221,8 @@
:activeName="activeName"
:formStatus="formStatus"
:idsObj="idsObj"
:apiBeneficiaryInfoDtoList="appointmentSummeryInfo.apiBeneficiaryInfoDtoList"
:apiBeneficiaryInfoFzDto="appointmentSummeryInfo.apiBeneficiaryInfoFzDto"
:appointmentStatus="appointmentSummeryInfo.status"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="beneficiaryInfoRef"
:pageSource="pageSource"
:showSubmitBtn="showSubmitBtn"
......@@ -214,6 +231,7 @@
anchorContainer=".appointmentTabPaneBox"
:fatherTabName="tabName"
:editStatus="editStatus"
:affixOffset="pageSource == 'fnaList' ? 360 : 250"
/>
</div>
<div v-if="tab.name === 'questionnaires'">
......@@ -222,15 +240,14 @@
:formStatus="formStatus"
:idsObj="idsObj"
:appointmentStatus="appointmentSummeryInfo.status"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="questionnairesInfoRef"
:pageSource="pageSource"
:showSubmitBtn="showSubmitBtn"
:foldInsurantInfo="foldInsurantInfo"
:affixOffset="360"
:tabIndex="tabsList.findIndex(t => t.name === 'questionnaires')"
anchorContainer=".appointmentTabPaneBox"
:editStatus="editStatus"
:affixOffset="pageSource == 'fnaList' ? 360 : 250"
/>
</div>
<div v-if="tab.name === 'fna'">
......@@ -238,7 +255,6 @@
:activeName="activeName"
:formStatus="formStatus"
:idsObj="idsObj"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
:pageSource="pageSource"
/>
</div>
......@@ -248,7 +264,6 @@
:formStatus="formStatus"
:idsObj="idsObj"
:apiAppointmentInfoDto="appointmentSummeryInfo.apiAppointmentInfoDto"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="policyTransferRef"
:pageSource="pageSource"
:showSubmitBtn="showSubmitBtn"
......@@ -259,7 +274,6 @@
<FileUpload
:activeName="activeName"
:idsObj="idsObj"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
:pageSource="pageSource"
:showSubmitBtn="showSubmitBtn"
ref="appointmentAccessoriesRef"
......@@ -376,17 +390,19 @@ import {
getAppointmentDetail,
storageAppointment,
editAppointmentDetail,
uploadExcel
uploadExcel,
appointmentEditStorage,
appointmentEditStatus
} from '@/api/sign/appointment'
import { getPolicyfollow, getPolicyInfo, signName } from '@/api/sign/underwritingMain'
import {
listTenantUser,
getInsuranceProductList,
getAdditionalProductList,
getBankList,
getUserSaleExpandList,
secondAdditonalList,
getAllSignList
getAllSignList,
uploadMaterialList
} from '@/api/common'
import { Check, Edit } from '@element-plus/icons-vue'
import { ref, nextTick, onUnmounted } from 'vue'
......@@ -426,17 +442,19 @@ const idsObj = ref({}) //各个模块的bizId
const appointmentSummeryInfo = ref({}) //预约详情总信息
const currentFile = ref(null)
const foldInsurantInfo = ref(false) //健康信息中得受保人信息是否隐藏
const showCancelApply = ref(false) //是否显示取消申请按钮
const processInfo = ref({
fnaNo: '暂无',
status: '未完成',
createTime: proxy.parseTime(new Date()),
customerName: userStore.name
})
const editStatus = ref(false) //编辑状态
const editStatus = ref(null) //编辑状态
const execlDialog = ref(false)
const isEmbed = ref(false) //是否作为组件插入
const policyNo = ref('') //新单跟进保单号
const currentPolicyholderInfo = ref({}) //存储下投保人信息,受保人模块要用到
const fileTableList = ref([])
const tabsList = ref([
{
label: '签约信息',
......@@ -486,43 +504,67 @@ const tabsList = ref([
status: '0',
key: 'questionnaireBizId'
},
{
label: '关联FNA',
name: 'fna',
id: 8,
status: '0',
key: 'fnaBizId'
},
{
label: '转保声明',
name: 'policyTransfer',
id: 9,
status: '0',
key: 'policyTransfer'
},
{
label: '附件', //大提交的时候不用提交了,因为上传文件的时候已经入库了
name: 'accessories',
id: 10,
status: '0',
key: 'fnaBizId'
}
//
// {
// label: '关联计划书', //关联计划书暂时先不做
// label: '关联FNA',
// name: 'fna',
// id: 10,
// id: 8,
// status: '0',
// key: 'fnaBizId'
// },
// {
// label: '其他', //先不做
// name: 'fna',
// id: 11,
// label: '转保声明',
// name: 'policyTransfer',
// id: 9,
// status: '0',
// key: 'fnaBizId'
// key: 'policyTransfer'
// },
{
label: '附件', //大提交的时候不用提交了,因为上传文件的时候已经入库了
name: 'accessories',
id: 10,
status: '0',
key: 'fnaBizId'
}
])
const assetVerification = () => {
proxy.$message.warning('此功能等待开放')
}
// 取消操作
const handleCancel = type => {
let obj = {
oprType: type == 'apply' ? 1 : 2, //操作类型 1-取消申请 2-取消预约
appointmentBizId: idsObj.value.appointmentBizId, //预约信息主表唯一业务ID
status: appointmentSummeryInfo.value.status //预约状态
}
proxy.$modal
.confirm(`确认取消${type == 'apply' ? '申请' : '预约'}`)
.then(function () {
return appointmentEditStatus(obj)
})
.then(res => {
if (res.code == 200) {
proxy.$modal.msgSuccess('已成功取消')
getAppointmentInfo(idsObj.value.appointmentBizId)
}
})
.catch(() => {})
}
// 获取默认附件信息
const getFileList = () => {
try {
uploadMaterialList({ objectType: 'appointment' }).then(response => {
fileTableList.value = response.data.map(item => {
return {
materialBizId: item.materialBizId,
fileBizIdList: []
}
})
})
} catch (error) {
fileTableList.value = []
proxy.$message.error('附件列表获取失败')
}
}
// 获取字典数据
const fetchDictData = dictType => {
let options = []
......@@ -538,10 +580,7 @@ const fetchDictData = dictType => {
return []
}
}
// 上传EXECL
const handleAddExecl = () => {
execlDialog.value = true
}
const downloadExcel = () => {
// 创建隐藏的下载链接
const link = document.createElement('a')
......@@ -622,7 +661,16 @@ const execlUpload = () => {
function getAppointmentInfo(appointmentBizId, changeTab) {
getAppointmentDetail(appointmentBizId).then(res => {
if (res.code == 200) {
editStatus.value = true
//因为是否第二持有人放在了预约主体里,所以需要单独处理
appointmentSummeryInfo.value = res.data
if (
res.data.apiAppointmentInfoDto.isSecond == '0' ||
res.data.apiAppointmentInfoDto.isSecond
) {
appointmentSummeryInfo.value.apiSecondHolderInfoDto.isSecond =
res.data.apiAppointmentInfoDto.isSecond
}
let options = fetchDictData('csf_ap_status')
options.forEach(item => {
if (item.value == appointmentSummeryInfo.value.status) {
......@@ -668,15 +716,9 @@ const getDictsData = async () => {
const response4 = await signName(params4)
if (response4.code == 200) {
response4.data.records = response4.data.records.map(item => {
// return {
// ...item,
// label: item.productName,
// value: item.additionalProductBizId
// }
return item
})
dictStore.setSignNameList(response4.data.records)
console.log('response4', response4.data.records)
}
return
}
......@@ -690,23 +732,7 @@ const getDictsData = async () => {
if (response1.code == 200) {
dictStore.setTenantUserList(response1.data.records)
}
const params2 = {
loginTenantBizId: userStore.projectInfo.tenantBizId,
pageNo: 1,
pageSize: 10
}
const response2 = await getInsuranceProductList(params2)
if (response2.code == 200) {
response2.data.records = response2.data.records.map(item => {
return {
...item,
label: item.productName,
value: item.productBizId
}
})
dictStore.setInsureProductList(response2.data.records)
}
const params3 = {
pageNo: 1,
pageSize: 10
......@@ -838,74 +864,97 @@ const isObject = value => {
}
const handleSubmit = async type => {
// 提交得时候要拿到各个步骤得表单数据
// if (appointmentInfoRef.value) {
// const result = await appointmentInfoRef.value[0].handleFormValues()
// submitAppointmentObj.value.apiAppointmentInfoDto = result
// if (!submitAppointmentObj.value.apiAppointmentInfoDto) return
// }
if (appointmentInfoRef.value) {
const result = await appointmentInfoRef.value[0].handleFormValues()
submitAppointmentObj.value.apiAppointmentInfoDto = result
console.log('====================================')
console.log('预约', result)
console.log('====================================')
if (!submitAppointmentObj.value.apiAppointmentInfoDto) return
}
if (productPlanRef.value) {
submitAppointmentObj.value.apiProductPlanInfoDto =
await productPlanRef.value[0].handleSubmitForm()
// if (productPlanRef.value) {
// submitAppointmentObj.value.apiProductPlanInfoDto =
// await productPlanRef.value[0].handleSubmitForm()
// if (!submitAppointmentObj.value.apiProductPlanInfoDto) return
// }
if (!submitAppointmentObj.value.apiProductPlanInfoDto) {
proxy.$message.error('请完善产品计划信息')
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)
if (policyHolderInfoRef.value) {
submitAppointmentObj.value.apiPolicyholderInfoDto =
await policyHolderInfoRef.value[0].handleFormValues('policyHolderInfoRef')
if (!submitAppointmentObj.value.apiPolicyholderInfoDto) {
proxy.$message.error('请确认投保人信息')
return
}
}
// await nextTick() // 👈 加这一行!
// const result = await insuredInfoRef.value[0].handleFormValues('insuredInfoRef')
// console.log('result', result)
// 获取受保人form
if (insuredInfoRef.value) {
submitAppointmentObj.value.apiInsurantInfoDto = await insuredInfoRef.value[0].handleFormValues(
'insuredInfoRef'
)
// if (!result) return
// submitAppointmentObj.value.apiInsurantInfoDto = result
// }
console.log('受保人', submitAppointmentObj.value.apiInsurantInfoDto)
if (!submitAppointmentObj.value.apiInsurantInfoDto) {
proxy.$message.error('请完善受保人信息')
return
}
}
if (beneficiaryInfoRef.value) {
submitAppointmentObj.value.apiBeneficiaryInfoFzDto =
await beneficiaryInfoRef.value[0].handleFormValues()
if (!submitAppointmentObj.value.apiBeneficiaryInfoFzDto) {
proxy.$message.error('请完善受益人信息')
return
} else {
}
}
if (secondHolderInfoRef.value) {
submitAppointmentObj.value.apiSecondHolderInfoDto =
await secondHolderInfoRef.value[0].handleFormValues()
if (!submitAppointmentObj.value.apiSecondHolderInfoDto) {
proxy.$message.error('请完善第二持有人信息')
return
} else {
submitAppointmentObj.value.apiAppointmentInfoDto.isSecond =
submitAppointmentObj.value.apiSecondHolderInfoDto.isSecond
}
}
// if (secondHolderInfoRef.value) {
// submitAppointmentObj.value.apiSecondHolderInfoDto =
// await secondHolderInfoRef.value[0].handleFormValues()
// if (!submitAppointmentObj.value.apiSecondHolderInfoDto) return
// }
// if (beneficiaryInfoRef.value) {
// submitAppointmentObj.value.apiBeneficiaryInfoFzDto =
// 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
// }
if (appointmentAccessoriesRef.value) {
if (questionnairesInfoRef.value) {
submitAppointmentObj.value.apiAnswerSaveRequest =
await questionnairesInfoRef.value[0].handleFormValues()
if (!submitAppointmentObj.value.apiAnswerSaveRequest) {
submitAppointmentObj.value.apiAnswerSaveRequest = null
}
}
if (appointmentAccessoriesRef.value && !idsObj.value.appointmentBizId) {
submitAppointmentObj.value.materialDtoList =
appointmentAccessoriesRef.value[0].handleFormValues()
if (!submitAppointmentObj.value.materialDtoList) return
if (submitAppointmentObj.value.materialDtoList.length == 0) {
submitAppointmentObj.value.materialDtoList = fileTableList.value
}
}
console.log('大提交', submitAppointmentObj.value)
return
// return
// 代表新增预约
if (formStatus.value == 'appointmentAdd' && !idsObj.value.appointmentBizId) {
submitAppointmentObj.value.apiAppointmentInfoDto.customerBizId =
props.processDetail.customerBizId
submitAppointmentObj.value.apiAppointmentInfoDto.fnaBizId = props.processDetail.fnaBizId
submitAppointmentObj.value.apiAppointmentInfoDto.fnaNo = props.processDetail.fnaNo
console.log('大提交', submitAppointmentObj.value)
// return
if (type == 'submit') {
// 新增预约单
addAppointment(submitAppointmentObj.value).then(res => {
if (res.code == 200) {
proxy.$message.success('预约成功')
appointmentInfoRef.value[0].handleEditStatus(true)
productPlanRef.value[0].handleEditStatus(true)
policyHolderInfoRef.value[0].handleEditStatus(true)
insuredInfoRef.value[0].handleEditStatus(true)
secondHolderInfoRef.value[0].handleEditStatus(true)
beneficiaryInfoRef.value[0].handleEditStatus(true)
editStatus.value = false
emit('handleSuccess', {
tab: 'appointment',
type: 'add'
......@@ -914,75 +963,22 @@ const handleSubmit = async type => {
})
}
}
// 代表修改预约单
if (idsObj.value.appointmentBizId) {
if (policyTransferRef.value) {
submitAppointmentObj.value.apiAppointmentInfoDto.policyTransfer =
policyTransferRef.value[0].form.policyTransfer
}
if (questionnairesInfoRef.value) {
submitAppointmentObj.value.answerSessionsDtoList =
questionnairesInfoRef.value[0].handleFormValues().answerSessionsDtoList
}
// 与预约聚合详情做对比,如果拿到得个表单数据有为空得就使用聚合详情得数据
for (const key1 in appointmentSummeryInfo.value) {
for (const key2 in submitAppointmentObj.value) {
if (
key1 == key2 &&
isArray(submitAppointmentObj.value[key2]) &&
submitAppointmentObj.value[key2].length == 0
) {
submitAppointmentObj.value[key2] = appointmentSummeryInfo.value[key1]
}
if (
key1 == key2 &&
isObject(submitAppointmentObj.value[key2]) &&
Object.keys(submitAppointmentObj.value[key2]).length == 0
) {
submitAppointmentObj.value[key2] = appointmentSummeryInfo.value[key1]
}
if (
key2 == 'apiPolicyholderInfoDto' &&
Object.keys(submitAppointmentObj.value[key2]).length !== 0
) {
submitAppointmentObj.value[key2]['appointmentBizId'] =
appointmentSummeryInfo.value.apiPolicyholderInfoDto.appointmentBizId
submitAppointmentObj.value[key2]['id'] =
appointmentSummeryInfo.value.apiPolicyholderInfoDto.id
submitAppointmentObj.value[key2]['policyholderBizId'] =
appointmentSummeryInfo.value.apiPolicyholderInfoDto.policyholderBizId
}
if (
key2 == 'apiInsurantInfoDto' &&
Object.keys(submitAppointmentObj.value[key2]).length !== 0
) {
submitAppointmentObj.value[key2]['appointmentBizId'] =
appointmentSummeryInfo.value.apiInsurantInfoDto.appointmentBizId
submitAppointmentObj.value[key2]['id'] =
appointmentSummeryInfo.value.apiInsurantInfoDto.id
submitAppointmentObj.value[key2]['insurantBizId'] =
appointmentSummeryInfo.value.apiInsurantInfoDto.insurantBizId
}
}
// 代表修改预约单 因为编辑暂存也会有预约id
if (idsObj.value.appointmentBizId && type == 'submit') {
// 已生成行程单的方式预约提交
if (route.query.appointmentType == '2') {
submitAppointmentObj.value.source = 2
}
// 编辑预约单
editAppointmentDetail(submitAppointmentObj.value).then(res => {
if (res.code == 200) {
appointmentInfoRef.value[0].handleEditStatus(true)
productPlanRef.value[0].handleEditStatus(true)
policyHolderInfoRef.value[0].handleEditStatus(true)
insuredInfoRef.value[0].handleEditStatus(true)
secondHolderInfoRef.value[0].handleEditStatus(true)
beneficiaryInfoRef.value[0].handleEditStatus(true)
policyTransferRef.value[0].handleEditStatus(true)
questionnairesInfoRef.value[0].handleEditStatus(true)
editStatus.value = true
getAppointmentInfo(idsObj.value.appointmentBizId)
proxy.$message.success('修改预约单成功')
}
})
getAppointmentInfo(idsObj.value.appointmentBizId)
}
// 预约暂存
// 新增预约暂存
if (type == 'storage') {
submitAppointmentObj.value.apiAppointmentInfoDto.customerBizId =
props.processDetail.customerBizId
......@@ -996,6 +992,21 @@ const handleSubmit = async type => {
}
})
}
// 编辑状态下预约暂存
if (type == 'editStorage') {
// submitAppointmentObj.value.apiAppointmentInfoDto.customerBizId =
// props.processDetail.customerBizId
// submitAppointmentObj.value.apiAppointmentInfoDto.fnaBizId = props.processDetail.fnaBizId
// submitAppointmentObj.value.apiAppointmentInfoDto.fnaNo = props.processDetail.fnaNo
// 暂存预约单
appointmentEditStorage(submitAppointmentObj.value).then(res => {
if (res.code == 200) {
proxy.$message.success('预约暂存提交成功')
editStatus.value = true
getAppointmentInfo(idsObj.value.appointmentBizId)
}
})
}
}
const handleEdit = () => {
editStatus.value = !editStatus.value
......@@ -1005,8 +1016,10 @@ if (route.query.appointmentNo && route.query.source == 'appointmentList') {
processInfo.value = route.query
idsObj.value.appointmentBizId = route.query.appointmentBizId
getDictsData()
// 请求预约单聚合详情
getAppointmentInfo(idsObj.value.appointmentBizId, true)
setTimeout(() => {
// 请求预约单聚合详情
getAppointmentInfo(idsObj.value.appointmentBizId, true)
}, 500)
}
const pageSource = computed(() => {
return props.source || route.query.source
......@@ -1026,7 +1039,7 @@ const minHight = computed(() => {
} else if (pageSource.value == 'policyList') {
return 'calc(100vh - 84.5px)'
} else {
return 'calc(100vh - 325px)'
return 'calc(100vh - 400px)'
}
})
......@@ -1105,11 +1118,14 @@ watch(
key: 'fnaBizId'
}
]
nextTick(() => {
activeName.value = 'appointmentInfo'
})
} else {
// getAppointmentInfo(idsObj.value.appointmentBizId)
activeName.value = ''
getAppointmentInfo(idsObj.value.appointmentBizId)
tabsList.value = [
{
label: '签约信息',
......@@ -1159,20 +1175,20 @@ watch(
status: '0',
key: 'questionnaireBizId'
},
{
label: '关联FNA',
name: 'fna',
id: 8,
status: '0',
key: 'fnaBizId'
},
{
label: '转保声明',
name: 'policyTransfer',
id: 9,
status: '0',
key: 'policyTransfer'
},
// {
// label: '关联FNA',
// name: 'fna',
// id: 8,
// status: '0',
// key: 'fnaBizId'
// },
// {
// label: '转保声明',
// name: 'policyTransfer',
// id: 9,
// status: '0',
// key: 'policyTransfer'
// },
{
label: '附件', //大提交的时候不用提交了,因为上传文件的时候已经入库了
name: 'accessories',
......@@ -1182,7 +1198,6 @@ watch(
}
]
}
nextTick(() => {
activeName.value = 'appointmentInfo'
})
......@@ -1275,12 +1290,7 @@ if (route.query.source == 'policyList') {
id: 6,
key: 'verifyPolicyInfo'
},
// {
// label: '新单事项',
// name: 'newpolicyTodo',
// id: 7,
// key: 'newpolicyTodo'
// },
{
label: '产品计划',
name: 'productPlan',
......@@ -1323,13 +1333,7 @@ if (route.query.source == 'policyList') {
status: '0',
key: 'questionnaireBizId'
},
// {
// label: '关联FNA',
// name: 'fna',
// id: 14,
// status: '0',
// key: 'fnaBizId'
// },
{
label: '转保声明',
name: 'policyTransfer',
......@@ -1361,17 +1365,20 @@ const showSubmitBtn = computed(() => {
return false
}
})
//刚进页面的编辑状态
//刚进页面的编辑状态,根据不同页面来源做处理
if (route.query.appointmentNo && route.query.source == 'appointmentList') {
editStatus.value = true
console.log('route.query', route.query)
} else if (route.query.source == 'policyList') {
editStatus.value = true
} else if (route.query.source == 'fnaList' && idsObj.value.appointmentBizId) {
} else if (route.query.source == 'fnaList' && route.query.appointmentBizId) {
idsObj.value.appointmentBizId = route.query.appointmentBizId
getAppointmentInfo(route.query.appointmentBizId)
editStatus.value = true
} else if (route.query.source == 'fnaList' && !idsObj.value.appointmentBizId) {
} else if (route.query.source == 'fnaList' && !route.query.appointmentBizId) {
editStatus.value = false
}
getFileList()
onUnmounted(() => {
// 彻底重置所有响应式数据
submitAppointmentObj.value = {}
......@@ -1393,9 +1400,6 @@ onUnmounted(() => {
beneficiaryInfoRef.value = null
policyTransferRef.value = null
questionnairesInfoRef.value = null
// 清理事件监听器(如果有的话)
// window.removeEventListener('resize', yourHandler)
})
</script>
<style lang="scss" scoped>
......@@ -1407,7 +1411,7 @@ onUnmounted(() => {
background-color: #fff !important;
}
.noembed-container {
padding: 20px;
padding: 10px 20px;
background-color: #f2f3f5;
/* min-height: calc(100vh - 84.5px); */
}
......@@ -1464,6 +1468,10 @@ onUnmounted(() => {
}
}
}
.right {
display: flex;
align-items: center;
}
}
.tabsBox {
.topButtonBox {
......@@ -1500,6 +1508,7 @@ onUnmounted(() => {
.appointmentTabPaneBox {
overflow-y: auto;
padding-right: 10px;
position: relative;
}
.overviewBox {
......
<template>
<div v-if="processedAppointmentData.length > 0">
<div>
<CommonForm
:showAnchor="false"
:anchorList="anchorList"
:affixOffset="affixOffset"
:anchorOffset="10"
:scrollContainerSelector="anchorContainer"
>
<template #form-right>
<el-form ref="appointmentInfoFormRef" :model="form" label-width="120px">
<div v-for="father in processedAppointmentData">
<el-row style="margin-bottom: 10px" v-if="father.showMoudle" :id="father.anchorKey">
<div class="formBox">
<CardOne :title="father.fatherTitle">
<!-- <template #mainTitCustom v-if="props.idsObj.appointmentBizId">
<div style="margin-left: 10px">
<el-button
@click="viewHistory"
type="primary"
link
v-if="father.key == 'administration'"
>历史记录</el-button
>
</div>
</template> -->
<!-- <template #headerRight v-if="father.key == 'administration'">
<div>
<el-button
v-if="idsObj.appointmentBizId"
@click="handleExprot"
type="primary"
link
>导出预约表</el-button
>
<el-button
v-if="appointmentStatus >= 2"
@click="getItineraryInfo"
type="primary"
link
>行程单预览</el-button
>
</div>
</template> -->
<template #content>
<!-- 不是表格 -->
<el-row :gutter="20" v-if="!father.showTable">
<template v-for="child in father.data" :key="child.key">
<el-col
:sm="child.sm"
:lg="child.lg"
class="formItemBox"
v-if="child.show"
>
<div>
<el-form-item
:label-width="child.labelWidth"
:label="child.label"
:prop="child.key"
:key="child.key"
:label-position="child.labelPosition"
class="button-form-item"
>
<el-input
v-if="child.domType === 'Input'"
:type="child.inputType"
v-model="form[child.key]"
:placeholder="child.placeholder"
maxlength="30"
:rows="child.rows"
:disabled="editStatus"
/>
<el-select
v-if="child.domType === 'Select'"
v-model="form[child.key]"
:placeholder="child.placeholder"
@change="handleSelectChange(father, child)"
:disabled="editStatus"
>
<el-option
v-for="item in child.options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- 带时分的时间框 -->
<div
v-if="child.domType === 'datetimePicker'"
class="compositionDateTime"
>
<el-date-picker
type="date"
placeholder="选择日期"
style="width: 100%"
v-model="form[child.key]"
:disabled="editStatus"
@change="handleDateChange(child)"
:disabled-date="time => disabledDate(time, child)"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
@clear="handleDateClear(child)"
/>
<span class="text-gray-500">-</span>
<el-time-picker
placeholder="选择时分"
style="width: 100%"
v-model="child.timeValue"
:disabled="editStatus"
format="HH:mm"
value-format="HH:mm"
@change="timeValueChange(child)"
/>
</div>
<!-- 不带时分 -->
<el-date-picker
style="width: 100%"
v-if="child.domType === 'DatePicker'"
v-model="form[child.key]"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
:placeholder="child.placeholder"
:disabled="editStatus"
:disabled-date="time => disabledDate(time, child)"
@change="handleDateChange(child)"
@clear="handleDateClear(child)"
/>
<el-input
v-if="child.domType === 'arrowRight'"
v-model="form[child.key]"
:placeholder="child.placeholder"
:suffix-icon="ArrowRight"
readonly
:disabled="editStatus"
@focus="handleFoucs(child)"
>
</el-input>
<el-select
v-model="form[child.key]"
v-if="child.domType === 'SearchSelect'"
filterable
:allow-create="child.allowCreate"
reserve-keyword
@change="handleSelectChange(father, child)"
:remote-method="query => searchSelectList(query, child.key)"
placeholder="请输入关键词搜索"
:loading="searchLoadingStates[child.key]"
:disabled="editStatus"
>
<el-option
v-for="item in searchOptions[child.key] || []"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<div v-if="child.domType === 'Div'" class="divClass">
<div v-if="child.key == 'information'" class="desBox">
<div class="title">{{ child.title }}</div>
<div class="informationBox">
<div
v-for="(item, index) in child.informationList"
:key="index"
>
{{ item.name }}
</div>
</div>
</div>
</div>
</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">
<template v-if="father.key == 'referrerDtoList'">
<el-table-column label="姓名" prop="realName" align="center">
<template #header>
<span class="required-label">姓名</span>
</template>
<template #default="scope">
<el-select
v-model="scope.row.realName"
filterable
remote
reserve-keyword
placeholder="请输入关键词搜索"
:remote-method="query => searchSelectList(query, 'realName')"
:loading="searchLoadingStates['realName']"
:disabled="editStatus"
@change="handleTableSelectChange(father, scope.row, 'realName')"
>
<el-option
v-for="item in searchOptions['realName'] || []"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="手机号" prop="phone" align="center">
<template #header>
<span class="required-label">手机号</span>
</template>
<template #default="scope">
<el-input
v-model="scope.row.phone"
size="default"
placeholder="请输入"
:disabled="editStatus"
/>
</template>
</el-table-column>
<el-table-column label="邮箱" prop="email" align="center">
<template #header>
<span class="required-label">邮箱</span>
</template>
<template #default="scope">
<el-input
v-model="scope.row.email"
size="default"
placeholder="请输入"
:disabled="editStatus"
/>
</template>
</el-table-column>
<el-table-column width="60px" align="center" label="操作">
<template #default="scope">
<el-icon
class="deleteIcon"
@click="deleteChildren(father, scope.$index)"
><Delete
/></el-icon>
</template>
</el-table-column>
</template>
<template v-if="father.key == 'userSignDtoList'">
<el-table-column label="姓名" prop="name" align="center">
<template #header>
<span class="required-label">姓名</span>
</template>
<template #default="scope">
<el-select
v-model="scope.row.name"
filterable
remote
reserve-keyword
placeholder="请选择"
:remote-method="query => searchSelectList(query, 'name')"
:loading="searchLoadingStates['name']"
:disabled="editStatus"
@change="handleTableSelectChange(father, scope.row, 'name')"
>
<el-option
v-for="item in searchOptions['name'] || []"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="手机号" prop="phone" align="center">
<template #header>
<span class="required-label">手机号</span>
</template>
<template #default="scope">
<el-input
v-model="scope.row.phone"
size="default"
placeholder="请输入"
:disabled="editStatus"
/>
</template>
</el-table-column>
<el-table-column label="执业编码" prop="practiceCode" align="center">
<template #header>
<span class="required-label">执业编码</span>
</template>
<template #default="scope">
<el-input
v-model="scope.row.practiceCode"
size="default"
placeholder="请输入"
:disabled="editStatus"
/>
</template>
</el-table-column>
<el-table-column label="邮箱" prop="email" align="center">
<template #default="scope">
<el-input
v-model="scope.row.email"
size="default"
placeholder="请输入"
:disabled="editStatus"
/>
</template>
</el-table-column>
<el-table-column label="证件类型" prop="cardType" align="center">
<template #default="scope">
<el-select
v-model="scope.row.cardType"
placeholder="请选择"
:disabled="editStatus"
clearable
>
<el-option
v-for="item in fetchDictData('csf_id_type')"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="证件号" prop="cardNo" align="center">
<template #default="scope">
<el-input
v-model="scope.row.cardNo"
size="default"
placeholder="请输入"
:disabled="editStatus"
/>
</template>
</el-table-column>
<el-table-column width="60px" align="center" label="操作">
<template #default="scope">
<el-icon
@click="deleteChildren(father, scope.$index)"
class="deleteIcon"
><Delete
/></el-icon>
</template>
</el-table-column>
</template>
</el-table>
</el-row>
</template>
</CardOne>
</div>
</el-row>
</div>
</el-form>
</template>
</CommonForm>
</div>
<Phone
@close="handleCloseDrawer"
:showDrawer="showPhoneDrawer"
:drawerInfo="drawerInfo"
:phoneMenuList="phoneMenuList"
:phoneQuickList="phoneQuickList"
@confirmDrawer="confirmDrawer"
/>
<Address
@close="handleCloseDrawer"
:showAddressDrawer="showAddressDrawer"
:drawerInfo="drawerInfo"
:addressMenuList="addressMenuList"
:addressQuickList="addressQuickList"
@confirmDrawer="confirmDrawer"
/>
<Country
:showCountryDrawer="showCountryDrawer"
@close="handleCloseDrawer"
@confirmCountry="confirmDrawer"
/>
</div>
</template>
<script setup name="appointmentInfo">
import CommonPage from '@/components/commonPage'
import dayjs from 'dayjs'
import { ArrowRight } from '@element-plus/icons-vue'
import appointmentDomData from '@/formJson/appointmentInfo'
import Country from '@/views/components/country'
import Phone from '@/views/components/phone'
import Address from '@/views/components/address'
import DetailPanel from '@/components/DetailPanel'
import { watch, nextTick } from 'vue'
import {
getAppointmentlog,
getAppointmentlogDetail,
getItineraryExprot,
getItineraryDetail,
getAppointmentExprot
} from '@/api/sign/appointment'
import { getBankList, getAllSignList, getUserSaleExpandList } from '@/api/common'
import CommonForm from '@/views/components/commonForm'
import CommonDialog from '@/components/commonDialog'
import CardOne from '@/components/formCard/cardOne'
import useDictStore from '@/store/modules/dict'
const dictStore = useDictStore() //获取字典数据
const props = defineProps({
activeName: { type: String, default: '' }, //tab名称
formStatus: { type: String, default: '' }, //父组件状态,新增、修改
idsObj: { type: Object, default: () => ({}) }, //父组件传递过来的id对象
detailInfo: { type: Object, default: () => ({}) }, //父组件传递过来的签约信息的详情
appointmentStatus: { type: Number }, //父组件传递过来的预约状态
customerBizId: { type: String, default: '' }, //提交状态,新增、修改
fatherTabName: { type: String, default: '' }, //一级tab名称
anchorContainer: { type: String, default: '' }, //锚点滚动容器
editStatus: { type: Boolean, default: true }, //编辑状态
affixOffset: { type: Number, default: 360 } //tab索引
})
const emit = defineEmits(['handleSuccessEdit'])
const { proxy } = getCurrentInstance()
const appointmentRef = ref(null)
const showPhoneDrawer = ref(false) //电话抽屉开关
const showAddressDrawer = ref(false) //地址抽屉开关
const showCountryDrawer = ref(false) //国家/地区抽屉开关
const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输入值
const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
const errorFields = ref([]) // 存储校验失败的字段信息
const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作
const consultKey = ref({})
const openAccountKey = ref({})
const openList = ref(false) //历史签约记录弹窗开关
const showDetail = ref(false) //签约详情弹窗开关
const detailTitle = ref('') //签约详情弹窗title
const detailInfo = ref({}) //签约详情信息
const tableData = ref([])
const tableLoading = ref([])
const itineraryData = ref([]) //行程单数据
const appointmentSummeryInfo = ref({}) //行程单数据
const exportLoading = ref(false) //下载行程单loading
const showItinerary = ref(false) //下载行程单loading
// 地址组件菜单数据
const addressMenuList = ref([
{
name: '国家/地区',
icon: false,
value: '',
placeholder: '请输入国家/地区',
key: 'region'
},
{
name: '省市',
icon: false,
value: '',
placeholder: '请输入省市',
key: 'city'
},
{
name: '街道',
icon: false,
value: '',
placeholder: '请输入街道',
key: 'street'
},
{
name: '详细地址',
icon: false,
value: '',
placeholder: '请输入详细地址',
key: 'location'
}
])
// 快捷地址的数据
const addressQuickList = ref([])
const phoneMenuList = ref([
{
name: '区号',
icon: true,
value: '',
placeholder: '请输入区号',
arrow: true,
type: 'string'
},
{
name: '电话号码',
icon: false,
value: '',
placeholder: '请输入电话号码',
type: 'number'
}
])
const phoneQuickList = ref([])
const deleteKeyList = ref([
'objType',
'mailingAddress',
'residentialAddress',
'residenceAddress',
'companyAddress'
]) // 存储需要删除的key
const searchOptions = ref({}) // 存储不同key对应的选项
const searchLoadingStates = ref({}) // 存储不同key对应的加载状态
const total = ref(0)
const data = reactive({
form: {},
processedAppointmentData: [], // 处理后的表单数据
oldAppointmentData: [], // 保存旧的表单Dom,便于撤销操作
rules: {}, //表单验证规则,
queryParams: {
pageNo: 1,
pageSize: 10
}
})
const { form, rules, processedAppointmentData, queryParams, oldAppointmentData } = toRefs(data)
// 获取预约行程单详情
function getItineraryInfo() {
getItineraryDetail(props.idsObj.appointmentBizId).then(res => {
if (res.code == 200) {
appointmentSummeryInfo.value = res.data
fetchDictData('csf_ap_meeting_point').forEach(item => {
if (item.value == appointmentSummeryInfo.value.meetingPoint) {
appointmentSummeryInfo.value.meetingPoint = item.label
}
})
if (appointmentSummeryInfo.value.total) {
appointmentSummeryInfo.value.total = Number(appointmentSummeryInfo.value.total).toFixed(2)
}
itineraryData.value = [
{
title: '集合信息',
data: [
// 第一行:2列布局(各占12)
{
label: '集合时间',
value: appointmentSummeryInfo.value.arrivalTime,
span: 12 // 占12/24
},
{
label: '集合地点',
value: appointmentSummeryInfo.value.meetingPoint,
span: 12 // 占12/24
},
{
label: '意向地点',
value: appointmentSummeryInfo.value.signingAddress,
span: 12 // 占12/24
}
]
},
{
title: '业务代表',
data: [
// 第一行:2列布局(各占12)
{
label: '业务代表',
value: appointmentSummeryInfo.value.businessRepresentName1,
span: 12 // 占12/24
},
{
label: '联系电话',
value: appointmentSummeryInfo.value.businessRepresentMobile1
? appointmentSummeryInfo.value.businessRepresentMobile1Code +
appointmentSummeryInfo.value.businessRepresentMobile1
: '-',
span: 12 // 占12/24
}
]
},
{
title: '咨询内容',
data: [
// 第一行:2列布局(各占12)
{
label: '咨询人',
value: appointmentSummeryInfo.value.name,
span: 12 // 占12/24
},
{
label: '意向缴费年期',
value: appointmentSummeryInfo.value.paymentTerm,
span: 12 // 占12/24
},
{
label: '保单征费',
value: appointmentSummeryInfo.value.policyFee || '-',
span: 12 // 占12/24
},
{
label: '首期保费',
value: appointmentSummeryInfo.value.eachIssuePremium || '-',
span: 12 // 占12/24
},
{
label: '币种',
value: appointmentSummeryInfo.value.currency,
span: 12 // 占12/24
},
{
label: '意向咨询产品',
value: appointmentSummeryInfo.value.productName,
span: 12 // 占12/24
},
{
label: '首期合计金额',
value: appointmentSummeryInfo.value.total,
span: 12 // 占12/24
}
]
}
]
showItinerary.value = true
}
})
}
// 导出行程单Pdf
const handleExprotPdf = () => {
exportLoading.value = true
getItineraryExprot(appointmentSummeryInfo.value.appointmentBizId).then(res => {
if (res.code == 200) {
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = res.data
link.target = '_blank' // 新窗口打开
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = `香港行程安排.pdf`
link.download = fileName
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
exportLoading.value = false
showItinerary.value = false
} else {
proxy.$message.error('行程单下载失败')
exportLoading.value = false
}
})
}
//导出预约表
const handleExprot = async row => {
try {
const res = await getAppointmentExprot(props.idsObj.appointmentBizId)
if (res.code == 200) {
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = res.data.url
// link.target = '_blank' // 新窗口打开
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = '预约导出.xlsx'
link.download = fileName
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
proxy.$message.success('导出成功')
}
} catch (error) {
console.error('导出失败:', error)
}
}
const changePageNo = val => {
queryParams.value.pageNo = val
// getList()
}
const changePageSize = val => {
queryParams.value.pageSize = val
// getList()
}
const timeValueChange = child => {
if (form.value[child.key]) {
child.finishTime = `${form.value[child.key]} ${child.timeValue}:00`
} else if (!form.value[child.key]) {
proxy.$message.warning(`请先选择${child.label}日期`)
child.timeValue = ''
}
}
// 签约详情
const viewDetail = row => {
try {
getAppointmentlogDetail(row.appointmentLogBizId).then(response => {
detailInfo.value = response.data
detailTitle.value = `${row.creatorName}签约详情`
showDetail.value = true
})
} catch (error) {
detailTitle.value = ''
detailInfo.value = {}
showDetail.value = false
}
}
// 签约历史记录
const viewHistory = () => {
try {
getAppointmentlog(queryParams.value).then(response => {
tableData.value = response.data.records
total.value = response.data.total
tableLoading.value = false
openList.value = true
})
} catch (error) {
tableData.value = []
} finally {
tableLoading.value = false
}
}
const handleTableSelectChange = (father, row, key) => {
searchOptions.value[key].forEach(item => {
if (row[key] == item.value) {
row[key] = item.label
row.userBizId = item.userBizId
if (key == 'name') {
row.userSignBizId = item.value
} else if (key == 'realName') {
row.userSaleBizId = item.value
}
}
})
}
// 添加表单子级dom
const addChildren = father => {
const processedData = JSON.parse(JSON.stringify(processedAppointmentData.value))
let obj4 = {
id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
span: 24, //栅格布局份数
email: '',
phone: '',
realName: ''
}
let obj5 = {
id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
span: 24, //栅格布局份数
name: '', //姓名
practiceCode: '', //执业编码
phone: '', //手机号
cardType: '', //证件类型
cardNo: '', //证件号码
email: '' //邮箱
}
for (const section of processedData) {
if (father.key == 'referrerDtoList' && section.key == father.key) {
section.data.push(obj4)
}
if (father.key == 'userSignDtoList' && section.key == father.key) {
section.data.push(obj5)
}
}
//更新form表单对应的数据,以便收集填写的值
// form.value[father.key].push(obj)
processedAppointmentData.value = processedData
}
const deleteChildren = (father, childIndex) => {
if (props.editStatus) {
proxy.$modal.confirm(`请先点击编辑再进行删除操作`, { showCancel: '0', title: '填写提示' })
return
}
const processedData = JSON.parse(JSON.stringify(processedAppointmentData.value))
for (const section of processedData) {
if (father.key == 'referrerDtoList' && section.key == father.key) {
section.data.splice(childIndex, 1)
}
if (father.key == 'userSignDtoList' && section.key == father.key) {
section.data.splice(childIndex, 1)
}
}
processedAppointmentData.value = processedData
}
// 搜索方法
const searchSelectList = async (query, key) => {
// 设置该字段的加载状态
searchLoadingStates.value[key] = true
let queryString = query.trim()
try {
// 根据不同的字段key调用不同的API
if (key === 'bankName') {
const params4 = {
pageNo: 1,
pageSize: 10,
queryContent: queryString
}
const response4 = await getBankList(params4)
if (response4.code == 200) {
response4.data.records = response4.data.records.map(item => {
return {
...item,
label: item.bankName,
value: item.bankBizId
}
})
searchOptions.value[key] = response4.data.records
}
} else if (key == 'realName') {
const params5 = {
pageNo: 1,
pageSize: 10,
queryContent: queryString
}
const response5 = await getUserSaleExpandList(params5)
if (response5.code == 200) {
response5.data.records = response5.data.records.map(item => {
return {
...item,
label: item.realName,
value: item.userSaleBizId
}
})
searchOptions.value[key] = response5.data.records
}
} else if (key == 'name') {
const params5 = {
pageNo: 1,
pageSize: 10,
realName: queryString
}
const response5 = await getAllSignList(params5)
if (response5.code == 200) {
response5.data.records = response5.data.records.map(item => {
return {
...item,
label: item.realName,
value: item.userSignBizId
}
})
searchOptions.value[key] = response5.data.records
}
}
} catch (error) {
console.error(` 搜索失败`, error)
searchOptions.value[key] = []
} finally {
searchLoadingStates.value[key] = false
}
}
const disabledDate = (time, child) => {
// 获取“今天”的日期,并将其时间部分设置为 00:00:00
const today = dayjs().startOf('day') // :cite[7]
// 将传入的 timestamp 转换为 dayjs 对象
const inputDate = dayjs(time)
switch (child.key) {
case 'signDate':
// 默认禁用今天及今天之前
return inputDate.isBefore(today, 'day') || inputDate.isSame(today, 'day')
break
case 'confirmAppointmentTime':
return inputDate.isBefore(today, 'day')
break
case 'openAccountStartTime':
return time.getTime() > Date.now()
break
case 'openAccountEndTime':
// 获取开始日期(需要从表单数据中获取)
const startTime = form.value.openAccountStartTime
if (startTime) {
const startDate = dayjs(startTime).startOf('day')
// 禁用开始日期之前的所有日期(包括开始日期当天)
return inputDate.isBefore(startDate, 'day') || inputDate.isSame(startDate, 'day')
} else {
// 如果没有选择开始日期,禁用今天之前的日期
return inputDate.isBefore(today, 'day')
}
break
default:
// return time.getTime() > Date.now()
break
}
}
const handleDateClear = child => {
if (child.key == 'openAccountStartTime' && !form.value['openAccountStartTime']) {
form.value['openAccountEndTime'] = ''
resetShow({ type: 'child', key: 'openAccountEndTime', status: true, flag: 'disabled' })
return
}
if (child.key == 'arrivalTime' && !form.value['arrivalTime']) {
form.value['departureTime'] = ''
resetShow({ type: 'child', key: 'departureTime', status: true, flag: 'disabled' })
return
}
}
const handleDateChange = child => {
if (child.key == 'openAccountStartTime' && form.value['openAccountStartTime']) {
resetShow({ type: 'child', key: 'openAccountEndTime', status: false, flag: 'disabled' })
disabledDate(form.value['openAccountStartTime'], { key: 'openAccountEndTime' })
}
// 拼接日期与时分
if (child.key == 'arrivalTime' && child.finishTime && child.finishTime.split(' ').length == 2) {
child.finishTime = `${form.value[child.key]} ${child.timeValue}:00`
} else if (
child.key == 'departureTime' &&
child.finishTime &&
child.finishTime.split(' ').length == 2
) {
child.finishTime = `${form.value[child.key]} ${child.timeValue}:00`
}
// 离港时间在到港时间之前
if (
child.key == 'arrivalTime' &&
form.value['departureTime'] &&
!dayjs(form.value['arrivalTime']).isBefore(dayjs(form.value['departureTime']))
) {
proxy.$message.error('到港时间应在离港时间之前!!')
}
if (
child.key == 'departureTime' &&
form.value['arrivalTime'] &&
dayjs(form.value['departureTime']).isBefore(dayjs(form.value['arrivalTime']))
) {
proxy.$message.error('离港时间应在到港时间之后!!')
}
if (child.key === 'confirmAppointmentTime' && !form.value[child.key]) {
resetShow({ type: 'child', key: 'newPolicyButton', status: false, flag: 'show' })
} else if (child.key === 'confirmAppointmentTime' && form.value[child.key]) {
resetShow({ type: 'child', key: 'newPolicyButton', status: true, flag: 'show' })
}
}
// 获取字典数据
const fetchDictData = dictType => {
let options = []
try {
dictStore.dictTypeLists.forEach(item => {
if (item.dictType == dictType) {
// options = item.dictItemList
if (dictType == 'sys_no_yes') {
item.dictItemList.forEach(item1 => {
item1.value = Number(item1.value)
})
}
options = item.dictItemList
}
})
return options
} catch (error) {
console.error('获取字典数据失败:', error)
return []
}
}
// 添加英文校验函数
const validateEnglish = (rule, value, callback) => {
if (value && !/^[A-Za-z]*$/.test(value)) {
// 清空非英文字符
form.value.firstNamePinyin = ''
callback(new Error('只能输入英文字母'))
} else {
callback()
}
}
// 处理表单配置,添加字典数据
const processFormData = async () => {
// 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(appointmentDomData))
for (const section of processedData) {
if (section.keyType == 'Array') {
//给表格类型里的下拉框options赋值,否则提交的时候会报错
searchOptions.value['realName'] = dictStore.userSaleExpandList
searchOptions.value['name'] = dictStore.userSaleExpandList
}
if (section.data) {
for (const field of section.data) {
if (section.key == 'openAccount') {
openAccountKey.value[field.key] = field.key
}
if (section.key == 'consult') {
consultKey.value[field.key] = field.key
}
if (field.dictType) {
// 获取字典数据
field.options = fetchDictData(field.dictType)
}
if (field.key == 'bankName') {
searchOptions.value[field.key] = dictStore.bankList
}
if (field.required) {
if (field.key === 'firstNamePinyin') {
rules.value[field.key] = [
{ required: true, message: `${field.label}不能为空`, trigger: 'blur' },
{ validator: validateEnglish, trigger: 'change' }
]
} else {
rules.value[field.key] = [
{ required: true, message: `${field.label}不能为空`, trigger: 'blur' }
]
}
}
}
}
}
console.log('searchOptions.value', searchOptions.value)
setFormValue(props.detailInfo, processedData)
// if (props.idsObj.appointmentBizId) {
// setFormValue(props.apiAppointmentInfoDto, processedData)
// return
// } else if (showDetail.value) {
// // 回显历史签约详情
// setFormValue(detailData.value, processedData)
// return
// } else {
// // 新增给默认值
// form.value['isReferrerAccompany'] = form.value['isOpenAccount'] = form.value['isUseCar'] = 0
// processedAppointmentData.value = processedData
// }
}
//弹出右侧抽屉
const handleFoucs = child => {
if (child.disabled) return
console.log('saveKey.value', saveKey.value)
drawerInfo.value = JSON.parse(JSON.stringify(child))
switch (child.drawerType) {
case 'phone':
phoneMenuList.value[0].key = child.code
phoneMenuList.value[1].key = child.key
phoneMenuList.value.forEach(item => {
for (const key in saveKey.value) {
if (key == child.key) {
for (const key2 in saveKey.value[key]) {
if (item.key == key2) {
item.value = saveKey.value[key][key2]
}
}
}
}
})
showPhoneDrawer.value = true
break
case 'address':
addressMenuList.value.forEach(item => {
item.value = ''
for (const key in saveKey.value) {
if (key == child.key) {
for (const key2 in saveKey.value[key]) {
if (item.key == key2) {
item.value = saveKey.value[key][key2]
}
}
}
}
})
showAddressDrawer.value = true
break
case 'country':
showCountryDrawer.value = true
break
default:
break
}
}
// 处理抽屉关闭
const handleCloseDrawer = () => {
showPhoneDrawer.value = false
showAddressDrawer.value = false
showCountryDrawer.value = false
drawerInfo.value = {}
}
const confirmDrawer = info => {
// info 为抽屉返回的值
if (drawerInfo.value.domType == 'arrowRight' && drawerInfo.value.drawerType) {
let newObj = info[drawerInfo.value.key]
//要判断drawerType
switch (drawerInfo.value.drawerType) {
case 'phone':
newObj.objType = drawerInfo.value.drawerType
// 因为电话有多个,根据点击的电话类型在抽屉里回显,所以要用drawerInfo.value.code来控制
newObj.key = drawerInfo.value.key
form.value[info.key] = newObj.phoneString = `${newObj[drawerInfo.value.code]} ${
newObj[drawerInfo.value.key]
}`
saveKey.value[drawerInfo.value.key] = newObj
// 检查数组中是否已存在key的电话
const existingIndex = phoneQuickList.value.findIndex(item => item.key === newObj.key)
if (existingIndex !== -1) {
// 更新已存在的电话
phoneQuickList.value[existingIndex] = {
code: newObj[drawerInfo.value.code],
mobile: newObj[drawerInfo.value.key],
key: drawerInfo.value.key,
phoneString: newObj.phoneString
}
} else {
// 添加新的快捷电话
phoneQuickList.value.push({
code: newObj[drawerInfo.value.code],
mobile: newObj[drawerInfo.value.key],
key: drawerInfo.value.key,
phoneString: newObj.phoneString
})
}
phoneQuickList.value = removeDuplicates(phoneQuickList.value, 'phoneString')
break
case 'address':
newObj.objType = drawerInfo.value.drawerType
newObj.type = drawerInfo.value.key
form.value[info.key] = `${newObj.region} ${newObj.city} ${newObj.street} ${newObj.location}`
saveKey.value[info.key] = newObj
break
case 'country':
info.objType = drawerInfo.value.drawerType
form.value[drawerInfo.value.key] = info.name
saveKey.value[drawerInfo.value.key] = info
break
default:
break
}
}
handleCloseDrawer()
}
// 根据联动重置表单项的显示与否 是否禁用
const resetShow = obj => {
for (const section of processedAppointmentData.value) {
if (obj.type == 'father' && section.key == obj.key) {
section.showMoudle = obj.status
// if (!obj.status) {
// if (section.data) {
// for (const field of section.data) {
// form.value[field.key] = ''
// }
// }
// }
} else if (obj.type == 'child') {
if (section.data) {
for (const field of section.data) {
if (field.key == obj.key && obj.flag == 'show') {
// 获取字典数据
field.show = obj.status
} else if (field.key == obj.key && obj.flag == 'disabled') {
field.disabled = obj.status
}
}
}
}
}
}
const handleSelectChange = (father, child) => {
switch (child.key) {
case 'isReferrerAccompany':
// 选择吸烟,展示吸烟数量
if (form.value[child.key] == '1') {
resetShow({ type: 'father', key: 'referrerDtoList', status: true })
} else {
resetShow({ type: 'father', key: 'referrerDtoList', status: false })
}
break
case 'isOpenAccount':
// 根据是否开户,展示开户信息
if (form.value[child.key] == '1') {
resetShow({ type: 'father', key: 'openAccount', status: true })
} else {
resetShow({ type: 'father', key: 'openAccount', status: false })
}
break
case 'bankName':
if (form.value[child.key]) {
searchOptions.value[child.key].forEach(item => {
if (item.value == form.value[child.key]) {
form.value[child.key] = item.label
form.value['bankId'] = item.value
}
})
if (
searchOptions.value[child.key].findIndex(item => item.value == form.value['bankId']) !==
-1
) {
searchOptions.value[child.key].forEach(item => {
if (item.value == form.value['bankId']) {
form.value['materials'] = item.materials
}
})
} else {
form.value['materials'] = ''
}
}
break
default:
break
}
}
// 改变编辑状态
const handleEditStatus = status => {
editStatus.value = status
// 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(processedAppointmentData.value))
for (const section of processedData) {
if (section.data) {
for (const field of section.data) {
if (editStatus.value) {
field.disabled = true
} else {
if (!form.value['openAccountStartTime'] && field.key == 'openAccountEndTime') {
field.disabled = true
} else {
field.disabled = false
}
}
}
}
}
processedAppointmentData.value = processedData
}
//给表单赋值 方便表单回显 obj 为表单数据
const setFormValue = (obj, formData) => {
let tempPhoneList = []
let tempAddressList = []
addressQuickList.value = []
phoneQuickList.value = []
// 深拷贝原始数据
form.value = JSON.parse(JSON.stringify(obj))
// 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(formData))
for (const section of processedData) {
if (obj.isOpenAccount == 1 && section.key == 'openAccount') {
section.showMoudle = true
}
if (obj.isReferrerAccompany == 1 && section.key == 'referrerDtoList') {
section.showMoudle = true
}
// 给表单表格赋值
for (const objKey in obj) {
if (objKey == section.key && section.keyType == 'Array' && obj[section.key].length > 0) {
section.data = obj[section.key]
}
}
if (section.data) {
for (const field of section.data) {
if (field.key == 'confirmAppointmentTime' && props.appointmentStatus !== 0) {
field.show = true
}
// 处理时间
if (field.key == 'openAccountEndTime' && obj[field.key]) {
// 开始时间是否在结束时间之前
if (
obj['openAccountStartTime'] &&
!dayjs(obj['openAccountStartTime']).isBefore(dayjs(obj[field.key]))
) {
form.value[field.key] = ''
}
}
if (field.key == 'departureTime' && obj[field.key]) {
if (obj[field.key].split(' ').length > 1) {
form.value[field.key] = obj[field.key].split(' ')[0]
field.timeValue = obj[field.key].split(' ')[1]
}
field.finishTime = obj[field.key]
// 开始时间是否在结束时间之前
if (obj['arrivalTime'] && !dayjs(obj['arrivalTime']).isBefore(dayjs(obj[field.key]))) {
form.value[field.key] = ''
}
}
// 给到港时间的时分赋值
if (field.key == 'arrivalTime') {
if (obj[field.key] && obj[field.key].split(' ').length > 1) {
form.value[field.key] = obj[field.key].split(' ')[0]
field.timeValue = obj[field.key].split(' ')[1]
}
field.finishTime = obj[field.key]
}
//要判断drawerType,因为抽屉要回显数据
switch (field.drawerType) {
case 'phone':
let phoneObj = {}
for (const key1 in field) {
for (const key2 in obj) {
if (key1 !== 'drawerType' && field[key1] == key2) {
if (key1 == 'code' && obj[key2]) {
phoneObj[field[key1]] = obj[key2].includes('+') ? obj[key2] : `+${obj[key2]}`
} else {
phoneObj[field[key1]] = obj[key2]
}
}
}
}
if (phoneObj[field.key]) {
phoneObj.phoneString = form.value[field.key] = `${phoneObj[field.code]} ${
phoneObj[field.key]
}`
tempPhoneList.push(phoneObj)
}
phoneObj.objType = field.drawerType
phoneObj.key = field.key
phoneObj.phoneCode = field.code
saveKey.value[field.key] = phoneObj
break
case 'address':
let addressObj = null
for (const key1 in field) {
if (obj.addressList && obj.addressList.length > 0) {
obj.addressList.forEach(item => {
if (key1 == item.type) {
addressObj = item
}
})
}
}
if (addressObj) {
form.value[
field.key
] = `${addressObj.region} ${addressObj.city} ${addressObj.street} ${addressObj.location}`
addressObj.addressString = `${addressObj.region} ${addressObj.city} ${addressObj.street} ${addressObj.location}`
addressObj.objType = field.drawerType
saveKey.value[field.key] = addressObj
if (tempAddressList.length > 0) {
tempAddressList.forEach(item => {
if (item.addressString !== addressObj.addressString) {
tempAddressList.push(addressObj)
}
})
} else {
tempAddressList.push(addressObj)
}
}
break
case 'country':
form.value[field.key] = obj.countryName
saveKey.value[field.key] = {
country: obj.country || '',
countryCode: obj.country || '',
countryName: obj.countryName || '',
name: obj.countryName || '',
objType: field.drawerType
}
break
default:
break
}
}
}
}
addressQuickList.value = tempAddressList
tempPhoneList.forEach(item => {
for (const key in saveKey.value) {
if (item.key == key) {
for (const key2 in saveKey.value[key]) {
if (item.key == key2) {
item.mobile = saveKey.value[key][key2]
}
if (item.phoneCode == key2) {
item.code = saveKey.value[key][key2]
}
}
}
}
})
phoneQuickList.value = removeDuplicates(tempPhoneList, 'phoneString')
addressQuickList.value = removeDuplicates(tempAddressList, 'addressString')
processedAppointmentData.value = oldAppointmentData.value = processedData
oldObjInfo.value = JSON.parse(JSON.stringify(form.value))
console.log('form.value', form.value)
}
// 数组去重
function removeDuplicates(arr, key) {
const seen = new Map()
const result = []
for (const item of arr) {
if (!seen.has(item[key])) {
seen.set(item[key], true)
result.push(item)
}
}
return result
}
// 获取校验失败的字段信息
const getInvalidFields = fields => {
const errors = []
for (const field in fields) {
if (fields[field] && fields[field].length > 0) {
errors.push({
field: field,
message: `签约信息模块-${fields[field][0].message}`
})
}
}
return errors
}
const handleFormValues = () => {
return new Promise(resolve => {
let submitObj = { ...form.value }
const pattern = /Time$/
proxy.$refs['appointmentInfoFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
//处理表单数据
for (const key1 in form.value) {
// 不开户去除开户相关信息
if (key1 == 'isOpenAccount' && form.value[key1] == 0) {
for (const key4 in openAccountKey.value) {
delete submitObj[key4]
}
}
if (pattern.test(key1) && form.value[key1]) {
submitObj[key1] = proxy.formatToDateTime(form.value[key1])
}
// 处理电话和地址相关的
for (const key2 in saveKey.value) {
//要判断drawerType
switch (saveKey.value[key2].objType) {
case 'phone':
if (key1 == key2) {
for (const key3 in saveKey.value[key2]) {
submitObj[key3] = saveKey.value[key2][key3]
}
}
break
case 'address':
if (key1 == key2) {
addressList.push(saveKey.value[key2])
}
break
case 'country':
if (key1 == key2) {
submitObj['country'] = saveKey.value[key2]['countryCode']
submitObj['countryName'] = saveKey.value[key2]['name']
}
break
default:
break
}
}
}
let obj = {
realName: '转介人姓名',
phone: '转介人手机',
email: '转介人邮箱'
}
let obj1 = {
name: '签单员姓名',
phone: '签单员电话',
practiceCode: '签单员执业编码'
}
processedAppointmentData.value.forEach(item => {
if (item.key == 'referrerDtoList') {
if (form.value['isReferrerAccompany'] == 1 && item.data.length > 0) {
item.data.forEach((item1, index) => {
for (const key in item1) {
if (!item1[key]) {
errorFields.value.push({
message: `陪同转介人-第${index + 1}${obj[key]}不能为空`
})
}
}
})
submitObj['referrerDtoList'] = item.data
} else if (form.value['isReferrerAccompany'] == 1 && item.data.length == 0) {
errorFields.value.push({
message: '签约信息模块--转介人陪同时,陪同转介人信息不能为空!!'
})
}
}
if (item.key == 'position') {
item.data.forEach((item1, index) => {
if (item1.compositionTime) {
submitObj[item1.key] = item1.finishTime
}
})
}
if (item.key == 'userSignDtoList' && item.data.length > 0) {
item.data.forEach((item1, index) => {
for (const key in item1) {
if (!item1[key]) {
errorFields.value.push({
message: `签单员-第${index + 1}${obj1[key]}不能为空`
})
}
}
})
submitObj['userSignDtoList'] = item.data
}
})
if (submitObj['signDate']) {
submitObj['signDate'] = proxy.formatToDateTime(submitObj['signDate'])
}
console.log('submitObj', submitObj)
if (submitObj['departureTime']) {
// 开始时间是否在结束时间之前
if (
submitObj['arrivalTime'] &&
!dayjs(submitObj['arrivalTime']).isBefore(dayjs(submitObj['departureTime']))
) {
errorFields.value.push({
message: '签约信息模块--离港时间必须晚于到港时间!!'
})
// return undefined
}
}
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
}
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)
}
})
})
}
const anchorList = computed(() => {
let data = []
for (const section of processedAppointmentData.value) {
if (section.showMoudle) {
data.push({ title: section.anchorKey, name: section.fatherTitle })
}
}
return data
})
// 因为tab嵌套了两层,所以需要监听父组件的tab否则锚点的显示就会有bug
watch(
() => props.fatherTabName,
newVal => {
if (newVal) {
appointmentRef.value = null
}
}
)
if (Object.keys(props.detailInfo).length > 0) {
processFormData()
}
// 暴露给父组件
defineExpose({
handleFormValues,
handleEditStatus
})
</script>
<style lang="scss" scoped>
.required-label::before {
content: '*';
color: #f56c6c;
margin-right: 4px;
}
.domEmpty {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
font-size: 16px;
color: #a8abb2;
margin-top: 100px;
}
.topBtn {
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 10px;
}
.formBox {
width: 100%;
.fatherLable {
font-size: 18px;
border-left: 4px solid #165dff;
padding-left: 5px;
}
.fatherDes {
font-size: 14px;
color: #a8abb2;
margin-top: 5px;
margin-bottom: 20px;
}
.inputBox {
width: 100%;
border: 1px solid #dcdfe6;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: space-between;
min-height: 32px;
padding: 0px 11px;
.rightArrow {
font-size: 14px;
color: #a8abb2;
}
}
.desBox {
.title {
width: 120px;
font-size: 14px;
text-align: left;
margin-bottom: 10px;
color: #606266;
font-weight: 700;
}
.informationBox {
font-size: 14px;
border: 1px solid #dcdfe6;
width: 100%;
border-radius: 4px;
padding: 2px 4px;
box-sizing: border-box;
}
}
}
.tabButton {
box-shadow: 0 -1px 14px #00000014;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
/* padding-right: 20px; */
padding-top: 20px;
.sumbitBtn {
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
height: 60px;
background-color: #165dff;
color: #fff;
padding: 0 30px;
.buttonIcon {
font-size: 16px;
color: #fff;
}
}
}
.customerBox {
.customerItem {
padding: 10px;
border-radius: 5px;
margin-bottom: 20px;
box-shadow: 0 -1px 14px #00000014;
.top {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
.left {
width: 40%;
display: flex;
align-items: center;
justify-content: flex-start;
.gender {
display: flex;
align-items: center;
}
}
}
.bottom {
.infoItem {
display: flex;
align-items: center;
margin: 5px 0;
}
}
}
.customerItem:last-child {
margin-bottom: 0px;
}
}
.deleteIcon {
color: red;
font-size: 18px;
padding-top: 10px;
}
.compositionDateTime {
display: flex;
width: 100%;
box-sizing: border-box;
}
.itineraryDialogBox {
.dialogItem {
.dialogItemTitle {
font-size: 16px;
font-weight: 500;
margin: 10px 0;
color: #333;
}
}
}
@media only screen and (min-width: 768px) {
.formBtn {
margin-top: 0 !important;
}
}
@media only screen and (min-width: 1200px) {
.formBtn {
margin-top: 30px !important;
}
}
</style>
......@@ -3,10 +3,9 @@
<div ref="appointmentRef">
<CommonForm
:anchorList="anchorList"
:affixOffset="360"
:affixOffset="affixOffset"
:anchorOffset="10"
:scrollContainerSelector="anchorContainer"
:scrollOffset="10"
:domIndex="tabIndex"
:activeName="activeName"
v-if="appointmentRef"
......@@ -17,6 +16,35 @@
<el-row style="margin-bottom: 10px" v-if="father.showMoudle" :id="father.anchorKey">
<div class="formBox">
<CardOne :title="father.fatherTitle">
<template #mainTitCustom v-if="props.idsObj.appointmentBizId">
<div style="margin-left: 10px">
<el-button
@click="viewHistory"
type="primary"
link
v-if="father.key == 'administration'"
>历史记录</el-button
>
</div>
</template>
<template #headerRight v-if="father.key == 'administration'">
<div>
<el-button
v-if="idsObj.appointmentBizId"
@click="handleExprot"
type="primary"
link
>导出预约表</el-button
>
<el-button
v-if="appointmentStatus >= 2"
@click="getItineraryInfo"
type="primary"
link
>行程单预览</el-button
>
</div>
</template>
<template #content>
<!-- 不是表格 -->
<el-row :gutter="20" v-if="!father.showTable">
......@@ -84,6 +112,7 @@
:disabled="editStatus"
format="HH:mm"
value-format="HH:mm"
@change="timeValueChange(child)"
/>
</div>
<!-- 不带时分 -->
......@@ -110,13 +139,6 @@
@focus="handleFoucs(child)"
>
</el-input>
<el-button
class="formBtn"
v-if="child.domType === 'button'"
:type="child.buttonType"
@click="handleButtonClick(child)"
>{{ child.buttonTxt }}</el-button
>
<el-select
v-model="form[child.key]"
......@@ -184,6 +206,7 @@
:remote-method="query => searchSelectList(query, 'realName')"
:loading="searchLoadingStates['realName']"
:disabled="editStatus"
@change="handleTableSelectChange(father, scope.row, 'realName')"
>
<el-option
v-for="item in searchOptions['realName'] || []"
......@@ -245,6 +268,7 @@
:remote-method="query => searchSelectList(query, 'name')"
:loading="searchLoadingStates['name']"
:disabled="editStatus"
@change="handleTableSelectChange(father, scope.row, 'name')"
>
<el-option
v-for="item in searchOptions['name'] || []"
......@@ -340,6 +364,101 @@
</template>
</CommonForm>
</div>
<!-- 历史签约记录 -->
<CommonDialog
dialogTitle="历史记录"
:showConfirm="false"
cancleText="关闭"
dialogWidth="70%"
:openDialog="openList"
:showClose="true"
@close="openList = false"
>
<div class="dialogBox">
<CommonPage
:showSearchForm="false"
:show-pagination="true"
:currentPage="queryParams.pageNo"
:total="total"
:pageSize="queryParams.pageSize"
@current-change="changePageNo"
@size-change="changePageSize"
:showOperationBtn="false"
>
<template #table>
<el-table v-loading="tableLoading" :data="tableData" border>
<el-table-column label="创建人" align="center" prop="creatorName" />
<!-- <el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="fetchDictData('sys_gender')" :value="scope.row.gender" />
</template>
</el-table-column> -->
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{
scope.row.createTime ? formatToDateTime(scope.row.createTime) : '--'
}}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
width="100"
class-name="small-padding fixed-width"
fixed="right"
>
<template #default="scope">
<el-button link type="primary" @click="viewDetail(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
</template>
</CommonPage>
</div>
</CommonDialog>
<!-- 签约详情 -->
<CommonDialog
:dialogTitle="detailTitle"
:showConfirm="false"
cancleText="关闭"
dialogWidth="70%"
:openDialog="showDetail"
:showClose="true"
@close="showDetail = false"
>
<el-scrollbar max-height="600px">
<div class="dialogBox">
<AppointmentDetail :detailInfo="detailInfo" :editSatus="true"></AppointmentDetail>
</div>
</el-scrollbar>
</CommonDialog>
<!-- 行程单详情 -->
<CommonDialog
dialogTitle="香港行程安排"
confirmText="下载行程单"
dialogWidth="70%"
:openDialog="showItinerary"
@confirm="handleExprotPdf"
@close="showItinerary = false"
:showClose="true"
:showCancle="false"
:confirmLoading="exportLoading"
>
<div class="itineraryDialogBox">
<div class="dialogItem" v-for="item in itineraryData">
<div class="dialogItemTitle">{{ item.title }}</div>
<DetailPanel
:data="item.data"
:row-span="24"
col-gap="10px"
label-width="120px"
row-height="45px"
:show-col-border="true"
/>
</div>
</div>
</CommonDialog>
<Phone
@close="handleCloseDrawer"
:showDrawer="showPhoneDrawer"
......@@ -364,18 +483,27 @@
</div>
</template>
<script setup name="appointmentInfo">
import CommonPage from '@/components/commonPage'
import dayjs from 'dayjs'
import { ArrowRight } from '@element-plus/icons-vue'
import appointmentDomData from '@/formJson/appointmentInfo'
import Country from '@/views/components/country'
import Phone from '@/views/components/phone'
import Address from '@/views/components/address'
import DetailPanel from '@/components/DetailPanel'
import { watch, nextTick } from 'vue'
import { editAppointmentInfo, newPolicy } from '@/api/sign/appointment'
import {
getAppointmentlog,
getAppointmentlogDetail,
getItineraryExprot,
getItineraryDetail,
getAppointmentExprot
} from '@/api/sign/appointment'
import { getBankList, getAllSignList, getUserSaleExpandList } from '@/api/common'
import CommonForm from '@/views/components/commonForm'
import CommonDialog from '@/components/commonDialog'
import CardOne from '@/components/formCard/cardOne'
import AppointmentDetail from './appointmentDetail'
import useDictStore from '@/store/modules/dict'
const dictStore = useDictStore() //获取字典数据
......@@ -385,13 +513,15 @@ const props = defineProps({
formStatus: { type: String, default: '' }, //父组件状态,新增、修改
idsObj: { type: Object, default: () => ({}) }, //父组件传递过来的id对象
apiAppointmentInfoDto: { type: Object, default: () => ({}) }, //父组件传递过来的签约信息的详情
appointmentStatus: { type: Number }, //父组件传递过来的预约状态
appointmentStatus: { type: Number }, //父组件传递过来的预约状态
customerBizId: { type: String, default: '' }, //提交状态,新增、修改
fatherTabName: { type: String, default: '' }, //一级tab名称
anchorContainer: { type: String, default: '' }, //锚点滚动容器
editStatus: { type: Boolean, default: true }, //编辑状态
tabIndex: { type: [String, Number], default: '' } //tab索引
tabIndex: { type: [String, Number], default: '' }, //tab索引
affixOffset: { type: Number, default: 360 } //tab索引
})
const emit = defineEmits(['handleSuccessEdit'])
const { proxy } = getCurrentInstance()
const appointmentRef = ref(null)
......@@ -401,11 +531,19 @@ const showCountryDrawer = ref(false) //国家/地区抽屉开关
const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输入值
const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
const errorFields = ref([]) // 存储校验失败的字段信息
const openList = ref(false) // 客户列表弹窗
const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作
const consultKey = ref({})
const openAccountKey = ref({})
const openList = ref(false) //历史签约记录弹窗开关
const showDetail = ref(false) //签约详情弹窗开关
const detailTitle = ref('') //签约详情弹窗title
const detailInfo = ref({}) //签约详情信息
const tableData = ref([])
const tableLoading = ref([])
const itineraryData = ref([]) //行程单数据
const appointmentSummeryInfo = ref({}) //行程单数据
const exportLoading = ref(false) //下载行程单loading
const showItinerary = ref(false) //下载行程单loading
// 地址组件菜单数据
const addressMenuList = ref([
{
......@@ -466,6 +604,7 @@ const deleteKeyList = ref([
]) // 存储需要删除的key
const searchOptions = ref({}) // 存储不同key对应的选项
const searchLoadingStates = ref({}) // 存储不同key对应的加载状态
const total = ref(0)
const data = reactive({
form: {},
processedAppointmentData: [], // 处理后的表单数据
......@@ -473,11 +612,223 @@ const data = reactive({
rules: {}, //表单验证规则,
queryParams: {
pageNo: 1,
pageSize: 4,
name: undefined
pageSize: 10
}
})
const { form, rules, processedAppointmentData, queryParams, oldAppointmentData } = toRefs(data)
// 获取预约行程单详情
function getItineraryInfo() {
getItineraryDetail(props.idsObj.appointmentBizId).then(res => {
if (res.code == 200) {
appointmentSummeryInfo.value = res.data
fetchDictData('csf_ap_meeting_point').forEach(item => {
if (item.value == appointmentSummeryInfo.value.meetingPoint) {
appointmentSummeryInfo.value.meetingPoint = item.label
}
})
if (appointmentSummeryInfo.value.total) {
appointmentSummeryInfo.value.total = Number(appointmentSummeryInfo.value.total).toFixed(2)
}
itineraryData.value = [
{
title: '集合信息',
data: [
// 第一行:2列布局(各占12)
{
label: '集合时间',
value: appointmentSummeryInfo.value.arrivalTime,
span: 12 // 占12/24
},
{
label: '集合地点',
value: appointmentSummeryInfo.value.meetingPoint,
span: 12 // 占12/24
},
{
label: '意向地点',
value: appointmentSummeryInfo.value.signingAddress,
span: 12 // 占12/24
}
]
},
{
title: '业务代表',
data: [
// 第一行:2列布局(各占12)
{
label: '业务代表',
value: appointmentSummeryInfo.value.businessRepresentName1,
span: 12 // 占12/24
},
{
label: '联系电话',
value: appointmentSummeryInfo.value.businessRepresentMobile1
? appointmentSummeryInfo.value.businessRepresentMobile1Code +
appointmentSummeryInfo.value.businessRepresentMobile1
: '-',
span: 12 // 占12/24
}
]
},
{
title: '咨询内容',
data: [
// 第一行:2列布局(各占12)
{
label: '咨询人',
value: appointmentSummeryInfo.value.name,
span: 12 // 占12/24
},
{
label: '意向缴费年期',
value: appointmentSummeryInfo.value.paymentTerm,
span: 12 // 占12/24
},
{
label: '保单征费',
value: appointmentSummeryInfo.value.policyFee || '-',
span: 12 // 占12/24
},
{
label: '首期保费',
value: appointmentSummeryInfo.value.eachIssuePremium || '-',
span: 12 // 占12/24
},
{
label: '币种',
value: appointmentSummeryInfo.value.currency,
span: 12 // 占12/24
},
{
label: '意向咨询产品',
value: appointmentSummeryInfo.value.productName,
span: 12 // 占12/24
},
{
label: '首期合计金额',
value: appointmentSummeryInfo.value.total,
span: 12 // 占12/24
}
]
}
]
showItinerary.value = true
}
})
}
// 导出行程单Pdf
const handleExprotPdf = () => {
exportLoading.value = true
getItineraryExprot(appointmentSummeryInfo.value.appointmentBizId).then(res => {
if (res.code == 200) {
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = res.data
link.target = '_blank' // 新窗口打开
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = `香港行程安排.pdf`
link.download = fileName
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
exportLoading.value = false
showItinerary.value = false
} else {
proxy.$message.error('行程单下载失败')
exportLoading.value = false
}
})
}
//导出预约表
const handleExprot = async row => {
try {
const res = await getAppointmentExprot(props.idsObj.appointmentBizId)
if (res.code == 200) {
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = res.data.url
// link.target = '_blank' // 新窗口打开
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = '预约导出.xlsx'
link.download = fileName
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
proxy.$message.success('导出成功')
}
} catch (error) {
console.error('导出失败:', error)
}
}
const changePageNo = val => {
queryParams.value.pageNo = val
// getList()
}
const changePageSize = val => {
queryParams.value.pageSize = val
// getList()
}
const timeValueChange = child => {
if (form.value[child.key]) {
child.finishTime = `${form.value[child.key]} ${child.timeValue}:00`
} else if (!form.value[child.key]) {
proxy.$message.warning(`请先选择${child.label}日期`)
child.timeValue = ''
}
}
// 签约详情
const viewDetail = row => {
try {
getAppointmentlogDetail(row.appointmentLogBizId).then(response => {
detailInfo.value = response.data
detailTitle.value = `${row.creatorName}签约详情`
showDetail.value = true
})
} catch (error) {
detailTitle.value = ''
detailInfo.value = {}
showDetail.value = false
}
}
// 签约历史记录
const viewHistory = () => {
try {
getAppointmentlog(queryParams.value).then(response => {
tableData.value = response.data.records
total.value = response.data.total
tableLoading.value = false
openList.value = true
})
} catch (error) {
tableData.value = []
} finally {
tableLoading.value = false
}
}
const handleTableSelectChange = (father, row, key) => {
searchOptions.value[key].forEach(item => {
if (row[key] == item.value) {
row[key] = item.label
row.userBizId = item.userBizId
if (key == 'name') {
row.userSignBizId = item.value
} else if (key == 'realName') {
row.userSaleBizId = item.value
}
}
})
}
// 添加表单子级dom
const addChildren = father => {
const processedData = JSON.parse(JSON.stringify(processedAppointmentData.value))
......@@ -513,7 +864,7 @@ const addChildren = father => {
processedAppointmentData.value = processedData
}
const deleteChildren = (father, childIndex) => {
if (props.editStatus.value) {
if (props.editStatus) {
proxy.$modal.confirm(`请先点击编辑再进行删除操作`, { showCancel: '0', title: '填写提示' })
return
}
......@@ -602,7 +953,7 @@ const disabledDate = (time, child) => {
const inputDate = dayjs(time)
switch (child.key) {
case 'intentionAppointmentTime':
case 'signDate':
// 默认禁用今天及今天之前
return inputDate.isBefore(today, 'day') || inputDate.isSame(today, 'day')
break
......@@ -631,21 +982,6 @@ const disabledDate = (time, child) => {
break
}
}
const handleButtonClick = child => {
if (child.key == 'newPolicyButton') {
let obj = {
appointmentBizId: props.idsObj.appointmentBizId,
confirmAppointmentTime: form.value.confirmAppointmentTime
}
newPolicy(obj).then(response => {
if (response.code == 200) {
proxy.$modal.msgSuccess('新单已生成')
emit('handleSuccessEdit')
}
})
}
}
const handleDateClear = child => {
if (child.key == 'openAccountStartTime' && !form.value['openAccountStartTime']) {
form.value['openAccountEndTime'] = ''
......@@ -663,7 +999,16 @@ const handleDateChange = child => {
resetShow({ type: 'child', key: 'openAccountEndTime', status: false, flag: 'disabled' })
disabledDate(form.value['openAccountStartTime'], { key: 'openAccountEndTime' })
}
// 拼接日期与时分
if (child.key == 'arrivalTime' && child.finishTime && child.finishTime.split(' ').length == 2) {
child.finishTime = `${form.value[child.key]} ${child.timeValue}:00`
} else if (
child.key == 'departureTime' &&
child.finishTime &&
child.finishTime.split(' ').length == 2
) {
child.finishTime = `${form.value[child.key]} ${child.timeValue}:00`
}
// 离港时间在到港时间之前
if (
child.key == 'arrivalTime' &&
......@@ -723,6 +1068,11 @@ const processFormData = async () => {
const processedData = JSON.parse(JSON.stringify(appointmentDomData))
for (const section of processedData) {
if (section.keyType == 'Array') {
//给表格类型里的下拉框options赋值,否则提交的时候会报错
searchOptions.value['realName'] = dictStore.userSaleExpandList
searchOptions.value['name'] = dictStore.userSaleExpandList
}
if (section.data) {
for (const field of section.data) {
if (section.key == 'openAccount') {
......@@ -738,9 +1088,7 @@ const processFormData = async () => {
if (field.key == 'bankName') {
searchOptions.value[field.key] = dictStore.bankList
}
if (field.key == 'realName') {
searchOptions.value[field.key] = dictStore.userSaleExpandList
}
if (field.required) {
if (field.key === 'firstNamePinyin') {
rules.value[field.key] = [
......@@ -756,10 +1104,16 @@ const processFormData = async () => {
}
}
}
console.log('searchOptions.value', searchOptions.value)
// 编辑状态下回显值
if (props.idsObj.appointmentBizId) {
// editStatus.value = true
setFormValue(props.apiAppointmentInfoDto, processedData)
return
} else if (showDetail.value) {
// 回显历史签约详情
setFormValue(detailData.value, processedData)
return
} else {
// 新增给默认值
form.value['isReferrerAccompany'] = form.value['isOpenAccount'] = form.value['isUseCar'] = 0
......@@ -912,7 +1266,7 @@ const handleSelectChange = (father, child) => {
break
case 'isOpenAccount':
// 选择吸烟,展示吸烟数量
// 根据是否开户,展示开户信息
if (form.value[child.key] == '1') {
resetShow({ type: 'father', key: 'openAccount', status: true })
} else {
......@@ -920,14 +1274,20 @@ const handleSelectChange = (father, child) => {
}
break
case 'bankName':
// 选择吸烟,展示吸烟数量
if (form.value[child.key]) {
searchOptions.value[child.key].forEach(item => {
if (item.value == form.value[child.key]) {
form.value[child.key] = item.label
form.value['bankId'] = item.value
}
})
if (
searchOptions.value[child.key].findIndex(item => item.value == form.value[child.key]) !==
searchOptions.value[child.key].findIndex(item => item.value == form.value['bankId']) !==
-1
) {
searchOptions.value[child.key].forEach(item => {
if (item.value == form.value[child.key]) {
if (item.value == form.value['bankId']) {
form.value['materials'] = item.materials
}
})
......@@ -955,11 +1315,7 @@ const handleEditStatus = status => {
} else {
if (!form.value['openAccountStartTime'] && field.key == 'openAccountEndTime') {
field.disabled = true
}
// else if (!form.value['arrivalTime'] && field.key == 'departureTime') {
// field.disabled = true
// }
else {
} else {
field.disabled = false
}
}
......@@ -979,29 +1335,24 @@ const setFormValue = (obj, formData) => {
// 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(formData))
for (const section of processedData) {
if (obj.isOpenAccount === 1 && section.key == 'openAccount') {
if (obj.isOpenAccount == 1 && section.key == 'openAccount') {
section.showMoudle = true
}
if (obj.isAccompany === 1 && section.key == 'consult') {
if (obj.isReferrerAccompany == 1 && section.key == 'referrerDtoList') {
section.showMoudle = true
}
// 给表单表格赋值
for (const objKey in obj) {
if (objKey == section.key && section.keyType == 'Array' && obj[section.key].length > 0) {
section.data = obj[section.key]
}
}
if (section.data) {
for (const field of section.data) {
if (field.key == 'confirmAppointmentTime' && props.appointmentStatus !== 0) {
field.show = true
}
if (obj.confirmAppointmentTime && field.key == 'newPolicyButton') {
field.show = true
}
if (props.apiAppointmentInfoDto.appointmentBizId) {
field.disabled = true
} else {
field.disabled = false
}
// if (field.key == 'bankName') {
// searchOptions.value[field.key] = fetchDictData(field.dictType)
// }
// 处理时间
if (field.key == 'openAccountEndTime' && obj[field.key]) {
// 开始时间是否在结束时间之前
......@@ -1010,16 +1361,28 @@ const setFormValue = (obj, formData) => {
!dayjs(obj['openAccountStartTime']).isBefore(dayjs(obj[field.key]))
) {
form.value[field.key] = ''
field.disabled = true
}
}
if (field.key == 'departureTime' && obj[field.key]) {
if (obj[field.key].split(' ').length > 1) {
form.value[field.key] = obj[field.key].split(' ')[0]
field.timeValue = obj[field.key].split(' ')[1]
}
field.finishTime = obj[field.key]
// 开始时间是否在结束时间之前
if (obj['arrivalTime'] && !dayjs(obj['arrivalTime']).isBefore(dayjs(obj[field.key]))) {
form.value[field.key] = ''
// field.disabled = true
}
}
// 给到港时间的时分赋值
if (field.key == 'arrivalTime') {
if (obj[field.key] && obj[field.key].split(' ').length > 1) {
form.value[field.key] = obj[field.key].split(' ')[0]
field.timeValue = obj[field.key].split(' ')[1]
}
field.finishTime = obj[field.key]
}
//要判断drawerType,因为抽屉要回显数据
switch (field.drawerType) {
case 'phone':
......@@ -1114,6 +1477,7 @@ const setFormValue = (obj, formData) => {
addressQuickList.value = removeDuplicates(tempAddressList, 'addressString')
processedAppointmentData.value = oldAppointmentData.value = processedData
oldObjInfo.value = JSON.parse(JSON.stringify(form.value))
console.log('form.value', form.value)
}
// 数组去重
function removeDuplicates(arr, key) {
......@@ -1136,7 +1500,7 @@ const getInvalidFields = fields => {
if (fields[field] && fields[field].length > 0) {
errors.push({
field: field,
message: fields[field][0].message
message: `签约信息模块-${fields[field][0].message}`
})
}
}
......@@ -1191,14 +1555,6 @@ const handleFormValues = () => {
}
}
}
if (submitObj['bankName']) {
searchOptions.value['bankName'].forEach(item => {
if (submitObj['bankName'] == item.bankBizId) {
submitObj['bankName'] = item.bankName
}
})
}
let obj = {
realName: '转介人姓名',
phone: '转介人手机',
......@@ -1212,14 +1568,7 @@ const handleFormValues = () => {
processedAppointmentData.value.forEach(item => {
if (item.key == 'referrerDtoList') {
if (form.value['isReferrerAccompany'] == 1 && item.data.length > 0) {
submitObj['referrerDtoList'] = item.data.map((item1, index) => {
if (item1.realName) {
searchOptions.value['realName'].forEach(item2 => {
if (item1.realName == item2.userSaleBizId) {
item1.realName = item2.realName
}
})
}
item.data.forEach((item1, index) => {
for (const key in item1) {
if (!item1[key]) {
errorFields.value.push({
......@@ -1227,12 +1576,8 @@ const handleFormValues = () => {
})
}
}
return {
realName: item1.realName,
phone: item1.phone,
email: item1.email
}
})
submitObj['referrerDtoList'] = item.data
} else if (form.value['isReferrerAccompany'] == 1 && item.data.length == 0) {
errorFields.value.push({
message: '签约信息模块--转介人陪同时,陪同转介人信息不能为空!!'
......@@ -1242,23 +1587,12 @@ const handleFormValues = () => {
if (item.key == 'position') {
item.data.forEach((item1, index) => {
if (item1.compositionTime) {
if (item1.timeValue) {
submitObj[item1.key] = form.value[item1.key] + ' ' + item1.timeValue + ':00'
} else {
submitObj[item1.key] = form.value[item1.key] + ' 00:00:00'
}
submitObj[item1.key] = item1.finishTime
}
})
}
if (item.key == 'userSignDtoList' && item.data.length > 0) {
submitObj['userSignDtoList'] = item.data.map((item1, index) => {
if (item1.name) {
searchOptions.value['name'].forEach(item2 => {
if (item1.name == item2.userSignBizId) {
item1.name = item2.realName
}
})
}
item.data.forEach((item1, index) => {
for (const key in item1) {
if (!item1[key]) {
errorFields.value.push({
......@@ -1266,17 +1600,13 @@ const handleFormValues = () => {
})
}
}
return {
name: item1.name,
phone: item1.phone,
email: item1.email,
practiceCode: item1.practiceCode,
cardType: item1.cardType,
cardNo: item1.cardNo
}
})
submitObj['userSignDtoList'] = item.data
}
})
if (submitObj['signDate']) {
submitObj['signDate'] = proxy.formatToDateTime(submitObj['signDate'])
}
console.log('submitObj', submitObj)
if (submitObj['departureTime']) {
// 开始时间是否在结束时间之前
......@@ -1314,13 +1644,34 @@ const anchorList = computed(() => {
}
return data
})
// 关闭弹窗时清空弹窗历史签约表格
watch(openList, newVal => {
if (!newVal) {
tableData.value = []
}
})
// 关闭弹窗时清空行程单数据
watch(showItinerary, newVal => {
if (!newVal) {
appointmentSummeryInfo.value = {}
itineraryData.value = []
}
})
// 关闭详情弹窗时清空
watch(showDetail, newVal => {
if (!newVal) {
detailTitle.value = ''
detailInfo.value = {}
}
})
watch(
() => props.activeName,
newVal => {
appointmentRef.value = null
if (newVal === 'appointmentInfo') {
openList.value = false
processFormData()
showDetail.value = false
openList.value = false
}
}
)
......@@ -1338,7 +1689,6 @@ watch(
() => props.formStatus,
newVal => {
if (newVal === 'appointmentEdit') {
openList.value = false
processFormData()
}
}
......@@ -1485,6 +1835,16 @@ defineExpose({
width: 100%;
box-sizing: border-box;
}
.itineraryDialogBox {
.dialogItem {
.dialogItemTitle {
font-size: 16px;
font-weight: 500;
margin: 10px 0;
color: #333;
}
}
}
@media only screen and (min-width: 768px) {
.formBtn {
margin-top: 0 !important;
......
......@@ -121,6 +121,7 @@
<el-button
type="primary"
size="small"
:disabled="props.editStatus"
@click="updateChildren(father, scope.row)"
>
修改
......@@ -128,6 +129,7 @@
<el-button
type="danger"
size="small"
:disabled="props.editStatus"
@click="deleteChildren(father, scope.$index)"
>
删除
......@@ -262,7 +264,7 @@ const props = defineProps({
fearthStatus: { type: String, default: '' }, //父组件状态,新增、修改
formStatus: { type: String, default: '' }, //父组件状态,新增、修改
idsObj: { type: Object, default: () => ({}) }, //父组件传递过来的id对象
apiBeneficiaryInfoDtoList: { type: Object, default: () => ({}) }, //父组件传递过来的预约信息的详情
apiBeneficiaryInfoFzDto: { type: Object, default: () => ({}) }, //父组件传递过来的预约信息的详情
appointmentStatus: { type: Number }, //父组件传递过来的预约的状态
customerInfo: { type: Object, default: () => ({}) }, //客户详情回显表单用
showSubmitBtn: { type: Boolean, default: false }, //父组件状态,新增、修改
......@@ -270,6 +272,7 @@ const props = defineProps({
fatherTabName: { type: String, default: '' }, //一级tab名称
anchorContainer: { type: String, default: '' }, //锚点滚动容器
editStatus: { type: Boolean, default: true }, //编辑状态
affixOffset: { type: Number },
tabIndex: { type: [String, Number], default: '' } //tab索引
})
const emit = defineEmits(['handleSuccessEdit', 'policyEditSuccess'])
......@@ -499,9 +502,6 @@ const getRules = child => {
return rules
}
const disabledDate = time => {
return time.getTime() > Date.now()
}
const customerList = () => {
console.log('触发了')
......@@ -593,10 +593,11 @@ const processFormData = async obj => {
} else {
processedBeneficiaryData.value = oldAppointmentData.value = processedData
}
// if (props.showSubmitBtn) {
// } else {
// processedBeneficiaryData.value = oldAppointmentData.value = processedData
// }
if (props.idsObj.appointmentBizId) {
setFormValue(processedData)
} else {
processedBeneficiaryData.value = oldAppointmentData.value = processedData
}
}
//弹出右侧抽屉
......@@ -816,140 +817,51 @@ function removeDuplicates(arr, key) {
return result
}
// 修改状态下,处理表单数据
const setFormValue = () => {
const setFormValue = processedData => {
personalObj.value = {}
companyObj.value = {}
processedBeneficiaryData.value = []
let quickMobile = []
let qucikAddress = []
// 深拷贝原始数据
const oldDom = JSON.parse(JSON.stringify(beneficiaryDomData))
// 先收集key,区分个人和企业
for (const item of oldDom) {
if (props.apiBeneficiaryInfoDtoList.length == 0) {
form.value.apiBeneficiaryInfoDtoList.push({ id: item.id })
}
if (item.children) {
for (const section of item.children) {
if (section.data) {
for (const field of section.data) {
if (section.key == 'customer' || section.key == 'other') {
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)
}
if (props.showSubmitBtn) {
field.disabled = true
}
}
}
const oldDom = JSON.parse(JSON.stringify(processedData))
let obj = JSON.parse(JSON.stringify(props.apiBeneficiaryInfoFzDto))
for (const section of oldDom) {
for (const key in obj) {
if (section.keyType == 'Object') {
form.value[key] = obj[key]
}
}
}
let newInfoList = JSON.parse(JSON.stringify(props.apiBeneficiaryInfoDtoList))
// 详情中有数据,dom应该根据详情中的数据来渲染
if (newInfoList.length > 0) {
let newDOM1 = JSON.parse(JSON.stringify(oldDom))
newInfoList.forEach((info, index) => {
newDOM1 = JSON.parse(JSON.stringify(oldDom))
for (const item of newDOM1) {
if (item.children) {
for (const section of item.children) {
// 根据选择得客户类型和与受保人关系,展示对应的模块
if (
(info.customerType == 'COMPANY' || info.customerType == 'INDIVIDUAL') &&
info.insurantRel &&
info.insurantRel == 'MYSELF' &&
section.key == 'customer'
) {
section.showMoudle = true
} else if (
info.customerType == 'COMPANY' &&
info.insurantRel &&
info.insurantRel !== 'MYSELF'
) {
if (section.key == 'person') {
section.showMoudle = false
} else {
section.showMoudle = true
}
} else if (
info.customerType == 'INDIVIDUAL' &&
info.insurantRel &&
info.insurantRel !== 'MYSELF'
) {
if (section.key == 'company') {
section.showMoudle = false
} else {
section.showMoudle = true
}
} else if (
(info.customerType == 'COMPANY' || info.customerType == 'INDIVIDUAL') &&
info.insurantRel &&
info.insurantRel == 'MYSELF' &&
section.key !== 'customer'
) {
section.showMoudle = false
if (section.keyType == 'Array' && key == section.key && obj[key].length > 0) {
if (section.formItem) {
for (const child of section.formItem) {
if (child.domType == 'Select') {
obj[key].forEach((item1, index) => {
if (section.key == 'apiBeneficiaryInfoDtoList' && item1.birthday) {
item1.birthday = proxy.formatToDate(item1.birthday)
}
fetchDictData(child.dictType).forEach(item2 => {
if (item1[child.key] == item2.value) {
item1[child.key + 'Name'] = item2.label
}
})
})
}
}
}
}
let phone = JSON.parse(JSON.stringify(info))
if (info.authMobile) {
quickMobile.push({
code: phone.authMobileCode,
mobile: phone.authMobile,
phoneString: `${phone.authMobileCode} ${phone.authMobile}`
})
info.authMobile = `${info.authMobileCode} ${info.authMobile}`
}
if (info.companyMobile) {
quickMobile.push({
code: phone.companyMobileCode,
mobile: phone.companyMobile,
phoneString: `${phone.companyMobileCode} ${phone.companyMobile}`
})
info.companyMobile = `${info.companyMobileCode} ${info.companyMobile}`
}
if (info.addressList && info.addressList.length > 0) {
info.addressList.forEach(address => {
if (address.type == 'companyEnterAddress') {
info.companyEnterAddress = `${address.region} ${address.city} ${address.street} ${address.location}`
}
if (address.type == 'txAddress') {
info.txAddress = `${address.region} ${address.city} ${address.street} ${address.location}`
section.data = obj[key]
if (section.key == 'apiBeneficiaryInfoDtoList') {
if (obj['isLegalBeneficiary'] == '0') {
section.showMoudle = true
} else {
section.data = []
section.showMoudle = false
}
qucikAddress.push({
...address,
id: info.id,
drawerType: 'address',
addressString: `${address.region} ${address.city} ${address.street} ${address.location}`
})
})
}
}
processedBeneficiaryData.value.push({
...newDOM1[0],
id: info.id,
beneficiaryBizId: info.beneficiaryBizId
})
})
form.value.apiBeneficiaryInfoDtoList = newInfoList
phoneQuickList.value = removeDuplicates(quickMobile, 'phoneString')
phoneOraddressKey.value = qucikAddress
addressQuickList.value = removeDuplicates(qucikAddress, 'addressString')
} else {
processedBeneficiaryData.value.push(oldDom[0]) // 详情中没有数据 ,dom应该根据默认数据来渲染
}
}
processedBeneficiaryData.value = oldDom
}
// 获取校验失败的字段信息
const getInvalidFields = fields => {
......@@ -958,7 +870,7 @@ const getInvalidFields = fields => {
if (fields[field] && fields[field].length > 0) {
errors.push({
field: field,
message: fields[field][0].message
message: `受益人模块-${fields[field][0].message}`
})
}
}
......@@ -968,33 +880,48 @@ const getInvalidFields = fields => {
// 处理表单填写得数据
const handleFormValues = () => {
return new Promise(async resolve => {
let submitObj = { ...form.value }
// 因为投保人没有policyholderRel的校验会影响 受保人,所以暂时先赋值处理
if (processedBeneficiaryData.value.length > 0) {
let submitObj = { ...form.value }
// 因为投保人没有policyholderRel的校验会影响 受保人,所以暂时先赋值处理
proxy.$refs['beneficiaryInfoFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
//处理表单数据
processedBeneficiaryData.value.forEach(item => {
if (item.keyType == 'Array') {
submitObj[item.key] = item.data
proxy.$refs['beneficiaryInfoFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
//处理表单数据
processedBeneficiaryData.value.forEach(item => {
if (item.keyType == 'Array') {
submitObj[item.key] = JSON.parse(JSON.stringify(item.data))
submitObj[item.key].forEach((item1, index) => {
if (item1['birthday']) {
item1['birthday'] = proxy.formatToDateTime(item1['birthday'])
}
})
}
})
if (submitObj['isLegalBeneficiary'] == '1') {
delete submitObj['apiBeneficiaryInfoDtoList']
}
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
return undefined
}
})
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)
}
resolve(errorFields.value.length == 0 ? submitObj : null)
})
} else {
if (props.idsObj.appointmentBizId) {
resolve(props.apiBeneficiaryInfoFzDto)
} else {
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
}
resolve(undefined)
}
})
}
})
}
......@@ -1027,15 +954,16 @@ watch(
if (newVal === 'beneficiary') {
openList.value = false
if (props.showSubmitBtn) {
setFormValue()
} else {
// 新增状态
processFormData({
domdata: beneficiaryDomData,
exportValue: null
})
}
processFormData({
domdata: beneficiaryDomData,
exportValue: null
})
// if (props.idsObj.appointmentBizId) {
// setFormValue()
// } else {
// // 新增状态
// }
}
}
)
......
<template>
<div class="uploadContainer">
<CardOne title="材料信息">
<template #headerRight>
<div>
<el-button @click="downloadFile" type="primary" :loading="downLoading"
>下载材料包</el-button
>
</div>
</template>
<template #content>
<el-table v-loading="loading" :data="fileTableList" boder>
<el-table-column label="序号" type="index" width="55" />
......@@ -23,8 +30,8 @@
v-if="fileTableList.length > 0 && fileTableList[0].relObjectMaterialBizId"
>
<template #default="scope">
<span v-if="scope.row.status === 1">已上传</span>
<span v-if="scope.row.status === 0" style="color: red">待上传</span>
<span v-if="scope.row.status === 'YSC'">已上传</span>
<span v-if="scope.row.status === 'WSC'" style="color: red">待上传</span>
</template>
</el-table-column>
<el-table-column
......@@ -35,17 +42,16 @@
fixed="right"
>
<template #default="scope">
<!-- <el-button type="primary" link @click="downloadFile(scope.row)">下载</el-button> -->
<el-button
type="primary"
link
@click="handleUploadFile(scope.row)"
v-if="scope.row.fileBizIdList.length == 0"
v-if="scope.row.status == 'WSC'"
>
上传
</el-button>
<el-button
v-if="props.pageSource !== 'policyList' && scope.row.fileBizIdList.length > 0"
v-if="props.pageSource !== 'policyList' && scope.row.status == 'YSC'"
type="primary"
link
@click="handleUpdate(scope.row)"
......@@ -135,7 +141,10 @@ import {
uploadMaterialList,
delUploadFile,
uploadRelObjectMaterialList,
uploadOssFileList
uploadOssFileList,
uploadOssFileSubmit,
downloadCompressedFile,
delMaterial
} from '@/api/common'
const props = defineProps({
activeName: { type: String, default: '' }, //tab名称
......@@ -156,7 +165,7 @@ const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + '/oss/api/oss/uploa
// 图片查看相关状态
const imageViewerVisible = ref(false)
const imageUrl = ref('')
const tempFileTableList = ref([])
const downLoading = ref(false)
const data = reactive({
form: {},
queryParams: {
......@@ -170,11 +179,35 @@ const uploadedFiles = ref([])
const currentUploadRow = ref([])
const handleSubmitUpload = () => {
if (uploadedFiles.value.length > 0) {
fileTableList.value.forEach(item => {
if (item.materialBizId == currentUploadRow.value.materialBizId) {
item.fileBizIdList = JSON.parse(JSON.stringify(uploadedFiles.value))
if (currentUploadRow.value.relObjectMaterialBizId) {
try {
uploadOssFileSubmit({
relObjectMaterialBizId: currentUploadRow.value.relObjectMaterialBizId,
fileBizIdList: uploadedFiles.value.map(item => item.fileBizId)
}).then(response => {
getFileList()
// fileTableList.value.forEach(item => {
// if (item.materialBizId == currentUploadRow.value.materialBizId) {
// item.status = 'YSC'
// }
// })
editVisible.value = false
})
} catch (error) {
console.log('error', error)
uploadedFiles.value = []
proxy.$message.error('文件修改失败')
}
})
} else {
fileTableList.value.forEach(item => {
if (item.materialBizId == currentUploadRow.value.materialBizId) {
item.fileBizIdList = JSON.parse(JSON.stringify(uploadedFiles.value))
item.status = 'YSC'
}
})
console.log('fileTableList.value', fileTableList.value)
}
}
editVisible.value = false
}
......@@ -212,15 +245,28 @@ const handleDetele = row => {
.confirm('是否确认删除此行数据?')
.then(function () {
if (row.relObjectMaterialBizId) {
console.log('远程删除')
return delMaterial(row.relObjectMaterialBizId)
} else {
fileTableList.value.splice(row.index, 1)
// 本地临时数据,直接从列表中移除
const index = fileTableList.value.findIndex(
item => item.materialBizId === row.materialBizId
)
if (index !== -1) {
fileTableList.value.splice(index, 1)
}
// 注意:这里不需要 return Promise,因为是同步操作
// 但为了统一 then 链,可以 return 一个成功标识
return { code: 200 } // 模拟成功
}
})
.then(res => {
if (res.code == 200) {
if (res && res.code == 200) {
proxy.$modal.msgSuccess('删除成功')
getFileList()
if (row.relObjectMaterialBizId) {
getFileList()
}
}
})
.catch(() => {})
......@@ -234,7 +280,7 @@ const handleUpdate = row => {
if (row.relObjectMaterialBizId) {
try {
uploadOssFileList({ objectBizId: row.relObjectMaterialBizId }).then(response => {
uploadedFiles.value = response.data
uploadedFiles.value = response.data || []
editVisible.value = true
})
} catch (error) {
......@@ -250,21 +296,65 @@ const handleView = row => {
imageUrl.value = row.fileUrl
imageViewerVisible.value = true
}
const downloadFile = row => {
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = row.fileUrl
link.target = '_blank' // 新窗口打开
// 下载材料包
const downloadFile = () => {
let apiMaterialDtoList = []
let params = {
objectName: '预约附件材料包', //对象名(包名)
objectBizId: '' //对象业务ID
}
if (!props.idsObj.appointmentBizId) {
if (fileTableList.value.filter(item => item.fileBizIdList.length > 0).length == 0) {
proxy.$modal.msgError('请先上传文件')
return
}
apiMaterialDtoList = fileTableList.value.map(item => {
return {
dataPerson: item.dataPerson, //资料人(字典)
dataType: item.dataType, //资料类型(字典)
fileUrlList: item.fileBizIdList.map(item2 => item2.url) //文件url
}
})
} else {
if (fileTableList.value.filter(item => item.fileUrlList.length > 0).length == 0) {
proxy.$modal.msgError('请先上传文件')
return
}
apiMaterialDtoList = fileTableList.value.map(item => {
return {
dataPerson: item.dataPerson, //资料人(字典)
dataType: item.dataType, //资料类型(字典)
fileUrlList: item.fileUrlList
}
})
}
params.apiMaterialDtoList = apiMaterialDtoList
try {
downLoading.value = true
downloadCompressedFile(params).then(response => {
downLoading.value = false
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = response.data.url
link.target = '_blank' // 新窗口打开
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = '预约材料包'
link.download = fileName
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = row.fileName
link.download = fileName
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
})
} catch (error) {
console.log('error', error)
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
proxy.$message.error('材料包下载失败')
} finally {
downLoading.value = false
}
}
// 上传前loading加载
......@@ -322,6 +412,7 @@ const getFileList = () => {
if (fileTableList.value.length > 0) {
fileTableList.value.forEach(item => {
item.fileBizIdList = []
item.status = 'WSC'
})
}
loading.value = false
......@@ -332,13 +423,10 @@ const getFileList = () => {
objectBizId: props.idsObj.appointmentBizId
}
uploadRelObjectMaterialList(obj).then(response => {
fileTableList.value = response.data
fileTableList.value = response.data.records
loading.value = false
})
}
if (tempFileTableList.value.length > 0) {
fileTableList.value = JSON.parse(JSON.stringify(tempFileTableList.value))
}
} catch (error) {
fileTableList.value = []
} finally {
......@@ -348,12 +436,10 @@ const getFileList = () => {
const handleFormValues = () => {
let submitData = []
fileTableList.value.forEach(item => {
if (item.fileBizIdList.length > 0) {
submitData.push({
materialBizId: item.materialBizId,
fileBizIdList: item.fileBizIdList.map(item => item.fileBizId)
})
}
submitData.push({
materialBizId: item.materialBizId,
fileBizIdList: item.fileBizIdList.map(item => item.fileBizId)
})
})
return submitData
}
......@@ -363,12 +449,15 @@ watch(editVisible, newVal => {
resetUploadedList()
}
})
const hasLoaded = ref(false) // 新增:是否已加载过数据
watch(
() => props.activeName,
newVal => {
tempFileTableList.value = JSON.parse(JSON.stringify(fileTableList.value))
if (newVal === 'accessories') {
getFileList()
if (!hasLoaded.value) {
getFileList()
hasLoaded.value = true
}
}
}
)
......
......@@ -373,7 +373,7 @@ const getInvalidFields = fields => {
if (fields[field] && fields[field].length > 0) {
errors.push({
field: field,
message: fields[field][0].message
message: `健康信息模块-${fields[field][0].message}`
})
}
}
......@@ -382,80 +382,86 @@ const getInvalidFields = fields => {
// 处理表单填写得数据
const handleFormValues = () => {
let submitObj = []
return new Promise(async resolve => {
proxy.$refs['heathFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
let submitObj = []
if (props.activeName == 'questionnaires') {
submitObj = JSON.parse(JSON.stringify(form.value))
console.log('1111', submitObj)
} else {
// submitObj = JSON.parse(JSON.stringify(tempSecondHolderForm.value))
// console.log('2222', submitObj)
}
if (questionnairesDom.value.length > 0) {
proxy.$refs['heathFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
let answerSessionsDtoList = []
// 处理表单数据
submitObj.forEach(level1 => {
level1.secondCategoryDtoList.forEach(level2 => {
// 修正:应该是 questionsDtoList 而不是 questionDtoList
if (level2.questionsDtoList && level2.questionsDtoList.length > 0) {
level2.questionsDtoList.forEach(level3 => {
// 检查是否有答案数据和附加问题
//
if (level3.answerSessionsDto) {
// 问题选择了是
if (
level3.answerSessionsDto.optionJsonDtoList &&
level3.answerSessionsDto.optionBizId &&
level3.answerSessionsDto.optionBizId == 'option_1002'
) {
level3.answerSessionsDto.optionJsonDtoList.forEach(level4 => {
level4.addQuestionsJsonDtoList = JSON.parse(
JSON.stringify(level3.addQuestionsDtoList)
)
})
}
answerSessionsDtoList.push({
questionBizId: level3.questionBizId,
...level3.answerSessionsDto
if (props.activeName == 'questionnaires') {
submitObj = JSON.parse(JSON.stringify(form.value))
} else {
submitObj = JSON.parse(JSON.stringify(tempSecondHolderForm.value))
}
let answerSessionsDtoList = []
if (submitObj.length > 0) {
// 处理表单数据
submitObj.forEach(level1 => {
level1.secondCategoryDtoList.forEach(level2 => {
// 修正:应该是 questionsDtoList 而不是 questionDtoList
if (level2.questionsDtoList && level2.questionsDtoList.length > 0) {
level2.questionsDtoList.forEach(level3 => {
// 检查是否有答案数据和附加问题
//
if (level3.answerSessionsDto) {
// 问题选择了是
if (
level3.answerSessionsDto.optionJsonDtoList &&
level3.answerSessionsDto.optionBizId &&
level3.answerSessionsDto.optionBizId == 'option_1002'
) {
level3.answerSessionsDto.optionJsonDtoList.forEach(level4 => {
level4.addQuestionsJsonDtoList = JSON.parse(
JSON.stringify(level3.addQuestionsDtoList)
)
})
}
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
}
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)
}
resolve(undefined)
}
}
})
})
} else {
resolve(undefined)
}
})
}
const getQuestionnairesInfo = () => {
loading.value = true
let id = ''
......@@ -566,6 +572,7 @@ const getQuestionnairesInfo = () => {
questionnairesDom.value = form.value = result
loading.value = false
console.log('questionnairesDom.value', questionnairesDom.value)
}
})
......@@ -579,6 +586,7 @@ const anchorList = computed(() => {
}
return data
})
const hasLoaded = ref(false) // 新增:是否已加载过数据
watch(
() => props.activeName,
newVal => {
......@@ -586,14 +594,10 @@ watch(
tempSecondHolderForm.value = { ...form.value }
if (newVal === 'questionnaires') {
if (
props.idsObj.appointmentBizId &&
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList')
) {
} else if (props.idsObj.policyBizId && props.pageSource == 'policyList') {
if (!hasLoaded.value) {
getQuestionnairesInfo()
hasLoaded.value = true
}
getQuestionnairesInfo()
console.log('foldInsurantInfo', props.foldInsurantInfo)
}
}
)
......@@ -603,7 +607,6 @@ defineExpose({
handleFormValues,
handleEditStatus,
questionLength: computed(() => {
return questionnairesDom.value.length
})
})
......
......@@ -995,7 +995,7 @@ const getInvalidFields = fields => {
if (fields[field] && fields[field].length > 0) {
errors.push({
field: field,
message: fields[field][0].message
message: `签约信息模块-${fields[field][0].message}`
})
}
}
......
......@@ -4,7 +4,7 @@
<div ref="productRef">
<CommonForm
:anchorList="anchorList"
:affixOffset="360"
:affixOffset="affixOffset"
:anchorOffset="10"
:scrollContainerSelector="anchorContainer"
:scrollOffset="10"
......@@ -87,7 +87,7 @@
:remote-method="query => searchSelectList(query, child.key)"
:loading="searchLoadingStates[child.key]"
:disabled="editStatus"
@change="handleSearchSelectChange(child.key)"
@change="handleSearchSelectChange(father, child.key)"
>
<el-option
v-for="item in searchOptions[child.key] || []"
......@@ -135,6 +135,7 @@
type="primary"
size="small"
@click="updateChildren(father, scope.row)"
:disabled="props.editStatus"
>
修改
</el-button>
......@@ -142,6 +143,7 @@
type="danger"
size="small"
@click="deleteChildren(father, scope.$index)"
:disabled="props.editStatus"
>
删除
</el-button>
......@@ -213,7 +215,7 @@
remote
reserve-keyword
placeholder="请输入关键词搜索"
@change="handleSearchSelectChange(child.key, dIndex)"
@change="handleSearchSelectChange('', child.key)"
:remote-method="query => searchSelectList(query, child.key)"
:loading="searchLoadingStates[child.key]"
>
......@@ -266,6 +268,7 @@ const props = defineProps({
idsObj: { type: Object, default: () => ({}) }, //父组件传递过来的id对象
apiProductPlanInfoDto: { type: Object, default: () => ({}) }, //父组件传递过来的预约信息的详情
appointmentStatus: { type: Number }, //父组件传递过来的预约的状态
affixOffset: { type: Number }, //父组件传递过来的预约的状态
fatherTabName: { type: String, default: '' }, //一级tab名称
anchorContainer: { type: String, default: '' }, //锚点滚动容器
editStatus: { type: Boolean, default: true }, //编辑状态
......@@ -287,7 +290,7 @@ const searchOptions = ref({}) // 存储不同key对应的选项
const searchLoadingStates = ref({}) // 存储不同key对应的加载状态
const additionalProductForm = ref([]) // 附加险的表单
const data = reactive({
form: {},
form: { apiProductPlanMainInfoDto: {}, apiProductPlanAdditionalInfoDtoList: [] },
tempForm: {}, //由于切换tab的时候,表单数据会重置,所以需要保存一份临时表单数据
processedProductData: [], // 处理后的表单数据
oldProductDomData: [], // 保存旧的表单Dom,便于撤销操作
......@@ -313,6 +316,31 @@ const updateChildren = (father, row) => {
dialogTitle.value = '修改附加计划'
dialogKey.value = 'apiProductPlanAdditionalInfoDtoList'
additionalProductForm.value = JSON.parse(JSON.stringify(father.formItem))
searchOptions.value['productLaunchName'] = dictStore.productAdditionalList
// 给弹窗里的供款年期赋值,否则下拉框没数据 有bug,有空再调试
// additionalProductForm.value.forEach(item => {
// searchOptions.value['productLaunchName'].forEach(item1 => {
// if (item1.value == dialogForm.value['productLaunchName']) {
// item1.apiAttributeSettingDtoList.forEach(item2 => {
// if (
// item2.attributeSettingBizId == 'attribute_setting_okpcuc8tlXRfVIAy' &&
// item.key == 'issueNumber'
// ) {
// if (item2.value) {
// item.options = item2.value
// .split(/[,,;;\s]+/)
// .map(item => item.trim())
// .filter(item => item !== '')
// .map(item => {
// return { label: item, value: item }
// })
// }
// }
// })
// }
// })
// })
}
dialogVisible.value = true
}
......@@ -369,31 +397,63 @@ const addChildren = father => {
dialogVisible.value = true
}
}
const handleSearchSelectChange = (key, index) => {
const handleSearchSelectChange = (father, key) => {
// 附加计划选择产品后,给供款期数下拉框赋值
if (key == 'productLaunchName') {
additionalProductForm.value.forEach(item => {
searchOptions.value['productLaunchName'].forEach(item1 => {
if (item1.value == dialogForm.value['productLaunchName']) {
item1.apiAttributeSettingDtoList.forEach(item2 => {
if (
item2.attributeSettingBizId == 'attribute_setting_okpcuc8tlXRfVIAy' &&
item.key == 'issueNumber'
) {
if (item2.value) {
item.options = item2.value
.split(/[,,;;\s]+/)
.map(item => item.trim())
.filter(item => item !== '')
.map(item => {
return { label: item, value: item }
})
dialogForm.value['productLaunchName'] = item1.label
dialogForm.value['productLaunchBizId'] = item1.value
}
item1.apiAttributeSettingDtoList.forEach(item2 => {
if (
item2.attributeSettingBizId == 'attribute_setting_okpcuc8tlXRfVIAy' &&
item.key == 'issueNumber'
) {
if (item2.value) {
item.options = item2.value
.split(/[,,;;\s]+/)
.map(item => item.trim())
.filter(item => item !== '')
.map(item => {
return { label: item, value: item }
})
if (item.options.length > 0) item.value = item.options[0].value
}
if (item.options.length > 0) dialogForm.value[item.key] = item.options[0].value
}
})
}
})
})
})
}
if (key == 'productLaunchMainName') {
father.data.forEach(item => {
searchOptions.value['productLaunchMainName'].forEach(item1 => {
if (item1.value == form.value[father.key][key]) {
form.value[father.key][key] = item1.label
form.value[father.key]['productLaunchBizId'] = item1.value
}
item1.apiAttributeSettingDtoList.forEach(item2 => {
if (
item2.attributeSettingBizId == 'attribute_setting_okpcuc8tlXRfVIAy' &&
item.key == 'issueNumber'
) {
if (item2.value) {
item.options = item2.value
.split(/[,,;;\s]+/)
.map(item => item.trim())
.filter(item => item !== '')
.map(item => {
return { label: item, value: item }
})
if (item.options.length > 0)
form.value[father.key]['issueNumber'] = item.options[0].value
}
console.log(item.options, item, '1111')
}
})
})
})
}
......@@ -405,6 +465,16 @@ const handleSearchSelectChange = (key, index) => {
} else {
resetShow('sumInsured', false)
}
form.value['apiProductPlanMainInfoDto']['insuranceTypeName'] = item.label
form.value['apiProductPlanMainInfoDto']['insuranceTypeId'] = item.value
}
})
}
if (key == 'companyName') {
dictStore.allInsuranceCompanyList.forEach(item => {
if (form.value[father.key][key] == item.value) {
form.value[father.key][key] = item.label
form.value[father.key].companyId = item.value
}
})
}
......@@ -438,7 +508,7 @@ const searchSelectList = async (query, fieldKey) => {
}
}
// 可以添加其他字段的处理,可以放其他的字段得请求,目前只有accountName,以后有了其他的在填充
else if (fieldKey === 'productLaunchName') {
else if (fieldKey === 'productLaunchName' || fieldKey === 'productLaunchMainName') {
const params = {
productName: query.trim(),
pageNo: 1,
......@@ -548,14 +618,15 @@ const processFormData = async () => {
}
})
}
if (section.data) {
for (const formKey in form.value) {
if (section.key == formKey) {
if (section.dataLength) {
for (let i = 1; i < section.dataLength; i++) {
section.data.push(JSON.parse(JSON.stringify(section.data[0])))
}
}
// if (section.dataLength) {
// for (let i = 1; i < section.dataLength; i++) {
// section.data.push(JSON.parse(JSON.stringify(section.data[0])))
// }
// }
for (const field of section.data) {
// 为下拉搜索框加options
if (field.domType == 'SearchSelect') {
......@@ -615,7 +686,7 @@ const processFormData = async () => {
}
// idsObj.appointmentBizId
// 证明是修改
if (props.showSubmitBtn) {
if (props.idsObj.appointmentBizId) {
//在流程和预约的时候要调用这个方法回显修改数据
setFormValue(props.apiProductPlanInfoDto, processedData)
} else {
......@@ -713,136 +784,6 @@ const setFormValue = (obj, formData) => {
}
}
// 2.根据最新的表单数据更新processedProductData的值,因为有些模块是多项的,所以表单数据要和dom对应上,防止dom有form表单里没有对应的数据会报错
let newChildren = {
//id: Date.now() + Math.floor(Math.random() * 1000), //唯一标识
span: 24, //栅格布局份数
childTitle: '附加险',
deleteBtn: true,
children: [
{
label: '产品名称',
key: 'addProductName',
domType: 'SearchSelect',
required: true,
maxLength: 30,
disabled: false,
placeholder: '请输入',
show: true,
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
labelPosition: 'top', //标签的位置
lg: 8 //栅格布局份数
},
{
label: '保额',
key: 'sumInsured',
domType: 'Input',
inputType: 'number',
required: true,
maxLength: 300,
disabled: false,
placeholder: '请输入',
show: true,
labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度
sm: 12, //栅格布局份数
lg: 8 //栅格布局份数
},
{
label: '保费',
key: 'premium',
domType: 'Input',
inputType: 'number',
required: true,
maxLength: 300,
disabled: false,
placeholder: '请输入',
show: true,
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',
options: fetchDictData('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 //栅格布局份数
}
]
}
// 深拷贝原始表单dom数据
const processedData = JSON.parse(JSON.stringify(formData))
for (const section of processedData) {
......@@ -862,28 +803,10 @@ const setFormValue = (obj, formData) => {
key == 'apiProductPlanAdditionalInfoDtoList' &&
newForm[section.key].length > 0
) {
for (let i = 0; i < newForm[section.key].length; i++) {
section.data.push(newChildren)
}
}
for (const field of section.data) {
if (key == 'apiProductPlanMainInfoDto') {
for (const key2 in newForm[key]) {
if (field.key == 'policyEffectiveDate' && newForm[key]['isBacktrack'] == '1') {
field.show = true
}
}
}
if (section.child == 'yes' && field.children && field.children.length > 0) {
for (const child of field.children) {
if (props.showSubmitBtn) {
child.disabled = true
} else {
child.disabled = false
}
}
}
newForm[section.key].forEach(item => {
item.productLaunchNameValue = item.productLaunchName
})
section.data = newForm[section.key]
}
}
}
......@@ -919,54 +842,46 @@ const isObject = value => {
return typeof value === 'object' && value !== null && !Array.isArray(value)
}
const handleSubmitForm = () => {
let submitObj = {}
if (props.activeName == 'productPlan') {
submitObj = JSON.parse(JSON.stringify(form.value))
} else {
submitObj = JSON.parse(JSON.stringify(tempForm.value))
}
let resDom = JSON.parse(JSON.stringify(processedProductData.value))
return new Promise(async resolve => {
proxy.$refs['productFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
resDom.forEach(section => {
if (section.keyType == 'Array' && section.data.length > 0) {
submitObj[section.key] = JSON.parse(JSON.stringify(section.data))
}
})
// 保险公司名称转换
dictStore.allInsuranceCompanyList.forEach(item => {
if (submitObj.apiProductPlanMainInfoDto.companyName == item.value) {
submitObj.apiProductPlanMainInfoDto.companyName = item.label
}
})
searchOptions.value['insuranceTypeName'].forEach(item => {
if (submitObj.apiProductPlanMainInfoDto.insuranceTypeName == item.value) {
submitObj.apiProductPlanMainInfoDto.insuranceTypeName = item.label
if (processedProductData.value.length > 0) {
proxy.$refs['productFormRef'].validate((valid, fields) => {
if (valid) {
errorFields.value = [] // 清空错误信息
let submitObj = {}
if (props.activeName == 'productPlan') {
submitObj = JSON.parse(JSON.stringify(form.value))
} else {
submitObj = JSON.parse(JSON.stringify(tempForm.value))
}
})
searchOptions.value['productLaunchName'].forEach(item => {
if (submitObj.apiProductPlanMainInfoDto.productLaunchName == item.value) {
submitObj.apiProductPlanMainInfoDto.productLaunchName = item.label
let resDom = JSON.parse(JSON.stringify(processedProductData.value))
resDom.forEach(section => {
if (section.keyType == 'Array' && section.data.length > 0) {
submitObj[section.key] = JSON.parse(JSON.stringify(section.data))
}
})
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
return undefined
}
})
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)
}
resolve(errorFields.value.length == 0 ? submitObj : null)
})
} else {
if (props.idsObj.appointmentBizId) {
resolve(props.apiProductPlanInfoDto)
} else {
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
}
resolve(undefined)
}
})
}
})
}
......
......@@ -48,6 +48,8 @@
v-if="child.domType === 'DatePicker'"
v-model="form[child.key]"
type="date"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD HH:mm:ss"
:placeholder="child.placeholder"
:disabled="editStatus"
/>
......@@ -240,6 +242,7 @@ const props = defineProps({
fatherTabName: { type: String, default: '' }, //一级tab名称
anchorContainer: { type: String, default: '' }, //锚点滚动容器
editStatus: { type: Boolean, default: false }, //编辑状态
affixOffset: { type: Number },
tabIndex: { type: [String, Number], default: '' } //tab索引
})
......@@ -419,10 +422,19 @@ const processFormData = async obj => {
form.value = {}
// 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(obj.domdata))
console.log('obj', obj)
for (const section of processedData) {
if (section.data) {
for (const field of section.data) {
// 编辑状态下回显表单值
if (section.key == 'apiSecondHolderInfoDto' && props.idsObj.appointmentBizId) {
if (obj['detailInfo'] && obj['detailInfo']['isSecond'] == '0') {
section.showMoudle = false
} else {
section.showMoudle = true
}
}
if (field.dictType) {
// 获取字典数据
field.options = fetchDictData(field.dictType)
......@@ -455,7 +467,7 @@ const processFormData = async obj => {
) {
form.value = { ...tempSecondHolderForm.value }
}
if (props.showSubmitBtn) {
if (props.idsObj.appointmentBizId) {
form.value = { ...props.apiSecondHolderInfoDto }
} else {
}
......@@ -651,7 +663,7 @@ const getInvalidFields = fields => {
if (fields[field] && fields[field].length > 0) {
errors.push({
field: field,
message: fields[field][0].message
message: `第二持有人模块-${fields[field][0].message}`
})
}
}
......@@ -661,79 +673,46 @@ const getInvalidFields = fields => {
// 处理表单填写得数据
const handleFormValues = () => {
return new Promise(async resolve => {
let submitObj = {}
if (props.activeName == 'secondHolder') {
submitObj = JSON.parse(JSON.stringify(form.value))
} else {
submitObj = JSON.parse(JSON.stringify(tempSecondHolderForm.value))
}
if (processedSecondHolderData.value.length > 0) {
proxy.$refs['secondHolderFormRef'].validate((valid, fields) => {
let submitObj = { ...form.value }
// debugger
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] = ''
console.log('form.value', form.value)
if (valid) {
errorFields.value = [] // 清空错误信息
if (form.value.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
}
// 表单提交
const submitForm = () => {
proxy.$refs['secondHolderFormRef'].validate((valid, fields) => {
if (valid) {
let submitObj = handleFormValues()
if (
props.idsObj.appointmentBizId &&
(props.pageSource == 'fnaList' || props.pageSource == 'appointmentList')
) {
editSecondHolderInfo(submitObj).then(res => {
if (res.code == 200) {
handleEditStatus(true)
proxy.$message.success('第二持有人修改成功')
emit('handleSuccessEdit')
submitObj['isSecond'] = form.value.isSecond
if (submitObj['birthday']) {
submitObj['birthday'] = proxy.formatToDateTime(submitObj['birthday'])
}
})
}
if (props.idsObj.policyBizId && props.pageSource == 'policyList') {
// submitObj['policySecondHolderBizId'] = props.apiInsurantInfoDto.policySecondHolderBizId
// submitObj['policyBizId'] = props.apiInsurantInfoDto.policyBizId
// submitObj['id'] = props.apiInsurantInfoDto.id
updatePolicySecondHolder(submitObj).then(res => {
if (res.code == 200) {
handleEditStatus(true)
proxy.$message.success('新单跟进-受保人修改成功')
emit('policyEditSuccess')
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
return undefined
}
})
}
errorFields.value = [] // 清空错误信息
if (props.idsObj.appointmentBizId) {
submitObj['secondHolderBizId'] = props.apiSecondHolderInfoDto.secondHolderBizId
}
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)
}
})
} else {
// 获取校验失败的字段信息
errorFields.value = getInvalidFields(fields)
if (errorFields.value.length > 0) {
proxy.$message.error(errorFields.value[0].message)
if (props.idsObj.appointmentBizId) {
resolve(props.apiSecondHolderInfoDto)
} else {
resolve(undefined)
}
}
})
......@@ -763,10 +742,19 @@ watch(
if (newVal === 'secondHolder') {
openList.value = false
processFormData({
domdata: secondHolderDomData,
exportValue: null
})
if (props.idsObj.appointmentBizId) {
processFormData({
domdata: secondHolderDomData,
exportValue: null,
detailInfo: props.apiSecondHolderInfoDto
})
console.log(' props.apiSecondHolderInfoDto', props.apiSecondHolderInfoDto)
} else {
processFormData({
domdata: secondHolderDomData,
exportValue: null
})
}
}
}
)
......
......@@ -118,30 +118,40 @@
<span>{{ formatToDate(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="left"
width="250"
class-name="small-padding fixed-width"
fixed="right"
>
<template #default="scope">
<el-button link type="primary" @click="handleUpdate(scope.row)">修改</el-button>
<el-button
link
type="primary"
v-if="scope.row.status == 2 || scope.row.status == 3"
@click="getAppointmentInfo(scope.row.appointmentBizId)"
>查看行程单</el-button
>
<el-button link type="primary" @click="handleExprot(scope.row)">导出</el-button>
<el-button
link
type="danger"
v-if="scope.row.status === 0"
@click="handleDelete(scope.row)"
>删除</el-button
>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template #default="{ row }">
<el-popover placement="left" :width="160" trigger="click">
<template #reference>
<el-button link type="primary" size="small">
<el-icon><MoreFilled /></el-icon>
</el-button>
</template>
<el-menu @select="index => handleSelect(index, row)" popper-class="custom-menu">
<el-menu-item
v-for="item in getVisibleDropdownItems(row)"
:index="item.value"
:key="item.value"
>
<el-text class="mx-1" v-if="!item.confirm">{{ item.label }}</el-text>
<el-popconfirm
v-else
confirm-button-text="Yes"
cancel-button-text="No"
:icon="InfoFilled"
icon-color="#626AEF"
:title="item.confirm"
@confirm="handleMenuConfirm(item.value, row)"
width="300"
placement="left-end"
>
<template #reference>
<el-text class="mx-1">{{ item.label }}</el-text>
</template>
</el-popconfirm>
</el-menu-item>
</el-menu>
</el-popover>
</template>
</el-table-column>
</el-table>
......@@ -187,6 +197,8 @@
</template>
<script setup name="Appointment">
import { MoreFilled, InfoFilled } from '@element-plus/icons-vue'
import CommonPage from '@/components/commonPage'
import DetailPanel from '@/components/DetailPanel'
import { onMounted, onActivated, ref } from 'vue'
......@@ -227,6 +239,7 @@ const operationBtnList = ref([
click: handleQuery
}
])
const changePageNo = val => {
queryParams.value.pageNo = val
getList()
......@@ -251,6 +264,60 @@ const { bx_currency_type, csf_ap_status, csf_ap_meeting_point } = proxy.useDict(
'csf_ap_status',
'csf_ap_meeting_point'
)
// 基础菜单项配置(不使用 ref,因为它是静态的)
const baseDropdownItems = [
{ label: '修改', value: 'edit', confirm: '' },
{
label: '生成行程单',
value: 'viewItinerary',
confirm: '',
// 只有当 row.status == 1 时才显示
showCondition: row => row.status == 1
}
]
const getVisibleDropdownItems = row => {
return baseDropdownItems.filter(item => {
// 如果有 showCondition,则执行;否则默认显示
return typeof item.showCondition === 'function' ? item.showCondition(row) : true
})
}
// 菜单选择处理(无确认的操作)
const handleSelect = (index, row) => {
// 只处理不需要确认的操作
const item = baseDropdownItems.find(i => i.value === index)
if (item && !item.confirm) {
handleMenuAction(index, row)
}
// 如果有 confirm,则由 el-popconfirm 触发 handleMenuConfirm
}
// 带确认的操作(由 popconfirm 触发)
const handleMenuConfirm = (value, row) => {
handleMenuAction(value, row)
}
// 统一处理菜单动作
const handleMenuAction = (action, row) => {
switch (action) {
case 'edit':
handleUpdate(row)
break
case 'viewItinerary':
if (row.status !== 0) {
handleUpdate(row, 'viewItinerary')
}
break
case 'delete':
if (row.status !== 0) {
proxy.$message.warning('仅“待提交”状态的预约可删除')
return
}
handleDelete(row)
break
default:
proxy.$message.info('功能暂未开放')
}
}
const handleExprotPdf = () => {
exportLoading.value = true
getItineraryExprot(appointmentSummeryInfo.value.appointmentBizId).then(res => {
......@@ -489,7 +556,7 @@ function handleDelete(row) {
.catch(() => {})
}
/** 修改按钮操作 */
function handleUpdate(row) {
function handleUpdate(row, type) {
// 对预约status进行转换,到编辑页面在转换会有时机问题
csf_ap_status._object.csf_ap_status.forEach(element => {
element.value = Number(element.value)
......@@ -506,6 +573,10 @@ function handleUpdate(row) {
appointmentBizId: row.appointmentBizId,
source: 'appointmentList'
}
// 以生成行程单的方式进入到预约详情
if (type == 'viewItinerary') {
data.appointmentType = '2'
}
router.push({
path: '/sign/appointment/appointmentEdit',
query: data
......
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