调整结算

This commit is contained in:
2026-09-05 00:04:46 +08:00
parent 96f2fa0eb5
commit 3bac9b6472
11 changed files with 688 additions and 352 deletions
+48 -12
View File
@@ -252,7 +252,7 @@
>
<el-table-column type="selection" width="52" fixed="left" align="center" />
<el-table-column type="index" label="序号" width="58" fixed="left" align="center" />
<el-table-column label="配载单号" prop="loadingNo" min-width="170" fixed="left">
<el-table-column label="配载单号" prop="loadingNo" min-width="170">
<template #default="{ row }">
<el-link
type="primary"
@@ -1172,6 +1172,31 @@ const createDialogForm = () => ({
businessStatus: 'draft',
});
// 后端以 -1 表示未填写里程,表单中应保持为空,避免给用户造成已填写的错觉。
const normalizeLoadingMileage = value => {
if (value === undefined || value === null || value === '' || Number(value) === -1) return '';
return value;
};
const createCopiedDialogForm = (detail = {}) => {
const form = createDialogForm();
Object.keys(form).forEach(prop => {
if (Object.prototype.hasOwnProperty.call(detail, prop)) form[prop] = detail[prop];
});
return {
...form,
id: '',
loadingNo: '',
startDate: '',
endDate: '',
dataSource: '手工创建',
currentProcessNode: '接单',
mileage: normalizeLoadingMileage(form.mileage),
taskInfoJson: '',
businessStatus: 'draft',
};
};
const unwrapRecords = res => {
const data = res?.data || res;
if (Array.isArray(data)) return data;
@@ -1369,7 +1394,8 @@ export default {
this.syncStandaloneTagTitle();
if (
to.query.mode !== from?.query?.mode ||
String(to.query.id || '') !== String(from?.query.id || '')
String(to.query.id || '') !== String(from?.query.id || '') ||
String(to.query.copyId || '') !== String(from?.query.copyId || '')
) {
this.initStandaloneFormPage();
}
@@ -1674,10 +1700,12 @@ export default {
async initStandaloneFormPage() {
if (!this.isStandaloneFormPage) return;
const mode = this.$route.query.mode === 'edit' ? 'edit' : 'add';
const copyId = mode === 'add' ? this.$route.query.copyId : '';
await this.openLoadingDialog(mode, {
id: this.$route.query.id,
id: copyId || this.$route.query.id,
copy: Boolean(copyId),
});
if (mode === 'add') await this.consumeLoadingCreateWaybills();
if (mode === 'add' && !copyId) await this.consumeLoadingCreateWaybills();
},
async consumeLoadingCreateWaybills() {
const raw = sessionStorage.getItem(loadingCreateWaybillsStorageKey);
@@ -1711,10 +1739,11 @@ export default {
try {
if (row?.id) {
const res = await loadingApi.getDetail(row.id);
this.dialogForm = {
...createDialogForm(),
...(res.data?.data || res.data || {}),
};
const detail = res.data?.data || res.data || {};
this.dialogForm = row.copy
? createCopiedDialogForm(detail)
: { ...createDialogForm(), ...detail };
this.dialogForm.mileage = normalizeLoadingMileage(this.dialogForm.mileage);
await this.restoreWaybillRows(
this.dialogForm.waybillIdsJson,
this.dialogForm.loadingSubNos
@@ -2247,6 +2276,7 @@ export default {
normalizePayload() {
this.syncRouteAddressFields();
this.rebuildSummaryFromWaybills(false);
this.dialogForm.mileage = normalizeLoadingMileage(this.dialogForm.mileage);
if (this.dialogForm.carrierType === '网货平台') {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
@@ -2332,6 +2362,7 @@ export default {
...this.dialogForm,
...(res.data?.data || res.data || {}),
};
this.dialogForm.mileage = normalizeLoadingMileage(this.dialogForm.mileage);
ElMessage.success('暂存成功');
this.loadTable();
} finally {
@@ -2356,10 +2387,15 @@ export default {
this.dialogSaving = '';
}
},
async copyLoading(row) {
await loadingApi.copy(row.id);
ElMessage.success('复制成功');
this.loadTable();
copyLoading(row) {
this.$router.push({
path: '/business/loading-manage/form',
query: {
mode: 'add',
copyId: row.id,
name: '新增配载管理',
},
});
},
deleteLoading(row) {
ElMessageBox.confirm(`确定删除配载单 ${row.loadingNo}`, '提示', { type: 'warning' })