fix: borrow/return/records permissionMap 基础列改为 null 始终可见,对齐 inbound 模式,移除 records alwaysVisible 硬编码

This commit is contained in:
yueli
2026-07-21 09:40:58 +08:00
parent 35690c5b8f
commit 4ab7b6f541
3 changed files with 36 additions and 32 deletions

View File

@ -275,17 +275,22 @@ import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
// 列与权限Code的映射关系
const permissionMap: Record<string, string> = {
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<string, string | null> = {
// 基础显示列 — 始终可见
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)
}
// --- 状态定义 ---

View File

@ -172,31 +172,29 @@ const handleClearSearch = () => {
}
// 列与权限Code的映射关系数据库中的code
const permissionMap: Record<string, string> = {
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<string, string | null> = {
// 基础显示列 — 始终可见
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<any[]>([])

View File

@ -205,19 +205,20 @@ import { useUserStore } from '@/stores/user'
const userStore = useUserStore()
// 列与权限Code的映射关系数据库中的code
const permissionMap: Record<string, string> = {
borrower_name: 'op_return:borrower_name',
sku: 'op_return:sku',
return_location: 'op_return:return_location',
const permissionMap: Record<string, string | null> = {
// 基础显示列 — 始终可见
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)
}
// --- 状态 ---