From 3bd19c1ab54a2d49d119f9d6eccc20cdf7499b57 Mon Sep 17 00:00:00 2001 From: yueli Date: Fri, 4 Sep 2026 14:52:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=80=9F=E5=BA=93=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=89=8B=E5=8A=A8=E5=AE=8C=E7=BB=93=E2=80=94?= =?UTF-8?q?=E2=80=94=E5=B7=B2=E9=80=9A=E8=BF=87(status=3D1)=E5=8D=95?= =?UTF-8?q?=E5=8F=AF=E5=BC=BA=E5=88=B6=E5=AE=8C=E7=BB=93=EF=BC=8C=E5=BA=93?= =?UTF-8?q?=E7=AE=A1/=E4=B8=BB=E7=AE=A1/=E8=B6=85=E7=AE=A1=E5=8F=AF?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-backend/app/api/v1/transactions.py | 23 +++++++++ inventory-web/src/api/transaction.ts | 8 ++++ .../src/views/borrow/approval/index.vue | 47 ++++++++++++++++++- 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/inventory-backend/app/api/v1/transactions.py b/inventory-backend/app/api/v1/transactions.py index 20b0166..20b3fcf 100644 --- a/inventory-backend/app/api/v1/transactions.py +++ b/inventory-backend/app/api/v1/transactions.py @@ -277,6 +277,29 @@ def approve_borrow_request(request_id): return jsonify({'code': 500, 'msg': f'服务器内部错误: {str(e)}'}), 500 +@trans_bp.route('/borrow/request//close', methods=['POST']) +@jwt_required() +@permission_required('op_borrow_approval') +def close_borrow_request(request_id): + """ + 手动完结已通过的借库审批单(status 1-已通过 → 3-已完成) + 参照出库审批的完结逻辑,供库管/主管在未走扫码借出时强制完结 + """ + try: + user_id, _ = get_current_user_info() + if not user_id: + return jsonify({'code': 401, 'msg': '用户未登录'}), 401 + + success, message, approval = BorrowApprovalService.mark_completed(request_id) + if not success: + return jsonify({'code': 400, 'msg': message}), 400 + + return jsonify({'code': 200, 'msg': message, 'data': approval.to_dict() if approval else None}), 200 + except Exception as e: + traceback.print_exc() + return jsonify({'code': 500, 'msg': f'服务器内部错误: {str(e)}'}), 500 + + # --- 获取借库审批单列表 --- @trans_bp.route('/borrow/request', methods=['GET']) @jwt_required() diff --git a/inventory-web/src/api/transaction.ts b/inventory-web/src/api/transaction.ts index bd4652d..746e6f6 100644 --- a/inventory-web/src/api/transaction.ts +++ b/inventory-web/src/api/transaction.ts @@ -174,6 +174,14 @@ export function approveBorrowRequest(id: number, data: { action: 'approve' | 're }) } +// 手动完结已通过的借库审批单(status 1 → 3) +export function closeBorrowRequest(id: number) { + return request({ + url: `/v1/transactions/borrow/request/${id}/close`, + method: 'post' + }) +} + /** * 借库选单专用库存列表(独立权限 op_borrow_apply) */ diff --git a/inventory-web/src/views/borrow/approval/index.vue b/inventory-web/src/views/borrow/approval/index.vue index 7fbacdb..338eaa2 100644 --- a/inventory-web/src/views/borrow/approval/index.vue +++ b/inventory-web/src/views/borrow/approval/index.vue @@ -137,6 +137,19 @@ 驳回 + + - @@ -182,14 +195,44 @@