mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-07 01:40:25 +08:00
release v1.8.6
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
:default-expanded-keys="props.defaultExpandedKeys"
|
:default-expanded-keys="props.defaultExpandedKeys"
|
||||||
>
|
>
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span @dblclick="treeNodeDblclick(data)" :class="data.type.nodeDblclickFunc ? 'none-select' : ''">
|
<span :id="node.key" @dblclick="treeNodeDblclick(data)" :class="data.type.nodeDblclickFunc ? 'none-select' : ''">
|
||||||
<span v-if="data.type.value == TagTreeNode.TagPath">
|
<span v-if="data.type.value == TagTreeNode.TagPath">
|
||||||
<tag-info :tag-path="data.label" />
|
<tag-info :tag-path="data.label" />
|
||||||
</span>
|
</span>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, reactive, ref, watch, toRefs } from 'vue';
|
import { onMounted, reactive, ref, watch, toRefs, nextTick } from 'vue';
|
||||||
import { NodeType, TagTreeNode } from './tag';
|
import { NodeType, TagTreeNode } from './tag';
|
||||||
import TagInfo from './TagInfo.vue';
|
import TagInfo from './TagInfo.vue';
|
||||||
import { Contextmenu } from '@/components/contextmenu';
|
import { Contextmenu } from '@/components/contextmenu';
|
||||||
@@ -126,7 +126,7 @@ const loadTags = async () => {
|
|||||||
* @param { Object } node
|
* @param { Object } node
|
||||||
* @param { Object } resolve
|
* @param { Object } resolve
|
||||||
*/
|
*/
|
||||||
const loadNode = async (node: any, resolve: any) => {
|
const loadNode = async (node: any, resolve: (data: any) => void, reject: () => void) => {
|
||||||
if (typeof resolve !== 'function') {
|
if (typeof resolve !== 'function') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -141,6 +141,8 @@ const loadNode = async (node: any, resolve: any) => {
|
|||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
// 调用 reject 以保持节点状态,并允许远程加载继续。
|
||||||
|
return reject();
|
||||||
}
|
}
|
||||||
return resolve(nodes);
|
return resolve(nodes);
|
||||||
};
|
};
|
||||||
@@ -207,6 +209,17 @@ const getNode = (nodeKey: any) => {
|
|||||||
|
|
||||||
const setCurrentKey = (nodeKey: any) => {
|
const setCurrentKey = (nodeKey: any) => {
|
||||||
treeRef.value.setCurrentKey(nodeKey);
|
treeRef.value.setCurrentKey(nodeKey);
|
||||||
|
|
||||||
|
// 通过Id获取到对应的dom元素
|
||||||
|
const node = document.getElementById(nodeKey);
|
||||||
|
if (node) {
|
||||||
|
setTimeout(() => {
|
||||||
|
nextTick(() => {
|
||||||
|
// 通过scrollIntoView方法将对应的dom元素定位到可见区域 【block: 'center'】这个属性是在垂直方向居中显示
|
||||||
|
node.scrollIntoView({ block: 'center' });
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
ref="tagTreeRef"
|
ref="tagTreeRef"
|
||||||
:data="state.tags"
|
:data="state.tags"
|
||||||
:default-expanded-keys="checkedTags"
|
:default-expanded-keys="state.defaultExpandedKeys"
|
||||||
:default-checked-keys="checkedTags"
|
:default-checked-keys="checkedTags"
|
||||||
multiple
|
multiple
|
||||||
:render-after-expand="true"
|
:render-after-expand="true"
|
||||||
@@ -74,10 +74,12 @@ const tagTreeRef: any = ref(null);
|
|||||||
const filterTag = ref('');
|
const filterTag = ref('');
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
defaultExpandedKeys: [] as any,
|
||||||
tags: [],
|
tags: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
state.defaultExpandedKeys = checkedTags.value;
|
||||||
search();
|
search();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -58,16 +58,61 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24" v-if="state.db">
|
<el-col :span="24" v-if="state.db">
|
||||||
<el-descriptions :column="4" size="small" border>
|
<el-descriptions :column="4" size="small" border>
|
||||||
<el-descriptions-item label-align="right" label="操作"
|
<el-descriptions-item label-align="right" label="操作">
|
||||||
><el-button
|
<el-button
|
||||||
:disabled="!state.db || !nowDbInst.id"
|
:disabled="!state.db || !nowDbInst.id"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="Search"
|
icon="Search"
|
||||||
@click="addQueryTab({ id: nowDbInst.id, dbs: nowDbInst.databases }, state.db)"
|
link
|
||||||
size="small"
|
@click="
|
||||||
>新建查询</el-button
|
addQueryTab(
|
||||||
></el-descriptions-item
|
{ id: nowDbInst.id, dbs: nowDbInst.databases, nodeKey: getSqlMenuNodeKey(nowDbInst.id, state.db) },
|
||||||
>
|
state.db
|
||||||
|
)
|
||||||
|
"
|
||||||
|
title="新建查询"
|
||||||
|
>
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<template v-if="!dbConfig.locationTreeNode">
|
||||||
|
<el-divider direction="vertical" border-style="dashed" />
|
||||||
|
<el-button @click="locationNowTreeNode(null)" title="定位至左侧树的指定位置" icon="Location" link></el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<el-divider direction="vertical" border-style="dashed" />
|
||||||
|
<!-- 数据库展示配置 -->
|
||||||
|
<el-popover
|
||||||
|
popper-style="max-height: 550px; overflow: auto; max-width: 450px"
|
||||||
|
placement="bottom"
|
||||||
|
width="auto"
|
||||||
|
title="数据库展示配置"
|
||||||
|
trigger="click"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-checkbox
|
||||||
|
v-model="dbConfig.showColumnComment"
|
||||||
|
label="显示字段备注"
|
||||||
|
:true-value="1"
|
||||||
|
:false-value="0"
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-checkbox
|
||||||
|
v-model="dbConfig.locationTreeNode"
|
||||||
|
label="自动定位树节点"
|
||||||
|
:true-value="1"
|
||||||
|
:false-value="0"
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<template #reference>
|
||||||
|
<el-link type="primary" icon="setting" :underline="false"></el-link>
|
||||||
|
</template>
|
||||||
|
</el-popover>
|
||||||
|
</el-descriptions-item>
|
||||||
|
|
||||||
<el-descriptions-item label-align="right" label="tag">{{ nowDbInst.tagPath }}</el-descriptions-item>
|
<el-descriptions-item label-align="right" label="tag">{{ nowDbInst.tagPath }}</el-descriptions-item>
|
||||||
|
|
||||||
@@ -103,7 +148,9 @@
|
|||||||
<el-tab-pane class="h100" closable v-for="dt in state.tabs.values()" :label="dt.label" :name="dt.key" :key="dt.key">
|
<el-tab-pane class="h100" closable v-for="dt in state.tabs.values()" :label="dt.label" :name="dt.key" :key="dt.key">
|
||||||
<template #label>
|
<template #label>
|
||||||
<el-popover :show-after="1000" placement="bottom-start" trigger="hover" :width="250">
|
<el-popover :show-after="1000" placement="bottom-start" trigger="hover" :width="250">
|
||||||
<template #reference> {{ dt.label }} </template>
|
<template #reference>
|
||||||
|
<span class="font12">{{ dt.label }}</span>
|
||||||
|
</template>
|
||||||
<template #default>
|
<template #default>
|
||||||
<el-descriptions :column="1" size="small">
|
<el-descriptions :column="1" size="small">
|
||||||
<el-descriptions-item label="tagPath">
|
<el-descriptions-item label="tagPath">
|
||||||
@@ -184,7 +231,7 @@ import { getDbDialect, schemaDbTypes } from './dialect/index';
|
|||||||
import { sleep } from '@/common/utils/loading';
|
import { sleep } from '@/common/utils/loading';
|
||||||
import { TagResourceTypeEnum } from '@/common/commonEnum';
|
import { TagResourceTypeEnum } from '@/common/commonEnum';
|
||||||
import { Pane, Splitpanes } from 'splitpanes';
|
import { Pane, Splitpanes } from 'splitpanes';
|
||||||
import { useEventListener } from '@vueuse/core';
|
import { useEventListener, useStorage } from '@vueuse/core';
|
||||||
import SqlExecBox from '@/views/ops/db/component/sqleditor/SqlExecBox';
|
import SqlExecBox from '@/views/ops/db/component/sqleditor/SqlExecBox';
|
||||||
import { useAutoOpenResource } from '@/store/autoOpenResource';
|
import { useAutoOpenResource } from '@/store/autoOpenResource';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
@@ -456,6 +503,8 @@ const state = reactive({
|
|||||||
|
|
||||||
const { nowDbInst, tableCreateDialog } = toRefs(state);
|
const { nowDbInst, tableCreateDialog } = toRefs(state);
|
||||||
|
|
||||||
|
const dbConfig = useStorage('dbConfig', { showColumnComment: false, locationTreeNode: false });
|
||||||
|
|
||||||
const serverInfoReqParam = ref({
|
const serverInfoReqParam = ref({
|
||||||
instanceId: 0,
|
instanceId: 0,
|
||||||
});
|
});
|
||||||
@@ -670,6 +719,18 @@ const onTabChange = () => {
|
|||||||
registerDbCompletionItemProvider(nowTab.dbId, nowTab.db, nowTab.params.dbs, nowDbInst.value.type);
|
registerDbCompletionItemProvider(nowTab.dbId, nowTab.db, nowTab.params.dbs, nowDbInst.value.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dbConfig.value.locationTreeNode) {
|
||||||
|
locationNowTreeNode(nowTab);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定位至当前树节点
|
||||||
|
*/
|
||||||
|
const locationNowTreeNode = (nowTab: any = null) => {
|
||||||
|
if (!nowTab) {
|
||||||
|
nowTab = state.tabs.get(state.activeName);
|
||||||
|
}
|
||||||
tagTreeRef.value.setCurrentKey(nowTab?.treeNodeKey);
|
tagTreeRef.value.setCurrentKey(nowTab?.treeNodeKey);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -854,7 +915,7 @@ const getNowDbInfo = () => {
|
|||||||
margin: 0 0 5px;
|
margin: 0 0 5px;
|
||||||
|
|
||||||
.el-tabs__item {
|
.el-tabs__item {
|
||||||
padding: 0 10px;
|
padding: 0 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<div style="text-align: center">
|
<div style="text-align: center">
|
||||||
<el-empty class="h100" :description="props.emptyText" :image-size="100" />
|
<el-empty :description="props.emptyText" :image-size="100" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-v2>
|
</el-table-v2>
|
||||||
|
|||||||
@@ -48,21 +48,6 @@
|
|||||||
<el-tooltip :show-after="500" class="box-item" effect="dark" content="commit" placement="top">
|
<el-tooltip :show-after="500" class="box-item" effect="dark" content="commit" placement="top">
|
||||||
<el-link @click="onCommit()" type="success" icon="CircleCheck" :underline="false"> </el-link>
|
<el-link @click="onCommit()" type="success" icon="CircleCheck" :underline="false"> </el-link>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-divider direction="vertical" border-style="dashed" />
|
|
||||||
|
|
||||||
<!-- 表数据展示配置 -->
|
|
||||||
<el-popover
|
|
||||||
popper-style="max-height: 550px; overflow: auto; max-width: 450px"
|
|
||||||
placement="bottom"
|
|
||||||
width="auto"
|
|
||||||
title="展示配置"
|
|
||||||
trigger="click"
|
|
||||||
>
|
|
||||||
<el-checkbox v-model="dbConfig.showColumnComment" label="显示字段备注" :true-value="true" :false-value="false" size="small" />
|
|
||||||
<template #reference>
|
|
||||||
<el-link type="primary" icon="setting" :underline="false"></el-link>
|
|
||||||
</template>
|
|
||||||
</el-popover>
|
|
||||||
|
|
||||||
<el-divider direction="vertical" border-style="dashed" />
|
<el-divider direction="vertical" border-style="dashed" />
|
||||||
|
|
||||||
@@ -258,7 +243,7 @@ import { DbInst } from '@/views/ops/db/db';
|
|||||||
import DbTableData from './DbTableData.vue';
|
import DbTableData from './DbTableData.vue';
|
||||||
import { DbDialect } from '@/views/ops/db/dialect';
|
import { DbDialect } from '@/views/ops/db/dialect';
|
||||||
import SvgIcon from '@/components/svgIcon/index.vue';
|
import SvgIcon from '@/components/svgIcon/index.vue';
|
||||||
import { useEventListener, useStorage } from '@vueuse/core';
|
import { useEventListener } from '@vueuse/core';
|
||||||
import { copyToClipboard } from '@/common/utils/string';
|
import { copyToClipboard } from '@/common/utils/string';
|
||||||
import DbTableDataForm from './DbTableDataForm.vue';
|
import DbTableDataForm from './DbTableDataForm.vue';
|
||||||
|
|
||||||
@@ -288,8 +273,6 @@ const condDialogInputRef: Ref = ref(null);
|
|||||||
|
|
||||||
const defaultPageSize = DbInst.DefaultLimit;
|
const defaultPageSize = DbInst.DefaultLimit;
|
||||||
|
|
||||||
const dbConfig = useStorage('dbConfig', { showColumnComment: false });
|
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
datas: [],
|
datas: [],
|
||||||
sql: '', // 当前数据tab执行的sql
|
sql: '', // 当前数据tab执行的sql
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ SELECT a.indexname AS "i
|
|||||||
indexdef AS "indexDef",
|
indexdef AS "indexDef",
|
||||||
c.attname AS "columnName",
|
c.attname AS "columnName",
|
||||||
c.attnum AS "seqInIndex",
|
c.attnum AS "seqInIndex",
|
||||||
case when a.indexname like '%_pkey' then 1 else 0 end AS "isPrimaryKey"
|
case when a.indexname like '%%_pkey' then 1 else 0 end AS "isPrimaryKey"
|
||||||
FROM pg_indexes a
|
FROM pg_indexes a
|
||||||
join pg_class b on a.indexname = b.relname
|
join pg_class b on a.indexname = b.relname
|
||||||
join pg_attribute c on b.oid = c.attrelid
|
join pg_attribute c on b.oid = c.attrelid
|
||||||
WHERE a.schemaname = (select current_schema())
|
WHERE a.schemaname = (select current_schema())
|
||||||
AND a.tablename = '%s'
|
AND a.tablename = '%s'
|
||||||
AND a.indexname not like '%_pkey'
|
AND a.indexname not like '%%_pkey'
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
--PGSQL_COLUMN_MA 表列信息
|
--PGSQL_COLUMN_MA 表列信息
|
||||||
SELECT a.table_name AS "tableName",
|
SELECT a.table_name AS "tableName",
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user