fix: borrow/return/records permissionMap 基础列改为 null 始终可见,对齐 inbound 模式,移除 records alwaysVisible 硬编码
This commit is contained in:
@ -275,17 +275,22 @@ import { useUserStore } from '@/stores/user'
|
|||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// 列与权限Code的映射关系
|
// 列与权限Code的映射关系
|
||||||
const permissionMap: Record<string, string> = {
|
const permissionMap: Record<string, string | null> = {
|
||||||
borrower_name: 'op_borrow:borrower_name',
|
// 基础显示列 — 始终可见
|
||||||
sku: 'op_borrow:sku',
|
name: null,
|
||||||
available_quantity: 'op_borrow:available_quantity',
|
spec_model: null,
|
||||||
out_quantity: 'op_borrow:out_quantity',
|
sku: null,
|
||||||
|
borrower_name: null,
|
||||||
|
available_quantity: null,
|
||||||
|
out_quantity: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasColumnPermission = (prop: string) => {
|
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]
|
const code = permissionMap[prop]
|
||||||
return code ? userStore.hasPermission(code) : false
|
if (code === null || code === undefined) return true
|
||||||
|
return userStore.hasPermission(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- 状态定义 ---
|
// --- 状态定义 ---
|
||||||
|
|||||||
@ -172,31 +172,29 @@ const handleClearSearch = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 列与权限Code的映射关系(数据库中的code)
|
// 列与权限Code的映射关系(数据库中的code)
|
||||||
const permissionMap: Record<string, string> = {
|
const permissionMap: Record<string, string | null> = {
|
||||||
borrow_no: 'op_records:borrow_no',
|
// 基础显示列 — 始终可见
|
||||||
borrower_name: 'op_records:borrower_name',
|
borrow_no: null,
|
||||||
sku: 'op_records:sku',
|
borrower_name: null,
|
||||||
borrow_time: 'op_records:borrow_time',
|
sku: null,
|
||||||
return_time: 'op_records:return_time',
|
borrow_time: null,
|
||||||
status: 'op_records:status',
|
return_time: null,
|
||||||
expected_return_time: 'op_records:expected_return_time',
|
return_operator: null,
|
||||||
return_location: 'op_records:return_location',
|
status: null,
|
||||||
|
expected_return_time: null,
|
||||||
|
return_location: null,
|
||||||
|
// 签名列 — 需要权限
|
||||||
borrow_signature: 'op_records:borrow_signature',
|
borrow_signature: 'op_records:borrow_signature',
|
||||||
return_signature: 'op_records:return_signature',
|
return_signature: 'op_records:return_signature',
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查列权限
|
// 检查列权限
|
||||||
const hasColumnPermission = (prop: string) => {
|
const hasColumnPermission = (prop: string) => {
|
||||||
if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') {
|
if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') return true
|
||||||
return true
|
if (!(prop in permissionMap)) return false
|
||||||
}
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
const code = permissionMap[prop]
|
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[]>([])
|
const list = ref<any[]>([])
|
||||||
|
|||||||
@ -205,19 +205,20 @@ import { useUserStore } from '@/stores/user'
|
|||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// 列与权限Code的映射关系(数据库中的code)
|
// 列与权限Code的映射关系(数据库中的code)
|
||||||
const permissionMap: Record<string, string> = {
|
const permissionMap: Record<string, string | null> = {
|
||||||
borrower_name: 'op_return:borrower_name',
|
// 基础显示列 — 始终可见
|
||||||
sku: 'op_return:sku',
|
borrower_name: null,
|
||||||
return_location: 'op_return:return_location',
|
sku: null,
|
||||||
|
return_location: null,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查列权限
|
// 检查列权限
|
||||||
const hasColumnPermission = (prop: string) => {
|
const hasColumnPermission = (prop: string) => {
|
||||||
if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') {
|
if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') return true
|
||||||
return true
|
if (!(prop in permissionMap)) return false
|
||||||
}
|
|
||||||
const code = permissionMap[prop]
|
const code = permissionMap[prop]
|
||||||
return code ? userStore.hasPermission(code) : false
|
if (code === null || code === undefined) return true
|
||||||
|
return userStore.hasPermission(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- 状态 ---
|
// --- 状态 ---
|
||||||
|
|||||||
Reference in New Issue
Block a user