Commit 119d4946 by Sweet Zhang

增加字段,对接接口

parent a17fcd13
...@@ -216,52 +216,74 @@ watch( ...@@ -216,52 +216,74 @@ watch(
// 提取同步逻辑 // 提取同步逻辑
function syncModelFromProps(newModelValue, newConfig) { function syncModelFromProps(newModelValue, newConfig) {
if (!newModelValue || !newConfig) return {} if (!newModelValue || !newConfig) return {}
const synced = {} const synced = {}
// 1️⃣ 同步主字段(config 中定义的 prop) // 1. 同步主字段
for (const item of newConfig) { for (const item of newConfig) {
const key = item.prop const key = item.prop
if (newModelValue.hasOwnProperty(key)) { if (newModelValue.hasOwnProperty(key)) {
synced[key] = newModelValue[key] synced[key] = newModelValue[key]
} else if (item.multiple || ['checkbox-group', 'daterange'].includes(item.type)) { } else if (item.multiple || ['checkbox-group', 'daterange'].includes(item.type)) {
synced[key] = item.defaultValue ?? [] synced[key] = item.defaultValue ?? []
} else { } else {
synced[key] = item.defaultValue ?? '' synced[key] = item.defaultValue ?? ''
}
} }
}
// 2️⃣ 同步 extra 字段(从主字段的 raw 中提取) // 2. 同步 extra 字段(从 newModelValue 中的 sourceField 重新计算)
for (const item of newConfig) { for (const item of newConfig) {
const sourceField = item.prop const sourceField = item.prop
const extraMap = item.onChangeExtraFields const extraMap = item.onChangeExtraFields
if (!extraMap || typeof extraMap !== 'object') continue if (!extraMap || typeof extraMap !== 'object') continue
const sourceObj = newModelValue[sourceField] const sourceObj = newModelValue[sourceField]
if (!sourceObj || typeof sourceObj !== 'object') continue if (sourceObj && typeof sourceObj === 'object') {
// newModelValue 中有 sourceField → 重新计算 extra
for (const [targetKey, subPath] of Object.entries(extraMap)) { for (const [targetKey, subPath] of Object.entries(extraMap)) {
const val = getNestedValue(sourceObj, subPath) const val = getNestedValue(sourceObj, subPath)
if (val !== undefined) { if (val !== undefined) {
synced[targetKey] = val synced[targetKey] = val
}
} }
}
} }
}
// ✅ 3️⃣ 【关键】保留 localModel 中已有的、未被覆盖的 extra 字段 // 3. 保留 localModel 中的 extra 字段(仅当 newModelValue 中没有对应的 sourceField 时)
for (const key in localModel.value) { for (const item of newConfig) {
// 如果这个 key 不是主字段(不在 config 中),且 synced 没有覆盖它 const sourceField = item.prop
if ( const extraMap = item.onChangeExtraFields
!synced.hasOwnProperty(key) && if (!extraMap || typeof extraMap !== 'object') continue
!newConfig.some(item => item.prop === key)
) { // 如果 newModelValue 中没有 sourceField,说明没有重新计算
// 说明它是 extra 字段,且这次同步没提供新值 → 保留旧值 if (newModelValue[sourceField] === undefined) {
synced[key] = localModel.value[key] // 那么保留 localModel 中对应的 extra 字段
for (const [targetKey, subPath] of Object.entries(extraMap)) {
if (localModel.value.hasOwnProperty(targetKey)) {
synced[targetKey] = localModel.value[targetKey]
} }
}
}
}
// 4. 保留其他不在 config 中的字段
for (const key in newModelValue) {
if (
!synced.hasOwnProperty(key) &&
!newConfig.some(item => item.prop === key)
) {
const isExtraTarget = newConfig.some(item =>
item.onChangeExtraFields && item.onChangeExtraFields.hasOwnProperty(key)
)
if (!isExtraTarget) {
synced[key] = newModelValue[key]
}
} }
}
return synced return synced
} }
function getNestedValue(obj, path) { function getNestedValue(obj, path) {
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<el-table-column prop="policyNo" label="保单号" width="120" sortable /> <el-table-column prop="policyNo" label="保单号" width="120" sortable />
<el-table-column prop="insuranceCompany" label="保险公司" width="120" sortable /> <el-table-column prop="insuranceCompany" label="保险公司" width="120" sortable />
<el-table-column prop="commissionPaidAmount" label="累积已入账金额" width="120" sortable /> <el-table-column prop="commissionPaidAmount" label="累积已入账金额" width="120" sortable />
<el-table-column prop="commissionPaidRatio" label="累积已入账比例" width="120" sortable /> <el-table-column prop="commissionPaidRatio" label="累积已入账比例" width="120" sortable :formatter="(row) => `${row.commissionPaidRatio }%`" />
<el-table-column prop="fortuneName" label="出账项目" width="130" sortable /> <el-table-column prop="fortuneName" label="出账项目" width="130" sortable />
<el-table-column prop="fortunePeriod" label="出账期数" width="130" sortable /> <el-table-column prop="fortunePeriod" label="出账期数" width="130" sortable />
<el-table-column prop="fortuneTotalPeriod" label="总期数" width="120" sortable /> <el-table-column prop="fortuneTotalPeriod" label="总期数" width="120" sortable />
...@@ -83,14 +83,15 @@ ...@@ -83,14 +83,15 @@
<el-table-column prop="currency" label="出账币种" width="130" sortable /> <el-table-column prop="currency" label="出账币种" width="130" sortable />
<el-table-column prop="fortunePaidAmount" label="已出账金额" width="120" sortable /> <el-table-column prop="fortunePaidAmount" label="已出账金额" width="120" sortable />
<el-table-column prop="fortuneUnpaidAmount" label="剩余出账金额" width="120" sortable /> <el-table-column prop="fortuneUnpaidAmount" label="剩余出账金额" width="120" sortable />
<el-table-column prop="currentPaymentAmount" label="本期出账金额" width="120" sortable /> <el-table-column prop="currentPaymentAmount" label="本期出账金额" width="120" sortable/>
<el-table-column prop="fortuneUnpaidRatio" label="剩余出账比例" width="120" sortable /> <el-table-column prop="fortuneUnpaidRatio" label="剩余出账比例" width="120" sortable :formatter="(row) => `${row.fortuneUnpaidRatio }%`" />
<el-table-column prop="status" label="出账状态" width="120" sortable> <el-table-column prop="status" label="出账状态" width="120" sortable>
<template #default="{ row }"> <template #default="{ row }">
{{ getDictLabel('csf_fortune_status', row.status) }} {{ getDictLabel('csf_fortune_status', row.status) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="premium" label="期交保费" width="120" sortable /> <el-table-column prop="premium" label="期交保费" width="120" sortable />
<el-table-column prop="policyCurrency" label="保单币种" width="120" sortable />
<el-table-column prop="payoutDate" label="出账日(实)" width="120" sortable /> <el-table-column prop="payoutDate" label="出账日(实)" width="120" sortable />
<el-table-column prop="remark" label="备注" width="120" sortable /> <el-table-column prop="remark" label="备注" width="120" sortable />
<el-table-column fixed="right" label="操作" min-width="120"> <el-table-column fixed="right" label="操作" min-width="120">
...@@ -342,7 +343,13 @@ const setPayoutAmountConfig = [ ...@@ -342,7 +343,13 @@ const setPayoutAmountConfig = [
prop: 'status', prop: 'status',
label: '出账状态', label: '出账状态',
dictType: 'csf_expected_fortune_status' dictType: 'csf_expected_fortune_status'
} },
// {
// type: 'input',
// prop: 'exchangeRate',
// label: '结算汇率',
// defaultValue: 1
// }
] ]
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
<el-table-column prop="totalPeriod" label="总期数" width="120" sortable /> <el-table-column prop="totalPeriod" label="总期数" width="120" sortable />
<el-table-column prop="commissionName" label="入账项目" width="120" sortable /> <el-table-column prop="commissionName" label="入账项目" width="120" sortable />
<el-table-column prop="premium" label="期交保费" width="120" sortable :formatter="formatCurrencyUtil" /> <el-table-column prop="premium" label="期交保费" width="120" sortable :formatter="formatCurrencyUtil" />
<el-table-column prop="policyCurrency" label="保单币种" width="120" sortable />
<el-table-column prop="remark" label="备注" width="120" sortable /> <el-table-column prop="remark" label="备注" width="120" sortable />
<el-table-column prop="isDeleted" label="记录状态" width="120" sortable> <el-table-column prop="isDeleted" label="记录状态" width="120" sortable>
<template #default="{ row }"> <template #default="{ row }">
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
:showClose="true" @close="payRecordDialogTableVisible = false"> :showClose="true" @close="payRecordDialogTableVisible = false">
<el-table :data="payRecordDialogTableData" border style="width: 100%"> <el-table :data="payRecordDialogTableData" border style="width: 100%">
<el-table-column v-for="item in payRecordDialogTableColumns" :key="item.property" :property="item.property" <el-table-column v-for="item in payRecordDialogTableColumns" :key="item.property" :property="item.property"
:label="item.label" :width="item.width" /> :label="item.label" :width="item.width" :formatter="item.formatter" />
</el-table> </el-table>
</CommonDialog> </CommonDialog>
<!-- 新增出账记录 --> <!-- 新增出账记录 -->
...@@ -450,11 +450,11 @@ const handleSelect = async (e, row) => { ...@@ -450,11 +450,11 @@ const handleSelect = async (e, row) => {
{ property: 'fortuneName', label: '出账项目', width: '150' }, { property: 'fortuneName', label: '出账项目', width: '150' },
{ property: 'currentPaymentAmount', label: '出账金额', width: '150' }, { property: 'currentPaymentAmount', label: '出账金额', width: '150' },
{ property: 'currency', label: '出账币种', width: '150' }, { property: 'currency', label: '出账币种', width: '150' },
{ property: 'commissionPaidRatio', label: '出账比例', width: '150' }, { property: 'currentPaymentRatio', label: '出账比例', width: '150',formatter: (row) => `${row.currentPaymentRatio }%` },
{ property: 'fortuneUnpaidRatio', label: '待出账比例', width: '150' }, { property: 'fortuneUnpaidRatio', label: '待出账比例', width: '150',formatter: (row) => `${row.fortuneUnpaidRatio }%` },
{ property: 'fortunePeriod', label: '佣金期数', width: '150' }, { property: 'fortunePeriod', label: '佣金期数', width: '150' },
{ property: 'fortuneTotalPeriod', label: '总期数', width: '150' }, { property: 'fortuneTotalPeriod', label: '总期数', width: '150' },
{ property: 'updaterId', label: '操作人', width: '150' }, { property: 'reconciliationOperator', label: '操作人', width: '150' },
{ property: 'updateTime', label: '操作时间', width: '150' } { property: 'updateTime', label: '操作时间', width: '150' }
] ]
} else if (e === 'setStatus') { } else if (e === 'setStatus') {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-col :sm="12" :lg="12" :xs="24"> <el-col :sm="12" :lg="12" :xs="24">
<div class="headerLeft"> <div class="headerLeft">
<div class="top">欢迎!</div> <div class="top">欢迎!</div>
<div class="bottom">王力群,wangliqun@bytedance.com</div> <div class="bottom">王力群</div>
</div> </div>
</el-col> </el-col>
<el-col :sm="12" :lg="12" :xs="24" class="right"> <el-col :sm="12" :lg="12" :xs="24" class="right">
......
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