From 7f39adf9f5a2f73a523f8cf0bcaf938b4e8577dc Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Sat, 10 Oct 2026 18:15:39 +0800 Subject: [PATCH] fix(fleet): lock destination in readonly inquiry dialog --- .../components/CapacityInquiryDialog.test.ts | 33 +++++++++++++++++++ .../components/CapacityInquiryDialog.vue | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/modules/overseas-master-data/components/CapacityInquiryDialog.test.ts b/src/modules/overseas-master-data/components/CapacityInquiryDialog.test.ts index 78444e8d..51b2cf4c 100644 --- a/src/modules/overseas-master-data/components/CapacityInquiryDialog.test.ts +++ b/src/modules/overseas-master-data/components/CapacityInquiryDialog.test.ts @@ -59,3 +59,36 @@ it.each(scenarios)('uses explicit offer quote queries, pagination and negotiated expect(listOfferQuotes).toHaveBeenCalledTimes(2) expect(wrapper.emitted('saved')).toHaveLength(1) }) + +it('locks the destination in readonly follow-up even without offer detail, while allowing multi-stop editing', async () => { + permissions.values = new Set(['platform:fleet:capacity-offer:manage']) + const multi = { ...offer, destinations: [...offer.destinations, { destinationKey: 'FBA:ACY2', name: 'ACY2', deliveryIndex: 2, remaining: null }] } + const row: CapacityInquiry = { + bookingNo: 'FB-READONLY', offerNo: offer.offerNo, tripNo: offer.tripNo, status: 'DRAFT', recordVersion: 1, + offerRecordVersion: offer.recordVersion, tripRecordVersion: offer.tripRecordVersion, salesOwnerUserId: '17', + customerId: '19', customerCode: 'C-19', customerName: '测试客户', businessType: 'LOCAL_LOOSEBOARD', deliveryMode: 'SELF_DELIVERY', + estimatedArrivalAt: null, expectedPalletCount: null, + cargo: { destinationKey: 'FBA:ACY2', cargoName: null, packageCount: null, palletSpaces: null, weightKg: null, volumeCbm: null, priceBasis: 'PALLET', unitPrice: null, currency: 'USD', contactName: null, contactPhone: null, remark: null }, + destinationLabel: 'ACY2', agreedAmount: null, quoteSource: null, businessOrderNo: null, incomingNo: null, dispatchNo: null, + updatedAt: '2026-10-10T00:00:00Z', actions: { canEdit: true, canConfirm: false, canCancel: true, blockReason: null }, appointmentCoverage: null, + progress: { stage: 'NEEDS_DETAILS', label: '待补资料', reservation: '尚未保位', owner: '销售', primaryAction: 'EDIT', message: '待补资料', missingFields: [] }, + } + const wrapper = mount(CapacityInquiryDialog, { attachTo: document.body, props: { modelValue: true, offer: null, inquiry: row, readonly: true }, global: { plugins: [createPinia(), ElementPlus] } }) + wrappers.push(wrapper); await flushPromises() + const destination = () => formItem(wrapper, '本车卸货站').findComponent({ name: 'ElSelect' }) + expect(destination().get('input[role="combobox"]').attributes('disabled')).toBeDefined() + await destination().find('.el-select__wrapper').trigger('click'); await flushPromises() + expect(destination().get('input[role="combobox"]').attributes('aria-expanded')).toBe('false') + expect(destination().props('modelValue')).toBe('FBA:ACY2') + await wrapper.setProps({ offer: multi, readonly: false }); await flushPromises() + expect(destination().get('input[role="combobox"]').attributes('disabled')).toBeUndefined() + await destination().find('.el-select__wrapper').trigger('click'); await flushPromises() + expect(destination().get('input[role="combobox"]').attributes('aria-expanded')).toBe('true') + await select(wrapper, '本车卸货站', 'FBA:ONT8') + expect(destination().props('modelValue')).toBe('FBA:ONT8') + await wrapper.setProps({ inquiry: null }); await flushPromises() + expect(destination().get('input[role="combobox"]').attributes('disabled')).toBeUndefined() + await wrapper.setProps({ offer }); await flushPromises() + expect(destination().get('input[role="combobox"]').attributes('disabled')).toBeDefined() + expect(saveCapacityInquiry).not.toHaveBeenCalled() +}) diff --git a/src/modules/overseas-master-data/components/CapacityInquiryDialog.vue b/src/modules/overseas-master-data/components/CapacityInquiryDialog.vue index 86ff707d..75ea25ea 100644 --- a/src/modules/overseas-master-data/components/CapacityInquiryDialog.vue +++ b/src/modules/overseas-master-data/components/CapacityInquiryDialog.vue @@ -119,7 +119,7 @@ onBeforeUnmount(() => { generation++; customerSequence++; quoteSequence++; clear 暂无可选客户 - +
已知货量(可先填写,未知可留空)