diff --git a/inventory-backend/app/api/v1/my_requests.py b/inventory-backend/app/api/v1/my_requests.py index fdc50c3..c81b314 100644 --- a/inventory-backend/app/api/v1/my_requests.py +++ b/inventory-backend/app/api/v1/my_requests.py @@ -171,14 +171,18 @@ def _withdraw_path(type_key, req_id): """ 撤回端点路径。撤回是**写操作**,保留在各模块自己的端点里 (三者释放逻辑不同),此处只提供路径供前端分发,不在此执行。 + + ★ 路径不带 /api 前缀:前端 axios 实例的 baseURL 是 '/api', + 传完整路径会拼成 /api/api/v1/... 导致 404。 + 这里返回的是 baseURL 之后的部分(与其它 API 封装的写法一致)。 """ if req_id is None: return '' if type_key == 'outbound': - return f"/api/v1/outbound/request/{req_id}/withdraw" + return f"/v1/outbound/request/{req_id}/withdraw" if type_key == 'borrow': - # 借库暂用 close 端点(语义为撤回/作废) - return f"/api/v1/transactions/borrow/request/{req_id}/close" + # 申请人路径:仅校验单据归属,普通员工无需 op_borrow_approval 权限 + return f"/v1/transactions/borrow/request/{req_id}/withdraw" if type_key == 'scrap': - return f"/api/v1/scrap/request/{req_id}/withdraw" + return f"/v1/scrap/request/{req_id}/withdraw" return ''