chore:优化字典管理左树排版

This commit is contained in:
秋帆
2024-05-19 12:00:38 +08:00
parent a175120d69
commit f8ded4b491
3 changed files with 5292 additions and 5984 deletions

10891
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
</slot> </slot>
</a-space> </a-space>
</a-row> </a-row>
<a-row align="stretch" :gutter="14" class="pane"> <a-row align="stretch" :gutter="14" class="h-full">
<a-col :xs="0" :sm="8" :md="7" :lg="6" :xl="5" :xxl="4" flex="260px" class="h-full ov-hidden"> <a-col :xs="0" :sm="8" :md="7" :lg="6" :xl="5" :xxl="4" flex="260px" class="h-full ov-hidden">
<DictTree placeholder="请输入关键词" @node-click="handleSelectDict" /> <DictTree placeholder="请输入关键词" @node-click="handleSelectDict" />
</a-col> </a-col>
@@ -83,7 +83,7 @@ const {
pagination, pagination,
search, search,
handleDelete handleDelete
} = useTable((page) => listDictItem({ ...queryForm, ...page }), { immediate: true }) } = useTable((page) => listDictItem({ ...queryForm, ...page }), { immediate: false })
const columns: TableInstanceColumns[] = [ const columns: TableInstanceColumns[] = [
{ {

View File

@@ -5,42 +5,28 @@
<template #prefix><icon-search /></template> <template #prefix><icon-search /></template>
</a-input> </a-input>
</div> </div>
<div class="dict-tree_tree"> <div class="dict-tree__container">
<a-scrollbar style="height: 100%; overflow: auto" outer-style="height: 100%"> <div class="dict-tree__tree">
<a-tree <a-tree :data="(treeData as unknown as TreeNodeData[])" :field-names="{ key: 'id' }" block-node
:data="(treeData as unknown as TreeNodeData[])" @select="select">
:field-names="{ key: 'id' }"
block-node
@select="select"
>
<template #title="node"> <template #title="node">
<a-trigger <a-trigger v-model:popup-visible="node.popupVisible" trigger="contextMenu" align-point
v-model:popup-visible="node.popupVisible" animation-name="slide-dynamic-origin" auto-fit-transform-origin position="bl" scroll-to-close>
trigger="contextMenu"
align-point
animation-name="slide-dynamic-origin"
auto-fit-transform-origin
position="bl"
scroll-to-close
>
<div @contextmenu="onContextmenu(node)">{{ node.name }}{{ node.code }}</div> <div @contextmenu="onContextmenu(node)">{{ node.name }}{{ node.code }}</div>
<template #content> <template #content>
<RightMenu <RightMenu v-if="has.hasPermOr(['system:dict:update', 'system:dict:delete'])" :data="node"
v-if="has.hasPermOr(['system:dict:update', 'system:dict:delete'])" @on-menu-item-click="onMenuItemClick" />
:data="node"
@on-menu-item-click="onMenuItemClick"
/>
</template> </template>
</a-trigger> </a-trigger>
</template> </template>
</a-tree> </a-tree>
<a-affix :offset-bottom="30"> </div>
</div>
<div>
<a-button v-permission="['system:dict:add']" type="primary" style="width: 100%" @click="onAdd"> <a-button v-permission="['system:dict:add']" type="primary" style="width: 100%" @click="onAdd">
<template #icon><icon-plus /></template> <template #icon><icon-plus /></template>
<span>新增</span> <span>新增</span>
</a-button> </a-button>
</a-affix>
</a-scrollbar>
</div> </div>
</div> </div>
@@ -59,15 +45,12 @@ import has from '@/utils/has'
interface Props { interface Props {
placeholder?: string placeholder?: string
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
placeholder: '请输入关键词' placeholder: '请输入关键词'
}) })
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'node-click', keys: Array<any>): void (e: 'node-click', keys: Array<any>): void
}>() }>()
// 选中节点 // 选中节点
const select = (keys: Array<any>) => { const select = (keys: Array<any>) => {
emit('node-click', keys) emit('node-click', keys)
@@ -175,6 +158,7 @@ onMounted(() => {
.arco-tree-node-title { .arco-tree-node-title {
border-radius: var(--border-radius-medium); border-radius: var(--border-radius-medium);
&:hover { &:hover {
background-color: var(--color-secondary-hover); background-color: var(--color-secondary-hover);
} }
@@ -184,6 +168,7 @@ onMounted(() => {
:deep(.arco-tree-node-selected) { :deep(.arco-tree-node-selected) {
.arco-tree-node-title { .arco-tree-node-title {
background-color: rgba(var(--primary-6), 0.1); background-color: rgba(var(--primary-6), 0.1);
&:hover { &:hover {
background-color: rgba(var(--primary-6), 0.1); background-color: rgba(var(--primary-6), 0.1);
} }
@@ -197,16 +182,28 @@ onMounted(() => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-sizing: border-box; box-sizing: border-box;
height: 100%;
&__search { &__search {
margin-bottom: 10px; margin-bottom: 10px;
} }
&__tree { &__container {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
background-color: var(--color-bg-1); background-color: var(--color-bg-1);
position: relative; position: relative;
height: 100%;
margin-bottom:10px;
}
&__tree {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto
} }
} }
</style> </style>