mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-06-04 09:15:39 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db8f30f27f |
@@ -20,15 +20,15 @@
|
||||
"@xterm/xterm": "^6.0.0",
|
||||
"asciinema-player": "^3.15.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.20",
|
||||
"echarts": "^6.0.0",
|
||||
"dayjs": "^1.11.21",
|
||||
"echarts": "^6.1.0",
|
||||
"element-plus": "^2.14.1",
|
||||
"js-base64": "^3.7.8",
|
||||
"jsencrypt": "^3.5.4",
|
||||
"json-bigint": "^1.0.0",
|
||||
"mermaid": "^11.15.0",
|
||||
"monaco-editor": "^0.55.1",
|
||||
"monaco-sql-languages": "^1.0.0",
|
||||
"monaco-sql-languages": "^1.1.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^3.0.4",
|
||||
"qrcode.vue": "^3.9.1",
|
||||
@@ -67,7 +67,7 @@
|
||||
"tailwindcss": "^4.3.0",
|
||||
"typescript": "^6.0.3",
|
||||
"typescript-eslint": "^8.59.2",
|
||||
"vite": "^8.0.14",
|
||||
"vite": "^8.0.16",
|
||||
"vite-plugin-progress": "0.0.7",
|
||||
"vue-eslint-parser": "^10.4.0"
|
||||
},
|
||||
|
||||
@@ -120,6 +120,11 @@ export class NodeType {
|
||||
// 节点双击事件
|
||||
nodeDblclickFunc?: (node: TagTreeNode) => void;
|
||||
|
||||
/**
|
||||
* 折叠时是否删除子节点以释放内存(展开时重新懒加载)
|
||||
*/
|
||||
collapseRemoveChildren: boolean = false;
|
||||
|
||||
constructor(value: number) {
|
||||
this.value = value;
|
||||
}
|
||||
@@ -163,6 +168,14 @@ export class NodeType {
|
||||
this.contextMenuItems = contextMenuItems;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置折叠时是否删除子节点
|
||||
*/
|
||||
withCollapseRemoveChildren(collapseRemoveChildren: boolean = true) {
|
||||
this.collapseRemoveChildren = collapseRemoveChildren;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export function expandCodePath(codePath: string) {
|
||||
|
||||
@@ -191,6 +191,7 @@ export const NodeTypePostgresSchema = new NodeType(224).withContextMenuItems([Co
|
||||
|
||||
// 数据库表菜单节点
|
||||
const NodeTypeTableMenu = new NodeType(4)
|
||||
.withCollapseRemoveChildren()
|
||||
.withContextMenuItems([
|
||||
ContextmenuItemRefresh,
|
||||
new ContextmenuItem('createTable', 'db.createTable').withIcon('Plus').withOnClick(async (parentNode: TagTreeNode) => {
|
||||
@@ -238,15 +239,12 @@ const NodeTypeTableMenu = new NodeType(4)
|
||||
// 数据库sql模板菜单节点
|
||||
const NodeTypeSqlMenu = new NodeType(225).withLoadNodesFunc(async (parentNode: TagTreeNode) => {
|
||||
const params = parentNode.params;
|
||||
const id = params.id;
|
||||
const db = params.db;
|
||||
const dbs = params.dbs;
|
||||
// 加载用户保存的sql脚本
|
||||
const sqls = await dbApi.getSqlNames.request({ id: id, db: db });
|
||||
const sqls = await dbApi.getSqlNames.request({ id: params.id, db: params.db });
|
||||
return sqls.map((x: any) => {
|
||||
return TagTreeNode.new(parentNode, `${parentNode.key}.${x.name}`, x.name, NodeTypeSql)
|
||||
.withIsLeaf(true)
|
||||
.withParams({ id, db, dbs, sqlName: x.name })
|
||||
.withParams({ ...params, sqlName: x.name })
|
||||
.withIcon(SqlIcon);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
:filter-node-method="filterNode"
|
||||
@node-click="treeNodeClick"
|
||||
@node-expand="treeNodeClick"
|
||||
@node-collapse="onNodeCollapse"
|
||||
@node-contextmenu="onNodeContextmenu"
|
||||
:default-expanded-keys="state.defaultExpandedKeys"
|
||||
>
|
||||
@@ -408,6 +409,32 @@ const treeNodeDblclick = async (data: any, node: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 递归查找子树中标记了 collapseRemoveChildren 的节点,删除其子节点
|
||||
const removeCollapseChildrenNodes = (node: any) => {
|
||||
if (node.data?.type?.collapseRemoveChildren) {
|
||||
// 找到标记节点,删除其所有子节点,不再往下递归
|
||||
const childNodes = [...node.childNodes];
|
||||
childNodes.forEach((child: any) => {
|
||||
treeRef.value?.remove(child.data || child);
|
||||
});
|
||||
console.log('removeCollapseChildrenNodes ', node.data);
|
||||
node.loaded = false;
|
||||
node.loading = false;
|
||||
node.isLeaf = false;
|
||||
node.expanded = false;
|
||||
return;
|
||||
}
|
||||
// 当前节点无标记,继续往子节点查找
|
||||
for (const child of [...node.childNodes]) {
|
||||
removeCollapseChildrenNodes(child);
|
||||
}
|
||||
};
|
||||
|
||||
// 树节点折叠事件 - 删除子树中标记了 collapseRemoveChildren 的节点的子节点,释放内存
|
||||
const onNodeCollapse = (data: any, node: any) => {
|
||||
removeCollapseChildrenNodes(node);
|
||||
};
|
||||
|
||||
// 树节点右击事件
|
||||
const onNodeContextmenu = (event: any, data: any) => {
|
||||
if (data.disabled) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:title="$t('system.role.allocateMenuTitle', { roleName: roleInfo?.name })"
|
||||
:title="$t('system.role.allocateMenuTitle', { roleName: props.role?.name })"
|
||||
v-model="visible"
|
||||
:before-close="onCancel"
|
||||
:show-close="false"
|
||||
@@ -25,10 +25,8 @@
|
||||
</template>
|
||||
</el-tree>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="state.submiting" @click="onCancel">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button :loading="state.submiting" type="primary" @click="onConfirm">{{ $t('common.confirm') }}</el-button>
|
||||
</div>
|
||||
<el-button :loading="state.submiting" @click="onCancel">{{ $t('common.cancel') }}</el-button>
|
||||
<el-button :loading="state.submiting" type="primary" @click="onConfirm">{{ $t('common.confirm') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
@@ -37,7 +35,7 @@
|
||||
<script lang="ts" setup>
|
||||
import SvgIcon from '@/components/svgIcon/index.vue';
|
||||
import { Msg } from '@/hooks/useI18n';
|
||||
import { reactive, ref, toRefs, watch } from 'vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { roleApi } from '../api';
|
||||
import { ResourceTypeEnum } from '../enums';
|
||||
import { getMenuIcon } from '../resource';
|
||||
@@ -72,19 +70,9 @@ const defaultProps = {
|
||||
const menuTree: any = ref(null);
|
||||
|
||||
const state = reactive({
|
||||
roleInfo: null as any,
|
||||
submiting: false,
|
||||
});
|
||||
|
||||
const { roleInfo } = toRefs(state);
|
||||
|
||||
watch(
|
||||
() => visible,
|
||||
(newValue) => {
|
||||
state.roleInfo = props.role;
|
||||
}
|
||||
);
|
||||
|
||||
const onConfirm = async () => {
|
||||
let menuIds = menuTree.value.getCheckedKeys();
|
||||
let halfMenuIds = menuTree.value.getHalfCheckedKeys();
|
||||
|
||||
@@ -5,6 +5,8 @@ go 1.26
|
||||
require (
|
||||
gitee.com/chunanyong/dm v1.8.23
|
||||
gitee.com/liuzongyang/libpq v1.10.11
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.45.0
|
||||
github.com/brianvoe/gofakeit/v7 v7.14.1
|
||||
github.com/cloudwego/eino v0.9.2
|
||||
github.com/cloudwego/eino-ext/components/model/openai v0.1.13
|
||||
github.com/docker/docker v28.5.2+incompatible
|
||||
@@ -32,12 +34,14 @@ require (
|
||||
github.com/pquerna/otp v1.5.0
|
||||
github.com/redis/go-redis/v9 v9.20.0
|
||||
github.com/robfig/cron/v3 v3.0.1 // 定时任务
|
||||
github.com/samber/lo v1.27.0
|
||||
github.com/sijms/go-ora/v2 v2.9.0
|
||||
github.com/spf13/cast v1.10.0
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/tidwall/gjson v1.19.0
|
||||
github.com/twmb/franz-go v1.20.7
|
||||
github.com/twmb/franz-go/pkg/kadm v1.17.2
|
||||
github.com/xuri/excelize/v2 v2.10.1
|
||||
go.mongodb.org/mongo-driver/v2 v2.5.0 // mongo
|
||||
golang.org/x/crypto v0.52.0
|
||||
golang.org/x/oauth2 v0.36.0
|
||||
@@ -50,13 +54,6 @@ require (
|
||||
gorm.io/gorm v1.31.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.45.0
|
||||
github.com/brianvoe/gofakeit/v7 v7.14.1
|
||||
github.com/samber/lo v1.27.0
|
||||
github.com/xuri/excelize/v2 v2.10.1
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.2.0 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.1.0 // indirect
|
||||
|
||||
Reference in New Issue
Block a user