feat(gerp): 部门详情不提供新增入口,新增 creatable 属性

CrudTable 新增 creatable 属性(默认 true)只隐藏「新增」按钮,保留编辑/删除/批量删除;部门详情页部门员工子表传 creatable=false —— 部门成员须走入职流程(EmployeeProfile → UserRole/UserRoleDepartment),本页只保留编辑职务与批量调整职务。
This commit is contained in:
TermiNexus committed 2026-10-01 16:56:44 +08:00
1 parent 78866514e8
commit f806106c88
2 files changed
+11 -1

No files matched your search

+8 -1
View File
@@ -86,6 +86,11 @@ const props = withDefaults(defineProps<{
* (用于 role_scope 非管理员场景,如 Products/Orders 仅管理员可改)。
*/
editable?: boolean
/**
* 是否允许新增(默认 true)。只隐藏「新增」按钮,保留编辑/删除/批量删除,
* 用于"记录不由本页新增"的场景(如部门详情的部门成员须走入职流程)。
*/
creatable?: boolean
/**
* 新增/编辑表单容器形态(默认 'drawer' 右侧抽屉):
* 传 'dialog' 改回居中弹窗 —— 表格自身嵌在弹窗里时必须传 'dialog'
@@ -97,6 +102,8 @@ const props = withDefaults(defineProps<{
// 不给默认值时 props.editable 恒为 false,canEdit 判定失败 → 所有未传 editable 的
// 表格都退化成只读(新增/批量删除/行内编辑/删除全消失,操作栏只剩「查看」)
editable: true,
// 同上:Boolean prop 不显式给默认值会被强制成 false,所有表格都会丢掉「新增」按钮
creatable: true,
// 默认抽屉:GERP 列表页的新增/编辑统一走右侧抽屉(详情页子表同理)
formMode: 'drawer',
})
@@ -514,7 +521,7 @@ defineExpose({
<div class="table-header">
<span class="table-title">{{ title || table }}</span>
<div class="table-actions">
<el-button v-if="canEdit" type="primary" @click="onHandleCreate">
<el-button v-if="canEdit && creatable" type="primary" @click="onHandleCreate">
<el-icon><Plus /></el-icon>新增
</el-button>
<el-button
+3
View File
@@ -226,6 +226,8 @@ watch(deptUUID, () => {
<span>部门员工</span>
</div>
</template>
<!-- 部门成员须走入职流程(EmployeeProfile → UserRole/UserRoleDepartment),
本页不提供「新增」入口,只保留编辑(职务/类型)与批量调整职务 -->
<CrudTable
v-if="deptUUID"
ref="deptTableRef"
@@ -233,6 +235,7 @@ watch(deptUUID, () => {
title="部门员工"
:query="{ DeptUUID: deptUUID, CompanyUUID: data?.CompanyUUID || '' }"
:pk-field="'UserRoleDepartmentUUID'"
:creatable="false"
selectable
pageable
:max-height="400"