1fec05c1 by xukangle

update: 联调分类分级目录接口

1 parent 4fa77310
......@@ -461,15 +461,46 @@ export const getDbDirFieldPageList = (data) => request({
data
})
/**
* 数据库目录-表联动查询
* @param data
* @returns
* @path /db-dir/table/select-list
*/
export const getDbDirTableSelectList = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/select-list`,
method: 'post',
data
})
/** 获取已有字段信息 */
export const getDsTableStructure= (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid`,
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid?tableGuid=${data.tableGuid}&execGuid=${data.execGuid}`,
method: 'post',
data
});
/** 获取已有数据库目录字段信息 入参是数组 */
export const getDsTableStructures= (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guids`,
method: 'post',
data
});
/**
* 数据库目录-字段查询分类分级
* @param {Object}
* @path /db-dir/field/get-classify-and-grade
*/
export const getDbDirFieldClassifyAndGrade = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/get-classify-and-grade`,
method: 'post',
data
})
/** 根据选择的连接池获取表列表 */
export const getDsTableByDs = (params) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`,
......
......@@ -90,6 +90,10 @@ const getExecGuid = async () => {
}
//
onMounted(() => {
getCgDirTreeData();
getCgDirFieldPage();
......@@ -364,9 +368,9 @@ const dataBaseTableInfo = ref({
fixedSelection: true,
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
{ label: "数据源", field: "cgDirName", width: 140 },
{ label: "表名称", field: "tableName", width: 180 },
{ label: "数据库表", field: "tableChName", width: 120 },
{ label: "数据源", field: "databaseChName", width: 140 },
{ label: "表名称", field: "tableChName", width: 180 },
{ label: "数据库表", field: "tableName", width: 120 },
{
label: "新建方式", field: "foundMode", width: 140, getName: (scope) => {
let dataGrade = scope.row.foundMode;
......@@ -380,7 +384,7 @@ const dataBaseTableInfo = ref({
return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表';
}
},
{ label: "任务修改人", field: "damName", width: 120 },
{ label: "任务修改人", field: "updateUserName", width: 120 },
{ 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' },
......@@ -397,31 +401,35 @@ const dataBaseTableInfo = ref({
type: "btn",
width: 300,
fixed: 'right',
btns: [
{
label: "配置业务规则", value: "edit", click: (scope) => {
console.log('编辑', scope);
// 路由跳转configure-rules
router.push({
name: 'configureRules',
query: {
cgDirName: scope.row.cgDirName,
tableName: scope.row.tableName,
tableChName: scope.row.tableChName,
tableGuid: scope.row.tableGuid,
description: scope.row.description,
execGuid: execGuidInfo.value.execGuid
}
});
btns: (scope) => {
return [
{
label: "配置业务规则", value: "edit", click: (scope) => {
console.log('编辑', scope);
// 路由跳转configure-rules
router.push({
name: 'configureRules',
query: {
cgDirName: scope.row.cgDirName,
tableName: scope.row.tableName,
tableChName: scope.row.tableChName,
tableGuid: scope.row.tableGuid,
description: scope.row.description,
execGuid: execGuidInfo.value.execGuid
}
});
}
},
{
label: "编辑表结构", value: "edit", click: (scope) => {
console.log('复制', scope);
},
disabled: scope.row.state !== 2 ? false : true
}
},
]
}
{
label: "编辑表结构", value: "copy", click: (scope) => {
console.log('复制', scope);
}
}
]
},
loading: false
......@@ -687,7 +695,7 @@ const getDataBaseTableData = async (params = {}) => {
pageIndex: 1,
pageSize: 10,
databaseGuid: "",
isDataAsset: checked.value ? 'Y' : 'N',
isDataAsset: '',
execGuid: execGuidInfo.value.execGuid,
};
const finalParams = { ...dataBaseParams, ...params };
......@@ -727,7 +735,9 @@ const getDataBaseFieldData = async (params = {}) => {
tableGuid: "",
execGuid: execGuidInfo.value.execGuid,
databaseGuid: "",
isDataAsset: checked.value ? 'Y' : 'N',
isDataAsset: '',
fieldName: '',
gradeDetailName: '',
};
const finalParams = { ...dataBaseParams, ...params };
......@@ -773,11 +783,14 @@ const tableFieldsDataInfo = ref({
const showTableOrDatabase = ref(true);
const isShowCreateBtn = ref(false);
// 定义tableGuid
const tableGuid = ref('');
const dataBaseGuid = ref('');
const dataBaseInfo = ref<any>({});
const dataBasenodeClick = (data: any) => {
isShowCreateBtn.value = false;
console.log('dataBasenodeClick', data);
if (data.cgDirName) {
tableGuid.value = '';
......@@ -786,7 +799,9 @@ const dataBasenodeClick = (data: any) => {
getDataBaseTableData();
}
if (data.databaseGuid) {
dataBaseInfo.value = data;
dataBaseGuid.value = data.databaseGuid;
isShowCreateBtn.value = true;
tableGuid.value = '';
getDataBaseFieldData({
databaseGuid: data.databaseGuid
......@@ -801,9 +816,9 @@ const dataBasenodeClick = (data: any) => {
getDataBaseFieldData({
tableGuid: data.tableGuid
});
getDataBaseTableData({
tableGuid: data.tableGuid
});
// getDataBaseTableData({
// tableGuid: data.tableGuid
// });
}
if (data.databaseGuid || data.cgDirName) {
......@@ -826,7 +841,8 @@ const handleSubjectTableCommand = (command: string) => {
router.push({
name: 'tableCreateFile',
query: {
type: 'tableCreateFile'
type: 'tableCreateFile',
foundMode: 2
}
});
} else if (command === 'existingCreate') {
......@@ -834,7 +850,11 @@ const handleSubjectTableCommand = (command: string) => {
router.push({
name: 'tableCreateExisting',
query: {
execGuid: execGuidInfo.value.execGuid
execGuid: execGuidInfo.value.execGuid,
foundMode: 1,
database: dataBaseInfo.value.database,
databaseChName: dataBaseInfo.value.databaseChName,
databaseGuid: dataBaseInfo.value.databaseGuid,
}
});
}
......@@ -1033,7 +1053,7 @@ loadOptionsA();
<div class="btns-area" v-if="!tableGuid && activeTab === 'table'">
<div class="left-btns">
<div class="dropdown_btn">
<div class="dropdown_btn" v-if="isShowCreateBtn">
<el-dropdown popper-class="table-create-menu" @command="handleSubjectTableCommand"
placement="bottom-start" trigger="click">
<span class="el-dropdown-link">
......
......@@ -6,7 +6,6 @@
import { ref } from "vue";
import router from "@/router";
import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory'
const { proxy } = getCurrentInstance() as any;
const bizRuleConfigData = ref<any>()
const getBizRuleConfigDetailData = async () => {
......@@ -105,9 +104,25 @@ const moveDown = () => {
// 编辑行
const editRow = (row) => {
if (!row.isEdit) {
const [symbol, value] = row.fieldLengthCondition.split('#');
row.lengthSymbol = symbol; // 初始化符号部分
row.lengthValue = value; // 初始化数值部分
// 编辑fieldLengthCondition
if (row.fieldLengthCondition) {
const [symbol, value] = row.fieldLengthCondition.split('#');
row.lengthSymbol = symbol; // 初始化符号部分
row.lengthValue = value; // 初始化数值部分
} else {
row.lengthSymbol = ''; // 默认值
row.lengthValue = ''; // 默认值
}
//编辑fieldValueRange
if (row.fieldValueRange) {
const [start, end] = row.fieldValueRange.split('-');
row.rangeStart = start; // 初始化符号部分
row.rangeEnd = end; // 初始化数值部分
} else {
row.rangeStart = ''; // 默认值
row.rangeEnd = ''; // 默认值
}
row.isEdit = true; // 进入编辑模式
}
};
......@@ -115,6 +130,7 @@ const editRow = (row) => {
// 保存数据
const saveRow = (row) => {
row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`;
row.fieldValueRange = [row.rangeStart || '', row.rangeEnd || ''];
row.isEdit = false
}
......@@ -213,19 +229,23 @@ const saveData = async () => {
"isNotNull": "string",
"fieldValueRange": "string"
*/
const params = tableData.value.map((item: any) => {
return {
guid: item.guid,
const inParams = [] as any
tableData.value.forEach((item: any) => {
const obj = {
guid: router.currentRoute.value.query.tableGuid,
fieldGuid: item.fieldGuid,
fieldLengthCondition: item.fieldLengthCondition,
fieldPrecision: item.fieldPrecision,
dictionaryGuid: item.dictionaryGuid,
isUnique: item.isUnique,
isNotNull: item.isNotNull,
isNotNull: item.isRequired,
fieldValueRange: item.fieldValueRange
}
inParams.push(obj)
})
const res: any = await updateBizRuleConfig(params)
console.log('finalParams', inParams)
const res: any = await updateBizRuleConfig(inParams)
if (res.code === proxy.$passCode) {
proxy.$message.success('修改配置规则成功!')
router.back()
......@@ -270,29 +290,29 @@ const cancel = () => {
<!-- 排序列(不可编辑) -->
<el-table-column type="index" label="排序" width="80" align="center" />
<!-- 字段中文名(不可编辑)fieldChName -->
<el-table-column prop="fieldName" label="字段中文名" width="120">
<el-table-column prop="fieldChName" label="字段中文名" width="120">
<template #default="scope">
{{ scope.row.fieldName ? scope.row.fieldName : '--' }}
{{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
</template>
</el-table-column>
<!-- 字段英文名(不可编辑) -->
<el-table-column prop="fieldEnglish" label="字段英文名" width="120">
<el-table-column prop="fieldName" label="字段英文名" width="120">
<template #default="scope">
{{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }}
{{ scope.row.fieldName ? scope.row.fieldName : '--' }}
</template>
</el-table-column>
<!-- 分类(不可编辑)classifyName -->
<el-table-column prop="fieldEnglish" label="分类" width="120">
<!-- <el-table-column prop="fieldEnglish" label="分类" width="120">
<template #default="scope">
{{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }}
</template>
</el-table-column>
</el-table-column> -->
<!-- 分级(不可编辑) -->
<el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
<!-- <el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
<template #default="scope">
{{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }}
</template>
</el-table-column>
</el-table-column> -->
<!-- 字段类型fieldType (不可编辑) -->
<el-table-column prop="fieldType" label="字段类型" width="150" align="center">
<template #default="scope">
......@@ -367,11 +387,20 @@ const cancel = () => {
</el-select>
</template>
</el-table-column>
<!-- 字段取值范围 fieldValueRange(可编辑)-->
<el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center">
<el-table-column prop="fieldValueRange" label="字段取值范围" width="260" align="center">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span>
<el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" />
<!-- 非编辑模式,展示取值范围 -->
<span v-if="!scope.row.isEdit">
{{ scope.row.fieldValueRange ? scope.row.fieldValueRange.join('-') : '--' }}
</span>
<!-- 编辑模式,显示两个输入框 -->
<div v-else style="display: flex; gap: 5px; align-items: center;">
<el-input v-model="scope.row.rangeStart" placeholder="最小值" style="width: 45%;" type="number" />
<span>-</span>
<el-input v-model="scope.row.rangeEnd" placeholder="最大值" style="width: 45%;" type="number" />
</div>
</template>
</el-table-column>
......
......@@ -196,13 +196,16 @@ const getPreviewData = () => {
const getTableStructure = () => {
let tableName = currDatasourceSelect.value.tableName;
console.log('tableName', currDatasourceSelect.value);
currDsTableStructureLoading.value = true;
currDsTableStructure.value = [];
getDsTableStructure({
tableName: tableName,
dataSourceGuid: databaseInfo.value.guid,
database: databaseInfo.value.databaseNameEn,
databaseType: databaseInfo.value.databaseType
// tableName: tableName,
// dataSourceGuid: databaseInfo.value.guid,
// database: databaseInfo.value.databaseNameEn,
// databaseType: databaseInfo.value.databaseType,
tableGuid: currDatasourceSelect.value.tableGuid,
execGuid: props.execGuid
}).then((res: any) => {
currDsTableStructureLoading.value = false;
if (res.code == proxy.$passCode) {
......@@ -318,7 +321,7 @@ watch(
if (val?.length && !currDatasourceSelect.value?.tableName) {
currDatasourceSelect.value = val[0];
}
emits("datasourceSelectedChange", val);
emits("datasourceSelectedChange", val, databaseGuid.value);
},
{
deep: true,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!