From 4ab7b6f5416f1ee31eb6f9ceed6e943a697c02a5 Mon Sep 17 00:00:00 2001 From: yueli Date: Tue, 21 Jul 2026 09:40:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20borrow/return/records=20permissionMap=20?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=88=97=E6=94=B9=E4=B8=BA=20null=20?= =?UTF-8?q?=E5=A7=8B=E7=BB=88=E5=8F=AF=E8=A7=81=EF=BC=8C=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=20inbound=20=E6=A8=A1=E5=BC=8F=EF=BC=8C=E7=A7=BB=E9=99=A4=20re?= =?UTF-8?q?cords=20alwaysVisible=20=E7=A1=AC=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/transaction/borrow.vue | 17 ++++++---- .../src/views/transaction/records.vue | 34 +++++++++---------- .../src/views/transaction/return.vue | 17 +++++----- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/inventory-web/src/views/transaction/borrow.vue b/inventory-web/src/views/transaction/borrow.vue index 65d430e..2dc13b0 100644 --- a/inventory-web/src/views/transaction/borrow.vue +++ b/inventory-web/src/views/transaction/borrow.vue @@ -275,17 +275,22 @@ import { useUserStore } from '@/stores/user' const userStore = useUserStore() // 列与权限Code的映射关系 -const permissionMap: Record = { - borrower_name: 'op_borrow:borrower_name', - sku: 'op_borrow:sku', - available_quantity: 'op_borrow:available_quantity', - out_quantity: 'op_borrow:out_quantity', +const permissionMap: Record = { + // 基础显示列 — 始终可见 + name: null, + spec_model: null, + sku: null, + borrower_name: null, + available_quantity: null, + out_quantity: null, } const hasColumnPermission = (prop: string) => { if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') return true + if (!(prop in permissionMap)) return false const code = permissionMap[prop] - return code ? userStore.hasPermission(code) : false + if (code === null || code === undefined) return true + return userStore.hasPermission(code) } // --- 状态定义 --- diff --git a/inventory-web/src/views/transaction/records.vue b/inventory-web/src/views/transaction/records.vue index b6538a4..09ca7a8 100644 --- a/inventory-web/src/views/transaction/records.vue +++ b/inventory-web/src/views/transaction/records.vue @@ -172,31 +172,29 @@ const handleClearSearch = () => { } // 列与权限Code的映射关系(数据库中的code) -const permissionMap: Record = { - borrow_no: 'op_records:borrow_no', - borrower_name: 'op_records:borrower_name', - sku: 'op_records:sku', - borrow_time: 'op_records:borrow_time', - return_time: 'op_records:return_time', - status: 'op_records:status', - expected_return_time: 'op_records:expected_return_time', - return_location: 'op_records:return_location', +const permissionMap: Record = { + // 基础显示列 — 始终可见 + borrow_no: null, + borrower_name: null, + sku: null, + borrow_time: null, + return_time: null, + return_operator: null, + status: null, + expected_return_time: null, + return_location: null, + // 签名列 — 需要权限 borrow_signature: 'op_records:borrow_signature', return_signature: 'op_records:return_signature', } // 检查列权限 const hasColumnPermission = (prop: string) => { - if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') { - return true - } - // SKU / return_time / return_operator 不再参与权限过滤,始终可见 - const alwaysVisible = ['sku', 'return_time', 'return_operator', 'expected_return_time', 'status', 'return_location', 'borrow_no', 'borrower_name', 'borrow_time'] - if (alwaysVisible.includes(prop)) { - return true - } + if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') return true + if (!(prop in permissionMap)) return false const code = permissionMap[prop] - return code ? userStore.hasPermission(code) : false + if (code === null || code === undefined) return true + return userStore.hasPermission(code) } const list = ref([]) diff --git a/inventory-web/src/views/transaction/return.vue b/inventory-web/src/views/transaction/return.vue index c1ccfe0..1574bed 100644 --- a/inventory-web/src/views/transaction/return.vue +++ b/inventory-web/src/views/transaction/return.vue @@ -205,19 +205,20 @@ import { useUserStore } from '@/stores/user' const userStore = useUserStore() // 列与权限Code的映射关系(数据库中的code) -const permissionMap: Record = { - borrower_name: 'op_return:borrower_name', - sku: 'op_return:sku', - return_location: 'op_return:return_location', +const permissionMap: Record = { + // 基础显示列 — 始终可见 + borrower_name: null, + sku: null, + return_location: null, } // 检查列权限 const hasColumnPermission = (prop: string) => { - if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') { - return true - } + if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') return true + if (!(prop in permissionMap)) return false const code = permissionMap[prop] - return code ? userStore.hasPermission(code) : false + if (code === null || code === undefined) return true + return userStore.hasPermission(code) } // --- 状态 ---