增加导入模版逻辑判断

This commit is contained in:
wuweihua
2026-11-02 16:41:47 +08:00
parent e93f0c0233
commit 7d3854bb4f
4 changed files with 1202 additions and 11 deletions
@@ -118,7 +118,20 @@ const colSurcharge = '附加费'
const colAction = '操作'
function cellKey(row, field) {
return String(row && row.psdId != null ? row.psdId : row && row.productCountryId) + ':' + field
if (!row) return 'none:' + field
// Prefer DB id; local Excel draft uses _localKey (psdId cleared in applyLocalDraft).
if (row.psdId != null && row.psdId !== '') return String(row.psdId) + ':' + field
if (row._localKey) return String(row._localKey) + ':' + field
const parts = [
row.productCode,
row.countryCode || row.countryName,
row.zoneCode || row.zoneName,
row.weightLabel,
row.weightMin,
row.weightMax,
row.productCountryId
]
return parts.map(v => (v == null ? '' : String(v))).join('|') + ':' + field
}
function formatNum(v, precision) {
@@ -150,7 +163,8 @@ async function commitEdit(row, field) {
editingKey.value = ''
try {
if (!row) return
if (!row.psdId) return
// Always emit: create/IMPORT_FRESH local draft has no psdId until finish;
// parent persist path decides DB write vs local-only.
emit('row-change', row)
} finally {
committing.value = false
@@ -890,7 +890,10 @@ async function onRowPriceChange(row) {
proxy.$modal.msgSuccess('价格已更新(完成时统一落库)')
return
}
if (!row.psdId) return
if (!row.psdId) {
proxy.$modal.msgWarning('明细尚未落库,请先点「完成」保存后再改价')
return
}
const prevFv = row._editPrevFv
const prevReg = row._editPrevReg
try {
@@ -899,6 +902,7 @@ async function onRowPriceChange(row) {
} catch (e) {
if (prevFv !== undefined) row.fvValue = prevFv
if (prevReg !== undefined) row.fvRegistrationFee = prevReg
proxy.$modal.msgError((e && e.message) ? e.message : '价格更新失败')
}
}