9bdd4ec1 by xukangle

fix : 修改分类分级相关问题

1 parent bf7dfb69
......@@ -33,6 +33,7 @@ import { download } from "@/utils/common";
import { getLabelList } from "@/api/modules/dataLabel";
const currentPath = ref<string[]>([]);
const currentDatabasePath = ref<string[]>([]);
const { proxy } = getCurrentInstance() as any;
const route = useRoute();
// 分级引用refGradeGuid
......@@ -48,14 +49,20 @@ const getCgDirTreeData = async () => {
}
const res: any = await getTaskExeTreeList(params);
if (res.code == proxy.$passCode) {
CgDirTreeList.value = res.data;
treeInfo.value.data = res.data;
currentPath.value = [res.data[0].classifyName];
treeInfo.value.expandedKey.push(res.data[0].classifyDetailGuid);
treeInfo.value.currentNodeKey = res.data[0].classifyDetailGuid;
classifyDetailGuidInfo.value = res.data[0].classifyDetailGuid;
searchItemList.value[1].options = res.data;
refGradeGuid.value = res.data[0].refGradeGuid;
const transformedData: any = [{
classifyDetailGuid: execGuidInfo.value.guid, // 新增字段 GUID
classifyName: execGuidInfo.value.cgDirName, // 新增字段目录名称
children: res.data, // 将原始数据放入 children
}];
CgDirTreeList.value = transformedData;
treeInfo.value.data = transformedData;
currentPath.value = [transformedData[0].classifyName];
treeInfo.value.expandedKey.push(transformedData[0].classifyDetailGuid);
treeInfo.value.currentNodeKey = transformedData[0].classifyDetailGuid;
// classifyDetailGuidInfo.value = res.data[0].classifyDetailGuid;
searchItemList.value[0].options = res.data || [];
refGradeGuid.value = res.data[0].refGradeGuid || '';
treeInfo.value.loading = false;
} else {
proxy.$ElMessage.error(res.msg);
......@@ -126,7 +133,7 @@ onMounted(async () => {
});
getDictionaryList();
getSearchTableList();
getLabelListData();
// getLabelListData();
getGradeData(refGradeGuid.value);
})
......@@ -160,21 +167,21 @@ const addStandardSet = () => {
// 右侧上方搜索tab配置
const searchItemList = ref([
{
label: '标签',
type: 'select',
maxlength: 19,
placeholder: '选择标签',
field: 'labelName',
default: '',
options: [],
props: {
label: 'label',
value: 'guid',
},
clearable: true,
filterable: true,
},
// {
// label: '标签',
// type: 'select',
// maxlength: 19,
// placeholder: '选择标签',
// field: 'labelName',
// default: '',
// options: [],
// props: {
// label: 'label',
// value: 'guid',
// },
// clearable: true,
// filterable: true,
// },
{
label: "",
placeholder: '分类',
......@@ -192,7 +199,8 @@ const searchItemList = ref([
block: false,
filterable: false,
clearable: true,
required: false
required: false,
visible: true,
}, {
label: '分级',
type: 'select',
......@@ -206,6 +214,7 @@ const searchItemList = ref([
value: 'guid',
},
clearable: true,
visible: true,
},
])
......@@ -265,7 +274,7 @@ const nodeClick = async (data: any) => {
const { guid, classifyDetailGuid, refGradeGuid } = data
classifyDetailGuidInfo.value = classifyDetailGuid;
// getGradeData(refGradeGuid);
searchItemList.value[1].default = data.classifyName;
searchItemList.value[0].default = data.classifyName;
await getCgDirFieldPage({
execGuid: execGuidInfo.value.execGuid,
......@@ -302,20 +311,20 @@ const findPath = (data: any[], targetGuid: string, path: string[] = []) => {
const getGradeData = async (refGradeGuid) => {
const res: any = await getGradeList({ classifyGradeGuid: refGradeGuid, pageIndex: 1, pageSize: -1 });
if (res.code == proxy.$passCode) {
searchItemList.value[2].options = res.data.records || [];
searchItemList.value[1].options = res.data.records || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}
// 获取标签
const getLabelListData = async () => {
const res: any = await getLabelList({ label: '' });
if (res.code == proxy.$passCode) {
searchItemList.value[0].options = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}
// const getLabelListData = async () => {
// const res: any = await getLabelList({ label: '' });
// if (res.code == proxy.$passCode) {
// searchItemList.value[0].options = res.data || [];
// } else {
// proxy.$ElMessage.error(res.msg);
// }
// }
// btns-area
const checked = ref(false);
......@@ -354,12 +363,12 @@ const tableInfo = ref({
}
},
{ label: "分级", field: "gradeDetailName", width: 80 },
{ label: "标签", field: "label", width: 140 },
{ label: "规则", field: "ruleDetail", width: 180 },
{ label: "表名", field: "tableName", width: 120, align: 'center' },
{ label: "表中文名", field: "tableChName", width: 120, align: 'center' },
{ label: "数据库名", field: "database", width: 120, align: 'center' },
{ label: "数据库中文名", field: "databaseChName", width: 120, align: 'center' },
// { label: "标签", field: "label", width: 140 },
// { label: "规则", field: "ruleDetail", width: 180 },
{ label: "表名", field: "tableName", width: 120, align: 'left' },
{ label: "表中文名", field: "tableChName", width: 120, align: 'left' },
{ label: "数据库名", field: "database", width: 120, align: 'left' },
{ label: "数据库中文名", field: "databaseChName", width: 120, align: 'left' },
],
data: [],
......@@ -831,6 +840,12 @@ const handleClick = (tab: any) => {
activeName.value = tab.props.name;
if (tab.props.name === 'second') {
classifyDetailGuidInfo.value = '';
if (activeTab.value === 'table') {
searchItemList.value[0].visible = false;
searchItemList.value[1].visible = false;
searchItemList.value[0].default = '';
searchItemList.value[1].default = '';
}
selectedA.value = null;
selectedB.value = null;
selectedC.value = null;
......@@ -842,6 +857,10 @@ const handleClick = (tab: any) => {
getDataBaseFieldData();
getDbDirTableSelectData(1, {});
} else {
searchItemList.value[0].visible = true;
searchItemList.value[1].visible = true;
searchItemList.value[0].default = '';
searchItemList.value[1].default = '';
selectedA.value = null;
selectedB.value = null;
selectedC.value = null;
......@@ -865,6 +884,10 @@ const getDataBaseTreeData = async () => {
// 更新到绑定的响应式数据
dataBaseTreeData.value = dataArray;
dataBaseTreeInfo.value.data = dataArray;
dataBaseTreeInfo.value.expandedKey.push(dataArray[0].guid);
dataBaseTreeInfo.value.currentNodeKey = dataArray[0].guid;
dataBaseGuid.value = dataArray[0].databaseGuid;
currentDatabasePath.value = [dataArray[0].name];
dataBaseTreeInfo.value.loading = false;
} else {
proxy.$ElMessage.error(res.msg);
......@@ -992,7 +1015,7 @@ const tableFieldsDataInfo = ref({
{ label: "数据库中文名", field: "databaseChName", width: TableColumnWidth.DATETIME },
{ label: "分类", field: "classifyDetailName", width: 120, align: 'center' },
{ label: "分级", field: "gradeDetailName", width: 120, align: 'center' },
{ label: "标签", field: "label", width: 120, align: 'center' },
// { label: "标签", field: "label", width: 120, align: 'center' },
],
data: [],
page: {
......@@ -1009,7 +1032,7 @@ const tableFieldsDataInfo = ref({
const showTableOrDatabase = ref(true);
const isShowCreateBtn = ref(false);
const isShowCreateBtn = ref(true);
// 定义tableGuid
const tableGuid = ref('');
const dataBaseGuid = ref('');
......@@ -1017,7 +1040,15 @@ const dataBaseInfo = ref<any>({});
const dataBasenodeClick = (data: any) => {
isShowCreateBtn.value = false;
console.log('dataBasenodeClick', data);
console.log('dataBasenodeClick', data, dataBaseTreeData.value);
const path = findDDatabasePath(dataBaseTreeData.value, data.guid);
console.log('path', path);
if (path) {
currentDatabasePath.value = path;
console.log('找到路径:', path);
} else {
console.error('未找到路径');
}
if (data.databaseGuid) {
dataBaseInfo.value = data;
dataBaseGuid.value = data.databaseGuid;
......@@ -1047,8 +1078,24 @@ const dataBasenodeClick = (data: any) => {
showTableOrDatabase.value = false;
return;
}
}
const findDDatabasePath = (data: any[], targetGuid: string, path: string[] = []) => {
for (const item of data) {
path.push(item.name); // 添加当前节点名称
if (item.guid === targetGuid) {
return path; // 找到目标节点,返回路径
}
if (item.children && item.children.length > 0) {
const result = findDDatabasePath(item.children, targetGuid, path);
if (result) return result; // 子节点找到目标节点,返回路径
}
path.pop(); // 回溯,移除当前节点
}
return null; // 未找到目标节点
};
const nodeSelectChange = (data: any) => {
console.log('nodeSelectChange', data);
}
......@@ -1087,14 +1134,17 @@ const isShowClassifyTip = ref(true);
const isShowDatabaseTip = ref(true);
const addIsShowClassifyTip = () => {
isShowClassifyTip.value = false;
tipHeight.value = 83;
}
const tipHeight = ref(200);
const tipHeight1 = ref(165);
const tipHeight = ref(135);
const tipHeight1 = ref(170);
const tipHeight2 = ref(130);
const addIsShowDatabaseTip = () => {
isShowDatabaseTip.value = false;
tipHeight.value = 148;
tipHeight1.value = 103;
tipHeight1.value = 118;
tipHeight2.value = 78;
}
// 表信息和字段信息切换
......@@ -1104,12 +1154,20 @@ const setActiveTab = (tab) => {
console.log('setActiveTab', tab);
activeTab.value = tab;
if (tab === 'word' && activeName.value === 'second') {
searchItemList.value[0].visible = true;
searchItemList.value[1].visible = true;
searchItemList.value[0].default = '';
searchItemList.value[1].default = '';
isShowWordSearch.value = false;
optionsA.value = [];
optionsB.value = [];
optionsC.value = [];
getDbDirFieldSelectData(1);
} else {
searchItemList.value[0].visible = false;
searchItemList.value[1].visible = false;
searchItemList.value[0].default = '';
searchItemList.value[1].default = '';
isShowWordSearch.value = true;
optionsA.value = [];
optionsB.value = [];
......@@ -1292,9 +1350,11 @@ const levelGuidInfo = ref('');
// 标签选择
const selectChange = (val, row, info) => {
console.log('selectChange', val, row, info);
if (info.classifyName == undefined) {
classifyDetailGuidInfo.value = '';
}
if (info) {
labelGuidInfo.value = info.labelName;
classifyDetailGuidInfo.value = info.classifyName;
levelGuidInfo.value = info.levelName;
}
}
......@@ -1382,7 +1442,7 @@ const treeSelectNodeClick = (node, item) => {
<el-button @click="batchControlRules">批量配置业务规则</el-button>
</div>
</div>
<div class="table_panel_wrap">
<div class="table_panel_wrap" :style="{ height: `calc(100% - ${tipHeight}px)` }">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange"
@tableCheckboxSelectChange="tableCheckboxSelectChange"
@tableCheckboxAllSelectChange="tableCheckboxAllSelectChange" />
......@@ -1403,7 +1463,12 @@ const treeSelectNodeClick = (node, item) => {
不再提醒
</el-button>
</div>
<div>全部</div>
<div class="path">
<span v-for="(item, index) in currentDatabasePath" :key="index" class="path-item">
<span :class="{ 'bold': index === currentDatabasePath.length - 1 }">{{ item }}</span>
<span v-if="index < currentDatabasePath.length - 1">/</span>
</span>
</div>
<div class="tab-btn">
内容信息:
<div v-if="showTableOrDatabase" class="table" :class="{ active: activeTab === 'table' }"
......@@ -1457,11 +1522,13 @@ const treeSelectNodeClick = (node, item) => {
<el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" />
</div>
</div>
<div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'">
<div class="table_panel_wrap_database" :style="{ height: `calc(100% - ${tipHeight1}px)` }"
v-if="!tableGuid && activeTab === 'table'">
<Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange"
@tableSwitchBeforeChange="tableSwitchBeforeChange" />
</div>
<div class="table_field" v-if="tableGuid || activeTab === 'word'">
<div class="table_field" :style="{ height: `calc(100% - ${tipHeight2}px)` }"
v-if="tableGuid || activeTab === 'word'">
<Table :tableInfo="tableFieldsDataInfo" @tablePageChange="dataFieldTablePageChange" />
</div>
</div>
......@@ -1600,7 +1667,6 @@ const treeSelectNodeClick = (node, item) => {
.table_panel_wrap {
width: 100%;
height: calc(100% - 130px);
min-height: 210px;
overflow: visible;
}
......
......@@ -383,6 +383,8 @@ const cancel = () => {
<el-option label="大于" value=">"></el-option>
<el-option label="等于" value="="></el-option>
<el-option label="小于" value="<"></el-option>
<el-option label="大于等于" value=">="></el-option>
<el-option label="小于等于" value="<="></el-option>
</el-select>
<el-input v-model="scope.row.lengthValue" placeholder="请输入" style="width: 45%;" />
</div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!