fix(scrap): 撤回按钮改用 scrap_approval 权限,修正错配
报废审批页的「撤回」按钮原先复用了执行按钮的 canExecute 条件 (scrap_execute)。但 scrap_execute 比 scrap_approval 多授予 INBOUND 角色 —— 意味着只具备执行权、无审批权的人也会看到撤回按钮。 撤回是对单据的处置动作,应与审批同权限等级。新增 canWithdraw 计算属性 (SUPER_ADMIN 或 scrap_approval),替换原 canExecute。 注:申请人在「我的申请单」页有自己的撤回入口,走的是单据归属校验, 不依赖此处权限。
This commit is contained in:
@ -125,7 +125,7 @@
|
||||
type="warning" plain size="small" :loading="row._executing" @click="openExecute(row)"
|
||||
>执行报废</el-button>
|
||||
<el-button
|
||||
v-if="canExecute"
|
||||
v-if="canWithdraw"
|
||||
type="info" plain size="small" :loading="row._withdrawing" @click="handleWithdraw(row)"
|
||||
>撤回</el-button>
|
||||
</template>
|
||||
@ -197,9 +197,19 @@ const rejectLoading = ref(false)
|
||||
const userNameCache = ref<Record<number, string>>({})
|
||||
|
||||
// --- 权限 ---
|
||||
// 执行报废:需「按单报废执行」权限
|
||||
const canExecute = computed(() =>
|
||||
userStore.role === 'SUPER_ADMIN' || userStore.hasPermission('scrap_execute')
|
||||
)
|
||||
// ★ 撤回:需「报废审批」权限(原先误用 canExecute)
|
||||
//
|
||||
// scrap_execute 比 scrap_approval 多授予 INBOUND 角色 —— 若沿用 canExecute,
|
||||
// 只具备执行权、无审批权的人也会看到撤回按钮。撤回是对单据的处置动作,
|
||||
// 应与审批同权限等级。(申请人在「申请页-我的申请单」有自己的撤回入口,
|
||||
// 走的是单据归属校验,不依赖此处。)
|
||||
const canWithdraw = computed(() =>
|
||||
userStore.role === 'SUPER_ADMIN' || userStore.hasPermission('scrap_approval')
|
||||
)
|
||||
|
||||
// --- 工具 ---
|
||||
const statusText = (status: number) => {
|
||||
|
||||
Reference in New Issue
Block a user