This commit is contained in:
2026-08-17 11:23:31 +08:00
parent f41eaa05a3
commit c6fa22c1b5
3 changed files with 14 additions and 1 deletions
@@ -186,6 +186,10 @@ function handleWeightChanged() {
void loadTasks() void loadTasks()
} }
function handleMeasurementUpdated() {
void loadTasks()
}
function handleWeightSummaryChanged(actualGrossWeightKg: number | null) { function handleWeightSummaryChanged(actualGrossWeightKg: number | null) {
measurementPanelRef.value?.updateActualGrossWeight(actualGrossWeightKg) measurementPanelRef.value?.updateActualGrossWeight(actualGrossWeightKg)
} }
@@ -304,6 +308,7 @@ onBeforeUnmount(() => { disposed = true; requestSerial += 1; optionsRequestSeria
:tenant-id="selectedInbound.tenantId" :tenant-id="selectedInbound.tenantId"
:inbound-id="selectedInbound.id" :inbound-id="selectedInbound.id"
@changed="handleTaskChanged" @changed="handleTaskChanged"
@updated="handleMeasurementUpdated"
/> />
</div> </div>
</el-dialog> </el-dialog>
@@ -316,6 +316,13 @@ describe('InboundMeasurementPanel', () => {
expect(wrapper.emitted('changed')).toHaveLength(1) expect(wrapper.emitted('changed')).toHaveLength(1)
}) })
it('emits updated without closing the parent task after manual carton entry', async () => {
const wrapper = await mountPanel()
const source = await import('./InboundMeasurementPanel.vue?raw').then((module) => module.default)
expect(source).toContain("emit('updated')")
expect(wrapper.emitted('updated')).toBeUndefined()
})
it('blocks normal submission when confirmed box counts do not match the order total', async () => { it('blocks normal submission when confirmed box counts do not match the order total', async () => {
vi.mocked(getInboundMeasurement).mockResolvedValueOnce(measurement({ originalPackageCount: 12 })) vi.mocked(getInboundMeasurement).mockResolvedValueOnce(measurement({ originalPackageCount: 12 }))
const wrapper = await mountPanel() const wrapper = await mountPanel()
@@ -23,6 +23,7 @@ const props = defineProps<{
const emit = defineEmits<{ const emit = defineEmits<{
changed: [] changed: []
updated: []
}>() }>()
interface EditableMeasurementItem extends SaveInboundMeasurementItemRequest { interface EditableMeasurementItem extends SaveInboundMeasurementItemRequest {
@@ -195,7 +196,7 @@ async function submitManualEntry() {
manualEntryOpen.value = false manualEntryOpen.value = false
ElMessage.success('箱规已录入,服务端计算结果已更新') ElMessage.success('箱规已录入,服务端计算结果已更新')
await loadMeasurement() await loadMeasurement()
emit('changed') emit('updated')
} catch (error) { } catch (error) {
const details = setOperationError(error, '手动箱规录入失败,请检查后重试') const details = setOperationError(error, '手动箱规录入失败,请检查后重试')
ElMessage.error(details.message) ElMessage.error(details.message)