From 1dbf74b7bc5a343ecb508e5e806740f03e1d9a80 Mon Sep 17 00:00:00 2001 From: yueli Date: Thu, 10 Sep 2026 09:47:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(borrow):=20=E5=80=9F=E5=BA=93=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E8=A1=A5=E3=80=8C=E5=AE=8C=E7=BB=93=E3=80=8D=E8=83=BD?= =?UTF-8?q?=E5=8A=9B=EF=BC=88=E5=AF=B9=E9=BD=90=E5=87=BA=E5=BA=93=20status?= =?UTF-8?q?=3D4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - mark_completed 改为 1→4 已完结(真正扫码借出完成仍为 status=3) - 前端审批页新增「已完结」筛选项与状态映射;审批信息列对 3/4 显示审批人 --- inventory-backend/app/api/v1/transactions.py | 2 +- inventory-backend/app/services/borrow_service.py | 11 +++++++---- inventory-web/src/views/borrow/approval/index.vue | 7 ++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/inventory-backend/app/api/v1/transactions.py b/inventory-backend/app/api/v1/transactions.py index 01857aa..2c2207e 100644 --- a/inventory-backend/app/api/v1/transactions.py +++ b/inventory-backend/app/api/v1/transactions.py @@ -307,7 +307,7 @@ def approve_borrow_request(request_id): @permission_required('op_borrow_approval') def close_borrow_request(request_id): """ - 手动完结已通过的借库审批单(status 1-已通过 → 3-已完成) + 手动完结已通过的借库审批单(status 1-已通过 → 4-已完结) 参照出库审批的完结逻辑,供库管/主管在未走扫码借出时强制完结 """ try: diff --git a/inventory-backend/app/services/borrow_service.py b/inventory-backend/app/services/borrow_service.py index 8e43840..f580c9a 100644 --- a/inventory-backend/app/services/borrow_service.py +++ b/inventory-backend/app/services/borrow_service.py @@ -464,18 +464,21 @@ class BorrowApprovalService: @staticmethod def mark_completed(request_id): - """标记审批单为已完成(借库执行完成后调用)""" + """ + 手动完结已通过的借库审批单(status 1-已通过 → 4-已完结,对齐出库审批的完结语义)。 + 注意:真正“扫码借出执行完成”走 trans_service.execute_dispatch,置 status=3(已完成)。 + """ approval = BorrowApproval.query.get(request_id) if not approval: return False, "审批单不存在", None if approval.status != 1: - return False, f"只有已通过的审批单才能标记为完成 (当前状态: {approval.status})", None + return False, f"只有已通过的审批单才能标记为完结 (当前状态: {approval.status})", None try: - approval.status = 3 # 已完成 + approval.status = 4 # 已完结 db.session.commit() - return True, "审批单已完成", approval + return True, "审批单已完结", approval except Exception as e: db.session.rollback() return False, f"操作失败: {str(e)}", None \ No newline at end of file diff --git a/inventory-web/src/views/borrow/approval/index.vue b/inventory-web/src/views/borrow/approval/index.vue index 338eaa2..f4e96ec 100644 --- a/inventory-web/src/views/borrow/approval/index.vue +++ b/inventory-web/src/views/borrow/approval/index.vue @@ -10,6 +10,7 @@ 已通过 已驳回 已完成 + 已完结 刷新 @@ -108,7 +109,7 @@ -