Commit b9c161b7 by yuzhenWang

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

修改新单跟进的供款年期为输入框

See merge request !50
parents b3f69e2e aaa3c2cf
<!-- components/FormPage.vue --> <!-- components/FormPage.vue -->
<template> <template>
<div class="form-page"> <div class="form-page">
<el-form ref="formRef" :model="localData" label-width="120px" size="default"> <el-form ref="formRef" :model="localData" label-width="120px" size="default">
<!-- Tabs --> <!-- Tabs -->
<el-tabs v-model="activeTab" @tab-click="handleTabClick" :before-leave="handleBeforeLeave"> <el-tabs v-model="activeTab" @tab-click="handleTabClick" :before-leave="handleBeforeLeave">
<el-tab-pane label="基础信息" name="basic"></el-tab-pane> <el-tab-pane label="基础信息" name="basic"></el-tab-pane>
<el-tab-pane label="产品计划" name="productPlan"></el-tab-pane> <el-tab-pane label="产品计划" name="productPlan"></el-tab-pane>
<el-tab-pane label="首期缴费" name="firstPayment"></el-tab-pane> <el-tab-pane label="首期缴费" name="firstPayment"></el-tab-pane>
<el-tab-pane label="介绍人" name="introducer"></el-tab-pane> <el-tab-pane label="介绍人" name="introducer"></el-tab-pane>
<el-tab-pane label="邮寄信息" name="postal"></el-tab-pane> <el-tab-pane label="邮寄信息" name="postal"></el-tab-pane>
<el-tab-pane label="关联记录" name="related"></el-tab-pane> <el-tab-pane label="关联记录" name="related"></el-tab-pane>
<el-tab-pane label="附件" name="attachment"></el-tab-pane> <el-tab-pane label="附件" name="attachment"></el-tab-pane>
</el-tabs> </el-tabs>
<!-- 基础信息 Tab 内容 --> <!-- 基础信息 Tab 内容 -->
<div v-if="activeTab === 'basic'" class="tab-content"> <div v-if="activeTab === 'basic'" class="tab-content">
<!-- 签单信息 --> <!-- 签单信息 -->
<div class="section"> <div class="section">
<h3 class="sectionTitle">基础信息</h3> <h3 class="sectionTitle">基础信息</h3>
<SearchForm ref="basicInfoFormRef" :config="basicInfoFormConfig" v-model="basicInfoFormData" /> <SearchForm
</div> ref="basicInfoFormRef"
:config="basicInfoFormConfig"
<!-- 保单信息 --> v-model="basicInfoFormData"
<div class="section"> />
<h3 class="sectionTitle">保单信息</h3> </div>
<SearchForm ref="policyInfoFormRef" :config="policyInfoFormConfig" v-model="policyInfoFormData" />
</div> <!-- 保单信息 -->
<div class="section">
<h3 class="sectionTitle">保单信息</h3>
</div> <SearchForm
<!-- 产品计划 Tab 内容 --> ref="policyInfoFormRef"
<div v-else-if="activeTab === 'productPlan'" class="tab-content"> :config="policyInfoFormConfig"
<!-- 基本计划 --> v-model="policyInfoFormData"
<div class="section"> />
<h3 class="sectionTitle">基本计划</h3> </div>
<SearchForm ref="basicPlanFormRef" :config="basicPlanFormConfig" v-model="basicPlanFormData" </div>
@selectChange="(prop, value, item) => handleSelectChange(prop, value, item, 'basicPlan')" /> <!-- 产品计划 Tab 内容 -->
</div> <div v-else-if="activeTab === 'productPlan'" class="tab-content">
<!-- 基本计划 -->
<!-- 附加计划(可编辑表格) --> <div class="section">
<div class="section"> <h3 class="sectionTitle">基本计划</h3>
<h3 class="sectionTitle">附加计划</h3> <SearchForm
<EditableTable v-model="localData.additionalPlans" :row-config="additionalPlansConfig" ref="basicPlanFormRef"
@batch-save="handleBatchSave" :disabled="props.mode === 'viewDetail'" /> :config="basicPlanFormConfig"
</div> v-model="basicPlanFormData"
</div> @selectChange="
<!-- 首期缴费 Tab 内容 --> (prop, value, item) => handleSelectChange(prop, value, item, 'basicPlan')
<div v-else-if="activeTab === 'firstPayment'" class="tab-content"> "
<!-- 签单信息 --> />
<div class="section"> </div>
<h3 class="sectionTitle">缴费信息</h3>
<SearchForm ref="firstPremiumFormRef" :config="firstPremiumFormConfig" <!-- 附加计划(可编辑表格) -->
v-model="firstPremiumFormData" /> <div class="section">
<h3 class="sectionTitle">首期对账信息</h3> <h3 class="sectionTitle">附加计划</h3>
<el-table :data="firstPremiumTableData" border style="width: 100%"> <EditableTable
<el-table-column prop="createTime" label="申请对账日期" width="180" v-model="localData.additionalPlans"
:formatter="(row, col, val) => formatToDateTime(val, 'YYYY-MM-DD HH:mm:ss')" /> :row-config="additionalPlansConfig"
<el-table-column prop="reconciliationStatus" label="对账状态" width="180" /> @batch-save="handleBatchSave"
<el-table-column prop="paymentMethod" label="缴费方式" width="180" /> :disabled="props.mode === 'viewDetail'"
<el-table-column prop="paymentAmount" label="汇款金额" width="180" /> />
<el-table-column prop="paymentCurrency" label="汇款币种" width="180" /> </div>
<el-table-column prop="recognizedAmount" label="认定金额" width="180" /> </div>
<el-table-column prop="recognizedCurrency" label="认定币种" width="180" /> <!-- 首期缴费 Tab 内容 -->
</el-table> <div v-else-if="activeTab === 'firstPayment'" class="tab-content">
</div> <!-- 签单信息 -->
</div> <div class="section">
<!-- 介绍人 Tab 内容 --> <h3 class="sectionTitle">缴费信息</h3>
<div v-else-if="activeTab === 'introducer'" class="tab-content"> <SearchForm
<!-- 签单信息 --> ref="firstPremiumFormRef"
<div class="section"> :config="firstPremiumFormConfig"
<h3 class="sectionTitle">介绍人信息</h3> v-model="firstPremiumFormData"
<h5>第一位默认是客户主要负责人,客户资料出现在介绍人(主)账号下,其他介绍人不会看到客户信息</h5> />
<EditableTable v-model="introducerTableData" :row-config="introducerConfig" <h3 class="sectionTitle">首期对账信息</h3>
@batch-save="handleBatchSave" :disabled="props.mode === 'viewDetail'" /> <el-table :data="firstPremiumTableData" border style="width: 100%">
</div> <el-table-column
</div> prop="createTime"
<!-- 邮寄信息 Tab 内容 --> label="申请对账日期"
<div v-else-if="activeTab === 'postal'" class="tab-content"> width="180"
<div class="section"> :formatter="(row, col, val) => formatToDateTime(val, 'YYYY-MM-DD HH:mm:ss')"
<h3 class="sectionTitle">邮寄信息</h3> />
<SearchForm ref="postalFormRef" :config="postalFormConfig" v-model="postalFormData" /> <el-table-column prop="reconciliationStatus" label="对账状态" width="180" />
</div> <el-table-column prop="paymentMethod" label="缴费方式" width="180" />
</div> <el-table-column prop="paymentAmount" label="汇款金额" width="180" />
<!-- 关联记录 Tab 内容 --> <el-table-column prop="paymentCurrency" label="汇款币种" width="180" />
<div v-else-if="activeTab === 'related'" class="tab-content"> <el-table-column prop="recognizedAmount" label="认定金额" width="180" />
<div class="section"> <el-table-column prop="recognizedCurrency" label="认定币种" width="180" />
<h3 class="sectionTitle">关联记录</h3> </el-table>
<el-table :data="relatedTableData" border style="width: 100%"> </div>
<el-table-column prop="fnaNo" label="流程编号" width="180" /> </div>
<el-table-column prop="policyNo" label="保单号" width="180" /> <!-- 介绍人 Tab 内容 -->
<el-table-column prop="customerName" label="客户姓名" width="180" /> <div v-else-if="activeTab === 'introducer'" class="tab-content">
<el-table-column prop="createTime" label="创建时间" width="180" <!-- 签单信息 -->
:formatter="(row) => formatToDate(row.createTime)" /> <div class="section">
<el-table-column fixed="right" label="操作" min-width="120"> <h3 class="sectionTitle">介绍人信息</h3>
<template #default> <h5>
<el-button link type="primary" size="small" @click="viewRecordDetail"> 第一位默认是客户主要负责人,客户资料出现在介绍人(主)账号下,其他介绍人不会看到客户信息
查看 </h5>
</el-button> <EditableTable
</template> v-model="introducerTableData"
</el-table-column> :row-config="introducerConfig"
</el-table> @batch-save="handleBatchSave"
</div> :disabled="props.mode === 'viewDetail'"
</div> />
<!-- 附件 Tab 内容 --> </div>
<div v-else-if="activeTab === 'attachment'" class="tab-content"> </div>
<div class="section"> <!-- 邮寄信息 Tab 内容 -->
<h3 class="sectionTitle">附件</h3> <div v-else-if="activeTab === 'postal'" class="tab-content">
<el-button type="primary" @click="fileUploadDialogFlag = true" <div class="section">
:disabled="props.mode === 'viewDetail'"> <h3 class="sectionTitle">邮寄信息</h3>
<el-icon class="el-icon--right"> <SearchForm ref="postalFormRef" :config="postalFormConfig" v-model="postalFormData" />
<Upload /> </div>
</el-icon>上传附件 </div>
</el-button> <!-- 关联记录 Tab 内容 -->
<el-table :data="attachmentTableData" border style="width: 100%"> <div v-else-if="activeTab === 'related'" class="tab-content">
<el-table-column v-for="(column, index) in attachmentTableColumns" :key="index" <div class="section">
:prop="column.prop" :label="column.label" :width="column.width" :sortable="column.sortable" <h3 class="sectionTitle">关联记录</h3>
:formatter="column.formatter" /> <el-table :data="relatedTableData" border style="width: 100%">
<el-table-column fixed="right" label="操作" min-width="120"> <el-table-column prop="fnaNo" label="流程编号" width="180" />
<template #default> <el-table-column prop="policyNo" label="保单号" width="180" />
<el-button link type="primary" size="small" @click="handleClick" <el-table-column prop="customerName" label="客户姓名" width="180" />
:disabled="props.mode === 'viewDetail'"> <el-table-column
修改 prop="createTime"
</el-button><el-button link type="danger" size="small" @click="handleClick" label="创建时间"
:disabled="props.mode === 'viewDetail'"> width="180"
删除 :formatter="row => formatToDate(row.createTime)"
</el-button> />
</template> <el-table-column fixed="right" label="操作" min-width="120">
</el-table-column> <template #default>
</el-table> <el-button link type="primary" size="small" @click="viewRecordDetail">
</div> 查看
</div> </el-button>
<!-- 其他 Tab 占位(你可以按需填充) --> </template>
<div v-else class="tab-placeholder"> </el-table-column>
<el-empty description="该 Tab 内容待开发" /> </el-table>
</div> </div>
<!-- 底部按钮 --> </div>
<div class="form-footer"> <!-- 附件 Tab 内容 -->
<el-button size="default" @click="handleCancel">取消</el-button> <div v-else-if="activeTab === 'attachment'" class="tab-content">
<el-button type="primary" size="default" @click="handleSubmit">确认</el-button> <div class="section">
</div> <h3 class="sectionTitle">附件</h3>
</el-form> <el-button
type="primary"
<CommonDialog dialogTitle='文件导入' dialogWidth='80%' :openDialog=fileUploadDialogFlag :showAction='true' @click="fileUploadDialogFlag = true"
:showClose='true' @close='fileUploadDialogFlag = false; files = ""' :disabled="props.mode === 'viewDetail'"
@confirm='fileUploadDialogFlag = false; files = ""'> >
<FileUpload v-model="files" :data="{ obiectTableName: 'policy_follow', objectBizId: props.policyBizId }" <el-icon class="el-icon--right"> <Upload /> </el-icon>上传附件
:file-type="['xlsx', 'xls', 'doc', 'docx', 'pdf', 'txt', 'jpg', 'jpeg', 'png', 'gif']" </el-button>
:action="'/oss/api/oss/batch/upload'" :limit="10" :fileSize="15" :name="'files'" <el-table :data="attachmentTableData" border style="width: 100%">
@uploadEnd="handleUploadEnd" /> <el-table-column
</CommonDialog> v-for="(column, index) in attachmentTableColumns"
</div> :key="index"
:prop="column.prop"
:label="column.label"
:width="column.width"
:sortable="column.sortable"
:formatter="column.formatter"
/>
<el-table-column fixed="right" label="操作" min-width="120">
<template #default>
<el-button
link
type="primary"
size="small"
@click="handleClick"
:disabled="props.mode === 'viewDetail'"
>
修改 </el-button
><el-button
link
type="danger"
size="small"
@click="handleClick"
:disabled="props.mode === 'viewDetail'"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 其他 Tab 占位(你可以按需填充) -->
<div v-else class="tab-placeholder">
<el-empty description="该 Tab 内容待开发" />
</div>
<!-- 底部按钮 -->
<div class="form-footer">
<el-button size="default" @click="handleCancel">取消</el-button>
<el-button type="primary" size="default" @click="handleSubmit">确认</el-button>
</div>
</el-form>
<CommonDialog
dialogTitle="文件导入"
dialogWidth="80%"
:openDialog="fileUploadDialogFlag"
:showAction="true"
:showClose="true"
@close="((fileUploadDialogFlag = false), (files = ''))"
@confirm="((fileUploadDialogFlag = false), (files = ''))"
>
<FileUpload
v-model="files"
:data="{ obiectTableName: 'policy_follow', objectBizId: props.policyBizId }"
:file-type="['xlsx', 'xls', 'doc', 'docx', 'pdf', 'txt', 'jpg', 'jpeg', 'png', 'gif']"
:action="'/oss/api/oss/batch/upload'"
:limit="10"
:fileSize="15"
:name="'files'"
@uploadEnd="handleUploadEnd"
/>
</CommonDialog>
</div>
</template> </template>
<script setup> <script setup>
...@@ -168,643 +230,702 @@ import EditableTable from '@/components/csf-common/EditableTable.vue' ...@@ -168,643 +230,702 @@ import EditableTable from '@/components/csf-common/EditableTable.vue'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
proxy.useDictLists(['sys_no_yes', 'csf_ap_frequency', 'bx_currency_type', 'csf_ap_first_issue', 'csf_ap_dividend', 'csf_fortune_status', 'csf_ap_mailing_method', 'receipt_status']) proxy.useDictLists([
'sys_no_yes',
'csf_ap_frequency',
'bx_currency_type',
'csf_ap_first_issue',
'csf_ap_dividend',
'csf_fortune_status',
'csf_ap_mailing_method',
'receipt_status'
])
const router = useRouter() const router = useRouter()
const userStore = useUserStore() const userStore = useUserStore()
const files = ref('') const files = ref('')
const fileUploadDialogFlag = ref(false) const fileUploadDialogFlag = ref(false)
// 记录每个 tab 是否有未保存的修改(dirty 状态) // 记录每个 tab 是否有未保存的修改(dirty 状态)
const tabDirty = ref({ const tabDirty = ref({
basic: false, basic: false,
productPlan: false, productPlan: false,
firstPayment: false, firstPayment: false,
introducer: false, introducer: false,
postal: false, postal: false,
related: false, related: false,
attachment: false attachment: false
}) })
// ===== Props & Emits ===== // ===== Props & Emits =====
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
mode: { mode: {
type: String, type: String,
default: 'viewDetail' default: 'viewDetail'
}, },
policyBizId: { policyBizId: {
type: String, type: String,
default: '' default: ''
} }
}) })
const emit = defineEmits(['update:modelValue', 'submit', 'cancel', 'saveRow']) const emit = defineEmits(['update:modelValue', 'submit', 'cancel', 'saveRow'])
const introducerTableData = ref([]) const introducerTableData = ref([])
const introducerConfig = [ const introducerConfig = [
{ {
type: 'select', type: 'select',
prop: 'brokerBizId', prop: 'brokerBizId',
label: '转介人', label: '转介人',
api: '/insurance/base/api/userSaleExpand/page', api: '/insurance/base/api/userSaleExpand/page',
keywordField: 'realName', keywordField: 'realName',
requestParams: { pageNo: 1, pageSize: 20 }, requestParams: { pageNo: 1, pageSize: 20 },
placeholder: '输入转介人名称搜索', placeholder: '输入转介人名称搜索',
debounceWait: 500, // 自定义防抖时间 debounceWait: 500, // 自定义防抖时间
onChangeExtraFields: { onChangeExtraFields: {
broker: 'realName',// 选中后自动填 broker = raw.realName broker: 'realName', // 选中后自动填 broker = raw.realName
brokerName: 'realName', brokerName: 'realName',
internalCode: 'code', internalCode: 'code',
team: 'teamName', team: 'teamName',
phone: 'phone', phone: 'phone'
},
transform: (res) => {
return (res?.data.records || []).map(item => ({
value: item.clientUserBizId,
label: item.realName,
...item
}))
},
},
// {
// type: 'select',
// prop: 'gender',
// label: '性别',
// span: 4,
// options: [
// { value: 'male', label: '男' },
// { value: 'female', label: '女' }
// ]
// },
{
type: 'input',
prop: 'phone',
label: '手机号码',
span: 4,
disabled: true
},
{
type: 'input',
prop: 'internalCode',
label: '内部编号',
span: 4,
disabled: true
},
{
type: 'input',
prop: 'team',
label: '所属团队',
span: 4,
disabled: true
}, {
type: 'input',
prop: 'brokerRatio',
label: '分配比例%',
span: 4,
inputType: 'integer',
rules: [
{ required: true, message: '请输入比例' },
{
validator: (rule, value, cb) => {
const n = Number(value)
if (isNaN(n) || n < 0 || n > 100) cb(new Error('0~100'))
else cb()
}
}
]
}, {
type: 'textarea',
prop: 'remark',
label: '备注',
span: 4
}, },
transform: res => {
return (res?.data.records || []).map(item => ({
value: item.clientUserBizId,
label: item.realName,
...item
}))
}
},
// {
// type: 'select',
// prop: 'gender',
// label: '性别',
// span: 4,
// options: [
// { value: 'male', label: '男' },
// { value: 'female', label: '女' }
// ]
// },
{
type: 'input',
prop: 'phone',
label: '手机号码',
span: 4,
disabled: true
},
{
type: 'input',
prop: 'internalCode',
label: '内部编号',
span: 4,
disabled: true
},
{
type: 'input',
prop: 'team',
label: '所属团队',
span: 4,
disabled: true
},
{
type: 'input',
prop: 'brokerRatio',
label: '分配比例%',
span: 4,
inputType: 'integer',
rules: [
{ required: true, message: '请输入比例' },
{
validator: (rule, value, cb) => {
const n = Number(value)
if (isNaN(n) || n < 0 || n > 100) cb(new Error('0~100'))
else cb()
}
}
]
},
{
type: 'textarea',
prop: 'remark',
label: '备注',
span: 4
}
] ]
// 附加计划表格 // 附加计划表格
const additionalPlansConfig = [ const additionalPlansConfig = [
{ {
type: 'input', type: 'input',
prop: 'product', prop: 'product',
label: '产品名称', label: '产品名称',
span: 4, span: 4
}, { },
type: 'input', {
prop: 'frequency', type: 'input',
label: '付款频率', prop: 'frequency',
span: 4, label: '付款频率',
}, { span: 4
type: 'input', },
prop: 'term', {
label: '保障期限', type: 'input',
span: 4, prop: 'term',
}, { label: '保障期限',
type: 'input', span: 4
prop: 'phone', },
label: '付款频率', {
span: 4, type: 'input',
}, { prop: 'phone',
type: 'input', label: '付款频率',
prop: 'periods', span: 4
label: '供款期数', },
span: 4, {
}, { type: 'input',
type: 'input', prop: 'periods',
prop: 'currency', label: '供款期数',
label: '保单币种', span: 4
span: 4, },
}, { {
type: 'input', type: 'input',
prop: 'premium', prop: 'currency',
label: '每期保费', label: '保单币种',
span: 4, span: 4
}, { },
type: 'input', {
prop: 'fee', type: 'input',
label: '保单征费', prop: 'premium',
span: 4, label: '每期保费',
}, span: 4
},
{
type: 'input',
prop: 'fee',
label: '保单征费',
span: 4
}
] ]
function handleBatchSave(validRows) { function handleBatchSave(validRows) {
console.log('批量提交:', validRows) console.log('批量提交:', validRows)
// 调用 API // 调用 API
introducerTableData.value = validRows introducerTableData.value = validRows
} }
function applyViewMode(fields, mode) { function applyViewMode(fields, mode) {
if (mode === 'viewDetail') { if (mode === 'viewDetail') {
return fields.map(item => ({
return fields.map(item => ({ ...item,
...item, disabled: true
disabled: true }))
})); }
} // 非查看模式:保留原对象,可选择性移除 disabled
// 非查看模式:保留原对象,可选择性移除 disabled return fields.map(item => {
return fields.map(item => { // 如果你希望编辑模式下完全不禁用,可以删除 disabled 属性
// 如果你希望编辑模式下完全不禁用,可以删除 disabled 属性 const newItem = { ...item }
const newItem = { ...item }; delete newItem.disabled
delete newItem.disabled; return newItem
return newItem; })
});
} }
const newOrderData = ref({}) const newOrderData = ref({})
const basicInfoFormRef = ref() const basicInfoFormRef = ref()
const basicInfoFormData = ref({}) const basicInfoFormData = ref({})
const basicInfoFormConfig = ref([ const basicInfoFormConfig = ref([
{ {
type: 'date', type: 'date',
prop: 'signDate', prop: 'signDate',
label: '签单日', label: '签单日'
}, { },
type: 'select', {
prop: 'signer', type: 'select',
label: '签单员', prop: 'signer',
api: '/insurance/base/api/userSignExpand/page', label: '签单员',
keywordField: 'realName', api: '/insurance/base/api/userSignExpand/page',
requestParams: { pageNo: 1, pageSize: 20 }, keywordField: 'realName',
placeholder: '输入签单员姓名搜索', requestParams: { pageNo: 1, pageSize: 20 },
debounceWait: 500, // 自定义防抖时间 placeholder: '输入签单员姓名搜索',
onChangeExtraFields: { debounceWait: 500, // 自定义防抖时间
signerBizId: 'userSignBizId', onChangeExtraFields: {
practiceCode: 'practiceCode', signerBizId: 'userSignBizId',
}, practiceCode: 'practiceCode'
valueKey: 'realName',
labelKey: 'realName',
transform: (res) => {
return res?.data.records || []
},
rules: [
{ required: true, message: '请选择签单员', trigger: 'blur' },
],
}, {
type: 'input',
prop: 'practiceCode',
label: '签单员执业编号',
}, {
type: 'select',
prop: 'signLocation',
label: '签单地点',
dictType: 'csf_ap_meeting_point',
}, },
valueKey: 'realName',
labelKey: 'realName',
transform: res => {
return res?.data.records || []
},
rules: [{ required: true, message: '请选择签单员', trigger: 'blur' }]
},
{
type: 'input',
prop: 'practiceCode',
label: '签单员执业编号'
},
{
type: 'select',
prop: 'signLocation',
label: '签单地点',
dictType: 'csf_ap_meeting_point'
}
]) ])
// 保单信息 // 保单信息
const policyInfoFormRef = ref() const policyInfoFormRef = ref()
const policyInfoFormData = ref({}) const policyInfoFormData = ref({})
const policyInfoFormConfig = ref([ const policyInfoFormConfig = ref([
{ {
type: 'input', type: 'input',
prop: 'policyNo', prop: 'policyNo',
label: '保单号', label: '保单号'
}, { },
type: 'date', {
prop: 'effectiveDate', type: 'date',
label: '保单生效日', prop: 'effectiveDate',
}, { label: '保单生效日'
type: 'date', },
prop: 'policyExpirationDate', {
label: '保单截止日', type: 'date',
}, { prop: 'policyExpirationDate',
type: 'date', label: '保单截止日'
prop: 'underwritingDate', },
label: '保单核保日', {
}, { type: 'date',
type: 'date', prop: 'underwritingDate',
prop: 'receiptDate', label: '保单核保日'
label: '保单回执日', },
}, { {
type: 'select', type: 'date',
prop: 'receiptStatus', prop: 'receiptDate',
label: '回执状态', label: '保单回执日'
dictType: 'receipt_status', },
}, { {
type: 'select', type: 'select',
prop: 'directPaymentEnabled', prop: 'receiptStatus',
label: '是否开通直接支付', label: '回执状态',
dictType: 'sys_no_yes', dictType: 'receipt_status'
}, { },
type: 'input', {
prop: 'policyHolder', type: 'select',
label: '保单持有人', prop: 'directPaymentEnabled',
}, { label: '是否开通直接支付',
type: 'input', dictType: 'sys_no_yes'
prop: 'insured', },
label: '保单受保人', {
}, { type: 'input',
type: 'input', prop: 'policyHolder',
prop: 'insuredAge', label: '保单持有人'
label: '受保人年龄', },
}, { {
type: 'input', type: 'input',
prop: 'gracePeriod', prop: 'insured',
label: '宽限期(天)', label: '保单受保人'
inputType: 'decimal', },
rules: [ {
{ pattern: /^\d+$/, message: '只能输入正整数', trigger: 'blur' } type: 'input',
] prop: 'insuredAge',
}, { label: '受保人年龄'
type: 'select', },
prop: 'isJoin', {
label: '是否参加递增保障权益', type: 'input',
dictType: 'sys_no_yes', prop: 'gracePeriod',
}, label: '宽限期(天)',
inputType: 'decimal',
rules: [{ pattern: /^\d+$/, message: '只能输入正整数', trigger: 'blur' }]
},
{
type: 'select',
prop: 'isJoin',
label: '是否参加递增保障权益',
dictType: 'sys_no_yes'
}
]) ])
// 基本计划 // 基本计划
const basicPlanFormRef = ref() const basicPlanFormRef = ref()
const basicPlanFormData = ref({}) const basicPlanFormData = ref({})
const basicPlanFormConfig = ref([ const basicPlanFormConfig = ref([
{ {
type: 'select', type: 'select',
prop: 'insuranceCompanyBizId', prop: 'insuranceCompanyBizId',
label: '保险公司', label: '保险公司',
api: '/insurance/base/api/insuranceCompany/page', api: '/insurance/base/api/insuranceCompany/page',
keywordField: 'queryContent', keywordField: 'queryContent',
requestParams: { pageNo: 1, pageSize: 500 }, requestParams: { pageNo: 1, pageSize: 500 },
placeholder: '输入保险公司名称搜索', placeholder: '输入保险公司名称搜索',
debounceWait: 500, // 自定义防抖时间 debounceWait: 500, // 自定义防抖时间
valueKey: 'insuranceCompanyBizId', valueKey: 'insuranceCompanyBizId',
labelKey: 'fullName', labelKey: 'fullName',
transform: (res) => { transform: res => {
return res?.data.records || [] return res?.data.records || []
},
onChangeExtraFields: {
insuranceCompany: 'fullName',
},
}, {
type: 'select',
prop: 'productCate',
label: '保险险种',
api: '/insurance/base/api/insuranceCategory/page',
keywordField: 'name',
requestParams: { pageNo: 1, pageSize: 20 },
placeholder: '输入保险险种名称搜索',
debounceWait: 500, // 自定义防抖时间
valueKey: 'insuranceCategoryBizId',
labelKey: 'name',
transform: (res) => {
return res?.data.records || []
},
onChangeExtraFields: {
insuranceCategoryCode: 'code',
},
}, },
{ onChangeExtraFields: {
type: 'select', insuranceCompany: 'fullName'
prop: 'productName', }
label: '产品名称', },
api: '/product/api/relProjectProductLaunch/parameter/page', {
keywordField: 'productName', type: 'select',
requestParams: () => ({ prop: 'productCate',
tenantBizId: userStore.projectInfo.tenantBizId, label: '保险险种',
projectBizId: userStore.projectInfo.projectBizId, api: '/insurance/base/api/insuranceCategory/page',
fieldBizId: 'field_olk1qZe81qHHKXbw', keywordField: 'name',
fieldValueBizId: 'field_value_uOfJH5ucA2YwJpbn', requestParams: { pageNo: 1, pageSize: 20 },
// ✅ 确认这里用的是正确的字段(code 或 bizId) placeholder: '输入保险险种名称搜索',
categoryCodeList: [basicPlanFormData.value.insuranceCategoryCode || ''], debounceWait: 500, // 自定义防抖时间
insuranceCompanyBizIdList: [basicPlanFormData.value.insuranceCompanyBizId || ''], valueKey: 'insuranceCategoryBizId',
pageNo: 1, labelKey: 'name',
pageSize: 20 transform: res => {
}), return res?.data.records || []
placeholder: '请选择产品名称',
debounceWait: 500,
valueKey: 'productName',
labelKey: 'productName',
transform: (res) => {
console.log('======子组件选择选项后,父组件接收的值 :', res?.data.records || [])
return res?.data.records || []
},
onChangeExtraFields: {
apiAttributeSettingDtoList: 'apiAttributeSettingDtoList',
productLaunchBizId: 'productLaunchBizId',
insuranceCategoryCode: 'code',
// 如果需要,也可以回填其他字段
},
}, },
{ onChangeExtraFields: {
type: 'select', insuranceCategoryCode: 'code'
prop: 'paymentFrequency', }
label: '付款频率', },
dictType: 'csf_ap_frequency', {
}, { type: 'select',
type: 'input', prop: 'productName',
prop: 'guaranteePeriod', label: '产品名称',
label: '保障期限', api: '/product/api/relProjectProductLaunch/parameter/page',
}, { keywordField: 'productName',
type: 'input', requestParams: () => ({
prop: 'sumInsured', tenantBizId: userStore.projectInfo.tenantBizId,
label: '保额(重疾险)', projectBizId: userStore.projectInfo.projectBizId,
}, { fieldBizId: 'field_olk1qZe81qHHKXbw',
type: 'select', fieldValueBizId: 'field_value_uOfJH5ucA2YwJpbn',
prop: 'issueNumber', // ✅ 确认这里用的是正确的字段(code 或 bizId)
label: '供款期数', categoryCodeList: [basicPlanFormData.value.insuranceCategoryCode || ''],
}, { insuranceCompanyBizIdList: [basicPlanFormData.value.insuranceCompanyBizId || ''],
type: 'select', pageNo: 1,
prop: 'policyCurrency', pageSize: 20
label: '保单币种', }),
dictType: 'bx_currency_type' placeholder: '请选择产品名称',
}, { debounceWait: 500,
type: 'input', valueKey: 'productName',
prop: 'initialPremium', labelKey: 'productName',
label: '每期保费', transform: res => {
inputType: 'decimal', console.log('======子组件选择选项后,父组件接收的值 :', res?.data.records || [])
decimalDigits: 2, return res?.data.records || []
visible: (formData) => formData.commissionBizType == 'R',
rules: [
{ required: true, message: '请输入金额', trigger: 'blur' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
]
}, {
type: 'input',
prop: 'policyLevy',
label: '保单征费',
inputType: 'decimal',
decimalDigits: 2,
visible: (formData) => formData.commissionBizType == 'R',
rules: [
{ required: true, message: '请输入金额', trigger: 'blur' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
]
}, {
type: 'select',
prop: 'isPrepay',
label: '是否预缴',
dictType: 'sys_no_yes'
}, {
type: 'select',
prop: 'isTraceable',
label: '是否追溯',
dictType: 'sys_no_yes'
}, {
type: 'date',
prop: 'retroactiveDate',
label: '回溯日期',
}, {
type: 'select',
prop: 'initialPaymentMethod',
label: '首期付款方式',
dictType: 'csf_ap_first_issue'
}, {
type: 'select',
prop: 'renewalPaymentMethod',
label: '续期付款方式',
dictType: 'csf_ap_first_issue'
}, {
type: 'select',
prop: 'dividendDistributionMethod',
label: '红利付款方式',
dictType: 'csf_ap_dividend'
}, },
onChangeExtraFields: {
apiAttributeSettingDtoList: 'apiAttributeSettingDtoList',
productLaunchBizId: 'productLaunchBizId',
insuranceCategoryCode: 'code'
// 如果需要,也可以回填其他字段
}
},
{
type: 'select',
prop: 'paymentFrequency',
label: '付款频率',
dictType: 'csf_ap_frequency'
},
{
type: 'input',
prop: 'guaranteePeriod',
label: '保障期限'
},
{
type: 'input',
prop: 'sumInsured',
label: '保额(重疾险)'
},
{
type: 'input',
prop: 'issueNumber',
label: '供款期数',
inputType: 'decimal'
},
{
type: 'select',
prop: 'policyCurrency',
label: '保单币种',
dictType: 'bx_currency_type'
},
{
type: 'input',
prop: 'initialPremium',
label: '每期保费',
inputType: 'decimal',
decimalDigits: 2,
visible: formData => formData.commissionBizType == 'R',
rules: [
{ required: true, message: '请输入金额', trigger: 'blur' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
]
},
{
type: 'input',
prop: 'policyLevy',
label: '保单征费',
inputType: 'decimal',
decimalDigits: 2,
visible: formData => formData.commissionBizType == 'R',
rules: [
{ required: true, message: '请输入金额', trigger: 'blur' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
]
},
{
type: 'select',
prop: 'isPrepay',
label: '是否预缴',
dictType: 'sys_no_yes'
},
{
type: 'select',
prop: 'isTraceable',
label: '是否追溯',
dictType: 'sys_no_yes'
},
{
type: 'date',
prop: 'retroactiveDate',
label: '回溯日期'
},
{
type: 'select',
prop: 'initialPaymentMethod',
label: '首期付款方式',
dictType: 'csf_ap_first_issue'
},
{
type: 'select',
prop: 'renewalPaymentMethod',
label: '续期付款方式',
dictType: 'csf_ap_first_issue'
},
{
type: 'select',
prop: 'dividendDistributionMethod',
label: '红利付款方式',
dictType: 'csf_ap_dividend'
}
]) ])
// 首期保费 // 首期保费
const firstPremiumTableData = ref([]) const firstPremiumTableData = ref([])
const firstPremiumFormRef = ref() const firstPremiumFormRef = ref()
const firstPremiumFormData = ref({}) const firstPremiumFormData = ref({})
const firstPremiumFormConfig = ref([ const firstPremiumFormConfig = ref([
{ {
type: 'input', type: 'input',
prop: 'initialPremium', prop: 'initialPremium',
label: '首期保费', label: '首期保费',
inputType: 'decimal', inputType: 'decimal',
decimalDigits: 2, decimalDigits: 2,
rules: [ rules: [
{ required: true, message: '请输入金额', trigger: 'blur' }, { required: true, message: '请输入金额', trigger: 'blur' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' } { pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
] ]
}, { },
type: 'input', {
prop: 'policyLevy', type: 'input',
label: '保单征费', prop: 'policyLevy',
inputType: 'decimal', label: '保单征费',
decimalDigits: 2, inputType: 'decimal',
rules: [ decimalDigits: 2,
{ required: true, message: '请输入金额', trigger: 'blur' }, rules: [
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' } { required: true, message: '请输入金额', trigger: 'blur' },
] { pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
}, { ]
type: 'select', },
prop: 'initialPaymentMethod', {
label: '首期缴费方式', type: 'select',
dictType: 'csf_ap_first_issue' prop: 'initialPaymentMethod',
}, { label: '首期缴费方式',
type: 'input', dictType: 'csf_ap_first_issue'
prop: 'initialPremiumPaid', },
label: '首期已缴保费', {
inputType: 'decimal', type: 'input',
decimalDigits: 2, prop: 'initialPremiumPaid',
rules: [ label: '首期已缴保费',
{ required: true, message: '请输入金额', trigger: 'blur' }, inputType: 'decimal',
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' } decimalDigits: 2,
] rules: [
}, { { required: true, message: '请输入金额', trigger: 'blur' },
type: 'input', { pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
prop: 'initialPremiumDue', ]
label: '首期待缴保费', },
inputType: 'decimal', {
decimalDigits: 2, type: 'input',
rules: [ prop: 'initialPremiumDue',
{ required: true, message: '请输入金额', trigger: 'blur' }, label: '首期待缴保费',
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' } inputType: 'decimal',
] decimalDigits: 2,
}, { rules: [
type: 'input', { required: true, message: '请输入金额', trigger: 'blur' },
prop: 'initialPremiumTotal', { pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
label: '首期缴费总额', ]
inputType: 'decimal', },
decimalDigits: 2, {
rules: [ type: 'input',
{ required: true, message: '请输入金额', trigger: 'blur' }, prop: 'initialPremiumTotal',
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' } label: '首期缴费总额',
] inputType: 'decimal',
}, decimalDigits: 2,
// { rules: [
// type: 'select', { required: true, message: '请输入金额', trigger: 'blur' },
// prop: 'initialPaymentStatus', { pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
// label: '缴费状态', ]
// multiple: true, },
// dictType: 'reconciliation_status' // {
// }, // type: 'select',
{ // prop: 'initialPaymentStatus',
type: 'date', // label: '缴费状态',
prop: 'latestPaymentDate', // multiple: true,
label: '最晚缴费日', // dictType: 'reconciliation_status'
placeholder: '请选择' // },
}, { {
type: 'input', type: 'date',
prop: 'initialPremiumDiscount', prop: 'latestPaymentDate',
label: '首期保费优惠金额', label: '最晚缴费日',
inputType: 'decimal', placeholder: '请选择'
decimalDigits: 2, },
rules: [ {
{ required: true, message: '请输入金额', trigger: 'blur' }, type: 'input',
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' } prop: 'initialPremiumDiscount',
] label: '首期保费优惠金额',
}, inputType: 'decimal',
decimalDigits: 2,
rules: [
{ required: true, message: '请输入金额', trigger: 'blur' },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '最多两位小数', trigger: 'blur' }
]
}
]) ])
// 邮寄信息 // 邮寄信息
const postalFormRef = ref(null) const postalFormRef = ref(null)
const postalFormData = ref({}) const postalFormData = ref({})
const postalFormConfig = ref([ const postalFormConfig = ref([
{ {
type: 'select', type: 'select',
prop: 'mailingMethod', prop: 'mailingMethod',
label: '寄送方式', label: '寄送方式',
dictType: 'csf_mailing_method' dictType: 'csf_mailing_method'
}, { },
type: 'input', {
prop: 'deliveryNo', type: 'input',
label: '快递单号', prop: 'deliveryNo',
visible: (formData) => formData.mailingMethod == '2' label: '快递单号',
}, { visible: formData => formData.mailingMethod == '2'
type: 'date', },
prop: 'brokerSignDate', {
label: '我司签收日', type: 'date',
rules: [ prop: 'brokerSignDate',
{ required: true, message: '请输入我司签收日', trigger: 'blur' } label: '我司签收日',
] rules: [{ required: true, message: '请输入我司签收日', trigger: 'blur' }]
}, { },
type: 'date', {
prop: 'customerSignDate', type: 'date',
label: '客户签收日', prop: 'customerSignDate',
rules: [ label: '客户签收日',
{ required: true, message: '请输入客户签收日', trigger: 'blur' } rules: [{ required: true, message: '请输入客户签收日', trigger: 'blur' }]
] }
},
]) ])
// 关联记录 // 关联记录
const relatedTableData = ref([]) const relatedTableData = ref([])
const attachmentTableData = ref([]) const attachmentTableData = ref([])
const attachmentTableColumns = ref([ const attachmentTableColumns = ref([
{ prop: 'originalName', label: '文件名', sortable: true, width: '150', formatter: (row) => row.originalName || '-' }, {
{ prop: 'fileType', label: '文件类型', sortable: true, width: '150', formatter: (row) => row.fileType || '-' }, prop: 'originalName',
{ prop: 'createTime', label: '上传时间', sortable: true, width: '150', formatter: (row) => row.createTime || '-' }, label: '文件名',
{ prop: 'creatorName', label: '上传人', sortable: true, width: '150', formatter: (row) => row.creatorName || '-' }, sortable: true,
width: '150',
formatter: row => row.originalName || '-'
},
{
prop: 'fileType',
label: '文件类型',
sortable: true,
width: '150',
formatter: row => row.fileType || '-'
},
{
prop: 'createTime',
label: '上传时间',
sortable: true,
width: '150',
formatter: row => row.createTime || '-'
},
{
prop: 'creatorName',
label: '上传人',
sortable: true,
width: '150',
formatter: row => row.creatorName || '-'
}
]) ])
// ===== 本地响应式数据 ===== // ===== 本地响应式数据 =====
const defaultFormData = () => ({}) const defaultFormData = () => ({})
// ✅ 使用 ref 而不是 reactive // ✅ 使用 ref 而不是 reactive
const localData = ref(defaultFormData()) const localData = ref(defaultFormData())
// ✅ 只在挂载时初始化一次(避免 watch 形成闭环) // ✅ 只在挂载时初始化一次(避免 watch 形成闭环)
onMounted(async () => { onMounted(async () => {
if (props.modelValue) { if (props.modelValue) {
console.log('🚀 父组件 props.modelValue 挂载时:', props.modelValue) console.log('🚀 父组件 props.modelValue 挂载时:', props.modelValue)
// 深拷贝 + 合并默认值,防止缺失字段 // 深拷贝 + 合并默认值,防止缺失字段
localData.value = { ...defaultFormData(), ...props.modelValue } localData.value = { ...defaultFormData(), ...props.modelValue }
} }
try { try {
getPolicyfollowDetail()
getPolicyfollowDetail() } catch (error) {
} catch (error) { console.error('字典加载失败', error)
console.error('字典加载失败', error) } finally {
} finally { }
// 应用查看模式到基本信息表格
} basicInfoFormConfig.value = basicInfoFormConfig
// 应用查看模式到基本信息表格 ? applyViewMode(basicInfoFormConfig.value, props.mode)
basicInfoFormConfig.value = basicInfoFormConfig ? applyViewMode(basicInfoFormConfig.value, props.mode) : [] : []
policyInfoFormConfig.value = policyInfoFormConfig ? applyViewMode(policyInfoFormConfig.value, props.mode) : [] policyInfoFormConfig.value = policyInfoFormConfig
? applyViewMode(policyInfoFormConfig.value, props.mode)
: []
}) })
// 监听基本信息(basic) // 监听基本信息(basic)
watch( watch(
[ [basicInfoFormData, policyInfoFormData],
basicInfoFormData, () => {
policyInfoFormData, tabDirty.value.basic = true
], },
() => { { deep: true }
tabDirty.value.basic = true
},
{ deep: true }
) )
// 监听首期保费(firstPayment) // 监听首期保费(firstPayment)
watch( watch(
firstPremiumFormData, firstPremiumFormData,
() => { () => {
tabDirty.value.firstPayment = true tabDirty.value.firstPayment = true
}, },
{ deep: true } { deep: true }
) )
// 监听邮寄信息 // 监听邮寄信息
watch( watch(
postalFormData, postalFormData,
() => { () => {
tabDirty.value.postal = true tabDirty.value.postal = true
}, },
{ deep: true }) { deep: true }
)
// 监听基本计划(productPlan) // 监听基本计划(productPlan)
watch( watch(
basicPlanFormData, basicPlanFormData,
() => { () => {
tabDirty.value.productPlan = true tabDirty.value.productPlan = true
}, },
{ deep: true } { deep: true }
) )
// ✅ 监听 localData 变化,emit 出去(用于 v-model) // ✅ 监听 localData 变化,emit 出去(用于 v-model)
watch( watch(
() => localData.value, () => localData.value,
(newVal) => { newVal => {
console.log('========父组件监测的localData:', newVal) console.log('========父组件监测的localData:', newVal)
emit('update:modelValue', newVal) emit('update:modelValue', newVal)
}, },
{ deep: true } { deep: true }
) )
// ===== 表单引用 & 验证规则 ===== // ===== 表单引用 & 验证规则 =====
const formRef = ref() const formRef = ref()
...@@ -813,293 +934,303 @@ const activeTab = ref('basic') ...@@ -813,293 +934,303 @@ const activeTab = ref('basic')
// ✅ 新增:切换前确认 // ✅ 新增:切换前确认
// ======================== // ========================
const handleBeforeLeave = async (newTabName, oldTabName) => { const handleBeforeLeave = async (newTabName, oldTabName) => {
console.log('切换前确认-----------------------', newTabName, oldTabName) console.log('切换前确认-----------------------', newTabName, oldTabName)
if (tabDirty.value[oldTabName]) { if (tabDirty.value[oldTabName]) {
try { try {
await ElMessageBox.confirm( await ElMessageBox.confirm(`“${getTabLabel(oldTabName)}” 未提交,确定要切换吗?`, '提示', {
`“${getTabLabel(oldTabName)}” 未提交,确定要切换吗?`, confirmButtonText: '继续切换',
'提示', cancelButtonText: '取消',
{ type: 'warning'
confirmButtonText: '继续切换', })
cancelButtonText: '取消', return true // 允许切换
type: 'warning' } catch {
} return false // 阻止切换
)
return true // 允许切换
} catch {
return false // 阻止切换
}
} }
return true // 无未保存内容,允许切换 }
return true // 无未保存内容,允许切换
} }
const getTabLabel = (name) => { const getTabLabel = name => {
const labels = { const labels = {
basic: '基础信息', basic: '基础信息',
productPlan: '产品计划', productPlan: '产品计划',
firstPayment: '首期缴费', firstPayment: '首期缴费',
introducer: '介绍人', introducer: '介绍人',
postal: '邮寄信息', postal: '邮寄信息',
related: '关联记录', related: '关联记录',
attachment: '附件' attachment: '附件'
} }
return labels[name] || name return labels[name] || name
} }
const handleTabClick = (tab) => { const handleTabClick = tab => {
if (tab.props.name === 'firstPayment') { if (tab.props.name === 'firstPayment') {
firstPremiumFormConfig.value = firstPremiumFormConfig ? applyViewMode(firstPremiumFormConfig.value, props.mode) : [] firstPremiumFormConfig.value = firstPremiumFormConfig
if (!policyInfoFormData.value.policyNo) return ? applyViewMode(firstPremiumFormConfig.value, props.mode)
getPremiumReconciliationList(policyInfoFormData.value.policyNo) : []
} else if (tab.props.name === 'postal') { if (!policyInfoFormData.value.policyNo) return
postalFormConfig.value = postalFormConfig ? applyViewMode(postalFormConfig.value, props.mode) : [] getPremiumReconciliationList(policyInfoFormData.value.policyNo)
} else if (tab.props.name === 'related') { } else if (tab.props.name === 'postal') {
getRelationRecord(newOrderData.value.fnaBizId) postalFormConfig.value = postalFormConfig
} else if (tab.props.name === 'attachment') { ? applyViewMode(postalFormConfig.value, props.mode)
getAttachmentListDetail(newOrderData.value.policyBizId) : []
} else if (tab.props.name === 'productPlan') { } else if (tab.props.name === 'related') {
basicPlanFormConfig.value = basicPlanFormConfig ? applyViewMode(basicPlanFormConfig.value, props.mode) : [] getRelationRecord(newOrderData.value.fnaBizId)
} else if (tab.props.name === 'introducer') { } else if (tab.props.name === 'attachment') {
// introducerConfig.value = introducerConfig ? applyViewMode(introducerConfig.value, props.mode) : [] getAttachmentListDetail(newOrderData.value.policyBizId)
} else if (tab.props.name === 'basic') { } else if (tab.props.name === 'productPlan') {
basicInfoFormConfig.value = basicInfoFormConfig ? applyViewMode(basicInfoFormConfig.value, props.mode) : [] basicPlanFormConfig.value = basicPlanFormConfig
} ? applyViewMode(basicPlanFormConfig.value, props.mode)
: []
} else if (tab.props.name === 'introducer') {
// introducerConfig.value = introducerConfig ? applyViewMode(introducerConfig.value, props.mode) : []
} else if (tab.props.name === 'basic') {
basicInfoFormConfig.value = basicInfoFormConfig
? applyViewMode(basicInfoFormConfig.value, props.mode)
: []
}
} }
const handleSubmit = () => { const handleSubmit = () => {
formRef.value?.validate((valid) => { formRef.value?.validate(valid => {
if (valid) { if (valid) {
console.log('提交数据', introducerTableData.value) console.log('提交数据', introducerTableData.value)
if (activeTab.value === 'postal') { if (activeTab.value === 'postal') {
emit('submit', { ...postalFormData.value, activeTab: activeTab.value }) emit('submit', { ...postalFormData.value, activeTab: activeTab.value })
} else if (activeTab.value === 'firstPayment') { } else if (activeTab.value === 'firstPayment') {
emit('submit', { ...firstPremiumFormData.value, activeTab: activeTab.value }) emit('submit', { ...firstPremiumFormData.value, activeTab: activeTab.value })
} else if (activeTab.value === 'attachment') { } else if (activeTab.value === 'attachment') {
emit('submit', { activeTab: activeTab.value }) emit('submit', { activeTab: activeTab.value })
} else if (activeTab.value === 'introducer') { } else if (activeTab.value === 'introducer') {
emit('submit', { ...introducerTableData.value, activeTab: activeTab.value }) emit('submit', { ...introducerTableData.value, activeTab: activeTab.value })
} else if (activeTab.value === 'basic') { } else if (activeTab.value === 'basic') {
emit('submit', { ...basicInfoFormData.value, activeTab: activeTab.value, ...policyInfoFormData.value }) emit('submit', {
} else if (activeTab.value === 'productPlan') { ...basicInfoFormData.value,
emit('submit', { ...basicPlanFormData.value, activeTab: activeTab.value, ...localData.additionalPlans }) activeTab: activeTab.value,
} ...policyInfoFormData.value
})
} } else if (activeTab.value === 'productPlan') {
}) emit('submit', {
...basicPlanFormData.value,
activeTab: activeTab.value,
...localData.additionalPlans
})
}
}
})
} }
const handleCancel = () => { const handleCancel = () => {
emit('cancel') emit('cancel')
} }
const handleClick = (tab) => { const handleClick = tab => {
activeTab.value = tab.name activeTab.value = tab.name
} }
// 如果外部 modelValue 更新(比如重新加载数据),同步到 localData // 如果外部 modelValue 更新(比如重新加载数据),同步到 localData
watch( watch(
() => props.modelValue, () => props.modelValue,
(newVal) => { newVal => {
if (newVal) { if (newVal) {
Object.assign(localData, defaultFormData(), newVal) Object.assign(localData, defaultFormData(), newVal)
} }
}, },
{ deep: true } { deep: true }
) )
// 查询新单跟进详情 // 查询新单跟进详情
const getPolicyfollowDetail = () => { const getPolicyfollowDetail = () => {
if (!props.policyBizId) { if (!props.policyBizId) {
return return
}
getPolicyfollow(props.policyBizId).then(res => {
if (res.code === 200) {
console.log('====父组件在赋值basicPlanFormData前', basicPlanFormData.value)
newOrderData.value = res.data
policyInfoFormData.value = { ...transformToFormData(res.data, policyInfoFormConfig.value) }
basicPlanFormData.value = { ...transformToFormData(res.data, basicPlanFormConfig.value) }
basicInfoFormData.value = { ...transformToFormData(res.data, basicInfoFormConfig.value) }
firstPremiumFormData.value = {
...transformToFormData(res.data, firstPremiumFormConfig.value)
}
introducerTableData.value = res.data.brokerList || []
console.log('====父组件在赋值basicPlanFormData后', basicPlanFormData.value)
} }
getPolicyfollow(props.policyBizId).then(res => { })
if (res.code === 200) {
console.log('====父组件在赋值basicPlanFormData前', basicPlanFormData.value)
newOrderData.value = res.data
policyInfoFormData.value = { ...transformToFormData(res.data, policyInfoFormConfig.value) };
basicPlanFormData.value = { ...transformToFormData(res.data, basicPlanFormConfig.value) };
basicInfoFormData.value = { ...transformToFormData(res.data, basicInfoFormConfig.value) };
firstPremiumFormData.value = { ...transformToFormData(res.data, firstPremiumFormConfig.value) };
introducerTableData.value = res.data.brokerList || []
console.log('====父组件在赋值basicPlanFormData后', basicPlanFormData.value)
}
})
} }
// 查询附件列表 // 查询附件列表
const getAttachmentListDetail = (policyBizId) => { const getAttachmentListDetail = policyBizId => {
if (!policyBizId) { if (!policyBizId) {
return return
}
const params = {
objectBizId: policyBizId,
pageNo: 1,
pageSize: 100
}
uploadOssFileList(params).then(res => {
if (res.code === 200) {
attachmentTableData.value = res.data || []
console.log('attachmentTableData', res.data)
} }
const params = { })
objectBizId: policyBizId,
pageNo: 1,
pageSize: 100,
}
uploadOssFileList(params).then(res => {
if (res.code === 200) {
attachmentTableData.value = res.data || []
console.log('attachmentTableData', res.data)
}
})
} }
// 附件上传方法 // 附件上传方法
const handleUploadEnd = (code) => { const handleUploadEnd = code => {
if (code === 200) { if (code === 200) {
ElMessage.success('上传文件成功') ElMessage.success('上传文件成功')
fileUploadDialogFlag.value = false fileUploadDialogFlag.value = false
files.value = '' files.value = ''
getAttachmentListDetail(props.policyBizId) getAttachmentListDetail(props.policyBizId)
} else { } else {
ElMessage.error('上传文件失败') ElMessage.error('上传文件失败')
} }
} }
// 组装表单数据 // 组装表单数据
const transformToFormData = (apiData, formConfig) => { const transformToFormData = (apiData, formConfig) => {
const formData = {}; const formData = {}
formConfig.forEach(item => { formConfig.forEach(item => {
const { prop, dictType } = item; const { prop, dictType } = item
let value = null; let value = null
// 特殊映射(按需添加) // 特殊映射(按需添加)
switch (prop) { switch (prop) {
case 'signLocation': case 'signLocation':
value = apiData.signLocation; value = apiData.signLocation
break; break
default: default:
value = apiData[prop]; value = apiData[prop]
} }
// 处理字典字段:如果配置了 dictType,且值是 number,转为 string // 处理字典字段:如果配置了 dictType,且值是 number,转为 string
if (dictType && typeof value === 'number') { if (dictType && typeof value === 'number') {
value = String(value); value = String(value)
} }
formData[prop] = value ?? null; formData[prop] = value ?? null
}); })
return formData; return formData
}; }
// 获取首期保费对账列表 // 获取首期保费对账列表
const getPremiumReconciliationList = (policyNo) => { const getPremiumReconciliationList = policyNo => {
const params = { const params = {
policyNo: policyNo, policyNo: policyNo,
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100
}
premiumReconciliationList(params).then(res => {
if (res.code === 200) {
firstPremiumTableData.value = res.data.records || []
} }
premiumReconciliationList(params).then(res => { })
if (res.code === 200) {
firstPremiumTableData.value = res.data.records || []
}
})
} }
// 获取关联流程记录 // 获取关联流程记录
const getRelationRecord = (fnaBizId) => { const getRelationRecord = fnaBizId => {
getProcessDetail(fnaBizId).then(res => { getProcessDetail(fnaBizId).then(res => {
if (res.code === 200) { if (res.code === 200) {
relatedTableData.value = [res.data] || [] relatedTableData.value = [res.data] || []
console.log('relationRecordData', res.data) console.log('relationRecordData', res.data)
} }
}) })
} }
const viewRecordDetail = (e) => { const viewRecordDetail = e => {
router.push({ router.push({
path: '/sign/FnaList/edit', path: '/sign/FnaList/edit',
query: { query: {
fnaBizId: newOrderData.value.fnaBizId, fnaBizId: newOrderData.value.fnaBizId,
type: 'edit', type: 'edit',
status: newOrderData.value.status, status: newOrderData.value.status,
source: 'newOrder', source: 'newOrder',
appointmentBizId: newOrderData.value.appointmentBizId appointmentBizId: newOrderData.value.appointmentBizId
} }
}) })
} }
const handleSelectChange = async (prop, value, item, type) => { const handleSelectChange = async (prop, value, item, type) => {
await nextTick() await nextTick()
// console.log('======子组件选择选项后,父组件接收的值 :', basicPlanFormData.value) // console.log('======子组件选择选项后,父组件接收的值 :', basicPlanFormData.value)
if (type === 'basicPlan') { if (type === 'basicPlan') {
const params = { const params = {
tenantBizId: userStore.projectInfo.tenantBizId, tenantBizId: userStore.projectInfo.tenantBizId,
projectBizId: userStore.projectInfo.projectBizId, projectBizId: userStore.projectInfo.projectBizId,
fieldBizId: 'field_olk1qZe81qHHKXbw', fieldBizId: 'field_olk1qZe81qHHKXbw',
fieldValueBizId: 'field_value_uOfJH5ucA2YwJpbn', fieldValueBizId: 'field_value_uOfJH5ucA2YwJpbn',
insuranceCompanyBizIdList: [basicPlanFormData.value.insuranceCompanyBizId], insuranceCompanyBizIdList: [basicPlanFormData.value.insuranceCompanyBizId],
categoryCodeList: [basicPlanFormData.value.insuranceCategoryCode], categoryCodeList: [basicPlanFormData.value.insuranceCategoryCode],
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100
}
console.log('====父组件拿到值,去调用产品列表查询接口', params)
getProductLists(params)
} }
console.log('====父组件拿到值,去调用产品列表查询接口', params)
getProductLists(params)
}
} }
// 获取产品列表 // 获取产品列表
const getProductLists = (params) => { const getProductLists = params => {
getProductList(params).then(res => { getProductList(params).then(res => {
if (res.code === 200) { if (res.code === 200) {
console.log('productList', res.data.records || []) console.log('productList', res.data.records || [])
// productList.value = res.data.records || [] // productList.value = res.data.records || []
} }
}) })
} }
defineExpose({ defineExpose({
getPolicyfollowDetail getPolicyfollowDetail
}) })
</script> </script>
<style scoped> <style scoped>
.form-page { .form-page {
padding: 10px; padding: 10px;
background: #fff; background: #fff;
border-radius: 4px; border-radius: 4px;
padding-top: 0; padding-top: 0;
} }
.tab-placeholder { .tab-placeholder {
padding: 40px 0; padding: 40px 0;
} }
.form-footer { .form-footer {
text-align: center; text-align: center;
margin-top: 30px; margin-top: 30px;
} }
.sectionTitle { .sectionTitle {
margin: 0 0 15px 0; margin: 0 0 15px 0;
font-size: 16px; font-size: 16px;
line-height: 1; line-height: 1;
position: relative; position: relative;
padding-left: 16px; padding-left: 16px;
} }
.sectionTitle::before { .sectionTitle::before {
content: ''; content: '';
position: absolute; position: absolute;
left: 0; left: 0;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
width: 6px; width: 6px;
height: 20px; height: 20px;
background-color: #007bff; background-color: #007bff;
border-radius: 5px; border-radius: 5px;
} }
.section h5 { .section h5 {
margin: 0; margin: 0;
font-size: 14px; font-size: 14px;
line-height: 1; line-height: 1;
position: relative; position: relative;
background-color: rgba(0, 119, 238, 0.05); background-color: rgba(0, 119, 238, 0.05);
color: #383838; color: #383838;
padding: 15px 10px; padding: 15px 10px;
border-radius: 4px; border-radius: 4px;
} }
</style> </style>
\ No newline at end of file
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