优化
This commit is contained in:
@@ -186,6 +186,10 @@ function handleWeightChanged() {
|
||||
void loadTasks()
|
||||
}
|
||||
|
||||
function handleMeasurementUpdated() {
|
||||
void loadTasks()
|
||||
}
|
||||
|
||||
function handleWeightSummaryChanged(actualGrossWeightKg: number | null) {
|
||||
measurementPanelRef.value?.updateActualGrossWeight(actualGrossWeightKg)
|
||||
}
|
||||
@@ -304,6 +308,7 @@ onBeforeUnmount(() => { disposed = true; requestSerial += 1; optionsRequestSeria
|
||||
:tenant-id="selectedInbound.tenantId"
|
||||
:inbound-id="selectedInbound.id"
|
||||
@changed="handleTaskChanged"
|
||||
@updated="handleMeasurementUpdated"
|
||||
/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@@ -316,6 +316,13 @@ describe('InboundMeasurementPanel', () => {
|
||||
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 () => {
|
||||
vi.mocked(getInboundMeasurement).mockResolvedValueOnce(measurement({ originalPackageCount: 12 }))
|
||||
const wrapper = await mountPanel()
|
||||
|
||||
@@ -23,6 +23,7 @@ const props = defineProps<{
|
||||
|
||||
const emit = defineEmits<{
|
||||
changed: []
|
||||
updated: []
|
||||
}>()
|
||||
|
||||
interface EditableMeasurementItem extends SaveInboundMeasurementItemRequest {
|
||||
@@ -195,7 +196,7 @@ async function submitManualEntry() {
|
||||
manualEntryOpen.value = false
|
||||
ElMessage.success('箱规已录入,服务端计算结果已更新')
|
||||
await loadMeasurement()
|
||||
emit('changed')
|
||||
emit('updated')
|
||||
} catch (error) {
|
||||
const details = setOperationError(error, '手动箱规录入失败,请检查后重试')
|
||||
ElMessage.error(details.message)
|
||||
|
||||
Reference in New Issue
Block a user