fix: 彻底解耦出库/借库权限联动 + 路由去硬编码roles + 补API权限保护
根因: 借库选单页面14处硬编码outbound_selection:operation, 导致两模块权限联动 修复: - borrow/apply: 14处outbound_selection:operation→op_borrow_apply:operation - stock.py: 拆分_do_get_stock_list裸逻辑, 出库/借库各绑独立权限码 - transactions: 新增/borrow/stock-list端点(@permission(op_borrow_apply)) - transaction.ts: 新增getBorrowStockList前端API函数 - outbound.py: 出库审批4端点改用独立outbound_approval权限码 - transactions.py: 借库审批3端点补@permission(op_borrow_approval) - purchase.py: 采购管理7端点补@permission(inbound_buy) - audit.py: 审计日志补@permission(system_audit) - router: 清除全部6处硬编码roles, 交由动态权限树控制
This commit is contained in:
@ -209,15 +209,9 @@ def get_all_stock():
|
||||
# ==============================================================================
|
||||
# 分页库存查询接口(服务端分页,出库/盘点/借用模块共用)
|
||||
# ==============================================================================
|
||||
@bp.route('/list', methods=['GET'])
|
||||
@jwt_required()
|
||||
def get_stock_list():
|
||||
def _do_get_stock_list():
|
||||
"""
|
||||
分页获取库存列表(stock_quantity > 0)
|
||||
参数:
|
||||
page - 页码(默认 1)
|
||||
pageSize - 每页条数(默认 20)
|
||||
keyword - 搜索关键字(模糊匹配名称/规格/SKU)
|
||||
分页获取库存列表(stock_quantity > 0) — 裸逻辑,供各模块复用
|
||||
"""
|
||||
try:
|
||||
page = request.args.get('page', 1, type=int)
|
||||
@ -352,6 +346,14 @@ def get_stock_list():
|
||||
return jsonify({'msg': f'获取库存列表失败: {str(e)}'}), 500
|
||||
|
||||
|
||||
@bp.route('/list', methods=['GET'])
|
||||
@jwt_required()
|
||||
@permission_required('outbound_selection')
|
||||
def get_stock_list():
|
||||
"""出库选单专用库存列表"""
|
||||
return _do_get_stock_list()
|
||||
|
||||
|
||||
# --- 草稿箱接口 ---
|
||||
|
||||
@bp.route('/draft/list', methods=['GET'])
|
||||
|
||||
Reference in New Issue
Block a user