7364348a by xukangle

fix : 分类分级查询

1 parent f3704a8e
......@@ -49,11 +49,11 @@ export const checkDeleteDictionaryScheme = (params) => request({
data: params
})
// 分页查询
// export const getDictionary = (params) => request({
// url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/page-list`,
// method: 'post',
// data: params
// })
export const getDictionary = (params) => request({
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/page-list`,
method: 'post',
data: params
})
// 查询数据字典启用状态的数据
export const getDictionaryAll = (params) => request({
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/list-all`,
......@@ -598,10 +598,10 @@ export const filterVal = (val, type) => {
/** 获取字典列表
* VITE_APP_PLAN_BASEURL 为环境变量 现在只是mock数据
*/
export const getDictionary = (params) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/data-dictionary-general/list-all?state=1`,
method: 'post'
})
// export const getDictionary = (params) => request({
// url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/data-dictionary-general/list-all?state=1`,
// method: 'post'
// })
......
......@@ -24,18 +24,22 @@ import {
getDbDirDetail,
getDbDirTableSelectList,
getDbDirFieldSelectList,
updateDataAsset
updateDataAsset,
getDictionaryAll
} from '@/api/modules/dataInventory';
import { TableColumnWidth } from "@/utils/enum";
import router from "@/router";
import { download } from "@/utils/common";
import { getLabelList } from "@/api/modules/dataLabel";
import { da } from "element-plus/es/locale";
const currentPath = ref<string[]>([]);
const { proxy } = getCurrentInstance() as any;
const route = useRoute();
// 分级引用refGradeGuid
const refGradeGuid = ref('');
// 初始分类classifyDetailGuid
const classifyDetailGuidInfo = ref('');
// 分级分类树形列表
const CgDirTreeList = ref();
const getCgDirTreeData = async () => {
......@@ -50,6 +54,7 @@ const getCgDirTreeData = async () => {
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;
treeInfo.value.loading = false;
......@@ -66,8 +71,9 @@ const getCgDirFieldPage = async (params = {}) => {
pageIndex: 1,
pageSize: 50,
execGuid: '',
classifyDetail: '',
gradeDetailGuid: '',
classifyDetail: '', // 分类guid
gradeDetailGuid: '', // 分级guid
labelGuid: '',
databaseGuid: '',
tableGuid: '',
fieldGuid: '',
......@@ -87,8 +93,9 @@ const getCgDirFieldPage = async (params = {}) => {
};
const dictionaryList = ref([]);
const getDictionaryList = () => {
getDictionary({}).then((res: any) => {
getDictionaryAll({ state: 1 }).then((res: any) => {
dictionaryList.value = [];
if (res.code == proxy.$passCode) {
dictionaryList.value = res.data || [];
......@@ -115,7 +122,8 @@ onMounted(async () => {
await getExecGuid();
await getCgDirTreeData();
await getCgDirFieldPage({
execGuid: execGuidInfo.value.execGuid
execGuid: execGuidInfo.value.execGuid,
classifyDetail: classifyDetailGuidInfo.value
});
getDictionaryList();
getSearchTableList();
......@@ -218,7 +226,7 @@ const toSearch = (val: any, clear: boolean = false) => {
pageIndex: 1,
pageSize: 50,
execGuid: execGuidInfo.value.execGuid,
classifyDetail: val.classifyName,
classifyDetail: classifyDetailGuidInfo.value,
gradeDetailGuid: val.levelName,
labelGuid: val.labelName,
databaseGuid: selectedA.value,
......@@ -234,9 +242,9 @@ const toSearch = (val: any, clear: boolean = false) => {
database: selectedA.value || '',
tableName: selectedB.value || '',
fieldName: selectedC.value || '',
classifyDetailName: val.classifyName,
gradeDetailName: val.levelName,
label: val.labelName,
classifyDetailGuid: val.classifyName,
gradeDetailGuid: val.levelName,
labelGuid: val.labelName,
});
}
if (activeName.value === 'second' && activeTab.value === 'word') {
......@@ -245,10 +253,10 @@ const toSearch = (val: any, clear: boolean = false) => {
pageSize: 50,
execGuid: execGuidInfo.value.execGuid,
database: selectedA.value || '',
tableName: selectedB.value || '',
classifyDetailName: val.classifyName,
gradeDetailName: val.levelName,
label: val.labelName,
fieldName: selectedB.value || '',
classifyDetailGuid: val.classifyName,
gradeDetailGuid: val.levelName,
labelGuid: val.labelName,
});
}
};
......@@ -257,8 +265,10 @@ const toSearch = (val: any, clear: boolean = false) => {
const nodeClick = async (data: any) => {
console.log('nodeClick', data);
const { guid, classifyDetailGuid, refGradeGuid } = data
classifyDetailGuidInfo.value = classifyDetailGuid;
// getGradeData(refGradeGuid);
searchItemList.value[1].default = data.classifyName;
await getCgDirFieldPage({
execGuid: execGuidInfo.value.execGuid,
classifyDetail: classifyDetailGuid,
......@@ -407,11 +417,13 @@ const tableCheckboxAllSelectChange = (select) => {
// 批量配置业务规则
const batchControlRules = () => {
console.log('selectedRulesData', selectedRulesData.value);
// 判断是否选中数据
if (!selectedRulesData.value || !selectedRulesData.value.guids || selectedRulesData.value.guids.length == 0) {
proxy.$ElMessage.warning('请选择数据');
return;
}
drawerInfo.value.visible = true;
classEditFormItems.value[0].default = selectedRulesData.value.rulesName;
}
......@@ -475,7 +487,7 @@ const dataBaseTableInfo = ref({
return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表';
}
},
{ label: "任务修改人", field: "updateUserName", width: 100 },
{ label: "任务修改人", field: "taskUpdateUserName", width: 100 },
{ label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
{ label: "描述", field: "description", width: 120, align: 'center' },
{ label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' },
......@@ -782,22 +794,20 @@ const drawerBtnClick = async (btn, info) => {
execGuid: execGuidInfo.value.execGuid
})
});
// const params = {
// fieldPrecision,
// dictionaryGuid,
// isUnique,
// isNotNull,
// fieldLengthCondition,
// fieldValueRange,
// fieldGuid: selectedRulesData.value.guids,
// execGuid: execGuidInfo.value.execGuid
// }
const res: any = await saveBizRuleConfig(params);
if (res.code == proxy.$passCode) {
btn.loading = false;
proxy.$ElMessage.success('配置成功!');
drawerInfo.value.visible = false;
getCgDirFieldPage();
getCgDirFieldPage({
execGuid: execGuidInfo.value.execGuid,
classifyDetail: classifyDetailGuidInfo.value,
gradeDetailGuid: levelGuidInfo.value,
labelGuid: labelGuidInfo.value,
databaseGuid: selectedA.value,
tableGuid: selectedB.value,
fieldGuid: selectedC.value,
});
} else {
btn.loading = false;
proxy.$ElMessage.error(res.msg);
......@@ -821,6 +831,7 @@ const handleClick = (tab: any) => {
console.log(tab.props.name);
activeName.value = tab.props.name;
if (tab.props.name === 'second') {
classifyDetailGuidInfo.value = '';
selectedA.value = null;
selectedB.value = null;
selectedC.value = null;
......@@ -849,8 +860,7 @@ const getDataBaseTreeData = async () => {
dataBaseTreeInfo.value.loading = true;
const res: any = await getDbDirTreeList({});
if (res.code == proxy.$passCode) {
const dataArray = [res.data];
console.log('dataArray', dataArray, typeof dataArray);
const dataArray = res.data;
// 遍历并添加 GUIDs
dataArray.forEach(addGuids);
// 更新到绑定的响应式数据
......@@ -869,11 +879,7 @@ const addGuids = (node) => {
} else if (node.tableGuid) {
node.guid = node.tableGuid;
node.name = node.tableChName;
} else {
node.guid = '1';
node.name = node.cgDirName;
}
if (node.children && Array.isArray(node.children)) {
node.children.forEach(addGuids);
}
......@@ -887,14 +893,16 @@ const getDataBaseTableData = async (params = {}) => {
const dataBaseParams = {
pageIndex: dataBasePage.value.curr,
pageSize: dataBasePage.value.limit,
databaseGuid: "",
tableGuid: tableGuid.value,
databaseGuid: dataBaseGuid.value,
isDataAsset: '',
execGuid: execGuidInfo.value.execGuid,
tableName: "",
database: "",
label: "",
classifyDetailName: "",
gradeDetailName: ""
fieldName: "",
labelGuid: "",
classifyDetailGuid: "",
gradeDetailGuid: ""
};
const finalParams = { ...dataBaseParams, ...params };
......@@ -939,10 +947,14 @@ const getDataBaseFieldData = async (params = {}) => {
pageIndex: dataFieldPage.value.curr,
pageSize: dataFieldPage.value.limit,
tableGuid: "",
execGuid: execGuidInfo.value.execGuid,
databaseGuid: "",
fieldName: '',
gradeDetailName: '',
execGuid: execGuidInfo.value.execGuid,
tableName: "",
database: "",
fieldName: "",
labelGuid: "",
classifyDetailGuid: "",
gradeDetailGuid: ""
};
const finalParams = { ...dataBaseParams, ...params };
const res: any = await getDbDirFieldPageList(finalParams);
......@@ -1011,12 +1023,6 @@ const dataBaseInfo = ref<any>({});
const dataBasenodeClick = (data: any) => {
isShowCreateBtn.value = false;
console.log('dataBasenodeClick', data);
if (data.cgDirName) {
tableGuid.value = '';
dataBaseGuid.value = '';
getDataBaseFieldData();
getDataBaseTableData();
}
if (data.databaseGuid) {
dataBaseInfo.value = data;
dataBaseGuid.value = data.databaseGuid;
......@@ -1035,9 +1041,7 @@ const dataBasenodeClick = (data: any) => {
getDataBaseFieldData({
tableGuid: data.tableGuid
});
// getDataBaseTableData({
// tableGuid: data.tableGuid
// });
}
if (data.databaseGuid || data.cgDirName) {
......@@ -1122,7 +1126,7 @@ const setActiveTab = (tab) => {
// 数据库字段搜索联动 getDbDirFieldSelectList
const getDbDirFieldSelectData = async (type, params = {}) => {
const inParams = {
condition: "database",
condition: "1",
database: "",
tableName: "",
execGuid: execGuidInfo.value.execGuid,
......@@ -1133,14 +1137,20 @@ const getDbDirFieldSelectData = async (type, params = {}) => {
console.log('getDbDirFieldSelectData', res);
if (type == 1) {
optionsA.value = res.data.map((item) => ({
dbGuid: item.database, // 数据库标识
name: item.database, // 数据库名称
dbGuid: item.databaseGuid, // 数据库标识
name: item.databaseChName, // 数据库名称
}));
}
if (type == 2) {
optionsB.value = res.data.map((item) => ({
dbGuid: item.tableName, // 表标识
name: item.tableName, // 表名称
dbGuid: item.tableGuid, // 表标识
name: item.tableChName, // 表名称
}));
}
if (type == 3) {
optionsC.value = res.data.map((item) => ({
dbGuid: item.fieldGuid, // 字段标识
name: item.fieldChName, // 字段名称
}));
}
} else {
......@@ -1173,10 +1183,11 @@ const getSearchTableList = async (type = 1, dbGuid = '') => {
const getDbDirTableSelectData = async (type, params = {}) => {
console.log('getDbDirTableSelectData', params);
const inParams = {
condition: "database",
database: "",
tableName: "",
condition: "1",
execGuid: execGuidInfo.value.execGuid,
databaseGuid: "",
tableGuid: "",
};
const finalParams = { ...inParams, ...params };
const res: any = await getDbDirTableSelectList(finalParams);
......@@ -1184,21 +1195,28 @@ const getDbDirTableSelectData = async (type, params = {}) => {
if (type == 1) {
optionsA.value = res.data.map((item) => ({
dbGuid: item.database, // 数据库标识
name: item.database, // 数据库名称
dbGuid: item.databaseGuid, // 数据库标识
name: item.databaseChName, // 数据库名称
}));
}
if (type == 2) {
console.log('进来了吗', res);
if (activeTab.value === 'word') {
console.log('进来了吗', res.data);
optionsC.value = res.data.map((item) => ({
dbGuid: item.fieldName, // 字段标识
name: item.fieldName, // 字段名称
}));
return;
}
optionsB.value = res.data.map((item) => ({
dbGuid: item.database, // 表标识
name: item.database, // 表名称
dbGuid: item.tableGuid, // 表标识
name: item.tableChName, // 表名称
}));
}
if (type == 3) {
optionsC.value = res.data.map((item) => ({
dbGuid: item.database, // 字段标识
name: item.database, // 字段名称
dbGuid: item.fieldGuid, // 字段标识
name: item.fieldChName, // 字段名称
}));
}
......@@ -1228,9 +1246,15 @@ const onAChange = async () => {
}
if (activeName.value == 'second') {
console.log('onAChange', optionsA.value);
await getDbDirTableSelectData(2, { database: selectedA.value }); // 数据库搜索
if (activeTab.value === 'word') {
await getDbDirFieldSelectData(2, { databaseGuid: selectedA.value, condition: "2" });
} else {
await getDbDirTableSelectData(2, { databaseGuid: selectedA.value, condition: "2" }); // 数据库搜索
}
}
};
// 第二个下拉框值改变时
......@@ -1243,7 +1267,11 @@ const onBChange = async () => {
await getSearchTableList(3, selectedB.value); // 分类分级搜索
}
if (activeName.value == 'second') {
await getDbDirTableSelectData(3, { tableName: selectedB.value }); // 数据库搜索
if (activeTab.value === 'word') {
await getDbDirFieldSelectData(3, { tableGuid: selectedB.value, databaseGuid: selectedA.value, condition: "3" });
} else {
await getDbDirTableSelectData(3, { tableGuid: selectedB.value, databaseGuid: selectedA.value, condition: "3" }); // 数据库搜索
}
}
};
......@@ -1265,10 +1293,19 @@ const exportDB = async () => {
});
}
// 分类选择
const treeSelectNodeChange = (node, item) => {
const { refGradeGuid } = node;
// getGradeData(refGradeGuid);
// 标签guid
const labelGuidInfo = ref('');
// 分级guid信息
const levelGuidInfo = ref('');
// 标签选择
const selectChange = (val, row, info) => {
console.log('selectChange', val, row, info);
if (info) {
labelGuidInfo.value = info.labelName;
classifyDetailGuidInfo.value = info.classifyName;
levelGuidInfo.value = info.levelName;
}
}
// 这里应该是onActivated 钩子,路由从configure-路由从configure-rules跳转过来要重新请求数据、
......@@ -1303,11 +1340,11 @@ onActivated(async () => {
<el-option v-for="item in optionsB" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
</el-select>
<el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px"
:clearable="true" v-if="isShowWordSearch">
:clearable="true">
<el-option v-for="item in optionsC" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
</el-select>
<TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch"
@treeSelectNodeChange="treeSelectNodeChange" />
@selectChange="selectChange" />
</div>
<div class="container_wrap full flex">
<div class="aside_wrap">
......@@ -1423,13 +1460,11 @@ onActivated(async () => {
<el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" />
</div>
</div>
<div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'"
:style="{ height: '483px', minHeight: '210px' }">
<div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'">
<Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange"
@tableSwitchBeforeChange="tableSwitchBeforeChange" />
</div>
<div class="table_field" v-if="tableGuid || activeTab === 'word'"
:style="{ height: '523px', minHeight: '210px' }">
<div class="table_field" v-if="tableGuid || activeTab === 'word'">
<Table :tableInfo="tableFieldsDataInfo" @tablePageChange="dataFieldTablePageChange" />
</div>
</div>
......@@ -1459,6 +1494,7 @@ onActivated(async () => {
padding: 0;
display: flex;
justify-content: space-between;
height: calc(100% - 44px);
.aside_wrap {
width: 199px;
......@@ -1567,19 +1603,21 @@ onActivated(async () => {
.table_panel_wrap {
width: 100%;
height: 520px;
height: calc(100% - 130px);
min-height: 210px;
overflow: visible;
}
.table_panel_wrap_database {
width: 100%;
height: calc(100% - 170px);
min-height: 210px;
overflow: visible;
}
.table_field {
width: 100%;
height: calc(100% - 130px);
min-height: 210px;
overflow: visible;
}
......
......@@ -677,7 +677,7 @@ const treePromise = ref();
// 获取数据字典树形数据
const getTreeData = (needClick = false, currData = {}) => {
const params = {
paramCode: 'data_structure_code'
paramCode: '数据字典类型'
}
treeInfo.value.loading = true
treePromise.value = getDictionaryTree(params).then((res: any) => {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!