This commit is contained in:
2026-08-07 18:44:55 +08:00
parent 2425e0cac1
commit 38a0ffd3e3
9 changed files with 272 additions and 40 deletions
@@ -106,6 +106,12 @@ function hasWeightDraftChanged(row: WeightResultResource) {
return Number(draft.value) !== Number(savedValue) || draft.unit !== savedUnit
}
function buildAdjustmentReason(row: WeightResultResource) {
const draft = weightDrafts.value[row.id]
const ocrUnit = normalizeUnit(row.ocrWeightUnit)
return `OCR 原值 ${formatWeight(row.ocrWeightValue, ocrUnit)},人工确认 ${formatWeight(Number(draft.value), draft.unit)}`
}
async function loadWorkspace() {
if (!customerId.value || !props.inboundId || !canView.value) {
workspace.value = null
@@ -188,21 +194,17 @@ async function confirmResult(row: WeightResultResource) {
activeAction.value = key
actionError.value = null
try {
let version = row.version
const payload = { version: row.version } as Parameters<typeof confirmWeightResult>[3]
if (hasWeightDraftChanged(row)) {
if (!canEdit.value) {
ElMessage.warning('当前账号缺少重量修改权限')
return
}
const corrected = await correctWeightResult(customerId.value, props.inboundId, row.id, {
version,
adjustedWeightValue: Number(draft.value),
adjustedWeightUnit: draft.unit,
adjustmentReason: '人工核对后修改识别重量',
})
version = corrected.version
payload.adjustedWeightValue = Number(draft.value)
payload.adjustedWeightUnit = draft.unit
payload.adjustmentReason = buildAdjustmentReason(row)
}
await confirmWeightResult(customerId.value, props.inboundId, row.id, { version })
await confirmWeightResult(customerId.value, props.inboundId, row.id, payload)
ElMessage.success('重量已确认并计入实际总重量')
await loadWorkspace()
emit('changed')
@@ -399,6 +401,7 @@ defineExpose({ reload: loadWorkspace })
<span>单位</span>
<el-segmented
v-model="weightDrafts[row.id].unit"
:aria-label="`称重图片序号 ${index + 1} 的重量单位`"
:options="['KG', 'LB']"
:disabled="Boolean(activeAction) || !editable || !canEdit || !canConfirm"
/>