Commit 658d366b by yuzhenWang

Merge branch 'feature-20250827wyz-写业务' into 'test'

Feature 20250827wyz 写业务

See merge request !15
parents 3b2adcf6 28e375f1
......@@ -3,7 +3,7 @@
<!-- direction="btt" -->
<el-drawer v-model="drawer" :before-close="handleBeforeClose" size="50%">
<template #header>
<h2>{{ drawerInfo.name }}</h2>
<h2>{{ drawerInfo.label }}</h2>
</template>
<template #default>
<div class="drawerContent">
......
......@@ -138,13 +138,6 @@ const setPhone = item => {
console.log('item', item)
menuList.value[0].value = item.code
menuList.value[1].value = item.mobile
// menuList.value.forEach(e => {
// for (const key in item) {
// if (e.key === key) {
// e.value = item[e.key]
// }
// }
// })
}
// 关闭国家地区的抽屉
const hanleCountryClose = () => {
......
......@@ -195,7 +195,13 @@ import Phone from '@/views/components/phone'
import Address from '@/views/components/address'
import { watch } from 'vue'
import { addCustomer, getCustomerDetail, editCustomer, getCustomerList } from '@/api/sign/fna'
import {
addCustomer,
getCustomerDetail,
editCustomer,
getCustomerList,
addFna
} from '@/api/sign/fna'
import useDictStore from '@/store/modules/dict'
const dictStore = useDictStore() //获取字典数据
const props = defineProps({
......@@ -417,14 +423,14 @@ const processFormData = async () => {
//弹出右侧抽屉
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 => {
item.value = ''
for (const key in saveKey.value) {
if (key == child.key) {
for (const key2 in saveKey.value[key]) {
......@@ -440,6 +446,7 @@ const handleFoucs = child => {
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]) {
......@@ -468,6 +475,8 @@ const handleCloseDrawer = () => {
}
// 点击了抽屉的确定
const confirmDrawer = info => {
console.log('抽屉info', info)
// info 为抽屉返回的值
if (drawerInfo.value.type == 'arrowRight' && drawerInfo.value.drawerType) {
console.log('drawerInfo.value', drawerInfo.value)
......@@ -478,8 +487,33 @@ const confirmDrawer = info => {
case 'phone':
newObj.objType = drawerInfo.value.drawerType
// 因为电话有多个,根据点击的电话类型在抽屉里回显,所以要用drawerInfo.value.code来控制
form.value[info.key] = `${newObj[drawerInfo.value.code]} ${newObj[drawerInfo.value.key]}`
form.value[info.key] = newObj.phoneString = `${newObj[drawerInfo.value.code]} ${
newObj[drawerInfo.value.key]
}`
newObj.key = drawerInfo.value.key
saveKey.value[drawerInfo.value.key] = newObj
// debugger
// 检查数组中是否已存在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
......@@ -668,8 +702,6 @@ const setFormValue = (obj, formData, exportValue) => {
} else {
form.value.age = null
}
console.log('form.value回填', form.value)
phoneQuickList.value = removeDuplicates(tempPhoneList, 'phoneString')
addressQuickList.value = removeDuplicates(tempAddressList, 'addressString')
......@@ -763,13 +795,19 @@ const submitForm = () => {
}
})
} else {
addCustomer(submitObj).then(res => {
if (res.code == 200) {
proxy.$message.success('客户新增成功')
emit('handleSuccess', {
tab: 'customer',
customerBizId: res.data.customerBizId,
type: 'add'
addFna({ remark: '' }).then(response => {
if (response.code == 200) {
// res.data.fnaBizId 写到这了,先增加fna,再增加客户 看一下流程是否报错
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'
})
}
})
}
})
......
......@@ -1005,7 +1005,7 @@ const submitForm = saveType => {
} else {
addfanForm(result).then(res => {
if (res.code == 200) {
proxy.$message.success('客户新增成功')
proxy.$message.success('fnaForm新增成功')
emit('handleSuccess', {
tab: 'fnaform',
fnaFormBizId: res.data.fnaFormBizId,
......
......@@ -146,10 +146,10 @@ const route = useRoute()
const router = useRouter()
const activeName = ref('overview')
const processInfo = ref({
// fnaNo: '暂无',
// status: '未完成',
// createTime: proxy.parseTime(new Date()),
// customerName: userStore.name
fnaNo: '--',
status: '未保存',
createTime: proxy.parseTime(new Date()),
customerName: userStore.name
}) // 流程详情信息
const updateStatus = ref(false)
const dictTypeLists = ref([])
......@@ -279,20 +279,22 @@ const processUpdate = (data, status) => {
updateProcess(data).then(res => {
if (res.code == 200) {
updateStatus.value = false
console.log('更新流程', res)
// 获取流程详情
getProcessInfo(processInfo.value.fnaBizId, status)
getProcessInfo(data.fnaBizId, status)
}
})
}
// 新建流程
const getAddInfo = () => {
addFna({ remark: '' }).then(res => {
if (res.code == 200) {
// 获取流程详情
getProcessInfo(res.data.fnaBizId)
}
})
}
// const getAddInfo = () => {
// addFna({ remark: '' }).then(res => {
// if (res.code == 200) {
// // 获取流程详情
// getProcessInfo(res.data.fnaBizId)
// }
// })
// }
// 获取流程详情
function getProcessInfo(fnaBizId, changeTab) {
getProcessDetail(fnaBizId).then(res => {
......@@ -373,9 +375,7 @@ const handleBack = () => {
}
if (route.query.type == 'add') {
console.log('add router', router)
getAddInfo()
// getAddInfo()
} else if (route.query.type == 'edit') {
setTimeout(() => {
getProcessInfo(route.query.fnaBizId)
......@@ -394,10 +394,7 @@ const handleSuccess = info => {
case 'customer':
if (info.type == 'add') {
//客户提交成功,更新流程
processUpdate(
{ fnaBizId: processInfo.value.fnaBizId, customerBizId: info.customerBizId },
'fnaform'
)
processUpdate({ fnaBizId: info.fnaBizId, customerBizId: info.customerBizId }, 'fnaform')
} else {
processUpdate({ fnaBizId: processInfo.value.fnaBizId, customerBizId: info.customerBizId })
}
......
......@@ -496,6 +496,7 @@ const handleFoucs = child => {
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]) {
......@@ -525,18 +526,39 @@ const handleCloseDrawer = () => {
const confirmDrawer = info => {
// info 为抽屉返回的值
if (drawerInfo.value.domType == 'arrowRight' && drawerInfo.value.drawerType) {
console.log('drawerInfo.value', drawerInfo.value)
let newObj = info[drawerInfo.value.key]
console.log('newObj', newObj)
//要判断drawerType
switch (drawerInfo.value.drawerType) {
case 'phone':
newObj.objType = drawerInfo.value.drawerType
// 因为电话有多个,根据点击的电话类型在抽屉里回显,所以要用drawerInfo.value.code来控制
form.value[info.key] = `${newObj[drawerInfo.value.code]} ${newObj[drawerInfo.value.key]}`
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
......
......@@ -242,6 +242,7 @@ const phoneOraddressKey = ref([]) // 存储当前点击的drawer框返回的对
const tableLoading = ref(false)
const tableData = ref([])
const total = ref(0)
const beneficiaryInfoFormRef = ref(null)
// 地址组件菜单数据
const addressMenuList = ref([
{
......@@ -353,16 +354,7 @@ const getRules = child => {
return rules
}
// const handleInputChange = (father, child, index) => {
// switch (child.key) {
// case 'nameEn':
// validateEnglish(form.value['apiBeneficiaryInfoDtoList'][index][child.key], child.key)
// break
// default:
// break
// }
// }
// 新增受益人
const addBeneficiary = () => {
let oneMoudle = JSON.parse(JSON.stringify(processedBeneficiaryData.value[0]))
......@@ -451,16 +443,6 @@ const fetchDictData = dictType => {
return []
}
}
// // 添加英文校验函数
// const validateEnglish = (rule, value, callback) => {
// if (value && !/^[A-Za-z]*$/.test(value)) {
// // 清空非英文字符
// form.value.firstNamePinyin = ''
// callback(new Error('只能输入英文字母'))
// } else {
// callback()
// }
// }
// 处理表单配置,添加字典数据
/**
......@@ -511,7 +493,7 @@ const processFormData = async obj => {
editStatus.value = true
} else {
editStatus.value = false
processedBeneficiaryData.value = oldAppointmentData.value = processedData
// processedBeneficiaryData.value = oldAppointmentData.value = processedData
}
}
......@@ -537,8 +519,6 @@ const handleFoucs = (child, l1, level1) => {
showPhoneDrawer.value = true
break
case 'address':
console.log('2222', phoneOraddressKey.value)
addressMenuList.value.forEach(item => {
item.value = ''
phoneOraddressKey.value.forEach(item1 => {
......@@ -574,9 +554,30 @@ const confirmDrawer = info => {
//要判断drawerType
switch (drawerInfo.value.drawerType) {
case 'phone':
form.value.apiBeneficiaryInfoDtoList[drawerInfo.value.l1][drawerInfo.value.key] = `${
newObj[drawerInfo.value.code]
} ${newObj[drawerInfo.value.key]}`
newObj.key = drawerInfo.value.key
form.value.apiBeneficiaryInfoDtoList[drawerInfo.value.l1][drawerInfo.value.key] =
newObj.phoneString = `${newObj[drawerInfo.value.code]} ${newObj[drawerInfo.value.key]}`
// 检查数组中是否已存在key的电话
const existingIndex1 = phoneQuickList.value.findIndex(item => item.key === newObj.key)
if (existingIndex1 !== -1) {
// 更新已存在的电话
phoneQuickList.value[existingIndex1] = {
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':
//因为可以添加多个受益人,所以需要判断是哪个受益人,一定要有id
......@@ -608,6 +609,12 @@ const confirmDrawer = info => {
default:
break
}
// 手动触发表单验证
nextTick(() => {
// 根据不同的drawerType确定要验证的字段key
const validateField = drawerInfo.value.key
beneficiaryInfoFormRef.value.clearValidate(validateField)
})
}
handleCloseDrawer()
......@@ -804,6 +811,7 @@ const setFormValue = () => {
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) {
......@@ -892,6 +900,14 @@ const setFormValue = () => {
} else {
processedBeneficiaryData.value.push(oldDom[0]) // 详情中没有数据 ,dom应该根据默认数据来渲染
}
// if (tempBeneficiaryDomData.value.length > 0) {
// form.value = { ...tempBeneficiaryForm.value }
// saveKey.value = { ...tempSaveKey.value }
// addressQuickList.value = JSON.parse(JSON.stringify(tempAddressQuickList.value))
// phoneQuickList.value = JSON.parse(JSON.stringify(tempPhoneQuickList.value))
// processedBeneficiaryData.value = JSON.parse(JSON.stringify(tempBeneficiaryDomData.value))
// }
// editStatus.value = true
}
// 获取校验失败的字段信息
const getInvalidFields = fields => {
......@@ -920,6 +936,8 @@ const handleFormValues = () => {
result = JSON.parse(JSON.stringify(tempBeneficiaryForm.value))
}
const pattern = /Time$/ // 以Time结尾
console.log('result', result)
for (const section of result['apiBeneficiaryInfoDtoList']) {
let submitObj = {}
if (phoneOraddressKey.value.length > 0) {
......@@ -930,21 +948,7 @@ const handleFormValues = () => {
if (pattern.test(key) && section[key]) {
section[key] = proxy.formatToDateTime(section[key])
}
// if (section['customerType'] == 'COMPANY') {
// for (const key1 in companyObj.value) {
// if (key == key1 && section[key]) {
// submitObj[key1] = section[key]
// }
// if (key == 'companyMobile' && section[key]) {
// submitObj[key] = section[key].split(' ')[1]
// submitObj['companyMobileCode'] = section[key].split(' ')[0]
// }
// if (key == 'authMobile' && section[key]) {
// submitObj[key] = section[key].split(' ')[1]
// submitObj['authMobileCode'] = section[key].split(' ')[0]
// }
// }
// }
//客户类型为个人的时候
if (section['customerType'] == 'INDIVIDUAL' && section[key]) {
for (const key1 in personalObj.value) {
if (key == key1) {
......@@ -952,6 +956,14 @@ const handleFormValues = () => {
}
}
}
// 客户类型为公司的时候
if (section['customerType'] == 'COMPANY' && section[key]) {
for (const key2 in companyObj.value) {
if (key == key2) {
submitObj[key2] = section[key]
}
}
}
}
if (submitObj['companyMobile']) {
submitObj['companyMobileCode'] = submitObj['companyMobile'].split(' ')[0]
......@@ -976,12 +988,17 @@ const handleFormValues = () => {
})
}
})
console.log('====================================')
console.log('受益人', submitObj)
console.log('====================================')
deleteKeyList.value.forEach(item => {
delete submitObj[item]
})
if (Object.keys(submitObj).length > 0) {
submitForm.push(submitObj)
}
submitForm.push(submitObj)
// if (Object.keys(submitObj).length > 0) {
// submitForm.push(submitObj)
// }
}
console.log('====================================')
......@@ -1052,6 +1069,7 @@ watch(
tempAddressQuickList.value = JSON.parse(JSON.stringify(addressQuickList.value))
tempPhoneQuickList.value = JSON.parse(JSON.stringify(phoneQuickList.value))
tempBeneficiaryDomData.value = JSON.parse(JSON.stringify(processedBeneficiaryData.value))
console.log('tempBeneficiaryDomData.value', tempBeneficiaryDomData.value)
if (newVal === 'beneficiary') {
openList.value = false
setTimeout(() => {
......
......@@ -30,7 +30,7 @@
<el-table-column label="文件类型" align="center" prop="fileType" />
<el-table-column
label="操作"
align="left"
align="center"
width="250"
class-name="small-padding fixed-width"
fixed="right"
......
......@@ -615,7 +615,31 @@ const processFormData = async obj => {
}
}
}
//当tab切换走,在切换回来的时候,需要把之前保存的值赋值回来
if (JSON.stringify(tempPolicyForm.value) !== '{}' && !props.idsObj.appointmentBizId) {
// 客户类型为公司时,隐藏非公司信息
if (
tempPolicyForm.value['customerType'] &&
tempPolicyForm.value['customerType'] == 'COMPANY'
) {
showContacts.value = false
if (section.key == 'company') {
section.showMoudle = true
} else if (section.key !== 'customer') {
section.showMoudle = false
}
} else if (
tempPolicyForm.value['customerType'] &&
tempPolicyForm.value['customerType'] !== 'COMPANY'
) {
showContacts.value = true
if (section.key == 'company') {
section.showMoudle = false
} else {
section.showMoudle = true
}
}
}
if (props.idsObj.appointmentBizId) {
field.disabled = true
} else {
......@@ -703,6 +727,7 @@ const handleFoucs = child => {
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]) {
......@@ -738,15 +763,41 @@ const confirmDrawer = info => {
switch (drawerInfo.value.drawerType) {
case 'phone':
newObj.objType = drawerInfo.value.drawerType
newObj.key = drawerInfo.value.key
// 因为电话有多个,根据点击的电话类型在抽屉里回显,所以要用drawerInfo.value.code来控制
form.value[info.key] = `${newObj[drawerInfo.value.code]} ${newObj[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
......@@ -1010,13 +1061,6 @@ const handleFormValues = () => {
}
// 表单提交
const submitForm = () => {
// let submitObj = { ...form.value }
// let submitObj = handleFormValues()
// console.log('====================================')
// console.log('submitObj', submitObj)
// console.log('====================================')
// return
proxy.$refs['insuredInfoFormRef'].validate((valid, fields) => {
if (valid) {
let submitObj = handleFormValues()
......
......@@ -619,6 +619,31 @@ const processFormData = async obj => {
}
}
}
//当tab切换走,在切换回来的时候,需要把之前保存的值赋值回来
if (JSON.stringify(tempPolicyForm.value) !== '{}' && !props.idsObj.appointmentBizId) {
// 客户类型为公司时,隐藏非公司信息
if (
tempPolicyForm.value['customerType'] &&
tempPolicyForm.value['customerType'] == 'COMPANY'
) {
showContacts.value = false
if (section.key == 'company') {
section.showMoudle = true
} else if (section.key !== 'customer') {
section.showMoudle = false
}
} else if (
tempPolicyForm.value['customerType'] &&
tempPolicyForm.value['customerType'] !== 'COMPANY'
) {
showContacts.value = true
if (section.key == 'company') {
section.showMoudle = false
} else {
section.showMoudle = true
}
}
}
if (props.idsObj.appointmentBizId) {
field.disabled = true
......@@ -663,9 +688,6 @@ const processFormData = async obj => {
if (form.value.smokingAllowed) {
form.value.smokingAllowed = Number(form.value.smokingAllowed)
}
console.log('修改form', form.value)
editStatus.value = true
} else {
editStatus.value = false
......@@ -708,6 +730,7 @@ const handleFoucs = child => {
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]) {
......@@ -744,8 +767,32 @@ const confirmDrawer = info => {
case 'phone':
newObj.objType = drawerInfo.value.drawerType
// 因为电话有多个,根据点击的电话类型在抽屉里回显,所以要用drawerInfo.value.code来控制
form.value[info.key] = `${newObj[drawerInfo.value.code]} ${newObj[drawerInfo.value.key]}`
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
......@@ -913,9 +960,6 @@ const handleFormValues = () => {
result = JSON.parse(JSON.stringify(tempPolicyForm.value))
saveKey.value = JSON.parse(JSON.stringify(tempSaveKey.value))
}
console.log('====================================')
console.log('投保人result', result)
console.log('====================================')
let newSaveKey = {}
if (result.birthday) {
result.birthday = proxy.formatToDateTime(result.birthday)
......
......@@ -463,6 +463,7 @@ const handleFoucs = child => {
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]) {
......
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