⚡ 优化区划国家入口、计划-1展示、路线地图点选与对账导出

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-27 23:16:18 +08:00
co-authored by Cursor
parent f3a33b1a04
commit b92625528c
7 changed files with 275 additions and 337 deletions
@@ -1212,7 +1212,11 @@ const fillEditForm = async row => {
carrierIds: [],
});
const plan = plans.value.find(item => String(item.id) === String(snapshot.planId));
if (plan) form.planId = plan.id;
// 接口数字 null 会序列化为 -1,未选计划时回填为空
form.planId =
plan && Number(plan.id) !== -1 && Number(plan.id) > 0
? plan.id
: normalizeOptionalPlanId(snapshot.planId) || '';
const contract = contracts.value.find(item => String(item.id) === String(snapshot.contractId));
form.contractId = contract?.id || '';
form.carrierType = snapshot.carrierType || '承运商';
@@ -1677,10 +1681,18 @@ const normalizeImportRow = row => ({
row['*运输方式']
),
});
const normalizeOptionalPlanId = value => {
if (value === undefined || value === null || value === '') return null;
return Number(value) === -1 || Number(value) <= 0 ? null : value;
};
const buildImportPayload = (status = form.status, rowList = rows.value, extra = {}) => {
const { file, ...batch } = form;
const planId = normalizeOptionalPlanId(batch.planId);
return {
...batch,
planId,
// 未选计划时不带占位名称,避免落库/回显 -1
planName: planId ? batch.planName || undefined : null,
status,
rows: rowList.map(normalizeImportRow).map(stripInternalRowFields),
...extra,