feat(authz): 应用类型卡片新增「全部展开」开关 + 用户管理列宽让位部门列
build / build (push) Successful in 3m16s

- MyTree 新增受控 prop expandAll(默认 false):在 zTree 初始化之后套用并监听变化,
  数据重载(切组/搜索过滤)后自动重新展开,规避调用方与 initTree 抢 nextTick 时序
- 组授权 / 角色授权的应用类型卡片头部加「全部展开 + small Switch」,默认关闭,
  控制该类型下全部应用与模块的展开收起;每个卡片独立,状态按 category id 保存
- 开关外层 @click.stop:卡片头部本身绑定 toggleCollapse,不阻断冒泡会连带折叠卡片
- 角色授权「用户管理」表格:账号/姓名改定宽(110/90)、操作 80,部门 minWidth 吃剩余
  宽度,把空间留给组路径列
This commit is contained in:
chenxing
2026-09-16 19:14:23 +08:00
parent a082e59c3e
commit 628a914e19
4 changed files with 64 additions and 5 deletions
+22 -1
View File
@@ -26,10 +26,15 @@
:type="collapsedMap[String(item.cat.id)] ? 'ios-arrow-forward' : 'ios-arrow-down'" />
<span class="cat-name" :title="item.cat.name">{{ item.cat.name }}</span>
<span class="cat-count">{{ item.treeData.length }}个应用</span>
<!-- 开关外层 @click.stop:否则点击会冒泡到卡片头部触发折叠 -->
<span class="expand-all" @click.stop>
<span class="expand-all-label">全部展开</span>
<Switch size="small" v-model="expandAllMap[String(item.cat.id)]" />
</span>
</div>
<div v-show="!collapsedMap[String(item.cat.id)]" class="cat-card-body">
<MyTree :treeData="item.treeData" :setting="treeSetting" :autoClick="false" :isCheck="true"
@on-tree-check="onTreeCheck" />
:expandAll="!!expandAllMap[String(item.cat.id)]" @on-tree-check="onTreeCheck" />
</div>
</div>
</div>
@@ -82,6 +87,9 @@ const searchKeyword = ref("");
const appliedKeyword = ref("");
const collapsedMap = reactive<Record<string, boolean>>({});
/** 各应用类型卡片的「全部展开」开关(默认关闭):状态随卡片独立保存,数据重载后仍生效 */
const expandAllMap = reactive<Record<string, boolean>>({});
const treeSetting = {
view: { dblClickExpand: false, showIcon: false },
check: {
@@ -402,6 +410,19 @@ watch(
padding: 6px 8px;
}
.expand-all {
display: flex;
align-items: center;
flex-shrink: 0;
gap: 4px;
}
.expand-all-label {
font-size: 12px;
color: #999;
white-space: nowrap;
}
.empty-tip {
color: #999;
padding: 48px 0;