mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
feat: 标签路径展示优化,新增提示
This commit is contained in:
64
mayfly_go_web/src/views/ops/component/TagInfo.vue
Normal file
64
mayfly_go_web/src/views/ops/component/TagInfo.vue
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<template>
|
||||||
|
<div style="display: inline-flex; justify-content: center; align-items: center; cursor: pointer;">
|
||||||
|
<el-popover @show="showTagInfo" placement="right-end" title="标签信息" :width="300" trigger="hover">
|
||||||
|
<template #reference>
|
||||||
|
<el-icon>
|
||||||
|
<InfoFilled />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
<span v-for="(v, i) in tags" :key="i">
|
||||||
|
<el-tooltip effect="customized" :content="v.remark" placement="top">
|
||||||
|
<span class="color-success">{{ v.name }}</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<span v-if="i != state.tags.length - 1" class="color-primary"> / </span>
|
||||||
|
</span>
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, toRefs, onMounted } from 'vue';
|
||||||
|
import { tagApi } from '../tag/api';
|
||||||
|
const props = defineProps({
|
||||||
|
tagPath: {
|
||||||
|
type: [String],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const state = reactive({
|
||||||
|
tagPath: '',
|
||||||
|
tags: [] as any,
|
||||||
|
})
|
||||||
|
|
||||||
|
const {
|
||||||
|
tags,
|
||||||
|
} = toRefs(state)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
state.tagPath = props.tagPath;
|
||||||
|
})
|
||||||
|
|
||||||
|
const showTagInfo = async () => {
|
||||||
|
if (state.tags && state.tags.length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tagStrs = state.tagPath.split('/');
|
||||||
|
const tagPaths = [];
|
||||||
|
let nowTag = '';
|
||||||
|
for (let tagStr of tagStrs) {
|
||||||
|
if (nowTag) {
|
||||||
|
nowTag = `${nowTag}/${tagStr}`
|
||||||
|
} else {
|
||||||
|
nowTag = tagStr
|
||||||
|
}
|
||||||
|
tagPaths.push(nowTag)
|
||||||
|
}
|
||||||
|
state.tags = await tagApi.listByQuery.request({ tagPaths: tagPaths.join(',') })
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
<el-sub-menu v-for="tag of tags" :index="tag.tagPath" :key="tag.tagPath"
|
<el-sub-menu v-for="tag of tags" :index="tag.tagPath" :key="tag.tagPath"
|
||||||
@click.stop="clickTag(tag.tagPath)">
|
@click.stop="clickTag(tag.tagPath)">
|
||||||
<template #title>
|
<template #title>
|
||||||
|
<tag-info :tag-path="tag.tagPath" />
|
||||||
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<FolderOpened v-if="opend[tag.tagPath]" color="#e6a23c" />
|
<FolderOpened v-if="opend[tag.tagPath]" color="#e6a23c" />
|
||||||
<Folder v-else />
|
<Folder v-else />
|
||||||
@@ -25,6 +27,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref, Ref, toRefs } from 'vue';
|
import { reactive, ref, Ref, toRefs } from 'vue';
|
||||||
|
import TagInfo from './TagInfo.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
instanceMenuMaxHeight: {
|
instanceMenuMaxHeight: {
|
||||||
@@ -60,7 +63,6 @@ const open = (index: string, isTag: boolean = false) => {
|
|||||||
if (!index) {
|
if (!index) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(index)
|
|
||||||
menuRef.value.open(index)
|
menuRef.value.open(index)
|
||||||
if (isTag) {
|
if (isTag) {
|
||||||
clickTag(index)
|
clickTag(index)
|
||||||
|
|||||||
@@ -20,7 +20,14 @@
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
<tag-info :tag-path="scope.row.tagPath" />
|
||||||
|
<span class="ml5">
|
||||||
|
{{ scope.row.tagPath }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="名称" min-width="160" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="name" label="名称" min-width="160" show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column min-width="170" label="host:port" show-overflow-tooltip>
|
<el-table-column min-width="170" label="host:port" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@@ -180,7 +187,7 @@
|
|||||||
size="small">DELETE</el-tag>
|
size="small">DELETE</el-tag>
|
||||||
<el-tag v-if="scope.row.type == enums.DbSqlExecTypeEnum['INSERT'].value" color="#A8DEE0"
|
<el-tag v-if="scope.row.type == enums.DbSqlExecTypeEnum['INSERT'].value" color="#A8DEE0"
|
||||||
size="small">INSERT</el-tag>
|
size="small">INSERT</el-tag>
|
||||||
<el-tag v-if="scope.row.type == enums.DbSqlExecTypeEnum['QUERY'].value" color="#A8DEE0"
|
<el-tag v-if="scope.row.type == enums.DbSqlExecTypeEnum['QUERY'].value" color="#A8DEE0"
|
||||||
size="small">QUERY</el-tag>
|
size="small">QUERY</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -293,6 +300,7 @@ import { isTrue } from '@/common/assert';
|
|||||||
import { Search as SearchIcon } from '@element-plus/icons-vue'
|
import { Search as SearchIcon } from '@element-plus/icons-vue'
|
||||||
import { tagApi } from '../tag/api.ts';
|
import { tagApi } from '../tag/api.ts';
|
||||||
import { dateFormat } from '@/common/utils/date';
|
import { dateFormat } from '@/common/utils/date';
|
||||||
|
import TagInfo from '../component/TagInfo.vue';
|
||||||
|
|
||||||
const permissions = {
|
const permissions = {
|
||||||
saveDb: 'db:save',
|
saveDb: 'db:save',
|
||||||
|
|||||||
@@ -23,18 +23,18 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</template>
|
</template>
|
||||||
<el-menu-item v-if="dbs[inst.id]?.length> 20" :index="'schema-filter-' + inst.id" :key="'schema-filter-' + inst.id">
|
<el-menu-item v-if="dbs[inst.id]?.length > 20" :index="'schema-filter-' + inst.id"
|
||||||
|
:key="'schema-filter-' + inst.id">
|
||||||
<template #title>
|
<template #title>
|
||||||
|
|
||||||
<el-input size="small" placeholder="过滤数据库" clearable
|
<el-input size="small" placeholder="过滤数据库" clearable @change="filterSchemaName(inst.id)"
|
||||||
@change="filterSchemaName(inst.id)"
|
@keyup="(e: any) => filterSchemaName(inst.id, e)"
|
||||||
@keyup="(e: any) => filterSchemaName(inst.id, e)"
|
v-model="state.schemaFilterParam[inst.id]" />
|
||||||
v-model="state.schemaFilterParam[inst.id]" />
|
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<!-- 第三级:数据库 -->
|
<!-- 第三级:数据库 -->
|
||||||
<el-sub-menu v-show="schema.show" v-for="schema in dbs[inst.id]" :index="inst.id + schema.name" :key="inst.id + schema.name"
|
<el-sub-menu v-show="schema.show" v-for="schema in dbs[inst.id]" :index="inst.id + schema.name"
|
||||||
:class="state.nowSchema === (inst.id + schema.name) && 'checked'"
|
:key="inst.id + schema.name" :class="state.nowSchema === (inst.id + schema.name) && 'checked'"
|
||||||
@click.stop="changeSchema(inst, schema.name)">
|
@click.stop="changeSchema(inst, schema.name)">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span class="checked-schema ml20">
|
<span class="checked-schema ml20">
|
||||||
@@ -57,7 +57,8 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-menu-item v-if="tables[inst.id + schema.name]?.length> 20" :index="inst.id + schema.name + '-tableSearch'"
|
<el-menu-item v-if="tables[inst.id + schema.name]?.length > 20"
|
||||||
|
:index="inst.id + schema.name + '-tableSearch'"
|
||||||
:key="inst.id + schema.name + '-tableSearch'">
|
:key="inst.id + schema.name + '-tableSearch'">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span class="ml35">
|
<span class="ml35">
|
||||||
@@ -79,8 +80,8 @@
|
|||||||
<Calendar color="#409eff" />
|
<Calendar color="#409eff" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-tooltip v-if="tb.tableComment" effect="customized"
|
<el-tooltip v-if="tb.tableComment" effect="customized"
|
||||||
:content="tb.tableComment" placement="right" >
|
:content="tb.tableComment" placement="right">
|
||||||
<span v-html="tb.showName || tb.tableName"></span>
|
<span v-html="tb.showName || tb.tableName"></span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<span v-else v-html="tb.showName || tb.tableName"></span>
|
<span v-else v-html="tb.showName || tb.tableName"></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -101,7 +102,8 @@
|
|||||||
|
|
||||||
<template v-for="sql in sqls[inst.id + schema.name]">
|
<template v-for="sql in sqls[inst.id + schema.name]">
|
||||||
<el-menu-item v-if="sql.show" :index="inst.id + schema.name + sql.name"
|
<el-menu-item v-if="sql.show" :index="inst.id + schema.name + sql.name"
|
||||||
:key="inst.id + schema.name + sql.name" @click="clickSqlName(inst, schema.name, sql.name)">
|
:key="inst.id + schema.name + sql.name"
|
||||||
|
@click="clickSqlName(inst, schema.name, sql.name)">
|
||||||
<template #title>
|
<template #title>
|
||||||
<div class="ml35" style="width: 100%">
|
<div class="ml35" style="width: 100%">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
@@ -171,8 +173,8 @@ const loadInstances = async () => {
|
|||||||
|
|
||||||
// dbs
|
// dbs
|
||||||
let databases = db.database.split(' ')
|
let databases = db.database.split(' ')
|
||||||
let dbs = [] as any [];
|
let dbs = [] as any[];
|
||||||
databases.forEach((a: string) =>dbs.push({name: a, show: true}))
|
databases.forEach((a: string) => dbs.push({ name: a, show: true }))
|
||||||
state.dbs[db.id] = dbs
|
state.dbs[db.id] = dbs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,7 +233,7 @@ const filterTableName = (instId: number, schema: string, event?: any) => {
|
|||||||
}
|
}
|
||||||
let param = state.filterParam[key] as string
|
let param = state.filterParam[key] as string
|
||||||
state.tables[key].forEach((a: any) => {
|
state.tables[key].forEach((a: any) => {
|
||||||
let {match, showName} = matchAndHighLight(param, a.tableName+a.tableComment, a.tableName)
|
let { match, showName } = matchAndHighLight(param, a.tableName + a.tableComment, a.tableName)
|
||||||
a.show = match;
|
a.show = match;
|
||||||
a.showName = showName
|
a.showName = showName
|
||||||
})
|
})
|
||||||
@@ -244,42 +246,42 @@ const filterSchemaName = (instId: number, event?: any) => {
|
|||||||
let param = state.schemaFilterParam[instId] as string
|
let param = state.schemaFilterParam[instId] as string
|
||||||
param = param?.replace('/', '\/')
|
param = param?.replace('/', '\/')
|
||||||
state.dbs[instId].forEach((a: any) => {
|
state.dbs[instId].forEach((a: any) => {
|
||||||
let {match, showName} = matchAndHighLight(param, a.name, a.name)
|
let { match, showName } = matchAndHighLight(param, a.name, a.name)
|
||||||
a.show = match
|
a.show = match
|
||||||
a.showName = showName
|
a.showName = showName
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchAndHighLight = (searchParam: string, param: string, title: string): {match: boolean, showName: string} => {
|
const matchAndHighLight = (searchParam: string, param: string, title: string): { match: boolean, showName: string } => {
|
||||||
if(!searchParam){
|
if (!searchParam) {
|
||||||
return {match: true, showName: ''}
|
return { match: true, showName: '' }
|
||||||
}
|
}
|
||||||
let str = '';
|
let str = '';
|
||||||
for(let c of searchParam?.replace('/', '\/')){
|
for (let c of searchParam?.replace('/', '\/')) {
|
||||||
str += `(${c}).*`
|
str += `(${c}).*`
|
||||||
}
|
}
|
||||||
let regex = eval(`/${str}/i`)
|
let regex = eval(`/${str}/i`)
|
||||||
let res = param.match(regex);
|
let res = param.match(regex);
|
||||||
if(res?.length){
|
if (res?.length) {
|
||||||
if(res?.length){
|
if (res?.length) {
|
||||||
let tmp = '', showName = '';
|
let tmp = '', showName = '';
|
||||||
for(let i =1; i<=res.length-1; i++){
|
for (let i = 1; i <= res.length - 1; i++) {
|
||||||
let head = (tmp || title).replace(res[i], `###${res[i]}!!!`);
|
let head = (tmp || title).replace(res[i], `###${res[i]}!!!`);
|
||||||
let idx = head.lastIndexOf('!!!')+3;
|
let idx = head.lastIndexOf('!!!') + 3;
|
||||||
tmp = head.substring(idx);
|
tmp = head.substring(idx);
|
||||||
showName += head.substring(0, idx)
|
showName += head.substring(0, idx)
|
||||||
if(!tmp){
|
if (!tmp) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showName += tmp;
|
showName += tmp;
|
||||||
showName = showName.replaceAll('###','<span style="color: red">')
|
showName = showName.replaceAll('###', '<span style="color: red">')
|
||||||
showName = showName.replaceAll('!!!','</span>')
|
showName = showName.replaceAll('!!!', '</span>')
|
||||||
return {match: true, showName}
|
return { match: true, showName }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {match: false, showName: ''}
|
return { match: false, showName: '' }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
<db-table ref="dbTableRef" :db-id="state.ti.dbId" :db-type="state.ti.dbType" :db="state.ti.db" :data="datas"
|
<db-table ref="dbTableRef" :db-id="state.ti.dbId" :db-type="state.ti.dbType" :db="state.ti.db" :data="datas"
|
||||||
:table="state.table" :column-names="columnNames" :loading="loading" :height="tableHeight"
|
:table="state.table" :column-names="columnNames" :loading="loading" :height="tableHeight"
|
||||||
:show-column-tip="true" :sortable="true" @sort-change="(sort: any) => onTableSortChange(sort)"
|
:show-column-tip="true" :sortable="'custom'" @sort-change="(sort: any) => onTableSortChange(sort)"
|
||||||
@selection-change="onDataSelectionChange" @change-updated-field="changeUpdatedField"></db-table>
|
@selection-change="onDataSelectionChange" @change-updated-field="changeUpdatedField"></db-table>
|
||||||
|
|
||||||
<el-row type="flex" class="mt5" justify="center">
|
<el-row type="flex" class="mt5" justify="center">
|
||||||
@@ -311,6 +311,7 @@ const onDeleteData = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onGenerateInsertSql = async () => {
|
const onGenerateInsertSql = async () => {
|
||||||
|
isTrue(state.selectionDatas && state.selectionDatas.length > 0, '请先选择数据');
|
||||||
emits('genInsertSql', state.ti.getNowDbInst().genInsertSql(state.ti.db, state.table, state.selectionDatas));
|
emits('genInsertSql', state.ti.getNowDbInst().genInsertSql(state.ti.db, state.table, state.selectionDatas));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,14 +29,21 @@
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
<tag-info :tag-path="scope.row.tagPath" />
|
||||||
|
<span class="ml5">
|
||||||
|
{{ scope.row.tagPath }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="名称" min-width="140" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="name" label="名称" min-width="140" show-overflow-tooltip></el-table-column>
|
||||||
<el-table-column prop="ip" label="ip:port" min-width="150">
|
<el-table-column prop="ip" label="ip:port" min-width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-link :disabled="scope.row.status == -1" @click="showMachineStats(scope.row)" type="primary"
|
<el-link :disabled="scope.row.status == -1" @click="showMachineStats(scope.row)" type="primary"
|
||||||
:underline="false">{{
|
:underline="false">
|
||||||
`${scope.row.ip}:${scope.row.port}`
|
{{ `${scope.row.ip}:${scope.row.port}`}}
|
||||||
}}</el-link>
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="status" label="状态" min-width="80">
|
<el-table-column prop="status" label="状态" min-width="80">
|
||||||
@@ -121,7 +128,8 @@
|
|||||||
<el-descriptions-item :span="1" label="端口">{{ infoDialog.data.port }}</el-descriptions-item>
|
<el-descriptions-item :span="1" label="端口">{{ infoDialog.data.port }}</el-descriptions-item>
|
||||||
|
|
||||||
<el-descriptions-item :span="2" label="用户名">{{ infoDialog.data.username }}</el-descriptions-item>
|
<el-descriptions-item :span="2" label="用户名">{{ infoDialog.data.username }}</el-descriptions-item>
|
||||||
<el-descriptions-item :span="1" label="认证方式">{{ infoDialog.data.authMethod == 1 ? 'Password' :
|
<el-descriptions-item :span="1" label="认证方式">{{
|
||||||
|
infoDialog.data.authMethod == 1 ? 'Password' :
|
||||||
'PublicKey'
|
'PublicKey'
|
||||||
}}</el-descriptions-item>
|
}}</el-descriptions-item>
|
||||||
|
|
||||||
@@ -176,6 +184,7 @@ import ProcessList from './ProcessList.vue';
|
|||||||
import MachineStats from './MachineStats.vue';
|
import MachineStats from './MachineStats.vue';
|
||||||
import MachineRec from './MachineRec.vue';
|
import MachineRec from './MachineRec.vue';
|
||||||
import { dateFormat } from '@/common/utils/date';
|
import { dateFormat } from '@/common/utils/date';
|
||||||
|
import TagInfo from '../component/TagInfo.vue';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
|||||||
@@ -20,7 +20,14 @@
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
<tag-info :tag-path="scope.row.tagPath" />
|
||||||
|
<span class="ml5">
|
||||||
|
{{ scope.row.tagPath }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="名称" width></el-table-column>
|
<el-table-column prop="name" label="名称" width></el-table-column>
|
||||||
<el-table-column prop="uri" label="连接uri" min-width="150" show-overflow-tooltip>
|
<el-table-column prop="uri" label="连接uri" min-width="150" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@@ -193,6 +200,7 @@ import { tagApi } from '../tag/api.ts';
|
|||||||
import MongoEdit from './MongoEdit.vue';
|
import MongoEdit from './MongoEdit.vue';
|
||||||
import { formatByteSize } from '@/common/utils/format';
|
import { formatByteSize } from '@/common/utils/format';
|
||||||
import { dateFormat } from '@/common/utils/date';
|
import { dateFormat } from '@/common/utils/date';
|
||||||
|
import TagInfo from '../component/TagInfo.vue';
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
tags: [],
|
tags: [],
|
||||||
|
|||||||
@@ -20,7 +20,14 @@
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="tagPath" label="标签路径" min-width="150" show-overflow-tooltip>
|
||||||
|
<template #default="scope">
|
||||||
|
<tag-info :tag-path="scope.row.tagPath" />
|
||||||
|
<span class="ml5">
|
||||||
|
{{ scope.row.tagPath }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column prop="name" label="名称" min-width="100"></el-table-column>
|
<el-table-column prop="name" label="名称" min-width="100"></el-table-column>
|
||||||
<el-table-column prop="host" label="host:port" min-width="150" show-overflow-tooltip> </el-table-column>
|
<el-table-column prop="host" label="host:port" min-width="150" show-overflow-tooltip> </el-table-column>
|
||||||
<el-table-column prop="mode" label="mode" min-width="100"></el-table-column>
|
<el-table-column prop="mode" label="mode" min-width="100"></el-table-column>
|
||||||
@@ -156,6 +163,7 @@ import { ElMessage, ElMessageBox } from 'element-plus';
|
|||||||
import { tagApi } from '../tag/api.ts';
|
import { tagApi } from '../tag/api.ts';
|
||||||
import RedisEdit from './RedisEdit.vue';
|
import RedisEdit from './RedisEdit.vue';
|
||||||
import { dateFormat } from '@/common/utils/date';
|
import { dateFormat } from '@/common/utils/date';
|
||||||
|
import TagInfo from '../component/TagInfo.vue';
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
tags: [],
|
tags: [],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import Api from '@/common/Api';
|
|||||||
|
|
||||||
export const tagApi = {
|
export const tagApi = {
|
||||||
getAccountTags: Api.create("/tag-trees/account-has", 'get'),
|
getAccountTags: Api.create("/tag-trees/account-has", 'get'),
|
||||||
|
listByQuery: Api.create("/tag-trees/query", 'get'),
|
||||||
getTagTrees: Api.create("/tag-trees", 'get'),
|
getTagTrees: Api.create("/tag-trees", 'get'),
|
||||||
saveTagTree: Api.create("/tag-trees", 'post'),
|
saveTagTree: Api.create("/tag-trees", 'post'),
|
||||||
delTagTree: Api.create("/tag-trees/{id}", 'delete'),
|
delTagTree: Api.create("/tag-trees/{id}", 'delete'),
|
||||||
@@ -11,8 +12,8 @@ export const tagApi = {
|
|||||||
delTeam: Api.create("/teams/{id}", 'delete'),
|
delTeam: Api.create("/teams/{id}", 'delete'),
|
||||||
|
|
||||||
getTeamMem: Api.create("/teams/{teamId}/members", 'get'),
|
getTeamMem: Api.create("/teams/{teamId}/members", 'get'),
|
||||||
saveTeamMem: Api.create("/teams/{teamId}/members", 'post'),
|
saveTeamMem: Api.create("/teams/{teamId}/members", 'post'),
|
||||||
delTeamMem: Api.create("/teams/{teamId}/members/{accountId}", 'delete'),
|
delTeamMem: Api.create("/teams/{teamId}/members/{accountId}", 'delete'),
|
||||||
|
|
||||||
getTeamTagIds: Api.create("/teams/{teamId}/tags", 'get'),
|
getTeamTagIds: Api.create("/teams/{teamId}/tags", 'get'),
|
||||||
saveTeamTags: Api.create("/teams/{teamId}/tags", 'post'),
|
saveTeamTags: Api.create("/teams/{teamId}/tags", 'post'),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"mayfly-go/internal/tag/domain/entity"
|
"mayfly-go/internal/tag/domain/entity"
|
||||||
"mayfly-go/pkg/ginx"
|
"mayfly-go/pkg/ginx"
|
||||||
"mayfly-go/pkg/req"
|
"mayfly-go/pkg/req"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TagTree struct {
|
type TagTree struct {
|
||||||
@@ -31,6 +32,15 @@ func (p *TagTree) GetTagTree(rc *req.Ctx) {
|
|||||||
rc.ResData = tagTrees.ToTrees(0)
|
rc.ResData = tagTrees.ToTrees(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *TagTree) ListByQuery(rc *req.Ctx) {
|
||||||
|
cond := new(entity.TagTreeQuery)
|
||||||
|
tagPaths := rc.GinCtx.Query("tagPaths")
|
||||||
|
cond.CodePaths = strings.Split(tagPaths, ",")
|
||||||
|
var tagTrees vo.TagTreeVOS
|
||||||
|
p.TagTreeApp.ListByQuery(cond, &tagTrees)
|
||||||
|
rc.ResData = tagTrees
|
||||||
|
}
|
||||||
|
|
||||||
func (p *TagTree) SaveTagTree(rc *req.Ctx) {
|
func (p *TagTree) SaveTagTree(rc *req.Ctx) {
|
||||||
projectTree := &entity.TagTree{}
|
projectTree := &entity.TagTree{}
|
||||||
ginx.BindJsonAndValid(rc.GinCtx, projectTree)
|
ginx.BindJsonAndValid(rc.GinCtx, projectTree)
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import "mayfly-go/pkg/model"
|
|||||||
type TagTreeQuery struct {
|
type TagTreeQuery struct {
|
||||||
model.Model
|
model.Model
|
||||||
|
|
||||||
Pid uint64
|
Pid uint64
|
||||||
Code string `json:"code"` // 标识
|
Code string `json:"code"` // 标识
|
||||||
CodePath string `json:"codePath"` // 标识路径
|
CodePath string `json:"codePath"` // 标识路径
|
||||||
Name string `json:"name"` // 名称
|
CodePaths []string
|
||||||
|
Name string `json:"name"` // 名称
|
||||||
CodePathLike string // 标识符路径模糊查询
|
CodePathLike string // 标识符路径模糊查询
|
||||||
CodePathLikes []string
|
CodePathLikes []string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"mayfly-go/internal/tag/domain/repository"
|
"mayfly-go/internal/tag/domain/repository"
|
||||||
"mayfly-go/pkg/biz"
|
"mayfly-go/pkg/biz"
|
||||||
"mayfly-go/pkg/model"
|
"mayfly-go/pkg/model"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type tagTreeRepoImpl struct{}
|
type tagTreeRepoImpl struct{}
|
||||||
@@ -22,6 +23,14 @@ func (p *tagTreeRepoImpl) SelectByCondition(condition *entity.TagTreeQuery, toEn
|
|||||||
if condition.CodePath != "" {
|
if condition.CodePath != "" {
|
||||||
sql = fmt.Sprintf("%s AND p.code_path = '%s'", sql, condition.CodePath)
|
sql = fmt.Sprintf("%s AND p.code_path = '%s'", sql, condition.CodePath)
|
||||||
}
|
}
|
||||||
|
if len(condition.CodePaths) > 0 {
|
||||||
|
strCodePaths := make([]string, 0)
|
||||||
|
// 将字符串用''包裹
|
||||||
|
for _, v := range condition.CodePaths {
|
||||||
|
strCodePaths = append(strCodePaths, fmt.Sprintf("'%s'", v))
|
||||||
|
}
|
||||||
|
sql = fmt.Sprintf("%s AND p.code_path IN (%s)", sql, strings.Join(strCodePaths, ","))
|
||||||
|
}
|
||||||
if condition.CodePathLike != "" {
|
if condition.CodePathLike != "" {
|
||||||
sql = fmt.Sprintf("%s AND p.code_path LIKE '%s'", sql, condition.CodePathLike+"%")
|
sql = fmt.Sprintf("%s AND p.code_path LIKE '%s'", sql, condition.CodePathLike+"%")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ func InitTagTreeRouter(router *gin.RouterGroup) {
|
|||||||
req.NewCtxWithGin(c).Handle(m.GetTagTree)
|
req.NewCtxWithGin(c).Handle(m.GetTagTree)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 根据条件获取标签
|
||||||
|
project.GET("query", func(c *gin.Context) {
|
||||||
|
req.NewCtxWithGin(c).Handle(m.ListByQuery)
|
||||||
|
})
|
||||||
|
|
||||||
// 获取登录账号拥有的标签信息
|
// 获取登录账号拥有的标签信息
|
||||||
project.GET("account-has", func(c *gin.Context) {
|
project.GET("account-has", func(c *gin.Context) {
|
||||||
req.NewCtxWithGin(c).Handle(m.GetAccountTags)
|
req.NewCtxWithGin(c).Handle(m.GetAccountTags)
|
||||||
|
|||||||
Reference in New Issue
Block a user