mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
fix: 问题修复
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
"trzsz": "^1.1.5",
|
||||
"uuid": "^9.0.1",
|
||||
"vue": "^3.4.23",
|
||||
"vue-router": "^4.3.0",
|
||||
"vue-router": "^4.3.1",
|
||||
"xterm": "^5.3.0",
|
||||
"xterm-addon-fit": "^0.8.0",
|
||||
"xterm-addon-search": "^0.13.0",
|
||||
@@ -49,14 +49,14 @@
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
||||
"@typescript-eslint/parser": "^6.7.4",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"@vue/compiler-sfc": "^3.4.21",
|
||||
"@vue/compiler-sfc": "^3.4.23",
|
||||
"code-inspector-plugin": "^0.4.5",
|
||||
"dotenv": "^16.3.1",
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-plugin-vue": "^9.21.1",
|
||||
"eslint-plugin-vue": "^9.25.0",
|
||||
"prettier": "^3.2.5",
|
||||
"sass": "^1.69.0",
|
||||
"typescript": "^5.3.2",
|
||||
"sass": "^1.75.0",
|
||||
"typescript": "^5.4.5",
|
||||
"vite": "^5.2.9",
|
||||
"vue-eslint-parser": "^9.4.2"
|
||||
},
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<div v-if="props.tags">
|
||||
<el-row v-for="(tagPath, idx) in tagPaths?.slice(0, 1)" :key="idx">
|
||||
<TagInfo :tag-path="tagPath" />
|
||||
<span class="ml3">{{ tagPath }}</span>
|
||||
<el-row v-for="(tag, idx) in props.tags?.slice(0, 1)" :key="idx">
|
||||
<TagInfo :tag-path="tag.codePath" />
|
||||
<span class="ml3">{{ tag.codePath }}</span>
|
||||
|
||||
<!-- 展示剩余的标签信息 -->
|
||||
<el-popover :show-after="300" v-if="tagPaths?.length > 1 && idx == 0" placement="top-start" width="230" trigger="hover">
|
||||
<el-popover :show-after="300" v-if="props.tags.length > 1 && idx == 0" placement="top-start" width="230" trigger="hover">
|
||||
<template #reference>
|
||||
<SvgIcon class="mt5 ml5" color="var(--el-color-primary)" name="MoreFilled" />
|
||||
</template>
|
||||
|
||||
<el-row v-for="i in tagPaths.slice(1)" :key="i">
|
||||
<TagInfo :tag-path="i" />
|
||||
<span class="ml3">{{ i }}</span>
|
||||
<el-row v-for="i in props.tags.slice(1)" :key="i">
|
||||
<TagInfo :tag-path="i.codePath" />
|
||||
<span class="ml3">{{ i.codePath }}</span>
|
||||
</el-row>
|
||||
</el-popover>
|
||||
</el-row>
|
||||
@@ -22,18 +22,12 @@
|
||||
<script lang="ts" setup>
|
||||
import SvgIcon from '@/components/svgIcon/index.vue';
|
||||
import TagInfo from './TagInfo.vue';
|
||||
import { computed } from 'vue';
|
||||
import { getTagPath } from './tag';
|
||||
const props = defineProps({
|
||||
tags: {
|
||||
type: [Array<any>],
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const tagPaths = computed(() => {
|
||||
return props.tags?.map((item) => getTagPath(item.codePath)) as any;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
@node-click="treeNodeClick"
|
||||
@node-expand="treeNodeClick"
|
||||
@node-contextmenu="nodeContextmenu"
|
||||
:default-expanded-keys="props.defaultExpandedKeys"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<span @dblclick="treeNodeDblclick(data)" :class="data.type.nodeDblclickFunc ? 'none-select' : ''">
|
||||
@@ -56,6 +57,9 @@ const props = defineProps({
|
||||
type: [Number],
|
||||
required: true,
|
||||
},
|
||||
defaultExpandedKeys: {
|
||||
type: [Array],
|
||||
},
|
||||
tagPathNodeType: {
|
||||
type: [NodeType],
|
||||
required: true,
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { toRefs, reactive, onMounted } from 'vue';
|
||||
import { tagApi } from '../tag/api';
|
||||
import { getTagPath } from './tag';
|
||||
|
||||
//定义事件
|
||||
const emit = defineEmits(['update:modelValue', 'changeTag', 'input']);
|
||||
@@ -54,10 +53,7 @@ const state = reactive({
|
||||
const { tags } = toRefs(state);
|
||||
|
||||
onMounted(async () => {
|
||||
if (props.selectTags) {
|
||||
state.selectTags = props.selectTags.map((item: any) => getTagPath(item));
|
||||
}
|
||||
|
||||
state.selectTags = props.selectTags;
|
||||
state.tags = await tagApi.getTagTrees.request({ type: -1 });
|
||||
});
|
||||
|
||||
|
||||
@@ -171,29 +171,3 @@ export function getTagPathSearchItem(resourceType: number) {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据codepath获取对应的tagPath
|
||||
* @param codePath codePath tag1/tag2/1|testmachien1/
|
||||
* @returns tagPath tag1/tag2/
|
||||
*/
|
||||
export function getTagPath(codePath: string) {
|
||||
// 以资源分隔符 "|" 对字符串进行分割
|
||||
let parts = codePath.split('|');
|
||||
if (parts.length < 2) {
|
||||
return codePath;
|
||||
}
|
||||
|
||||
// 从分割后的第一个子串中提取所需部分
|
||||
let substringBeforeNumber = parts[0];
|
||||
|
||||
// 找到最后一个 "/" 的位置
|
||||
let lastSlashIndex = substringBeforeNumber.lastIndexOf('/');
|
||||
|
||||
// 如果找到最后一个 "/" 符号,则截取子串
|
||||
if (lastSlashIndex !== -1) {
|
||||
return substringBeforeNumber.slice(0, lastSlashIndex + 1);
|
||||
}
|
||||
|
||||
return codePath;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,6 @@ import { TagResourceTypeEnum } from '@/common/commonEnum';
|
||||
import ResourceAuthCertTableEdit from '../component/ResourceAuthCertTableEdit.vue';
|
||||
import { AuthCertCiphertextTypeEnum } from '../tag/enums';
|
||||
import TagTreeSelect from '../component/TagTreeSelect.vue';
|
||||
import { getTagPath } from '../component/tag';
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
@@ -213,7 +212,7 @@ const DefaultForm = {
|
||||
code: '',
|
||||
name: null,
|
||||
host: '',
|
||||
port: null,
|
||||
port: getDbDialect(DbType.mysql).getInfo().defaultPort,
|
||||
extra: '', // 连接需要的额外参数(json字符串)
|
||||
params: null,
|
||||
remark: '',
|
||||
@@ -261,7 +260,6 @@ const getReqForm = async () => {
|
||||
if (!state.form.sshTunnelMachineId) {
|
||||
reqForm.sshTunnelMachineId = -1;
|
||||
}
|
||||
reqForm.tagCodePaths = state.form.tagCodePaths.map((t: any) => getTagPath(t)) as any;
|
||||
if (Object.keys(state.extra).length > 0) {
|
||||
reqForm.extra = JSON.stringify(state.extra);
|
||||
}
|
||||
|
||||
@@ -302,11 +302,12 @@ const NodeTypeDb = new NodeType(SqlExecNodeType.Db)
|
||||
return new TagTreeNode(`${params.id}.${params.db}.schema.${sn}`, sn, NodeTypePostgresSchema).withParams(nParams).withIcon(SchemaIcon);
|
||||
});
|
||||
}
|
||||
return NodeTypeTables(params);
|
||||
|
||||
return getNodeTypeTables(params);
|
||||
})
|
||||
.withNodeClickFunc(nodeClickChangeDb);
|
||||
|
||||
const NodeTypeTables = (params: any) => {
|
||||
const getNodeTypeTables = (params: any) => {
|
||||
let tableKey = `${params.id}.${params.db}.table-menu`;
|
||||
let sqlKey = getSqlMenuNodeKey(params.id, params.db);
|
||||
return [
|
||||
@@ -321,7 +322,7 @@ const NodeTypePostgresSchema = new NodeType(SqlExecNodeType.PgSchema)
|
||||
.withLoadNodesFunc(async (parentNode: TagTreeNode) => {
|
||||
const params = parentNode.params;
|
||||
params.parentKey = parentNode.key;
|
||||
return NodeTypeTables(params);
|
||||
return getNodeTypeTables(params);
|
||||
})
|
||||
.withNodeClickFunc(nodeClickChangeDb);
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ import { MachineProtocolEnum } from './enums';
|
||||
import DrawerHeader from '@/components/drawer-header/DrawerHeader.vue';
|
||||
import { ResourceCodePattern } from '@/common/pattern';
|
||||
import { TagResourceTypeEnum } from '@/common/commonEnum';
|
||||
import { getTagPath } from '../component/tag';
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
@@ -186,7 +185,8 @@ const { isFetching: saveBtnLoading, execute: saveMachineExec } = machineApi.save
|
||||
watchEffect(() => {
|
||||
state.dialogVisible = props.visible;
|
||||
if (!state.dialogVisible) {
|
||||
state.form = defaultForm;
|
||||
state.form = { ...defaultForm };
|
||||
state.form.authCerts = [];
|
||||
return;
|
||||
}
|
||||
const machine: any = props.machine;
|
||||
@@ -236,7 +236,6 @@ const getReqForm = () => {
|
||||
if (!state.form.sshTunnelMachineId || state.form.sshTunnelMachineId <= 0) {
|
||||
reqForm.sshTunnelMachineId = -1;
|
||||
}
|
||||
reqForm.tagCodePaths = state.form.tagCodePaths.map((t: any) => getTagPath(t)) as any;
|
||||
return reqForm;
|
||||
};
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ import { ElMessage } from 'element-plus';
|
||||
import TagTreeSelect from '../component/TagTreeSelect.vue';
|
||||
import SshTunnelSelect from '../component/SshTunnelSelect.vue';
|
||||
import { ResourceCodePattern } from '@/common/pattern';
|
||||
import { getTagPath } from '../component/tag';
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
@@ -160,7 +159,6 @@ const getReqForm = () => {
|
||||
if (!state.form.sshTunnelMachineId || state.form.sshTunnelMachineId <= 0) {
|
||||
reqForm.sshTunnelMachineId = -1;
|
||||
}
|
||||
reqForm.tagCodePaths = state.form.tagCodePaths.map((t: any) => getTagPath(t)) as any;
|
||||
return reqForm;
|
||||
};
|
||||
|
||||
|
||||
@@ -116,7 +116,6 @@ import SshTunnelSelect from '../component/SshTunnelSelect.vue';
|
||||
import ProcdefSelectFormItem from '@/views/flow/components/ProcdefSelectFormItem.vue';
|
||||
import { ResourceCodePattern } from '@/common/pattern';
|
||||
import DrawerHeader from '@/components/drawer-header/DrawerHeader.vue';
|
||||
import { getTagPath } from '../component/tag';
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
@@ -249,7 +248,6 @@ const getReqForm = async () => {
|
||||
if (!state.form.sshTunnelMachineId || state.form.sshTunnelMachineId <= 0) {
|
||||
reqForm.sshTunnelMachineId = -1;
|
||||
}
|
||||
reqForm.tagCodePaths = state.form.tagCodePaths.map((t: any) => getTagPath(t)) as any;
|
||||
return reqForm;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user