ddc5c4ea by xukangle

fix: 分类分级目录

1 parent e7384c73
......@@ -142,7 +142,7 @@ export const getTableFieldLineage = (params) => request({
/** 获取表的所有字段血缘数据 */
export const getTableAllFieldLineage = (params) => request({
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/lineage/lineage-query-field?databaseName=${params.databaseName}&tableName=${params.tableName}`,
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/lineage/lineage-query-field?databaseName=${params.databaseName}&tableName=${params.tableName}&tableGuid=${params.tableGuid}`,
method: 'get',
})
......
......@@ -1018,8 +1018,8 @@ const tableFieldsDataInfo = ref({
{ label: "表中文名", field: "tableChName", width: 140, },
{ label: "数据库名称", field: "database", width: 120 },
{ label: "数据库中文名", field: "databaseChName", width: TableColumnWidth.DATETIME },
{ label: "分类", field: "classifyDetailName", width: 120, align: 'center' },
{ label: "分级", field: "gradeDetailName", width: 120, align: 'center' },
{ label: "分类", field: "classifyDetailName", width: 120, align: 'left' },
{ label: "分级", field: "gradeDetailName", width: 120, align: 'left' },
// { label: "标签", field: "label", width: 120, align: 'center' },
],
data: [],
......
......@@ -507,7 +507,7 @@ const cancelEdit = (row) => {
:deep(.bottom_table) {
margin-top: 12px;
height: calc(100% - 150px);
height: calc(100% - 115px);
overflow-y: auto;
.el-table td.el-table__cell {
......
......@@ -320,7 +320,7 @@ watch(
if (val?.length && !currDatasourceSelect.value?.tableName) {
currDatasourceSelect.value = val[0];
}
emits("datasourceSelectedChange", val, databaseGuid.value);
emits("datasourceSelectedChange", val, currDatasourceSelect.value);
},
{
deep: true,
......@@ -361,9 +361,9 @@ const getTextAlign = (field) => {
<el-table-column type="selection" :width="22" align="center" />
<el-table-column prop="tableName" label="名称" width="100px" align="left" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="tableComment" label="表注释" width="60px" align="left" show-overflow-tooltip>
<el-table-column prop="tableChName" label="表中文名称" width="80px" align="left" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row['tableComment'] ?? '--' }}</span>
<span>{{ scope.row['tableChName'] ?? '--' }}</span>
</template>
</el-table-column>
</el-table>
......@@ -497,7 +497,7 @@ const getTextAlign = (field) => {
height: calc(100% - 80px);
.content-left {
width: 200px;
width: 220px;
border-right: 1px solid #d9d9d9;
.title-left {
......@@ -532,7 +532,7 @@ const getTextAlign = (field) => {
}
.content-right {
width: calc(100% - 200px);
width: calc(100% - 220px);
.title-right {
height: 44px;
......
......@@ -217,10 +217,12 @@ const stepsInfo = ref({
});
// 保存选中的库表信息
const selectedDatabaseTableInfo = ref<any>([]);
const datasourceSelectedRows: Ref<any> = ref([]);
// 记录数据库databaseGuid
const handlDsSelectedChange = (v, guid) => {
const handlDsSelectedChange = (v, curr) => {
selectedDatabaseTableInfo.value = curr || '';
datasourceSelectedRows.value = v || [];
const params: any = [];
v.forEach((item) => {
......@@ -245,6 +247,9 @@ const nextStep = async () => {
});
return;
}
tableDataInfo.value[0].tableName = selectedDatabaseTableInfo.value.tableName;
tableDataInfo.value[0].tableChName = selectedDatabaseTableInfo.value.tableChName;
getFieldTree();
stepsInfo.value.step = 1;
};
......@@ -315,6 +320,7 @@ const editableFields = {
classifyDetailGuid: true, // 分类可编辑
fieldType: true, // 字段类型可编辑
fieldChName: true, // 字段中文名可编辑
sourceFieldChName: true, // 源字段中文名可编辑
}
const tableFieldsLoading = ref(false)
......@@ -622,45 +628,45 @@ const submit = async () => {
console.log('提交', tableDataDetailInfo.value, tableDataInfo.value)
saveBtn.value = true
// 校验表格数据是否填写完整
if (!checkTableData(tableDataDetailInfo.value)) {
saveBtn.value = false
return
}
// 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参
if (!editInfoData.value.guid) {
try {
await saveOrUpdate({
tableName: tableDataInfo.value[0].tableName,
tableChName: tableDataInfo.value[0].tableChName,
databaseGuid: route.query.databaseGuid || '',
database: route.query.database || '',
databaseChName: route.query.databaseChName || '',
foundMode: route.query.foundMode,
isDraft: 'N',
}, 0)
saveBtn.value = false
} catch (error) {
saveBtn.value = false
}
} else {
// 修改 saveOrUpdate({}, 1)
try {
await saveOrUpdate({
guid: editInfoData.value.guid,
tableName: tableDataInfo.value[0].tableName,
tableChName: tableDataInfo.value[0].tableChName,
databaseGuid: editInfoData.value.databaseGuid || '',
database: editInfoData.value.database || '',
databaseChName: editInfoData.value.databaseChName || '',
foundMode: editInfoData.value.foundMode,
isDraft: 'N',
tableGuid: route.query.tableGuid,
}, 1)
saveBtn.value = false
} catch (error) {
saveBtn.value = false
}
}
// if (!checkTableData(tableDataDetailInfo.value)) {
// saveBtn.value = false
// return
// }
// // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参
// if (!editInfoData.value.guid) {
// try {
// await saveOrUpdate({
// tableName: tableDataInfo.value[0].tableName,
// tableChName: tableDataInfo.value[0].tableChName,
// databaseGuid: route.query.databaseGuid || '',
// database: route.query.database || '',
// databaseChName: route.query.databaseChName || '',
// foundMode: route.query.foundMode,
// isDraft: 'N',
// }, 0)
// saveBtn.value = false
// } catch (error) {
// saveBtn.value = false
// }
// } else {
// // 修改 saveOrUpdate({}, 1)
// try {
// await saveOrUpdate({
// guid: editInfoData.value.guid,
// tableName: tableDataInfo.value[0].tableName,
// tableChName: tableDataInfo.value[0].tableChName,
// databaseGuid: editInfoData.value.databaseGuid || '',
// database: editInfoData.value.database || '',
// databaseChName: editInfoData.value.databaseChName || '',
// foundMode: editInfoData.value.foundMode,
// isDraft: 'N',
// tableGuid: route.query.tableGuid,
// }, 1)
// saveBtn.value = false
// } catch (error) {
// saveBtn.value = false
// }
// }
}
......@@ -951,7 +957,7 @@ onActivated(() => {
<!-- 排序列(不可编辑) -->
<el-table-column type="index" label="排序" width="80" align="center" />
<!-- 字段中文名(可编辑)fieldChName -->
<el-table-column prop="fieldChName" label="目标字段中文名" width="150">
<el-table-column prop="fieldChName" label="目标字段中文名" width="150" show-overflow-tooltip>
<!-- 可以编辑 -->
<template #default="scope">
<span v-if="!scope.row.isEdit || !editableFields.fieldChName">{{ scope.row.fieldChName ?
......@@ -962,7 +968,7 @@ onActivated(() => {
</el-table-column>
<!-- 字段英文名(可编辑) -->
<el-table-column prop="fieldName" label="目标字段英文名" width="150">
<el-table-column prop="fieldName" label="目标字段英文名" width="150" show-overflow-tooltip>
<template #default="scope">
<span v-if="!scope.row.isEdit || !editableFields.fieldName">{{ scope.row.fieldName ?
scope.row.fieldName
......@@ -972,31 +978,31 @@ onActivated(() => {
</template>
</el-table-column>
<!-- 源数据库 -->
<el-table-column prop="databaseChName" label="源数据库" width="150">
<el-table-column prop="sourceDatabase" label="源数据库" width="150" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.databaseChName ? scope.row.databaseChName : '--' }}
{{ scope.row.sourceDatabase ? scope.row.sourceDatabase : '--' }}
</template>
</el-table-column>
<!-- 源数据表 -->
<el-table-column prop="tableName" label="源数据表" width="150">
<el-table-column prop="sourceTableName" label="源数据表" width="150" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.tableName ? scope.row.tableName : '--' }}
{{ scope.row.sourceTableName ? scope.row.sourceTableName : '--' }}
</template>
</el-table-column>
<!-- 源字段中文 -->
<el-table-column prop="fieldChName" label="源字段中文" width="150">
<el-table-column prop="sourceFieldName" label="源字段中文" width="150" show-overflow-tooltip>
<template #default="scope">
{{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
{{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }}
</template>
</el-table-column>
<!-- 源字段英文 -->
<el-table-column prop="fieldName" label="源字段英文" width="150">
<el-table-column prop="sourceFieldChName" label="源字段英文" width="150" show-overflow-tooltip>
<template #default="scope">
<!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} -->
<span v-if="!scope.row.isEdit || !editableFields.fieldName">{{ scope.row.fieldName ?
scope.row.fieldName : '--' }}</span>
<el-input v-else v-model="scope.row.fieldName" placeholder="请输入长度" />
<span v-if="!scope.row.isEdit || !editableFields.sourceFieldChName">{{ scope.row.sourceFieldChName ?
scope.row.sourceFieldChName : '--' }}</span>
<el-input v-else v-model="scope.row.sourceFieldChName" placeholder="请输入长度" />
</template>
</el-table-column>
<!-- 源端字段 fieldType fieldTypeProps-->
......@@ -1016,7 +1022,7 @@ onActivated(() => {
</el-table-column>
<!-- 长度(可编辑) -->
<el-table-column prop="fieldLength" label="长度" width="120" align="center">
<el-table-column prop="fieldLength" label="长度" width="120" align="left">
<template #default="scope">
<!-- 非编辑状态 -->
<span v-if="!scope.row.isEdit">
......@@ -1034,7 +1040,7 @@ onActivated(() => {
</el-table-column>
<!-- 精度(可编辑) -->
<el-table-column prop="fieldPrecision" label="精度" width="120" align="center">
<el-table-column prop="fieldPrecision" label="精度" width="120" align="left">
<template #default="scope">
<!-- 非编辑状态 -->
<span v-if="!scope.row.isEdit">
......@@ -1049,7 +1055,7 @@ onActivated(() => {
</template>
</el-table-column>
<!-- 关联字典(可编辑)el-tree-select 形式下拉形式 -->
<el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="center">
<el-table-column prop="dictionaryGuid" label="关联字典" width="150" align="left">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.dictionaryGuid
? dictionaryList.find((item: any) => item.guid === scope.row.dictionaryGuid)?.chName : '--' }}</span>
......@@ -1061,11 +1067,11 @@ onActivated(() => {
</el-table-column>
<!-- 数据是否唯一(可编辑) -->
<el-table-column prop="isPrimary" label="是否主键" width="150" align="center">
<el-table-column prop="isPrimary" label="是否主键" width="150" align="left">
<template #default="scope">
<span v-if="!scope.row.isEdit || !editableFields.isPrimary">{{ scope.row.isPrimary ? scope.row.isPrimary
:
'--' }}</span>
<span v-if="!scope.row.isEdit || !editableFields.isPrimary">{{ scope.row.isPrimary ?
(scope.row.isPrimary ===
'Y' ? '是' : '否') : '--' }}</span>
<el-select v-else v-model="scope.row.isPrimary" placeholder="请选择">
<el-option label="Y" value="Y" />
<el-option label="N" value="N" />
......@@ -1073,10 +1079,11 @@ onActivated(() => {
</template>
</el-table-column>
<!-- 是否必填(可编辑) -->
<el-table-column prop="isNotNull" label="是否必填" width="120" align="center">
<el-table-column prop="notNull" label="是否必填" width="120" align="left">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.isNotNull ? scope.row.isNotNull : '--' }}</span>
<el-select v-else v-model="scope.row.isNotNull" placeholder="请选择">
<span v-if="!scope.row.isEdit">{{ scope.row.notNull ? (scope.row.notNull ===
'Y' ? '是' : '否') : '--' }}</span>
<el-select v-else v-model="scope.row.notNull" placeholder="请选择">
<el-option label="Y" value="Y" />
<el-option label="N" value="N" />
</el-select>
......@@ -1101,7 +1108,7 @@ onActivated(() => {
</template>
</el-table-column>
<!-- 分级(不可编辑) -->
<el-table-column prop="gradeDetailGuid" label="分级" width="120" align="center">
<el-table-column prop="gradeDetailGuid" label="分级" width="120" align="left">
<template #default="scope">
<div v-if="scope.row.isEdit">
<el-select v-model="scope.row.gradeDetailGuid" placeholder="请选择分级" clearable filterable
......
......@@ -284,7 +284,7 @@ const loadTreeNode = (node, resolve) => {
})
node.data.children = data;
nextTick(() => {
treeInfo.value.currentNodeKey && treeInfoRef.value.setCurrentKey(treeInfo.value.currentNodeKey);
treeInfo.value.currentNodeKey && treeInfoRef.value.setCurrentKey(treeInfo.value.currentNodeKey);
treeInfo.value.currentNodeKey && isCurrentNodeField && scrollToNode(treeInfo.value.currentNodeKey);
let node1 = treeInfoRef.value.treeRef.store.nodesMap[treeInfo.value.currentNodeKey];
if (node1) {
......@@ -1010,7 +1010,7 @@ const getTableFieldLineageMap = () => {
const getAllTableFieldLineageMap = () => {
lineageLoading.value = true;
isFieldLineage.value = true;
getTableAllFieldLineage({ databaseName: lastClickNode.value.databaseName, tableName: lastClickNode.value.tableName }).then((res: any) => {
getTableAllFieldLineage({ databaseName: lastClickNode.value.databaseName, tableName: lastClickNode.value.tableName, tableGuid: lastClickNode.value.guid }).then((res: any) => {
if (res.code == proxy.$passCode) {
let data1 = res.data || [];
lineageData.value = data1;
......@@ -1152,4 +1152,4 @@ const handleLineageSwitchChange = (val, type) => {
z-index: 10000;
/* 设置一个较高的z-index值确保在最上层显示 */
}
</style>
\ No newline at end of file
</style>
......
......@@ -100,11 +100,11 @@ const fieldTableInfo = ref({
//跳转倒查看血缘页面。
let row = scope.row;
set({
tableGuid: sheetInfo.value.guid,
table: sheetInfo.value.tableName,
databas: sheetInfo.value.databaseName,
tableGuid: sheetInfo.value.guid,
table: sheetInfo.value.tableName,
databas: sheetInfo.value.databaseName,
databaseCh: sheetInfo.value.databaseChName,
dsGuid: sheetInfo.value.databaseGuid,
dsGuid: sheetInfo.value.databaseGuid,
fGuid: row.guid,
fEnName: row.enName
})
......@@ -191,7 +191,7 @@ const tabsPaneMap = ref({
type: 'table',
tableInfo: fieldTableInfo.value,
show: true
},
},
{
title: '索引信息',
type: 'table',
......@@ -680,11 +680,11 @@ const handleRefres = () => {
const handleEdit = () => {
lineageGraph.value[0].handleEdit({});//先退出全屏再跳转,否则回来查看时就没有了。
set({
tableGuid: sheetInfo.value.guid,
table: sheetInfo.value.tableName,
databas: sheetInfo.value.databaseName,
tableGuid: sheetInfo.value.guid,
table: sheetInfo.value.tableName,
databas: sheetInfo.value.databaseName,
databaseCh: sheetInfo.value.databaseChName,
dsGuid: sheetInfo.value.databaseGuid,
dsGuid: sheetInfo.value.databaseGuid,
isFieldLine: isFieldLineage.value
})
router.push({
......@@ -722,7 +722,7 @@ const getTableLineageMap = () => {
const getAllTableFieldLineageMap = () => {
lineageDataLoading.value = true;
isFieldLineage.value = true;
getTableAllFieldLineage({ databaseName: sheetInfo.value.databaseName, tableName: sheetInfo.value.tableName }).then((res: any) => {
getTableAllFieldLineage({ databaseName: sheetInfo.value.databaseName, tableName: sheetInfo.value.tableName, tableGuid: sheetInfo.value.guid }).then((res: any) => {
if (res.code == proxy.$passCode) {
let data1 = res.data || [];
lineageData.value = data1;
......@@ -802,8 +802,8 @@ const handleLineageSwitchChange = (val) => {
<LineageGraph ref="lineageGraph" v-if="lineageData.length" layout="vertical" :lineageData="lineageData"
:is-field-lineage="isFieldLineage" :primary-table="sheetInfo.tableName" :is-detail="true"
:primaryDatabase="sheetInfo.databaseName" :isEdit="true" @handleSave="handleSave"
@tableContextMenu="handleTableContextMenu" @handleToggle="handleToggle" :isToggle="isToggle" @handleChOrEn=handleChOrEn :isCh="isCh"
@handleRefres="handleRefres" @handleEdit="handleEdit"
@tableContextMenu="handleTableContextMenu" @handleToggle="handleToggle" :isToggle="isToggle"
@handleChOrEn=handleChOrEn :isCh="isCh" @handleRefres="handleRefres" @handleEdit="handleEdit"
@handleLineageSwitchChange="handleLineageSwitchChange" />
</div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!