1fec05c1 by xukangle

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

1 parent 4fa77310
...@@ -461,15 +461,46 @@ export const getDbDirFieldPageList = (data) => request({ ...@@ -461,15 +461,46 @@ export const getDbDirFieldPageList = (data) => request({
461 data 461 data
462 }) 462 })
463 463
464 /**
465 * 数据库目录-表联动查询
466 * @param data
467 * @returns
468 * @path /db-dir/table/select-list
469 */
470 export const getDbDirTableSelectList = (data) => request({
471 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/select-list`,
472 method: 'post',
473 data
474 })
475
464 476
465 477
466 /** 获取已有字段信息 */ 478 /** 获取已有字段信息 */
467 export const getDsTableStructure= (data) => request({ 479 export const getDsTableStructure= (data) => request({
468 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid`, 480 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid?tableGuid=${data.tableGuid}&execGuid=${data.execGuid}`,
469 method: 'post', 481 method: 'post',
470 data
471 }); 482 });
472 483
484 /** 获取已有数据库目录字段信息 入参是数组 */
485 export const getDsTableStructures= (data) => request({
486 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guids`,
487 method: 'post',
488 data
489 });
490
491 /**
492 * 数据库目录-字段查询分类分级
493 * @param {Object}
494 * @path /db-dir/field/get-classify-and-grade
495 */
496 export const getDbDirFieldClassifyAndGrade = (data) => request({
497 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/get-classify-and-grade`,
498 method: 'post',
499 data
500 })
501
502
503
473 /** 根据选择的连接池获取表列表 */ 504 /** 根据选择的连接池获取表列表 */
474 export const getDsTableByDs = (params) => request({ 505 export const getDsTableByDs = (params) => request({
475 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`, 506 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`,
......
...@@ -90,6 +90,10 @@ const getExecGuid = async () => { ...@@ -90,6 +90,10 @@ const getExecGuid = async () => {
90 } 90 }
91 91
92 92
93 //
94
95
96
93 onMounted(() => { 97 onMounted(() => {
94 getCgDirTreeData(); 98 getCgDirTreeData();
95 getCgDirFieldPage(); 99 getCgDirFieldPage();
...@@ -364,9 +368,9 @@ const dataBaseTableInfo = ref({ ...@@ -364,9 +368,9 @@ const dataBaseTableInfo = ref({
364 fixedSelection: true, 368 fixedSelection: true,
365 fields: [ 369 fields: [
366 { label: "序号", type: "index", width: 56, align: "center" }, 370 { label: "序号", type: "index", width: 56, align: "center" },
367 { label: "数据源", field: "cgDirName", width: 140 }, 371 { label: "数据源", field: "databaseChName", width: 140 },
368 { label: "表名称", field: "tableName", width: 180 }, 372 { label: "表名称", field: "tableChName", width: 180 },
369 { label: "数据库表", field: "tableChName", width: 120 }, 373 { label: "数据库表", field: "tableName", width: 120 },
370 { 374 {
371 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => { 375 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => {
372 let dataGrade = scope.row.foundMode; 376 let dataGrade = scope.row.foundMode;
...@@ -380,7 +384,7 @@ const dataBaseTableInfo = ref({ ...@@ -380,7 +384,7 @@ const dataBaseTableInfo = ref({
380 return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表'; 384 return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表';
381 } 385 }
382 }, 386 },
383 { label: "任务修改人", field: "damName", width: 120 }, 387 { label: "任务修改人", field: "updateUserName", width: 120 },
384 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME }, 388 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
385 { label: "描述", field: "description", width: 120, align: 'center' }, 389 { label: "描述", field: "description", width: 120, align: 'center' },
386 { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' }, 390 { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' },
...@@ -397,31 +401,35 @@ const dataBaseTableInfo = ref({ ...@@ -397,31 +401,35 @@ const dataBaseTableInfo = ref({
397 type: "btn", 401 type: "btn",
398 width: 300, 402 width: 300,
399 fixed: 'right', 403 fixed: 'right',
400 btns: [ 404 btns: (scope) => {
401 { 405 return [
402 label: "配置业务规则", value: "edit", click: (scope) => { 406 {
403 console.log('编辑', scope); 407 label: "配置业务规则", value: "edit", click: (scope) => {
404 // 路由跳转configure-rules 408 console.log('编辑', scope);
405 router.push({ 409 // 路由跳转configure-rules
406 name: 'configureRules', 410 router.push({
407 query: { 411 name: 'configureRules',
408 cgDirName: scope.row.cgDirName, 412 query: {
409 tableName: scope.row.tableName, 413 cgDirName: scope.row.cgDirName,
410 tableChName: scope.row.tableChName, 414 tableName: scope.row.tableName,
411 tableGuid: scope.row.tableGuid, 415 tableChName: scope.row.tableChName,
412 description: scope.row.description, 416 tableGuid: scope.row.tableGuid,
413 execGuid: execGuidInfo.value.execGuid 417 description: scope.row.description,
414 } 418 execGuid: execGuidInfo.value.execGuid
415 }); 419 }
420 });
421 }
422 },
423 {
424 label: "编辑表结构", value: "edit", click: (scope) => {
425 console.log('复制', scope);
426 },
427 disabled: scope.row.state !== 2 ? false : true
416 } 428 }
417 }, 429 ]
430 }
431
418 432
419 {
420 label: "编辑表结构", value: "copy", click: (scope) => {
421 console.log('复制', scope);
422 }
423 }
424 ]
425 433
426 }, 434 },
427 loading: false 435 loading: false
...@@ -687,7 +695,7 @@ const getDataBaseTableData = async (params = {}) => { ...@@ -687,7 +695,7 @@ const getDataBaseTableData = async (params = {}) => {
687 pageIndex: 1, 695 pageIndex: 1,
688 pageSize: 10, 696 pageSize: 10,
689 databaseGuid: "", 697 databaseGuid: "",
690 isDataAsset: checked.value ? 'Y' : 'N', 698 isDataAsset: '',
691 execGuid: execGuidInfo.value.execGuid, 699 execGuid: execGuidInfo.value.execGuid,
692 }; 700 };
693 const finalParams = { ...dataBaseParams, ...params }; 701 const finalParams = { ...dataBaseParams, ...params };
...@@ -727,7 +735,9 @@ const getDataBaseFieldData = async (params = {}) => { ...@@ -727,7 +735,9 @@ const getDataBaseFieldData = async (params = {}) => {
727 tableGuid: "", 735 tableGuid: "",
728 execGuid: execGuidInfo.value.execGuid, 736 execGuid: execGuidInfo.value.execGuid,
729 databaseGuid: "", 737 databaseGuid: "",
730 isDataAsset: checked.value ? 'Y' : 'N', 738 isDataAsset: '',
739 fieldName: '',
740 gradeDetailName: '',
731 }; 741 };
732 const finalParams = { ...dataBaseParams, ...params }; 742 const finalParams = { ...dataBaseParams, ...params };
733 743
...@@ -773,11 +783,14 @@ const tableFieldsDataInfo = ref({ ...@@ -773,11 +783,14 @@ const tableFieldsDataInfo = ref({
773 783
774 784
775 const showTableOrDatabase = ref(true); 785 const showTableOrDatabase = ref(true);
786 const isShowCreateBtn = ref(false);
776 // 定义tableGuid 787 // 定义tableGuid
777 const tableGuid = ref(''); 788 const tableGuid = ref('');
778 const dataBaseGuid = ref(''); 789 const dataBaseGuid = ref('');
790 const dataBaseInfo = ref<any>({});
779 791
780 const dataBasenodeClick = (data: any) => { 792 const dataBasenodeClick = (data: any) => {
793 isShowCreateBtn.value = false;
781 console.log('dataBasenodeClick', data); 794 console.log('dataBasenodeClick', data);
782 if (data.cgDirName) { 795 if (data.cgDirName) {
783 tableGuid.value = ''; 796 tableGuid.value = '';
...@@ -786,7 +799,9 @@ const dataBasenodeClick = (data: any) => { ...@@ -786,7 +799,9 @@ const dataBasenodeClick = (data: any) => {
786 getDataBaseTableData(); 799 getDataBaseTableData();
787 } 800 }
788 if (data.databaseGuid) { 801 if (data.databaseGuid) {
802 dataBaseInfo.value = data;
789 dataBaseGuid.value = data.databaseGuid; 803 dataBaseGuid.value = data.databaseGuid;
804 isShowCreateBtn.value = true;
790 tableGuid.value = ''; 805 tableGuid.value = '';
791 getDataBaseFieldData({ 806 getDataBaseFieldData({
792 databaseGuid: data.databaseGuid 807 databaseGuid: data.databaseGuid
...@@ -801,9 +816,9 @@ const dataBasenodeClick = (data: any) => { ...@@ -801,9 +816,9 @@ const dataBasenodeClick = (data: any) => {
801 getDataBaseFieldData({ 816 getDataBaseFieldData({
802 tableGuid: data.tableGuid 817 tableGuid: data.tableGuid
803 }); 818 });
804 getDataBaseTableData({ 819 // getDataBaseTableData({
805 tableGuid: data.tableGuid 820 // tableGuid: data.tableGuid
806 }); 821 // });
807 } 822 }
808 823
809 if (data.databaseGuid || data.cgDirName) { 824 if (data.databaseGuid || data.cgDirName) {
...@@ -826,7 +841,8 @@ const handleSubjectTableCommand = (command: string) => { ...@@ -826,7 +841,8 @@ const handleSubjectTableCommand = (command: string) => {
826 router.push({ 841 router.push({
827 name: 'tableCreateFile', 842 name: 'tableCreateFile',
828 query: { 843 query: {
829 type: 'tableCreateFile' 844 type: 'tableCreateFile',
845 foundMode: 2
830 } 846 }
831 }); 847 });
832 } else if (command === 'existingCreate') { 848 } else if (command === 'existingCreate') {
...@@ -834,7 +850,11 @@ const handleSubjectTableCommand = (command: string) => { ...@@ -834,7 +850,11 @@ const handleSubjectTableCommand = (command: string) => {
834 router.push({ 850 router.push({
835 name: 'tableCreateExisting', 851 name: 'tableCreateExisting',
836 query: { 852 query: {
837 execGuid: execGuidInfo.value.execGuid 853 execGuid: execGuidInfo.value.execGuid,
854 foundMode: 1,
855 database: dataBaseInfo.value.database,
856 databaseChName: dataBaseInfo.value.databaseChName,
857 databaseGuid: dataBaseInfo.value.databaseGuid,
838 } 858 }
839 }); 859 });
840 } 860 }
...@@ -1033,7 +1053,7 @@ loadOptionsA(); ...@@ -1033,7 +1053,7 @@ loadOptionsA();
1033 1053
1034 <div class="btns-area" v-if="!tableGuid && activeTab === 'table'"> 1054 <div class="btns-area" v-if="!tableGuid && activeTab === 'table'">
1035 <div class="left-btns"> 1055 <div class="left-btns">
1036 <div class="dropdown_btn"> 1056 <div class="dropdown_btn" v-if="isShowCreateBtn">
1037 <el-dropdown popper-class="table-create-menu" @command="handleSubjectTableCommand" 1057 <el-dropdown popper-class="table-create-menu" @command="handleSubjectTableCommand"
1038 placement="bottom-start" trigger="click"> 1058 placement="bottom-start" trigger="click">
1039 <span class="el-dropdown-link"> 1059 <span class="el-dropdown-link">
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
6 import { ref } from "vue"; 6 import { ref } from "vue";
7 import router from "@/router"; 7 import router from "@/router";
8 import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory' 8 import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory'
9
10 const { proxy } = getCurrentInstance() as any; 9 const { proxy } = getCurrentInstance() as any;
11 const bizRuleConfigData = ref<any>() 10 const bizRuleConfigData = ref<any>()
12 const getBizRuleConfigDetailData = async () => { 11 const getBizRuleConfigDetailData = async () => {
...@@ -105,9 +104,25 @@ const moveDown = () => { ...@@ -105,9 +104,25 @@ const moveDown = () => {
105 // 编辑行 104 // 编辑行
106 const editRow = (row) => { 105 const editRow = (row) => {
107 if (!row.isEdit) { 106 if (!row.isEdit) {
108 const [symbol, value] = row.fieldLengthCondition.split('#'); 107 // 编辑fieldLengthCondition
109 row.lengthSymbol = symbol; // 初始化符号部分 108 if (row.fieldLengthCondition) {
110 row.lengthValue = value; // 初始化数值部分 109 const [symbol, value] = row.fieldLengthCondition.split('#');
110 row.lengthSymbol = symbol; // 初始化符号部分
111 row.lengthValue = value; // 初始化数值部分
112 } else {
113 row.lengthSymbol = ''; // 默认值
114 row.lengthValue = ''; // 默认值
115 }
116 //编辑fieldValueRange
117 if (row.fieldValueRange) {
118 const [start, end] = row.fieldValueRange.split('-');
119 row.rangeStart = start; // 初始化符号部分
120 row.rangeEnd = end; // 初始化数值部分
121 } else {
122 row.rangeStart = ''; // 默认值
123 row.rangeEnd = ''; // 默认值
124 }
125
111 row.isEdit = true; // 进入编辑模式 126 row.isEdit = true; // 进入编辑模式
112 } 127 }
113 }; 128 };
...@@ -115,6 +130,7 @@ const editRow = (row) => { ...@@ -115,6 +130,7 @@ const editRow = (row) => {
115 // 保存数据 130 // 保存数据
116 const saveRow = (row) => { 131 const saveRow = (row) => {
117 row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`; 132 row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`;
133 row.fieldValueRange = [row.rangeStart || '', row.rangeEnd || ''];
118 row.isEdit = false 134 row.isEdit = false
119 } 135 }
120 136
...@@ -213,19 +229,23 @@ const saveData = async () => { ...@@ -213,19 +229,23 @@ const saveData = async () => {
213 "isNotNull": "string", 229 "isNotNull": "string",
214 "fieldValueRange": "string" 230 "fieldValueRange": "string"
215 */ 231 */
216 const params = tableData.value.map((item: any) => { 232 const inParams = [] as any
217 return { 233 tableData.value.forEach((item: any) => {
218 guid: item.guid, 234 const obj = {
235 guid: router.currentRoute.value.query.tableGuid,
219 fieldGuid: item.fieldGuid, 236 fieldGuid: item.fieldGuid,
220 fieldLengthCondition: item.fieldLengthCondition, 237 fieldLengthCondition: item.fieldLengthCondition,
221 fieldPrecision: item.fieldPrecision, 238 fieldPrecision: item.fieldPrecision,
222 dictionaryGuid: item.dictionaryGuid, 239 dictionaryGuid: item.dictionaryGuid,
223 isUnique: item.isUnique, 240 isUnique: item.isUnique,
224 isNotNull: item.isNotNull, 241 isNotNull: item.isRequired,
225 fieldValueRange: item.fieldValueRange 242 fieldValueRange: item.fieldValueRange
226 } 243 }
244 inParams.push(obj)
227 }) 245 })
228 const res: any = await updateBizRuleConfig(params) 246
247 console.log('finalParams', inParams)
248 const res: any = await updateBizRuleConfig(inParams)
229 if (res.code === proxy.$passCode) { 249 if (res.code === proxy.$passCode) {
230 proxy.$message.success('修改配置规则成功!') 250 proxy.$message.success('修改配置规则成功!')
231 router.back() 251 router.back()
...@@ -270,29 +290,29 @@ const cancel = () => { ...@@ -270,29 +290,29 @@ const cancel = () => {
270 <!-- 排序列(不可编辑) --> 290 <!-- 排序列(不可编辑) -->
271 <el-table-column type="index" label="排序" width="80" align="center" /> 291 <el-table-column type="index" label="排序" width="80" align="center" />
272 <!-- 字段中文名(不可编辑)fieldChName --> 292 <!-- 字段中文名(不可编辑)fieldChName -->
273 <el-table-column prop="fieldName" label="字段中文名" width="120"> 293 <el-table-column prop="fieldChName" label="字段中文名" width="120">
274 <template #default="scope"> 294 <template #default="scope">
275 {{ scope.row.fieldName ? scope.row.fieldName : '--' }} 295 {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
276 </template> 296 </template>
277 </el-table-column> 297 </el-table-column>
278 <!-- 字段英文名(不可编辑) --> 298 <!-- 字段英文名(不可编辑) -->
279 <el-table-column prop="fieldEnglish" label="字段英文名" width="120"> 299 <el-table-column prop="fieldName" label="字段英文名" width="120">
280 <template #default="scope"> 300 <template #default="scope">
281 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} 301 {{ scope.row.fieldName ? scope.row.fieldName : '--' }}
282 </template> 302 </template>
283 </el-table-column> 303 </el-table-column>
284 <!-- 分类(不可编辑)classifyName --> 304 <!-- 分类(不可编辑)classifyName -->
285 <el-table-column prop="fieldEnglish" label="分类" width="120"> 305 <!-- <el-table-column prop="fieldEnglish" label="分类" width="120">
286 <template #default="scope"> 306 <template #default="scope">
287 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} 307 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }}
288 </template> 308 </template>
289 </el-table-column> 309 </el-table-column> -->
290 <!-- 分级(不可编辑) --> 310 <!-- 分级(不可编辑) -->
291 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> 311 <!-- <el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
292 <template #default="scope"> 312 <template #default="scope">
293 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} 313 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }}
294 </template> 314 </template>
295 </el-table-column> 315 </el-table-column> -->
296 <!-- 字段类型fieldType (不可编辑) --> 316 <!-- 字段类型fieldType (不可编辑) -->
297 <el-table-column prop="fieldType" label="字段类型" width="150" align="center"> 317 <el-table-column prop="fieldType" label="字段类型" width="150" align="center">
298 <template #default="scope"> 318 <template #default="scope">
...@@ -367,11 +387,20 @@ const cancel = () => { ...@@ -367,11 +387,20 @@ const cancel = () => {
367 </el-select> 387 </el-select>
368 </template> 388 </template>
369 </el-table-column> 389 </el-table-column>
390
370 <!-- 字段取值范围 fieldValueRange(可编辑)--> 391 <!-- 字段取值范围 fieldValueRange(可编辑)-->
371 <el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center"> 392 <el-table-column prop="fieldValueRange" label="字段取值范围" width="260" align="center">
372 <template #default="scope"> 393 <template #default="scope">
373 <span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span> 394 <!-- 非编辑模式,展示取值范围 -->
374 <el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" /> 395 <span v-if="!scope.row.isEdit">
396 {{ scope.row.fieldValueRange ? scope.row.fieldValueRange.join('-') : '--' }}
397 </span>
398 <!-- 编辑模式,显示两个输入框 -->
399 <div v-else style="display: flex; gap: 5px; align-items: center;">
400 <el-input v-model="scope.row.rangeStart" placeholder="最小值" style="width: 45%;" type="number" />
401 <span>-</span>
402 <el-input v-model="scope.row.rangeEnd" placeholder="最大值" style="width: 45%;" type="number" />
403 </div>
375 </template> 404 </template>
376 </el-table-column> 405 </el-table-column>
377 406
......
...@@ -196,13 +196,16 @@ const getPreviewData = () => { ...@@ -196,13 +196,16 @@ const getPreviewData = () => {
196 196
197 const getTableStructure = () => { 197 const getTableStructure = () => {
198 let tableName = currDatasourceSelect.value.tableName; 198 let tableName = currDatasourceSelect.value.tableName;
199 console.log('tableName', currDatasourceSelect.value);
199 currDsTableStructureLoading.value = true; 200 currDsTableStructureLoading.value = true;
200 currDsTableStructure.value = []; 201 currDsTableStructure.value = [];
201 getDsTableStructure({ 202 getDsTableStructure({
202 tableName: tableName, 203 // tableName: tableName,
203 dataSourceGuid: databaseInfo.value.guid, 204 // dataSourceGuid: databaseInfo.value.guid,
204 database: databaseInfo.value.databaseNameEn, 205 // database: databaseInfo.value.databaseNameEn,
205 databaseType: databaseInfo.value.databaseType 206 // databaseType: databaseInfo.value.databaseType,
207 tableGuid: currDatasourceSelect.value.tableGuid,
208 execGuid: props.execGuid
206 }).then((res: any) => { 209 }).then((res: any) => {
207 currDsTableStructureLoading.value = false; 210 currDsTableStructureLoading.value = false;
208 if (res.code == proxy.$passCode) { 211 if (res.code == proxy.$passCode) {
...@@ -318,7 +321,7 @@ watch( ...@@ -318,7 +321,7 @@ watch(
318 if (val?.length && !currDatasourceSelect.value?.tableName) { 321 if (val?.length && !currDatasourceSelect.value?.tableName) {
319 currDatasourceSelect.value = val[0]; 322 currDatasourceSelect.value = val[0];
320 } 323 }
321 emits("datasourceSelectedChange", val); 324 emits("datasourceSelectedChange", val, databaseGuid.value);
322 }, 325 },
323 { 326 {
324 deep: true, 327 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!