表格里数据有 n 多条,如果发生额和第一条数据的需收金额相等,就全部被第一条数据拆分,不再向下递归,否则就递归拆分剩余金额。
table 表格数据:
detailData: [
{
feeType: '租金',
amountReceivableIncludTax: 55,
billStatus: 22,
needCharge: 300
},
{
feeType: '租金',
amountReceivableIncludTax: 99,
billStatus: 1,
needCharge: 200
},
{
feeType: '租金',
amountReceivableIncludTax: 9,
billStatus: 1,
needCharge: 100
}
],
表格 columns:
columns: [
{
title: '费用类型',
align: 'center',
dataIndex: 'feeType'
},
{
title: '应收金额',
align: 'center',
dataIndex: 'amountReceivableIncludTax'
},
{
title: '已结清',
align: 'center',
dataIndex: 'billStatus'
},
{
title: '需收金额',
align: 'center',
dataIndex: 'needCharge'
},
{
title: '流水拆分匹配',
align: 'center',
dataIndex: 'flowMatchData',
scopedSlots: { customRender: 'flowMatchData' }
}
],
页面表格
<a-table bordered :data-source="detailData" :columns="columns">
<!-- 流水拆分匹配 -->
<template slot="flowMatchData" slot-scope="text, record, index">
<a-input
v-model="record.flowMatchData"
placeholder="0.00"
@blur="handleFlowMatch(record, index)"
/>
</template>
</a-table>
看到@hfhan 给答案了,不过我还补充完整了,加上了校验,与列表的计算。