fix(material): 基础信息(Odoo)补回表单禁用权限守卫
buyOdoo.vue 是 list.vue 的手工副本。68fd93b 给 list.vue 加了 formDisabled
(无 material_list:operation 权限时整个表单只读),未同步到 Odoo 页。
列表页的「编辑/新增」按钮虽有权限守卫,但 URL 深链 ?edit_id= 不受守卫,
可直接打开 Odoo 页弹窗:字段能改、确定能点,提交后才被后端
@permission_required('material_list:operation') 拦下,用户白填一遍。
补上 formDisabled computed 及表单、确定按钮两处绑定,与 list.vue 对齐。
This commit is contained in:
@ -437,7 +437,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px" :disabled="formDisabled">
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
@ -655,7 +655,7 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="cancel" :disabled="isUploading">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm" :loading="submitLoading || isUploading">确 定</el-button>
|
||||
<el-button type="primary" @click="submitForm" :loading="submitLoading || isUploading" :disabled="formDisabled">确 定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -789,6 +789,16 @@ const canEditRemark = computed(() => {
|
||||
return userStore.hasPermission('material_list:remark_edit');
|
||||
});
|
||||
|
||||
// 表单全局禁用:没有 material_list:operation 权限时,所有表单字段不可编辑
|
||||
// ★ 为什么必须有:列表页的「编辑/新增」按钮虽然有权限守卫,但 URL 深链
|
||||
// ?edit_id= 不受守卫,可直接打开本弹窗。若此处不禁用,用户能改完并点确定,
|
||||
// 最终被后端 @permission_required('material_list:operation') 拦下 —— 白填一遍。
|
||||
// (与 list.vue 对齐)
|
||||
const formDisabled = computed(() => {
|
||||
if (userStore.role === 'SUPER_ADMIN' || userStore.username === 'IRIS') return false;
|
||||
return !userStore.hasPermission('material_list:operation');
|
||||
});
|
||||
|
||||
// --- 类型定义 ---
|
||||
interface MaterialBaseVO {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user