Commit eb5a516b by yuzhenWang

修改流程2

parent aa8cecef
...@@ -24,7 +24,7 @@ const appointmentInfo = [ ...@@ -24,7 +24,7 @@ const appointmentInfo = [
label: '预约时间', label: '预约时间',
key: 'confirmAppointmentTime', key: 'confirmAppointmentTime',
domType: 'datetimePicker', domType: 'datetimePicker',
required: true, required: false,
disabled: true, disabled: true,
placeholder: '请选择', placeholder: '请选择',
show: false, show: false,
......
...@@ -377,7 +377,7 @@ const beneficiary = [ ...@@ -377,7 +377,7 @@ const beneficiary = [
showMoudle: true, //模块是否展示 showMoudle: true, //模块是否展示
data: [ data: [
{ {
label: '受益比', label: '受益比',
key: 'benefitRatio', key: 'benefitRatio',
customerKey: 'idCard', customerKey: 'idCard',
domType: 'Input', domType: 'Input',
......
...@@ -4,36 +4,36 @@ const customer = [ ...@@ -4,36 +4,36 @@ const customer = [
type: 'object', type: 'object',
key: 'personInfo', key: 'personInfo',
data: [ data: [
{ // {
label: '姓氏', // label: '姓氏',
key: 'lastName', // key: 'lastName',
type: 'Input', // type: 'Input',
inputType: 'text', // inputType: 'text',
required: false, // required: false,
maxLength: 5, // maxLength: 5,
disabled: false, // disabled: false,
placeholder: '请输入', // placeholder: '请输入',
show: true, // show: true,
labelPosition: 'top', //标签的位置 // labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 // labelWidth: '120px', //标签宽度
sm: 8, //栅格布局份数 // sm: 8, //栅格布局份数
lg: 8 //栅格布局份数 // lg: 8 //栅格布局份数
}, // },
{ // {
label: '名字', // label: '名字',
key: 'firstName', // key: 'firstName',
type: 'Input', // type: 'Input',
inputType: 'text', // inputType: 'text',
required: false, // required: false,
maxLength: 10, // maxLength: 10,
disabled: false, // disabled: false,
placeholder: '请输入', // placeholder: '请输入',
show: true, // show: true,
labelPosition: 'top', //标签的位置 // labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 // labelWidth: '120px', //标签宽度
sm: 8, //栅格布局份数 // sm: 8, //栅格布局份数
lg: 8 //栅格布局份数 // lg: 8 //栅格布局份数
}, // },
{ {
label: '姓名', label: '姓名',
key: 'name', key: 'name',
...@@ -49,36 +49,36 @@ const customer = [ ...@@ -49,36 +49,36 @@ const customer = [
sm: 8, //栅格布局份数 sm: 8, //栅格布局份数
lg: 8 //栅格布局份数 lg: 8 //栅格布局份数
}, },
{ // {
label: '姓氏拼音', // label: '姓氏拼音',
key: 'lastNamePinyin', // key: 'lastNamePinyin',
type: 'Input', // type: 'Input',
inputType: 'text', // inputType: 'text',
required: false, // required: false,
maxLength: 30, // maxLength: 30,
disabled: false, // disabled: false,
placeholder: '请输入', // placeholder: '请输入',
show: true, // show: true,
labelPosition: 'top', //标签的位置 // labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 // labelWidth: '120px', //标签宽度
sm: 8, //栅格布局份数 // sm: 8, //栅格布局份数
lg: 8 //栅格布局份数 // lg: 8 //栅格布局份数
}, // },
{ // {
label: '姓名拼音', // label: '姓名拼音',
key: 'pinyin', // key: 'pinyin',
type: 'Input', // type: 'Input',
inputType: 'text', // inputType: 'text',
required: false, // required: false,
maxLength: 30, // maxLength: 30,
disabled: false, // disabled: false,
placeholder: '请输入', // placeholder: '请输入',
show: true, // show: true,
labelPosition: 'top', //标签的位置 // labelPosition: 'top', //标签的位置
labelWidth: '120px', //标签宽度 // labelWidth: '120px', //标签宽度
sm: 8, //栅格布局份数 // sm: 8, //栅格布局份数
lg: 8 //栅格布局份数 // lg: 8 //栅格布局份数
}, // },
{ {
label: '名字-英文', label: '名字-英文',
key: 'firstNamePinyin', key: 'firstNamePinyin',
...@@ -126,7 +126,7 @@ const customer = [ ...@@ -126,7 +126,7 @@ const customer = [
label: '生日', label: '生日',
key: 'birthdate', key: 'birthdate',
type: 'DatePicker', type: 'DatePicker',
required: false, required: true,
disabled: false, disabled: false,
placeholder: '请选择', placeholder: '请选择',
show: true, show: true,
...@@ -142,7 +142,7 @@ const customer = [ ...@@ -142,7 +142,7 @@ const customer = [
inputType: 'number', inputType: 'number',
maxLength: 30, maxLength: 30,
required: true, required: true,
disabled: false, disabled: true,
placeholder: '请输入', placeholder: '请输入',
show: true, show: true,
labelPosition: 'top', //标签的位置 labelPosition: 'top', //标签的位置
...@@ -251,7 +251,7 @@ const customer = [ ...@@ -251,7 +251,7 @@ const customer = [
type: 'Input', type: 'Input',
inputType: 'text', inputType: 'text',
maxLength: 300, maxLength: 300,
required: true, required: false,
disabled: false, disabled: false,
placeholder: '请输入', placeholder: '请输入',
show: true, show: true,
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
:placeholder="child.placeholder" :placeholder="child.placeholder"
maxlength="30" maxlength="30"
:disabled="child.disabled" :disabled="child.disabled"
@change="handleInputChange(child)"
/> />
<el-select <el-select
v-if="child.type === 'Select'" v-if="child.type === 'Select'"
...@@ -63,6 +64,9 @@ ...@@ -63,6 +64,9 @@
type="date" type="date"
:placeholder="child.placeholder" :placeholder="child.placeholder"
:disabled="child.disabled" :disabled="child.disabled"
:disabled-date="time => disabledDate(time, child)"
:default-value="defaultDisplayDate"
@change="handleDateChange(child)"
/> />
<el-input <el-input
...@@ -180,6 +184,8 @@ ...@@ -180,6 +184,8 @@
</div> </div>
</template> </template>
<script setup name="customer"> <script setup name="customer">
import { calculateExactAge } from '@/utils/date'
import dayjs from 'dayjs'
import { ArrowRight } from '@element-plus/icons-vue' import { ArrowRight } from '@element-plus/icons-vue'
import customerDomData from '@/formJson/customer' import customerDomData from '@/formJson/customer'
import Country from '@/views/components/country' import Country from '@/views/components/country'
...@@ -211,6 +217,10 @@ const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作 ...@@ -211,6 +217,10 @@ const oldObjInfo = ref({}) // 修改时存储原始数据,便于撤销操作
const tableLoading = ref(false) const tableLoading = ref(false)
const tableData = ref([]) const tableData = ref([])
const total = ref(0) const total = ref(0)
const customerRef = ref(null)
// / 计算默认显示的日期(18年前的今天)
const defaultDisplayDate = ref(dayjs().subtract(18, 'year').toDate())
// 地址组件菜单数据 // 地址组件菜单数据
const addressMenuList = ref([ const addressMenuList = ref([
{ {
...@@ -281,6 +291,34 @@ const data = reactive({ ...@@ -281,6 +291,34 @@ const data = reactive({
} }
}) })
const { form, rules, processedCustomerData, queryParams, oldCustomerData } = toRefs(data) const { form, rules, processedCustomerData, queryParams, oldCustomerData } = toRefs(data)
const handleInputChange = child => {
if (
(child.key == 'lastName' || child.key == 'firstName') &&
form.value['lastName'] &&
form.value['firstName']
) {
form.value['name'] = form.value['lastName'] + form.value['firstName']
}
}
const handleDateChange = child => {
let age = null
if (child.key == 'birthdate') {
age = calculateExactAge(proxy.formatToDate(form.value.birthdate))
if (age >= 18) {
form.value.age = age
}
}
}
const disabledDate = (time, child) => {
if (child.key == 'birthdate') {
// 计算18年前的今天
const eighteenYearsAgo = dayjs().subtract(18, 'year')
// 禁用今天之后的日期和18年前的今天之后的日期
return time.getTime() > Date.now() || time.getTime() > eighteenYearsAgo.valueOf()
} else {
return time.getTime() > Date.now()
}
}
const resetCustomerList = () => { const resetCustomerList = () => {
queryParams.value = { queryParams.value = {
pageNo: 1, pageNo: 1,
...@@ -369,7 +407,7 @@ const processFormData = async () => { ...@@ -369,7 +407,7 @@ const processFormData = async () => {
} }
if (props.customerBizId) { if (props.customerBizId) {
field.disabled = true field.disabled = true
} else { } else if (field.key !== 'age') {
field.disabled = false field.disabled = false
} }
} }
...@@ -437,6 +475,7 @@ const handleCloseDrawer = () => { ...@@ -437,6 +475,7 @@ const handleCloseDrawer = () => {
showCountryDrawer.value = false showCountryDrawer.value = false
drawerInfo.value = {} drawerInfo.value = {}
} }
// 点击了抽屉的确定
const confirmDrawer = info => { const confirmDrawer = info => {
// info 为抽屉返回的值 // info 为抽屉返回的值
if (drawerInfo.value.type == 'arrowRight' && drawerInfo.value.drawerType) { if (drawerInfo.value.type == 'arrowRight' && drawerInfo.value.drawerType) {
...@@ -465,8 +504,13 @@ const confirmDrawer = info => { ...@@ -465,8 +504,13 @@ const confirmDrawer = info => {
default: default:
break break
} }
// 手动触发表单验证
nextTick(() => {
// 根据不同的drawerType确定要验证的字段key
const validateField = drawerInfo.value.key
customerRef.value.clearValidate(validateField)
})
} }
console.log('saveKey.value', saveKey.value)
handleCloseDrawer() handleCloseDrawer()
} }
...@@ -505,8 +549,6 @@ const handleSelectChange = child => { ...@@ -505,8 +549,6 @@ const handleSelectChange = child => {
// 改变编辑状态 // 改变编辑状态
const handleEditStatus = () => { const handleEditStatus = () => {
editStatus.value = !editStatus.value editStatus.value = !editStatus.value
console.log('触发了编辑状态', editStatus.value)
// 深拷贝原始数据 // 深拷贝原始数据
const processedData = JSON.parse(JSON.stringify(processedCustomerData.value)) const processedData = JSON.parse(JSON.stringify(processedCustomerData.value))
for (const section of processedData) { for (const section of processedData) {
...@@ -514,7 +556,7 @@ const handleEditStatus = () => { ...@@ -514,7 +556,7 @@ const handleEditStatus = () => {
for (const field of section.data) { for (const field of section.data) {
if (editStatus.value) { if (editStatus.value) {
field.disabled = true field.disabled = true
} else { } else if (field.key !== 'age') {
field.disabled = false field.disabled = false
} }
} }
...@@ -627,6 +669,15 @@ const setFormValue = (obj, formData, exportValue) => { ...@@ -627,6 +669,15 @@ const setFormValue = (obj, formData, exportValue) => {
} }
} }
}) })
if (form.value['birthdate']) {
let age = calculateExactAge(proxy.formatToDate(form.value.birthdate))
if (age >= 18) {
form.value.age = age
}
} else {
form.value.age = null
}
console.log('form.value回填', form.value)
phoneQuickList.value = removeDuplicates(tempPhoneList, 'phoneString') phoneQuickList.value = removeDuplicates(tempPhoneList, 'phoneString')
addressQuickList.value = removeDuplicates(tempAddressList, 'addressString') addressQuickList.value = removeDuplicates(tempAddressList, 'addressString')
...@@ -760,7 +811,7 @@ const resetForm = () => { ...@@ -760,7 +811,7 @@ const resetForm = () => {
.catch(() => {}) .catch(() => {})
} }
// 获取流程详情 // 获取客户详情
function getCustomerInfo(customerBizId, formData) { function getCustomerInfo(customerBizId, formData) {
getCustomerDetail(customerBizId).then(async res => { getCustomerDetail(customerBizId).then(async res => {
if (res.code == 200) { if (res.code == 200) {
......
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
:fnaFormBizId="processInfo.fnaFormBizId" :fnaFormBizId="processInfo.fnaFormBizId"
:customerBizId="processInfo.customerBizId" :customerBizId="processInfo.customerBizId"
:dictTypeLists="dictTypeLists" :dictTypeLists="dictTypeLists"
:customerInfo="customerInfo"
@handleSuccess="handleSuccess" @handleSuccess="handleSuccess"
/> />
</div> </div>
...@@ -130,7 +131,7 @@ ...@@ -130,7 +131,7 @@
import AppointmentEdit from '@/views/sign/appointment/appointmentEdit' import AppointmentEdit from '@/views/sign/appointment/appointmentEdit'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import useDictStore from '@/store/modules/dict' import useDictStore from '@/store/modules/dict'
import { addFna, getProcessDetail, updateProcess } from '@/api/sign/fna' import { addFna, getProcessDetail, updateProcess, getCustomerDetail } from '@/api/sign/fna'
import { listTenantUser, getInsuranceProductList, getAdditionalProductList } from '@/api/common' import { listTenantUser, getInsuranceProductList, getAdditionalProductList } from '@/api/common'
import Customer from './components/customer' import Customer from './components/customer'
import FanForm from './components/fanForm' import FanForm from './components/fanForm'
...@@ -151,6 +152,7 @@ const processInfo = ref({ ...@@ -151,6 +152,7 @@ const processInfo = ref({
}) // 流程详情信息 }) // 流程详情信息
const updateStatus = ref(false) const updateStatus = ref(false)
const dictTypeLists = ref([]) const dictTypeLists = ref([])
const customerInfo = ref({})
const tabsList = ref([ const tabsList = ref([
{ {
label: '总览', label: '总览',
...@@ -314,6 +316,9 @@ function getProcessInfo(fnaBizId, changeTab) { ...@@ -314,6 +316,9 @@ function getProcessInfo(fnaBizId, changeTab) {
} }
// Tab切换前的验证 // Tab切换前的验证
const beforeTabLeave = (activeTabName, oldTabName) => { const beforeTabLeave = (activeTabName, oldTabName) => {
if (processInfo.value.customerBizId) {
getCustomerInfo(processInfo.value.customerBizId)
}
// 如果切换到总览,始终允许 // 如果切换到总览,始终允许
if (activeTabName === 'overview' || activeTabName === 'customer') { if (activeTabName === 'overview' || activeTabName === 'customer') {
return true return true
...@@ -372,6 +377,14 @@ if (route.query.type == 'add') { ...@@ -372,6 +377,14 @@ if (route.query.type == 'add') {
getProcessInfo(route.query.fnaBizId) getProcessInfo(route.query.fnaBizId)
}, 100) }, 100)
} }
// 获取客户详情
function getCustomerInfo(customerBizId) {
getCustomerDetail(customerBizId).then(async res => {
if (res.code == 200) {
customerInfo.value = res.data
}
})
}
const handleSuccess = info => { const handleSuccess = info => {
switch (info.tab) { switch (info.tab) {
case 'customer': case 'customer':
...@@ -384,7 +397,7 @@ const handleSuccess = info => { ...@@ -384,7 +397,7 @@ const handleSuccess = info => {
} else { } else {
processUpdate({ fnaBizId: processInfo.value.fnaBizId, customerBizId: info.customerBizId }) processUpdate({ fnaBizId: processInfo.value.fnaBizId, customerBizId: info.customerBizId })
} }
getCustomerInfo(info.customerBizId)
break break
case 'fnaform': case 'fnaform':
if (info.type == 'add') { if (info.type == 'add') {
......
...@@ -80,15 +80,9 @@ ...@@ -80,15 +80,9 @@
@selection-change="tableSelect" @selection-change="tableSelect"
@sort-change="sortChange" @sort-change="sortChange"
> >
<el-table-column type="selection" width="55" /> <!-- <el-table-column type="selection" width="55" /> -->
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" label="序号" />
<el-table-column label="流程编号" align="center" prop="fnaNo" width="200" />
<el-table-column label="预约编号" align="center" prop="appointmentNo" width="200" />
<el-table-column label="新单编号" align="center" prop="policyId" />
<el-table-column label="保单号" align="center" prop="policyNo" width="150" />
<el-table-column label="客户姓名" align="center" prop="customerName" width="100" /> <el-table-column label="客户姓名" align="center" prop="customerName" width="100" />
<el-table-column label="状态" align="center" width="150"> <el-table-column label="状态" align="center" width="150">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.status == 'UNCOMPLETED'"> <span v-if="scope.row.status == 'UNCOMPLETED'">
...@@ -102,6 +96,11 @@ ...@@ -102,6 +96,11 @@
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="流程编号" align="center" prop="fnaNo" width="200" />
<el-table-column label="预约编号" align="center" prop="appointmentNo" width="200" />
<el-table-column label="新单编号" align="center" prop="policyId" />
<el-table-column label="保单号" align="center" prop="policyNo" width="150" />
<el-table-column label="创建时间" sortable align="center" prop="createTime" width="200"> <el-table-column label="创建时间" sortable align="center" prop="createTime" width="200">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
...@@ -115,13 +114,9 @@ ...@@ -115,13 +114,9 @@
fixed="right" fixed="right"
> >
<template #default="scope"> <template #default="scope">
<el-button type="primary" @click="handleUpdate(scope.row)">修改</el-button> <el-button type="primary" link @click="handleUpdate(scope.row)">修改</el-button>
<el-button type="success" @click="handleCopy(scope.row)">生成副本</el-button> <el-button type="success" link @click="handleCopy(scope.row)">生成副本</el-button>
<!-- v-if="scope.row.status == 'COMPLETED'" --> <el-button v-if="!scope.row.policyNo" type="danger" link @click="handleDelete(scope.row)"
<el-button
v-if="scope.row.status == 'COMPLETED'"
type="danger"
@click="handleDelete(scope.row)"
>删除</el-button >删除</el-button
> >
</template> </template>
......
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
:idsObj="idsObj" :idsObj="idsObj"
:apiSecondHolderInfoDto="appointmentSummeryInfo.apiSecondHolderInfoDto" :apiSecondHolderInfoDto="appointmentSummeryInfo.apiSecondHolderInfoDto"
:appointmentStatus="appointmentSummeryInfo.status" :appointmentStatus="appointmentSummeryInfo.status"
:customerInfo="customerInfo"
@handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)" @handleSuccessEdit="getAppointmentInfo(idsObj.appointmentBizId)"
ref="secondHolderInfoRef" ref="secondHolderInfoRef"
/> />
...@@ -468,6 +469,7 @@ function getAppointmentInfo(appointmentBizId, changeTab) { ...@@ -468,6 +469,7 @@ function getAppointmentInfo(appointmentBizId, changeTab) {
processInfo.value.status = item.label processInfo.value.status = item.label
} }
}) })
getCustomerInfo(res.data.apiAppointmentInfoDto.customerBizId)
if (!appointmentSummeryInfo.value.apiAppointmentInfoDto.appointmentBizId) { if (!appointmentSummeryInfo.value.apiAppointmentInfoDto.appointmentBizId) {
showStorage.value = true showStorage.value = true
} }
...@@ -744,9 +746,7 @@ watch( ...@@ -744,9 +746,7 @@ watch(
if (!idsObj.value.appointmentBizId) { if (!idsObj.value.appointmentBizId) {
formStatus.value = 'appointmentAdd' formStatus.value = 'appointmentAdd'
getCustomerInfo(props.processDetail.customerBizId) getCustomerInfo(props.processDetail.customerBizId)
// if (idsObj.value.appointmentBizId) {
// getAppointmentInfo(idsObj.value.appointmentBizId)
// }
tabsList.value = [ tabsList.value = [
{ {
label: '预约信息', label: '预约信息',
...@@ -867,12 +867,14 @@ watch( ...@@ -867,12 +867,14 @@ watch(
} }
] ]
} }
nextTick(() => { nextTick(() => {
activeName.value = 'appointmentInfo' activeName.value = 'appointmentInfo'
}) })
} }
} }
) )
onUnmounted(() => { onUnmounted(() => {
console.log('预约编辑页面完全销毁') console.log('预约编辑页面完全销毁')
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
:placeholder="child.placeholder" :placeholder="child.placeholder"
:disabled="child.disabled" :disabled="child.disabled"
@change="handleDateChange(child)" @change="handleDateChange(child)"
:disabled-date="time => disabledDate(time, child)"
format="YYYY-MM-DD HH:mm" format="YYYY-MM-DD HH:mm"
value-format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
/> />
...@@ -151,6 +152,7 @@ ...@@ -151,6 +152,7 @@
</div> </div>
</template> </template>
<script setup name="appointmentInfo"> <script setup name="appointmentInfo">
import dayjs from 'dayjs'
import { ArrowRight } from '@element-plus/icons-vue' import { ArrowRight } from '@element-plus/icons-vue'
import appointmentDomData from '@/formJson/appointmentInfo' import appointmentDomData from '@/formJson/appointmentInfo'
import Country from '@/views/components/country' import Country from '@/views/components/country'
...@@ -256,6 +258,25 @@ const data = reactive({ ...@@ -256,6 +258,25 @@ const data = reactive({
} }
}) })
const { form, rules, processedAppointmentData, queryParams, oldAppointmentData } = toRefs(data) const { form, rules, processedAppointmentData, queryParams, oldAppointmentData } = toRefs(data)
const disabledDate = (time, child) => {
// 获取“今天”的日期,并将其时间部分设置为 00:00:00
const today = dayjs().startOf('day') // :cite[7]
// 将传入的 timestamp 转换为 dayjs 对象
const inputDate = dayjs(time)
// 可以根据参数调整逻辑
if (child.key == 'intentionAppointmentTime') {
// 默认禁用今天及今天之前 (使用 isBefore 或 isSame)
return inputDate.isBefore(today, 'day') || inputDate.isSame(today, 'day') // :cite[3]
// 如果允许选择今天,只禁用今天之前的日期 (使用 isBefore)
// return inputDate.isBefore(today, 'day') // :cite[3]
} else {
// 如果允许选择今天,只禁用今天之前的日期 (使用 isBefore)
return inputDate.isBefore(today, 'day') // :cite[3]
// return time.getTime() > Date.now()
}
}
const handleButtonClick = child => { const handleButtonClick = child => {
if (child.key == 'newPolicyButton') { if (child.key == 'newPolicyButton') {
let obj = { let obj = {
......
...@@ -218,6 +218,7 @@ const props = defineProps({ ...@@ -218,6 +218,7 @@ const props = defineProps({
const emit = defineEmits(['handleSuccessEdit']) const emit = defineEmits(['handleSuccessEdit'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
// const { csf_id_type, sys_gender } = proxy.useDict('csf_id_type', 'sys_gender') // const { csf_id_type, sys_gender } = proxy.useDict('csf_id_type', 'sys_gender')
const insuredInfoFormRef = ref(null)
const showPhoneDrawer = ref(false) //电话抽屉开关 const showPhoneDrawer = ref(false) //电话抽屉开关
const showAddressDrawer = ref(false) //地址抽屉开关 const showAddressDrawer = ref(false) //地址抽屉开关
const showCountryDrawer = ref(false) //国家/地区抽屉开关 const showCountryDrawer = ref(false) //国家/地区抽屉开关
...@@ -665,11 +666,7 @@ const confirmDrawer = info => { ...@@ -665,11 +666,7 @@ const confirmDrawer = info => {
// info 为抽屉返回的值 // info 为抽屉返回的值
if (drawerInfo.value.domType == 'arrowRight' && drawerInfo.value.drawerType) { if (drawerInfo.value.domType == 'arrowRight' && drawerInfo.value.drawerType) {
let newObj = info[drawerInfo.value.key] let newObj = info[drawerInfo.value.key]
// if (form.value['customerType'] == 'COMPANY') {
// newObj.fatherKey = 'company'
// } else if (form.value['customerType'] == 'INDIVIDUAL') {
// newObj.fatherKey = 'person'
// }
//要判断drawerType //要判断drawerType
switch (drawerInfo.value.drawerType) { switch (drawerInfo.value.drawerType) {
case 'phone': case 'phone':
...@@ -692,6 +689,12 @@ const confirmDrawer = info => { ...@@ -692,6 +689,12 @@ const confirmDrawer = info => {
default: default:
break break
} }
// 手动触发表单验证
nextTick(() => {
// 根据不同的drawerType确定要验证的字段key
const validateField = drawerInfo.value.key
insuredInfoFormRef.value.clearValidate(validateField)
})
} }
handleCloseDrawer() handleCloseDrawer()
......
...@@ -218,6 +218,7 @@ const props = defineProps({ ...@@ -218,6 +218,7 @@ const props = defineProps({
const emit = defineEmits(['handleSuccessEdit']) const emit = defineEmits(['handleSuccessEdit'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
// const { csf_id_type, sys_gender } = proxy.useDict('csf_id_type', 'sys_gender') // const { csf_id_type, sys_gender } = proxy.useDict('csf_id_type', 'sys_gender')
const policyholderInfoFormRef = ref(null)
const showPhoneDrawer = ref(false) //电话抽屉开关 const showPhoneDrawer = ref(false) //电话抽屉开关
const showAddressDrawer = ref(false) //地址抽屉开关 const showAddressDrawer = ref(false) //地址抽屉开关
const showCountryDrawer = ref(false) //国家/地区抽屉开关 const showCountryDrawer = ref(false) //国家/地区抽屉开关
...@@ -609,10 +610,9 @@ const processFormData = async obj => { ...@@ -609,10 +610,9 @@ const processFormData = async obj => {
//弹出右侧抽屉 //弹出右侧抽屉
const handleFoucs = child => { const handleFoucs = child => {
if (child.disabled) return if (child.disabled) return
console.log('saveKey.value', saveKey.value)
console.log('child', child)
drawerInfo.value = JSON.parse(JSON.stringify(child)) drawerInfo.value = JSON.parse(JSON.stringify(child))
switch (child.drawerType) { switch (child.drawerType) {
case 'phone': case 'phone':
phoneMenuList.value[0].key = child.code phoneMenuList.value[0].key = child.code
...@@ -687,6 +687,12 @@ const confirmDrawer = info => { ...@@ -687,6 +687,12 @@ const confirmDrawer = info => {
default: default:
break break
} }
// 手动触发表单验证
nextTick(() => {
// 根据不同的drawerType确定要验证的字段key
const validateField = drawerInfo.value.key
policyholderInfoFormRef.value.clearValidate(validateField)
})
} }
handleCloseDrawer() handleCloseDrawer()
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
:placeholder="child.placeholder" :placeholder="child.placeholder"
maxlength="30" maxlength="30"
:disabled="child.disabled" :disabled="child.disabled"
@input="handleInputChange(father, child)"
/> />
<el-select <el-select
v-if="child.domType === 'Select'" v-if="child.domType === 'Select'"
...@@ -200,6 +201,7 @@ const props = defineProps({ ...@@ -200,6 +201,7 @@ const props = defineProps({
appointmentStatus: { type: Number }, //父组件传递过来的预约的状态 appointmentStatus: { type: Number }, //父组件传递过来的预约的状态
customerInfo: { type: Object, default: () => ({}) } //客户详情回显表单用 customerInfo: { type: Object, default: () => ({}) } //客户详情回显表单用
}) })
const emit = defineEmits(['handleSuccessEdit']) const emit = defineEmits(['handleSuccessEdit'])
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
// const { csf_id_type, sys_gender } = proxy.useDict('csf_id_type', 'sys_gender') // const { csf_id_type, sys_gender } = proxy.useDict('csf_id_type', 'sys_gender')
...@@ -208,7 +210,6 @@ const showAddressDrawer = ref(false) //地址抽屉开关 ...@@ -208,7 +210,6 @@ const showAddressDrawer = ref(false) //地址抽屉开关
const showCountryDrawer = ref(false) //国家/地区抽屉开关 const showCountryDrawer = ref(false) //国家/地区抽屉开关
const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输入值 const drawerInfo = ref({}) // 用于存储所有arrowRight类型的输入框输入值
const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key const saveKey = ref({}) // 用于存储当前点击的drawer框返回的对象,修改的时候回显值也要存key
const tempSaveKey = ref({}) // 用于tab切换的时候保存一份临时的值,防止切换的时候数据丢失
const errorFields = ref([]) // 存储校验失败的字段信息 const errorFields = ref([]) // 存储校验失败的字段信息
const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑 const editStatus = ref(true) // 表单是否可编辑,若是修改初始不可编辑
const openList = ref(false) // 客户列表弹窗 const openList = ref(false) // 客户列表弹窗
...@@ -366,13 +367,11 @@ const fetchDictData = dictType => { ...@@ -366,13 +367,11 @@ const fetchDictData = dictType => {
} }
} }
// 添加英文校验函数 // 添加英文校验函数
const validateEnglish = (rule, value, callback) => { const validateEnglish = (value, key) => {
if (value && !/^[A-Za-z]*$/.test(value)) { if (value && !/^[A-Za-z]*$/.test(value)) {
// 清空非英文字符 // 清空非英文字符
form.value.firstNamePinyin = '' form.value[key] = ''
callback(new Error('只能输入英文字母')) proxy.$modal.msgError('请输入英文字符')
} else {
callback()
} }
} }
...@@ -420,12 +419,6 @@ const processFormData = async obj => { ...@@ -420,12 +419,6 @@ const processFormData = async obj => {
if (props.idsObj.appointmentBizId) { if (props.idsObj.appointmentBizId) {
field.disabled = true field.disabled = true
} else {
if (field.key == 'age') {
field.disabled = true
} else {
field.disabled = false
}
} }
} }
} }
...@@ -558,53 +551,37 @@ const resetShow = obj => { ...@@ -558,53 +551,37 @@ const resetShow = obj => {
} }
} }
const handleSelectChange = (father, child) => { const handleSelectChange = (father, child) => {
switch (child.key) { const processData = JSON.parse(JSON.stringify(processedSecondHolderData.value))
case 'customerType': for (const section of processData) {
if (form.value[child.key] == 'COMPANY') { switch (child.key) {
showContacts.value = false case 'insurantRel':
for (const section of processedSecondHolderData.value) { for (const field of section.data) {
if (section.key == 'company') { for (const key1 in field) {
for (const key1 in saveKey.value) { for (const key2 in props.customerInfo) {
for (const key2 in commonObj.value) { //当选择得关系是本人 用dom得key和用户信息得key做对比,给表单赋值
if (key1 == key2) { if (key1 == 'customerKey' && field[key1] == key2) {
saveKey.value[key1]['fatherKey'] = section.key form.value[field.key] = props.customerInfo[key2]
}
} }
} }
section.showMoudle = true
} else if (section.key !== 'customer') {
section.showMoudle = false
} }
} }
} else { if (form.value['birthTime']) {
showContacts.value = true let age = calculateExactAge(proxy.formatToDate(form.value.birthTime))
for (const section of processedSecondHolderData.value) { if (age >= 0) {
if (section.key == 'company') { form.value.age = age
section.showMoudle = false
} else {
section.showMoudle = true
} }
} }
} break
break
case 'smokingAllowed':
// 选择吸烟,展示吸烟数量
if (form.value[child.key] == '1') {
resetShow({ type: 'child', key: 'smokingVolume', status: true })
} else {
resetShow({ type: 'child', key: 'smokingVolume', status: false })
}
break
case 'isVip':
// 选择vip,展示vip备注
if (form.value[child.key] == '1') {
resetShow({ type: 'child', key: 'vipRemark', status: true })
} else {
resetShow({ type: 'child', key: 'vipRemark', status: false })
}
default:
break
}
}
}
const handleInputChange = (father, child) => {
switch (child.key) {
case 'nameEn':
validateEnglish(form.value[child.key], child.key)
break break
default: default:
...@@ -623,7 +600,7 @@ const handleEditStatus = status => { ...@@ -623,7 +600,7 @@ const handleEditStatus = status => {
for (const field of section.data) { for (const field of section.data) {
if (editStatus.value) { if (editStatus.value) {
field.disabled = true field.disabled = true
} else { } else if (field.key !== 'age') {
field.disabled = false field.disabled = false
} }
} }
...@@ -732,10 +709,6 @@ watch( ...@@ -732,10 +709,6 @@ watch(
exportValue: null exportValue: null
}) })
}, 500) }, 500)
// processFormData({
// domdata: secondHolderDomData,
// exportValue: null
// })
} }
} }
) )
......
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