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}`,
481 method: 'post',
482 });
483
484 /** 获取已有数据库目录字段信息 入参是数组 */
485 export const getDsTableStructures= (data) => request({
486 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guids`,
469 method: 'post', 487 method: 'post',
470 data 488 data
471 }); 489 });
472 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,7 +401,8 @@ const dataBaseTableInfo = ref({ ...@@ -397,7 +401,8 @@ 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) => {
405 return [
401 { 406 {
402 label: "配置业务规则", value: "edit", click: (scope) => { 407 label: "配置业务规则", value: "edit", click: (scope) => {
403 console.log('编辑', scope); 408 console.log('编辑', scope);
...@@ -415,13 +420,16 @@ const dataBaseTableInfo = ref({ ...@@ -415,13 +420,16 @@ const dataBaseTableInfo = ref({
415 }); 420 });
416 } 421 }
417 }, 422 },
418
419 { 423 {
420 label: "编辑表结构", value: "copy", click: (scope) => { 424 label: "编辑表结构", value: "edit", click: (scope) => {
421 console.log('复制', scope); 425 console.log('复制', scope);
422 } 426 },
427 disabled: scope.row.state !== 2 ? false : true
423 } 428 }
424 ] 429 ]
430 }
431
432
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) {
107 // 编辑fieldLengthCondition
108 if (row.fieldLengthCondition) {
108 const [symbol, value] = row.fieldLengthCondition.split('#'); 109 const [symbol, value] = row.fieldLengthCondition.split('#');
109 row.lengthSymbol = symbol; // 初始化符号部分 110 row.lengthSymbol = symbol; // 初始化符号部分
110 row.lengthValue = value; // 初始化数值部分 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,
......
...@@ -9,10 +9,12 @@ import StepBar from "@/components/StepBar/index.vue"; ...@@ -9,10 +9,12 @@ import StepBar from "@/components/StepBar/index.vue";
9 import { 9 import {
10 getDbDirDataSourceList, 10 getDbDirDataSourceList,
11 getDsData, 11 getDsData,
12 getDsTableStructure,
13 saveDbDirTable, 12 saveDbDirTable,
14 updateDbDirTable, 13 updateDbDirTable,
15 createTableSql, 14 createTableSql,
15 getDsTableStructures,
16 getDbDirFieldClassifyAndGrade,
17 getDbDirTableSelectList
16 } from "@/api/modules/dataInventory"; 18 } from "@/api/modules/dataInventory";
17 import existingTableSelect from "./existingTableSelect.vue"; 19 import existingTableSelect from "./existingTableSelect.vue";
18 20
...@@ -45,8 +47,44 @@ const processData = (data) => { ...@@ -45,8 +47,44 @@ const processData = (data) => {
45 databaseGuid: undefined, // 删除旧键 "databaseGuid" 47 databaseGuid: undefined, // 删除旧键 "databaseGuid"
46 })).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键 48 })).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键
47 }; 49 };
50
51 // 获取分类分级的数据 getDbDirFieldClassifyAndGrade
52 const gradeList: any = ref([]);
53 const classifyList: any = ref([]);
54
55 const getDbDirFieldClassifyAndGradeList = async () => {
56 const params = {
57 execGuid: execGuid.value,
58 type: 'C',
59 fieldName: 'classifyName',
60 }
61
62 const res: any = await getDbDirFieldClassifyAndGrade(params);
63 if (res.code === proxy.$passCode) {
64 console.log('分类分级数据', res.data)
65 } else {
66 proxy.$ElMessage.error(res.msg);
67 }
68 };
69
70 // 联动查询数据getDbDirTableSelectList
71 const getTableSelectList = async (params) => {
72 const inParams = {
73
74 }
75 const res: any = await getDbDirTableSelectList(params);
76 if (res.code === proxy.$passCode) {
77 console.log('联动查询数据', res.data)
78 } else {
79 proxy.$ElMessage.error(res.msg);
80 }
81 };
82
83
84
48 onMounted(async () => { 85 onMounted(async () => {
49 await getDbDirDataSourceListData(); 86 await getDbDirDataSourceListData();
87 await getDbDirFieldClassifyAndGradeList();
50 }); 88 });
51 89
52 const stepsInfo = ref({ 90 const stepsInfo = ref({
...@@ -63,14 +101,14 @@ const datasourceSelectedRows: Ref<any> = ref([]); ...@@ -63,14 +101,14 @@ const datasourceSelectedRows: Ref<any> = ref([]);
63 101
64 //记录下一步时选中的库表信息。 102 //记录下一步时选中的库表信息。
65 const selectedDatabaseTable: Ref<any> = ref([]); 103 const selectedDatabaseTable: Ref<any> = ref([]);
66 104 // 记录数据库databaseGuid
67 const handlDsSelectedChange = (v) => { 105 const handlDsSelectedChange = (v, guid) => {
68 datasourceSelectedRows.value = v || []; 106 datasourceSelectedRows.value = v || [];
69 const params: any = []; 107 const params: any = [];
70 v.forEach((item) => { 108 v.forEach((item) => {
71 params.push({ 109 params.push({
72 tableName: item.tableName, 110 tableGuid: item.tableGuid,
73 database: item.database, 111 execGuid: execGuid.value,
74 }); 112 });
75 }); 113 });
76 selectedDatabaseTable.value = params; 114 selectedDatabaseTable.value = params;
...@@ -99,7 +137,7 @@ const nextStep = () => { ...@@ -99,7 +137,7 @@ const nextStep = () => {
99 137
100 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value 138 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value
101 const getNextTableInfo = async () => { 139 const getNextTableInfo = async () => {
102 const res: any = await getDsTableStructure(selectedDatabaseTable.value); 140 const res: any = await getDsTableStructures(selectedDatabaseTable.value);
103 if (res.code === proxy.$passCode) { 141 if (res.code === proxy.$passCode) {
104 tableDataDetailInfo.value = res.data; 142 tableDataDetailInfo.value = res.data;
105 } else { 143 } else {
...@@ -331,37 +369,42 @@ const submitAsDraft = () => { ...@@ -331,37 +369,42 @@ const submitAsDraft = () => {
331 * 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空 369 * 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空
332 */ 370 */
333 371
334 const checkTableData = (tableDataInfo, tableDataDetailInfo) => { 372 // const checkTableData = (tableDataInfo, tableDataDetailInfo) => {
335 373
336 const tableDataInfoKeys = ['tableName', 'tableChName'] 374 // const tableDataInfoKeys = ['tableName', 'tableChName']
337 const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid'] 375 // const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid']
338 let flag = true 376 // let flag = true
339 tableDataInfo.forEach(item => { 377 // tableDataInfo.forEach(item => {
340 tableDataInfoKeys.forEach(key => { 378 // tableDataInfoKeys.forEach(key => {
341 if (!item[key]) { 379 // if (!item[key]) {
342 flag = false 380 // flag = false
343 proxy.$ElMessage.error('表名称、数据库表不能为空') 381 // proxy.$ElMessage.error('表名称、数据库表不能为空')
344 } 382 // }
345 }) 383 // })
346 }) 384 // })
347 tableDataDetailInfo.forEach(item => { 385 // tableDataDetailInfo.forEach(item => {
348 tableDataDetailInfoKeys.forEach(key => { 386 // tableDataDetailInfoKeys.forEach(key => {
349 if (!item[key]) { 387 // if (!item[key]) {
350 flag = false 388 // flag = false
351 proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空') 389 // proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空')
352 } 390 // }
353 }) 391 // })
354 }) 392 // })
355 return flag 393 // return flag
356 } 394 // }
357 395
358 const guid = ref('') 396 const guid = ref('')
359 const submit = async () => { 397 const submit = async () => {
360 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) 398 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value)
361 // 校验表格数据是否填写完整 399 const params = {
362 if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) { 400 tableName: tableDataInfo.value[0].tableName,
363 return 401 tableChName: tableDataInfo.value[0].tableChName,
402 foundMode: route.query.foundMode,
364 } 403 }
404 // 校验表格数据是否填写完整
405 // if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) {
406 // return
407 // }
365 /** 408 /**
366 "guid": "string", 409 "guid": "string",
367 "cgDirName": "string", 410 "cgDirName": "string",
...@@ -407,7 +450,15 @@ const submit = async () => { ...@@ -407,7 +450,15 @@ const submit = async () => {
407 */ 450 */
408 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 451 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参
409 if (!guid.value) { 452 if (!guid.value) {
410 saveOrUpdate({}, 0) 453 saveOrUpdate({
454 tableName: tableDataInfo.value[0].tableName,
455 tableChName: tableDataInfo.value[0].tableChName,
456 databaseGuid: route.query.databaseGuid || '',
457 database: route.query.database || '',
458 databaseChName: route.query.databaseChName || '',
459 foundMode: route.query.foundMode,
460 isDraft: 'N',
461 }, 0)
411 } else { 462 } else {
412 saveOrUpdate({}, 1) 463 saveOrUpdate({}, 1)
413 } 464 }
...@@ -425,7 +476,6 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -425,7 +476,6 @@ const saveOrUpdate = async (params: any = {}, type) => {
425 tableChName: '', 476 tableChName: '',
426 databaseGuid: '', 477 databaseGuid: '',
427 database: '', 478 database: '',
428 dbType: '',
429 databaseChName: '', 479 databaseChName: '',
430 foundMode: 0, 480 foundMode: 0,
431 state: 0, 481 state: 0,
...@@ -519,6 +569,10 @@ const newCreateSqlDialogInfo = ref({ ...@@ -519,6 +569,10 @@ const newCreateSqlDialogInfo = ref({
519 newCreateSqlDialogInfo.value.submitBtnLoading = true; 569 newCreateSqlDialogInfo.value.submitBtnLoading = true;
520 const params = { 570 const params = {
521 ...info, 571 ...info,
572 tableName: tableDataInfo.value[0].tableName,
573 tableChName: tableDataInfo.value[0].tableChName,
574 foundMode: route.query.foundMode,
575 isDraft: 'N',
522 }; 576 };
523 await saveOrUpdate(params, 2); 577 await saveOrUpdate(params, 2);
524 newCreateSqlDialogInfo.value.submitBtnLoading = false; 578 newCreateSqlDialogInfo.value.submitBtnLoading = false;
...@@ -597,42 +651,55 @@ const createNewSql = () => { ...@@ -597,42 +651,55 @@ const createNewSql = () => {
597 }"> 651 }">
598 <el-table-column type="selection" :width="32" align="center" /> 652 <el-table-column type="selection" :width="32" align="center" />
599 <!-- 排序列(不可编辑) --> 653 <!-- 排序列(不可编辑) -->
600 <el-table-column prop="id" label="排序" width="80" align="center" /> 654 <el-table-column type="index" label="排序" width="80" align="center" />
601 <!-- 字段中文名(不可编辑)fieldChName --> 655 <!-- 字段中文名(不可编辑)fieldChName -->
602 <el-table-column prop="fieldName" label="字段中文名" width="150"> 656 <el-table-column prop="fieldChName" label="目标字段中文名" width="150">
603 <template #default="scope"> 657 <template #default="scope">
604 {{ scope.row.fieldName ? scope.row.fieldName : '--' }} 658 {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
605 </template> 659 </template>
606 </el-table-column> 660 </el-table-column>
607 <!-- 字段英文名(不可编辑) --> 661 <!-- 字段英文名(不可编辑) -->
608 <el-table-column prop="fieldEnglish" label="字段英文名" width="150"> 662 <el-table-column prop="fieldName" label="目标字段英文名" width="150">
609 <template #default="scope"> 663 <template #default="scope">
610 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} 664 {{ scope.row.fieldName ? scope.row.fieldName : '--' }}
611 </template> 665 </template>
612 </el-table-column> 666 </el-table-column>
613 <!-- 分类(不可编辑)classifyName --> 667 <!-- 源数据库 -->
614 <el-table-column prop="classifyName" label="分类" width="150"> 668 <el-table-column prop="sourceDatabase" label="源数据库" width="150">
615 <template #default="scope"> 669 <template #default="scope">
616 {{ scope.row.classifyName ? scope.row.classifyName : '--' }} 670 {{ scope.row.sourceDatabase ? scope.row.sourceDatabase : '--' }}
617 </template> 671 </template>
618 </el-table-column> 672 </el-table-column>
619 <!-- 分级(不可编辑) --> 673 <!-- 源数据表 -->
620 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> 674 <el-table-column prop="sourceTableName" label="源数据表" width="150">
621 <template #default="scope"> 675 <template #default="scope">
622 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} 676 {{ scope.row.sourceTableName ? scope.row.sourceTableName : '--' }}
677 </template>
678 </el-table-column>
679 <!-- 源字段中文 -->
680 <el-table-column prop="sourceFieldChName" label="源字段中文" width="150">
681 <template #default="scope">
682 {{ scope.row.sourceFieldChName ? scope.row.sourceFieldChName : '--' }}
683 </template>
684 </el-table-column>
685 <!-- 源字段英文 -->
686 <el-table-column prop="sourceFieldName" label="源字段英文" width="150">
687 <template #default="scope">
688 {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }}
623 </template> 689 </template>
624 </el-table-column> 690 </el-table-column>
625 <!-- 字段类型fieldType (不可编辑) --> 691 <!-- 源端字段 fieldType-->
626 <el-table-column prop="fieldType" label="字段类型" width="150" align="center"> 692 <el-table-column prop="fieldType" label="源端字段类型" width="150">
627 <template #default="scope"> 693 <template #default="scope">
628 {{ scope.row.fieldType ? scope.row.fieldType : '--' }} 694 {{ scope.row.fieldType ? scope.row.fieldType : '--' }}
629 </template> 695 </template>
630 </el-table-column> 696 </el-table-column>
631 697
632 <!-- 长度(可编辑) --> 698 <!-- 长度(可编辑) -->
633 <el-table-column prop="length" label="长度" width="120" align="center"> 699 <el-table-column prop="fieldLength" label="长度" width="120" align="center">
634 <template #default="scope"> 700 <template #default="scope">
635 <span v-if="!scope.row.isEdit || !editableFields.length">{{ scope.row.length ? scope.row.length 701 <span v-if="!scope.row.isEdit || !editableFields.length">{{ scope.row.fieldLength ?
702 scope.row.fieldLength
636 : '--' }}</span> 703 : '--' }}</span>
637 <el-input v-else v-model="scope.row.length" placeholder="请输入长度" /> 704 <el-input v-else v-model="scope.row.length" placeholder="请输入长度" />
638 </template> 705 </template>
...@@ -656,34 +723,39 @@ const createNewSql = () => { ...@@ -656,34 +723,39 @@ const createNewSql = () => {
656 </el-table-column> 723 </el-table-column>
657 724
658 <!-- 数据是否唯一(可编辑) --> 725 <!-- 数据是否唯一(可编辑) -->
659 <el-table-column prop="isUnique" label="数据是否唯一" width="150" align="center"> 726 <el-table-column prop="isPrimary" label="是否主键" width="150" align="center">
660 <template #default="scope"> 727 <template #default="scope">
661 <span v-if="!scope.row.isEdit || !editableFields.isUnique">{{ scope.row.isUnique ? scope.row.isUnique : 728 <span v-if="!scope.row.isEdit || !editableFields.length">{{ scope.row.isPrimary ? scope.row.isPrimary :
662 '--' }}</span> 729 '--' }}</span>
663 <el-select v-else v-model="scope.row.isUnique" placeholder="请选择"> 730 <el-select v-else v-model="scope.row.isPrimary" placeholder="请选择">
664 <el-option label="是" value="是" /> 731 <el-option label="是" value="是" />
665 <el-option label="否" value="否" /> 732 <el-option label="否" value="否" />
666 </el-select> 733 </el-select>
667 </template> 734 </template>
668 </el-table-column> 735 </el-table-column>
669 <!-- 是否必填(可编辑) --> 736 <!-- 是否必填(可编辑) -->
670 <el-table-column prop="isRequired" label="是否必填" width="120" align="center"> 737 <el-table-column prop="isNotNull" label="是否必填" width="120" align="center">
671 <template #default="scope"> 738 <template #default="scope">
672 <span v-if="!scope.row.isEdit">{{ scope.row.isRequired ? scope.row.isRequired : '--' }}</span> 739 <span v-if="!scope.row.isEdit">{{ scope.row.isNotNull ? scope.row.isNotNull : '--' }}</span>
673 <el-select v-else v-model="scope.row.isRequired" placeholder="请选择"> 740 <el-select v-else v-model="scope.row.isNotNull" placeholder="请选择">
674 <el-option label="是" value="是" /> 741 <el-option label="是" value="是" />
675 <el-option label="否" value="否" /> 742 <el-option label="否" value="否" />
676 </el-select> 743 </el-select>
677 </template> 744 </template>
678 </el-table-column> 745 </el-table-column>
679 <!-- 字段取值范围 fieldValueRange(可编辑)--> 746
680 <el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center"> 747 <!-- 分类(不可编辑)classifyName -->
748 <el-table-column prop="classifyName" label="分类" width="150">
681 <template #default="scope"> 749 <template #default="scope">
682 <span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span> 750 {{ scope.row.classifyName ? scope.row.classifyName : '--' }}
683 <el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" /> 751 </template>
752 </el-table-column>
753 <!-- 分级(不可编辑) -->
754 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
755 <template #default="scope">
756 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }}
684 </template> 757 </template>
685 </el-table-column> 758 </el-table-column>
686
687 <!-- 操作列 --> 759 <!-- 操作列 -->
688 <el-table-column label="操作" width="100" align="center" fixed="right"> 760 <el-table-column label="操作" width="100" align="center" fixed="right">
689 <template #default="scope"> 761 <template #default="scope">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!