This commit is contained in:
2026-08-28 02:10:54 +08:00
parent 3482d03905
commit 17bbde81b2
5 changed files with 140 additions and 44 deletions
@@ -4,11 +4,7 @@
v-bind="editorContainerProps"
@update:model-value="visible = $event"
>
<div
v-loading="loading"
class="formal-editor"
:class="{ 'formal-editor--page': pageMode }"
>
<div v-loading="loading" class="formal-editor" :class="{ 'formal-editor--page': pageMode }">
<section-card title="结算基本信息">
<el-form
ref="formRef"
@@ -227,6 +223,9 @@
>
<template #default="{ row }">
<span v-if="column.money">{{ formatMoney(row[column.prop]) }}</span>
<span v-else-if="column.prop === 'transportQuantity'">
{{ formatQuantity(row[column.prop]) }}
</span>
<span v-else-if="column.prop === 'transportType'">
{{ transportTypeName(row[column.prop]) }}
</span>
@@ -417,7 +416,12 @@
<el-table-column prop="paidAmount" label="已付款金额" min-width="130" align="center">
<template #default="{ row }">{{ formatMoney(row.paidAmount) }}</template>
</el-table-column>
<el-table-column prop="approvalStatusName" label="单据状态" min-width="120" align="center">
<el-table-column
prop="approvalStatusName"
label="单据状态"
min-width="120"
align="center"
>
<template #default="{ row }">{{ displayValue(row.approvalStatusName) }}</template>
</el-table-column>
<el-table-column prop="kingdeeBillNo" label="金蝶单据号" min-width="150" align="center">
@@ -439,7 +443,12 @@
<el-table-column prop="adjustmentAmount" label="调整金额" min-width="130" align="center">
<template #default="{ row }">{{ formatMoney(row.adjustmentAmount) }}</template>
</el-table-column>
<el-table-column prop="approvalStatusName" label="单据状态" min-width="120" align="center">
<el-table-column
prop="approvalStatusName"
label="单据状态"
min-width="120"
align="center"
>
<template #default="{ row }">{{ displayValue(row.approvalStatusName) }}</template>
</el-table-column>
<el-table-column prop="remark" label="备注" min-width="220" align="center">
@@ -627,7 +636,7 @@
><el-input-number
v-model="row.transportQuantity"
:min="0"
:precision="6"
:precision="2"
:controls="false" /></template
></el-table-column>
<el-table-column label="里程(KM" min-width="130" align="center"
@@ -1458,9 +1467,7 @@ export default {
remainingAmount = Number((remainingAmount - matchedAmount).toFixed(2));
return {
invoiceNo,
invoiceDate: this.$dayjs()
.subtract(index, 'day')
.format('YYYY-MM-DD'),
invoiceDate: this.$dayjs().subtract(index, 'day').format('YYYY-MM-DD'),
invoiceType: index === 1 ? '增值税普通发票' : '增值税专用发票',
taxRate: [3, 6, 9][index],
invoiceAmount: invoiceAmounts[index],
@@ -1627,6 +1634,11 @@ export default {
formatMoney(value) {
return `${Number(value || 0).toFixed(2)} RMB`;
},
formatQuantity(value) {
if (value === undefined || value === null || value === '') return '-';
const quantity = Number(value);
return Number.isFinite(quantity) ? quantity.toFixed(2) : '-';
},
async loadTransportTypeOptions() {
const { data } = await getDictionary({ code: 'transport_type' });
this.transportTypeOptions = data?.data || [];
@@ -12,7 +12,7 @@
v-if="hasPermission('formal_settlement_payment')"
type="primary"
plain
disabled
:disabled="!selection.length"
@click="$emit('payment')"
>付款申请</el-button
>
@@ -20,7 +20,7 @@
v-if="hasPermission('formal_settlement_sync')"
type="primary"
plain
disabled
:disabled="selection.length !== 1"
@click="$emit('sync')"
>同步金蝶</el-button
>
@@ -46,13 +46,16 @@
</div>
</div>
<el-table
ref="tableRef"
v-loading="loading"
:data="rows"
border
highlight-current-row
@current-change="handleCurrentChange"
@selection-change="handleSelectionChange"
>
<el-table-column type="index" label="序号" width="64" fixed="left" align="center" />
<el-table-column type="selection" width="52" fixed="left" align="center" />
<el-table-column
v-for="column in columns"
:key="column.prop"
@@ -131,17 +134,40 @@ export default {
page: { type: Object, required: true },
hasPermission: { type: Function, required: true },
},
emits: ['create', 'payment', 'sync', 'print', 'export', 'refresh', 'page-change', 'action'],
emits: [
'create',
'payment',
'sync',
'print',
'export',
'refresh',
'page-change',
'action',
'update:selection',
],
data() {
return {
Refresh,
selection: [],
};
},
watch: {
rows() {
this.selection = [];
this.$refs.tableRef?.clearSelection();
this.$emit('update:selection', this.selection);
},
},
methods: {
handleCurrentChange(row) {
this.selection = row ? [row] : [];
this.$emit('update:selection', this.selection);
if (!row && this.selection.length === 1) {
this.selection = [];
this.$emit('update:selection', this.selection);
}
},
handleSelectionChange(selection) {
this.selection = selection;
this.$emit('update:selection', selection);
},
emitAction(type, row) {
this.$emit('action', { type, row });
@@ -505,12 +505,13 @@
<el-table-column prop="cargoType" label="货物类型" min-width="130" align="center" />
<el-table-column label="运输总量" min-width="150" align="center">
<template #default="{ row }">
<span v-if="adjustDialog.readonly">{{ formatQuantity(row) }}</span>
<el-input-number
v-else
v-model="row.transportQuantity"
:min="0"
:precision="6"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
/>
</template>
</el-table-column>
@@ -570,7 +571,6 @@
<template #default="{ row }">
<el-input-number
v-model="row.settlementAmountTax"
:min="0"
:precision="2"
:controls="false"
:disabled="adjustDialog.readonly"
@@ -1111,11 +1111,6 @@ export default {
},
recalculateSummaryRow(row) {
row.settlementAmount = Number(row.originalAmount || 0) + Number(row.adjustAmount || 0);
if (row.settlementAmount < 0) {
row.adjustAmount = -Number(row.originalAmount || 0);
row.settlementAmount = 0;
this.$message.warning('结算金额不能小于0');
}
},
buildSummaryFeesFromDetails() {
const summaryMap = new Map();
@@ -1176,7 +1171,9 @@ export default {
0
);
const residualAmount = Number((totalAmount - knownAmount).toFixed(2));
if (residualAmount > 0) appendSummary('其他费用', residualAmount, row.feeType);
if (Math.abs(residualAmount) >= 0.005) {
appendSummary('其他费用', residualAmount, row.feeType);
}
});
const manualFees = this.summaryFees.filter(row => row.manualFlag === 1);
@@ -1479,8 +1476,11 @@ export default {
return `${amount.toFixed(2)} ${currency || 'RMB'}`;
},
formatQuantity(row) {
if (row.transportQuantity === undefined || row.transportQuantity === null) return '-';
return `${row.transportQuantity}${row.quantityUnit ? ` ${row.quantityUnit}` : ''}`;
const value = row.transportQuantity;
if (value === undefined || value === null || value === '') return '-';
const quantity = Number(value);
if (!Number.isFinite(quantity)) return '-';
return `${quantity.toFixed(2)}${row.quantityUnit ? ` ${row.quantityUnit}` : ''}`;
},
displayValue(value) {
return value === undefined || value === null || value === '' ? '-' : value;