From af41eb1803e9b582e1cad5a295330a8c7c022a6c Mon Sep 17 00:00:00 2001 From: dxc Date: Fri, 27 Feb 2026 13:45:49 +0800 Subject: [PATCH] feat: add RBAC controls for outbound selection module Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) --- inventory-backend/app/api/v1/outbound.py | 6 ++++- .../src/views/outbound/Selection.vue | 25 +++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/inventory-backend/app/api/v1/outbound.py b/inventory-backend/app/api/v1/outbound.py index fea85e3..ae857e0 100644 --- a/inventory-backend/app/api/v1/outbound.py +++ b/inventory-backend/app/api/v1/outbound.py @@ -1,6 +1,7 @@ from flask import Blueprint, request, jsonify from app.services.outbound_service import OutboundService from flask_jwt_extended import jwt_required, get_jwt_identity +from app.utils.decorators import permission_required import traceback outbound_bp = Blueprint('outbound', __name__, url_prefix='/outbound') @@ -12,6 +13,7 @@ outbound_bp = Blueprint('outbound', __name__, url_prefix='/outbound') # -------------------------------------------------------- @outbound_bp.route('/scan', methods=['GET']) @jwt_required() +@permission_required('outbound_selection') def scan_barcode(): barcode = request.args.get('barcode') if not barcode: @@ -44,6 +46,7 @@ def scan_barcode(): # -------------------------------------------------------- @outbound_bp.route('', methods=['POST']) @jwt_required() +@permission_required('outbound_selection:operation') def create_outbound(): data = request.get_json() if not data: @@ -89,6 +92,7 @@ def create_outbound(): # -------------------------------------------------------- @outbound_bp.route('', methods=['GET']) @jwt_required() +@permission_required('outbound_selection') def get_outbound_list(): try: page = int(request.args.get('page', 1)) @@ -106,4 +110,4 @@ def get_outbound_list(): }) except Exception as e: traceback.print_exc() - return jsonify({'code': 500, 'msg': str(e)}), 500 \ No newline at end of file + return jsonify({'code': 500, 'msg': str(e)}), 500 diff --git a/inventory-web/src/views/outbound/Selection.vue b/inventory-web/src/views/outbound/Selection.vue index 296fa98..b08470e 100644 --- a/inventory-web/src/views/outbound/Selection.vue +++ b/inventory-web/src/views/outbound/Selection.vue @@ -8,14 +8,14 @@ (请添加需要出库的物品)
- + 手动添加库存 - + 按 BOM 套餐添加 - + 生成预览 & 打印
@@ -71,6 +71,7 @@ size="small" style="width: 100%" controls-position="right" + :disabled="!userStore.hasPermission('outbound_selection:operation')" @change="(val) => handleMainQuantityChange(val, row)" /> @@ -78,7 +79,7 @@ @@ -133,6 +134,7 @@ size="small" style="width: 100%" placeholder="0" + :disabled="!userStore.hasPermission('outbound_selection:operation')" @click.stop @change="(val) => handleManualQuantityChange(val, row)" /> @@ -144,7 +146,7 @@ 已勾选 {{ tempSelection.length }} 项 取消 - 确认添加 + 确认添加 @@ -161,7 +163,7 @@ - +
@@ -169,7 +171,7 @@
@@ -204,11 +206,11 @@ 取消 - + 导出 Excel - + 确认打印 (A4) @@ -283,6 +285,9 @@ import { Printer, Search, Plus, Download, List } from '@element-plus/icons-vue' import { ElMessage, ElTable, ElMessageBox } from 'element-plus' import { getAllStock, printSelectionList } from '@/api/inbound/stock' import { getBomList, getBomDetail } from '@/api/bom' +import { useUserStore } from '@/stores/user' + +const userStore = useUserStore() // --- 状态变量 --- const selectedItems = ref([]) @@ -598,4 +603,4 @@ const confirmExport = () => { .sig-label { font-size: 14px; margin-bottom: 40px; text-align: left; width: 100%; } .sig-line { border-bottom: 1px solid #000; width: 100%; height: 1px; display: block; } } - \ No newline at end of file +