From 83274ddf5dc938c1bfeedd26cb61d0fa0b4f44d0 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sun, 18 Oct 2026 20:48:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8A=A5=E4=BB=B7=E5=8D=95):=20=E5=90=8E?= =?UTF-8?q?=E5=8F=B0/=E7=B3=BB=E7=BB=9F=E8=A7=A6=E5=8F=91=E4=BC=A0?= =?UTF-8?q?=E9=80=92=E6=97=B6=E8=A1=A5=E6=9C=80=E5=B0=8F=20ctx=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=20branch=5Frequired=20=E9=9D=99=E9=BB=98?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/services/quoteSheetEditService.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/server/src/services/quoteSheetEditService.ts b/server/src/services/quoteSheetEditService.ts index 30fdea8..54b2b31 100644 --- a/server/src/services/quoteSheetEditService.ts +++ b/server/src/services/quoteSheetEditService.ts @@ -47,11 +47,26 @@ export async function requestDeliveryReviewForSheet(input: { const branchCode = input.branchCode || getEffectiveBranchCode(input.ctx || null, input.operatingBranchCode || null); if (!branchCode) return { ok: false, code: 'branch_required', message: '请选择当前操作分公司' }; + // 后台/系统触发没有请求上下文 ⇒ 造一个只带分公司的最小 ctx(非超管 ⇒ getEffectiveBranchCode 直接用 ctx.branchCode) + const ctx: TenantContext = + input.ctx ?? + ({ + userId: '', + roles: [], + permissions: ['customer_manage'], + branchCode, + supplierCode: null, + purchaserCode: null, + isSuperAdmin: false, + isBranchAdmin: false, + isInternalStaff: false, + isSupplierAccount: false, + } as TenantContext); try { const res = await submitPriceProposal({ quoteSheetCode: input.quoteSheetCode, note: null, - ctx: input.ctx ?? null, + ctx, operatingBranchCode: input.operatingBranchCode ?? branchCode, requestedBy: input.requestedBy ?? null, });