7901b7d1 by lxs

Merge branch 'develop' of http://117.78.60.236:8000/csbr-daop/fe-data-asset-management into develop

2 parents 4eabcb1c ccc1b00e
...@@ -33,6 +33,9 @@ VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service ...@@ -33,6 +33,9 @@ VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service
33 # VITE_APP_CHECK_BASEURL = /mock 33 # VITE_APP_CHECK_BASEURL = /mock
34 VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory 34 VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
35 35
36 #数据源接口地址
37 VITE_APP_DATA_SOURCE_URL = ms-daop-data-source-service
38
36 # 数据字典接口地址 39 # 数据字典接口地址
37 VITE_APP_CONFIG_URL = 'ms-daop-configure-service' 40 VITE_APP_CONFIG_URL = 'ms-daop-configure-service'
38 41
......
...@@ -62,6 +62,9 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory ...@@ -62,6 +62,9 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
62 # 数据字典接口地址 62 # 数据字典接口地址
63 VITE_APP_CONFIG_URL = 'ms-daop-configure-service' 63 VITE_APP_CONFIG_URL = 'ms-daop-configure-service'
64 64
65 #数据源接口地址
66 VITE_APP_DATA_SOURCE_URL = ms-daop-data-source-service
67
65 # 文件上传下载接口地址 68 # 文件上传下载接口地址
66 VITE_APP_COMMON_URL = 'ms-daop-common-service' 69 VITE_APP_COMMON_URL = 'ms-daop-common-service'
67 70
......
...@@ -764,8 +764,8 @@ export const createTableSql = (data) => request({ ...@@ -764,8 +764,8 @@ export const createTableSql = (data) => request({
764 * @param {no params} 764 * @param {no params}
765 * @path /cg-dir/export 765 * @path /cg-dir/export
766 */ 766 */
767 export const exportCgDir = () => request({ 767 export const exportCgDir = (params) => request({
768 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/export`, 768 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/export?execGuid=${params.execGuid}`,
769 method: 'post', 769 method: 'post',
770 responseType: 'blob', 770 responseType: 'blob',
771 }) 771 })
...@@ -792,6 +792,21 @@ export const getDbDirDetail = (params) => request({ ...@@ -792,6 +792,21 @@ export const getDbDirDetail = (params) => request({
792 method: 'get', 792 method: 'get',
793 }) 793 })
794 794
795 /**
796 * 数据库目录修改规划数据资产
797 * @param {Object}
798 * @path /db-dir/table/update-data-asset
799 *
800 */
801
802 export const updateDataAsset = (data) => request({
803 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/update-data-asset`,
804 method: 'post',
805 data
806 })
807
808
809
795 /*********************业务规则配置 ************数据库目录************************* */ 810 /*********************业务规则配置 ************数据库目录************************* */
796 811
797 /** 812 /**
......
...@@ -192,7 +192,7 @@ export const getMetaChangeList = (params) => request({ ...@@ -192,7 +192,7 @@ export const getMetaChangeList = (params) => request({
192 192
193 /** 获取数据库选择列表 */ 193 /** 获取数据库选择列表 */
194 export const getDatabase = (params) => request({ 194 export const getDatabase = (params) => request({
195 url: `${import.meta.env.VITE_APP_API_BASEURL}/data-source/get-source-list`, 195 url: `${import.meta.env.VITE_APP_DATA_SOURCE_URL}/data-source/get-source-list`,
196 method: 'post', 196 method: 'post',
197 data: params 197 data: params
198 }) 198 })
......
...@@ -235,8 +235,8 @@ const routes: RouteRecordRaw[] = [ ...@@ -235,8 +235,8 @@ const routes: RouteRecordRaw[] = [
235 reuse: true 235 reuse: true
236 }, 236 },
237 beforeEnter: (to, from) => { 237 beforeEnter: (to, from) => {
238 if (to.query.domainName) { 238 if (to.query.editOpt) {
239 to.meta.title = `已有表新建(${to.query.domainName})`; 239 to.meta.title = `编辑-(${to.query.tableChName})`;
240 to.meta.editPage = true; 240 to.meta.editPage = true;
241 } 241 }
242 } 242 }
......
...@@ -93,46 +93,46 @@ const routes: RouteRecordRaw[] = [ ...@@ -93,46 +93,46 @@ const routes: RouteRecordRaw[] = [
93 }, 93 },
94 ], 94 ],
95 }, 95 },
96 // { 96 {
97 // path: '/data-meta/metadata-lineage', 97 path: '/data-meta/metadata-lineage',
98 // component: Layout, 98 component: Layout,
99 // meta: { 99 meta: {
100 // title: '元数据血缘', 100 title: '元数据血缘',
101 // icon: 'ep:grid', 101 icon: 'ep:grid',
102 // }, 102 },
103 // children: [ 103 children: [
104 // { 104 {
105 // path: 'analysis-view', 105 path: 'analysis-view',
106 // name: 'analysisView', 106 name: 'analysisView',
107 // component: () => import('@/views/data_meta/analysisView.vue'), 107 component: () => import('@/views/data_meta/analysisView.vue'),
108 // meta: { 108 meta: {
109 // title: '查看血缘', 109 title: '查看血缘',
110 // breadcrumb: false, 110 breadcrumb: false,
111 // cache: true 111 cache: true
112 // }, 112 },
113 // }, 113 },
114 // { 114 {
115 // path: 'change-detection', 115 path: 'change-detection',
116 // name: 'changeDetection', 116 name: 'changeDetection',
117 // component: () => import('@/views/data_meta/changeDetection.vue'), 117 component: () => import('@/views/data_meta/changeDetection.vue'),
118 // meta: { 118 meta: {
119 // title: '血缘变更检测', 119 title: '血缘变更检测',
120 // breadcrumb: false, 120 breadcrumb: false,
121 // cache: true 121 cache: true
122 // }, 122 },
123 // }, 123 },
124 // { 124 {
125 // path: 'analysis-reports', 125 path: 'analysis-reports',
126 // name: 'analysisReports', 126 name: 'analysisReports',
127 // component: () => import('@/views/data_meta/analysisReports.vue'), 127 component: () => import('@/views/data_meta/analysisReports.vue'),
128 // meta: { 128 meta: {
129 // title: '血缘关系解析', 129 title: '血缘关系解析',
130 // breadcrumb: false, 130 breadcrumb: false,
131 // cache: true 131 cache: true
132 // }, 132 },
133 // }, 133 },
134 // ], 134 ],
135 // }, 135 },
136 ] 136 ]
137 137
138 export default routes 138 export default routes
......
...@@ -23,7 +23,8 @@ import { ...@@ -23,7 +23,8 @@ import {
23 exportDbDirTable, 23 exportDbDirTable,
24 getDbDirDetail, 24 getDbDirDetail,
25 getDbDirTableSelectList, 25 getDbDirTableSelectList,
26 getDbDirFieldSelectList 26 getDbDirFieldSelectList,
27 updateDataAsset
27 } from '@/api/modules/dataInventory'; 28 } from '@/api/modules/dataInventory';
28 import { TableColumnWidth } from "@/utils/enum"; 29 import { TableColumnWidth } from "@/utils/enum";
29 import router from "@/router"; 30 import router from "@/router";
...@@ -32,7 +33,7 @@ import { getLabelList } from "@/api/modules/dataLabel"; ...@@ -32,7 +33,7 @@ import { getLabelList } from "@/api/modules/dataLabel";
32 33
33 const currentPath = ref<string[]>([]); 34 const currentPath = ref<string[]>([]);
34 const { proxy } = getCurrentInstance() as any; 35 const { proxy } = getCurrentInstance() as any;
35 36 const route = useRoute();
36 // 分级分类树形列表 37 // 分级分类树形列表
37 const CgDirTreeList = ref(); 38 const CgDirTreeList = ref();
38 const getCgDirTreeData = async () => { 39 const getCgDirTreeData = async () => {
...@@ -45,8 +46,8 @@ const getCgDirTreeData = async () => { ...@@ -45,8 +46,8 @@ const getCgDirTreeData = async () => {
45 CgDirTreeList.value = res.data; 46 CgDirTreeList.value = res.data;
46 treeInfo.value.data = res.data; 47 treeInfo.value.data = res.data;
47 currentPath.value = [res.data[0].classifyName]; 48 currentPath.value = [res.data[0].classifyName];
48 treeInfo.value.expandedKey = [res.data[0].guid]; 49 treeInfo.value.expandedKey.push(res.data[0].classifyDetailGuid);
49 treeInfo.value.currentNodeKey = res.data[0].guid; 50 treeInfo.value.currentNodeKey = res.data[0].classifyDetailGuid;
50 searchItemList.value[1].options = res.data; 51 searchItemList.value[1].options = res.data;
51 treeInfo.value.loading = false; 52 treeInfo.value.loading = false;
52 } else { 53 } else {
...@@ -120,8 +121,8 @@ onMounted(async () => { ...@@ -120,8 +121,8 @@ onMounted(async () => {
120 }) 121 })
121 122
122 // 左侧tree-list 123 // 左侧tree-list
123 const treeInfo = ref({ 124 const treeInfo = ref<any>({
124 id: "data-pickup-tree", 125 id: "data-tree",
125 filter: true, 126 filter: true,
126 editTreeItem: false, 127 editTreeItem: false,
127 queryValue: "", 128 queryValue: "",
...@@ -132,7 +133,7 @@ const treeInfo = ref({ ...@@ -132,7 +133,7 @@ const treeInfo = ref({
132 value: "classifyDetailGuid", 133 value: "classifyDetailGuid",
133 }, 134 },
134 nodeKey: 'classifyDetailGuid', 135 nodeKey: 'classifyDetailGuid',
135 expandedKey: ['0'], 136 expandedKey: [],
136 currentNodeKey: '', 137 currentNodeKey: '',
137 expandOnNodeClick: false, 138 expandOnNodeClick: false,
138 data: [], 139 data: [],
...@@ -158,7 +159,7 @@ const searchItemList = ref([ ...@@ -158,7 +159,7 @@ const searchItemList = ref([
158 options: [], 159 options: [],
159 props: { 160 props: {
160 label: 'label', 161 label: 'label',
161 value: 'guid', 162 value: 'label',
162 }, 163 },
163 clearable: true, 164 clearable: true,
164 filterable: true, 165 filterable: true,
...@@ -175,11 +176,11 @@ const searchItemList = ref([ ...@@ -175,11 +176,11 @@ const searchItemList = ref([
175 lazy: false, 176 lazy: false,
176 props: { 177 props: {
177 label: "classifyName", 178 label: "classifyName",
178 value: "classifyDetailGuid", 179 value: "classifyName",
179 }, 180 },
180 block: false, 181 block: false,
181 filterable: false, 182 filterable: false,
182 clearable: false, 183 clearable: true,
183 required: false 184 required: false
184 }, { 185 }, {
185 label: '分级', 186 label: '分级',
...@@ -191,7 +192,7 @@ const searchItemList = ref([ ...@@ -191,7 +192,7 @@ const searchItemList = ref([
191 options: [], 192 options: [],
192 props: { 193 props: {
193 label: 'name', 194 label: 'name',
194 value: 'guid', 195 value: 'name',
195 }, 196 },
196 clearable: true, 197 clearable: true,
197 }, 198 },
...@@ -206,6 +207,7 @@ const toSearch = (val: any, clear: boolean = false) => { ...@@ -206,6 +207,7 @@ const toSearch = (val: any, clear: boolean = false) => {
206 selectedC.value = null; 207 selectedC.value = null;
207 searchItemList.value.map(item => item.default = '') 208 searchItemList.value.map(item => item.default = '')
208 } 209 }
210 console.log('toSearch', val);
209 // 差一个label标签 -- 未完成 211 // 差一个label标签 -- 未完成
210 if (activeName.value === 'first') { 212 if (activeName.value === 'first') {
211 getCgDirFieldPage({ 213 getCgDirFieldPage({
...@@ -214,25 +216,36 @@ const toSearch = (val: any, clear: boolean = false) => { ...@@ -214,25 +216,36 @@ const toSearch = (val: any, clear: boolean = false) => {
214 execGuid: execGuidInfo.value.execGuid, 216 execGuid: execGuidInfo.value.execGuid,
215 classifyDetail: val.classifyName, 217 classifyDetail: val.classifyName,
216 gradeDetailGuid: val.levelName, 218 gradeDetailGuid: val.levelName,
219 label: val.labelName,
217 databaseGuid: selectedA.value, 220 databaseGuid: selectedA.value,
218 tableGuid: selectedB.value, 221 tableGuid: selectedB.value,
219 fieldGuid: selectedC.value, 222 fieldGuid: selectedC.value,
220 }); 223 });
221 } 224 }
222 if (activeName.value === 'second') { 225 if (activeName.value === 'second' && activeTab.value === 'table') {
223 getDataBaseFieldData({ 226 getDataBaseTableData({
224 pageIndex: 1, 227 pageIndex: 1,
225 pageSize: 50, 228 pageSize: 50,
226 execGuid: execGuidInfo.value.execGuid, 229 execGuid: execGuidInfo.value.execGuid,
227 databaseGuid: selectedA.value, 230 database: selectedA.value || '',
228 tableGuid: selectedB.value, 231 tableName: selectedB.value || '',
229 fieldGuid: selectedC.value, 232 fieldName: selectedC.value || '',
233 classifyDetailName: val.classifyName,
234 gradeDetailName: val.levelName,
235 label: val.labelName,
230 }); 236 });
231 } 237 }
232 if (activeName.value === 'second' && activeTab.value === 'word') { 238 if (activeName.value === 'second' && activeTab.value === 'word') {
233 getSearchTableList(1, selectedA.value); 239 getDataBaseFieldData({
234 getSearchTableList(2, selectedB.value); 240 pageIndex: 1,
235 getSearchTableList(3, selectedC.value); 241 pageSize: 50,
242 execGuid: execGuidInfo.value.execGuid,
243 database: selectedA.value || '',
244 tableName: selectedB.value || '',
245 classifyDetailName: val.classifyName,
246 gradeDetailName: val.levelName,
247 label: val.labelName,
248 });
236 } 249 }
237 }; 250 };
238 251
...@@ -297,7 +310,9 @@ const checked = ref(false); ...@@ -297,7 +310,9 @@ const checked = ref(false);
297 const changeCheck = (val) => { 310 const changeCheck = (val) => {
298 311
299 checked.value = val; 312 checked.value = val;
300 getDataBaseTableData(); 313 getDataBaseTableData({
314 isDataAsset: val ? 'Y' : ''
315 });
301 } 316 }
302 317
303 //下方表格配置 318 //下方表格配置
...@@ -320,14 +335,15 @@ const tableInfo = ref({ ...@@ -320,14 +335,15 @@ const tableInfo = ref({
320 fields: [ 335 fields: [
321 { label: "序号", type: "index", width: 56, align: "center" }, 336 { label: "序号", type: "index", width: 56, align: "center" },
322 { label: "字段名", field: "fieldName", width: 140 }, 337 { label: "字段名", field: "fieldName", width: 140 },
323 { label: "分类", field: "classifyDetailName", width: 180 }, 338 { label: "字段中文名", field: "fieldChName", width: 180 },
324 { label: "分级", field: "gradeDetailName", width: 120 }, 339 { label: "分类", field: "classifyDetailName", width: 120 },
340 { label: "分级", field: "gradeDetailName", width: 80 },
325 { label: "标签", field: "label", width: 140 }, 341 { label: "标签", field: "label", width: 140 },
326 { label: "规则", field: "ruleDetail", width: 180 }, 342 { label: "规则", field: "ruleDetail", width: 180 },
327 { label: "表名", field: "tableName", width: 120, align: 'center' }, 343 { label: "表名", field: "tableName", width: 120, align: 'center' },
328 { label: "表中文名", field: "tableChName", width: 120, align: 'center' }, 344 { label: "表中文名", field: "tableChName", width: 120, align: 'center' },
329 { label: "数据库名", field: "database", width: 120, align: 'center' }, 345 { label: "数据库名", field: "database", width: 120, align: 'center' },
330 { label: "数据类型", field: "databaseChName", width: 120, align: 'center' }, 346 { label: "数据库中文名", field: "databaseChName", width: 120, align: 'center' },
331 347
332 ], 348 ],
333 data: [], 349 data: [],
...@@ -414,7 +430,7 @@ const dataBaseTreeInfo = ref<any>({ ...@@ -414,7 +430,7 @@ const dataBaseTreeInfo = ref<any>({
414 }); 430 });
415 431
416 const dataBasePage = ref({ 432 const dataBasePage = ref({
417 limit: 10, 433 limit: 50,
418 curr: 1, 434 curr: 1,
419 sizes: [ 435 sizes: [
420 { label: "10", value: 10 }, 436 { label: "10", value: 10 },
...@@ -432,7 +448,7 @@ const dataBaseTableInfo = ref({ ...@@ -432,7 +448,7 @@ const dataBaseTableInfo = ref({
432 fields: [ 448 fields: [
433 { label: "序号", type: "index", width: 56, align: "center" }, 449 { label: "序号", type: "index", width: 56, align: "center" },
434 { label: "数据源", field: "databaseChName", width: 140 }, 450 { label: "数据源", field: "databaseChName", width: 140 },
435 { label: "表名称", field: "tableChName", width: 180 }, 451 { label: "表名称", field: "tableChName", width: 120 },
436 { label: "数据库表", field: "tableName", width: 120 }, 452 { label: "数据库表", field: "tableName", width: 120 },
437 { 453 {
438 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => { 454 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => {
...@@ -445,13 +461,13 @@ const dataBaseTableInfo = ref({ ...@@ -445,13 +461,13 @@ const dataBaseTableInfo = ref({
445 } 461 }
446 }, 462 },
447 { 463 {
448 label: "状态", field: "state", type: 'tag', width: 180, getName: (scope) => { 464 label: "状态", field: "state", type: 'tag', width: 120, getName: (scope) => {
449 let status = scope.row.state; 465 let status = scope.row.state;
450 // 0 草稿中 1 已建表 2 已有默认表 466 // 0 草稿中 1 已建表 2 已有默认表
451 return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表'; 467 return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表';
452 } 468 }
453 }, 469 },
454 { label: "任务修改人", field: "updateUserName", width: 120 }, 470 { label: "任务修改人", field: "updateUserName", width: 100 },
455 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME }, 471 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
456 { label: "描述", field: "description", width: 120, align: 'center' }, 472 { label: "描述", field: "description", width: 120, align: 'center' },
457 { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' }, 473 { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' },
...@@ -466,13 +482,13 @@ const dataBaseTableInfo = ref({ ...@@ -466,13 +482,13 @@ const dataBaseTableInfo = ref({
466 actionInfo: { 482 actionInfo: {
467 label: "操作", 483 label: "操作",
468 type: "btn", 484 type: "btn",
469 width: 300, 485 width: 200,
470 fixed: 'right', 486 fixed: 'right',
471 btns: (scope) => { 487 btns: (scope) => {
472 return [ 488 return [
473 { 489 {
474 label: "配置业务规则", value: "edit", click: (scope) => { 490 label: "配置业务规则", value: "edit", click: (scope) => {
475 console.log('编辑', scope); 491 console.log('配置', scope);
476 // 路由跳转configure-rules 492 // 路由跳转configure-rules
477 router.push({ 493 router.push({
478 name: 'configureRules', 494 name: 'configureRules',
...@@ -482,7 +498,8 @@ const dataBaseTableInfo = ref({ ...@@ -482,7 +498,8 @@ const dataBaseTableInfo = ref({
482 tableChName: scope.row.tableChName, 498 tableChName: scope.row.tableChName,
483 tableGuid: scope.row.tableGuid, 499 tableGuid: scope.row.tableGuid,
484 description: scope.row.description, 500 description: scope.row.description,
485 execGuid: execGuidInfo.value.execGuid 501 execGuid: execGuidInfo.value.execGuid,
502 databaseChName: scope.row.databaseChName,
486 } 503 }
487 }); 504 });
488 } 505 }
...@@ -490,30 +507,37 @@ const dataBaseTableInfo = ref({ ...@@ -490,30 +507,37 @@ const dataBaseTableInfo = ref({
490 { 507 {
491 label: "编辑表结构", value: "edit", click: (scope) => { 508 label: "编辑表结构", value: "edit", click: (scope) => {
492 console.log('复制', scope); 509 console.log('复制', scope);
493 getDbDirDetail({ 510 // foundMode 1 已有表新建 2 根据文件新建
494 tableGuid: scope.row.tableGuid 511 if (scope.row.foundMode === 1) {
495 }).then((res: any) => { 512 // 已有表新建编辑 editOpt 代表时编辑
496 if (res.code == proxy.$passCode) { 513 router.push({
497 console.log('res', res); 514 name: 'tableCreateExisting',
498 router.push({ 515 query: {
499 name: 'tableCreateExisting', 516 foundMode: '1',
500 query: { 517 editOpt: '1',
501 execGuid: execGuidInfo.value.execGuid, 518 tableGuid: scope.row.tableGuid,
502 foundMode: 1, 519 execGuid: execGuidInfo.value.execGuid,
503 database: res.data.database, 520 tableChName: scope.row.tableChName,
504 databaseChName: res.data.databaseChName, 521 database: scope.row.database,
505 databaseGuid: res.data.databaseGuid, 522 databaseChName: scope.row.databaseChName,
506 tableGuid: scope.row.tableGuid, 523 databaseGuid: scope.row.databaseGuid,
507 tableName: scope.row.tableName, 524 }
508 tableChName: scope.row.tableChName, 525 });
509 description: scope.row.description, 526 } else {
510 } 527 router.push({
511 }); 528 name: 'tableCreateExisting',
512 } else { 529 query: {
513 proxy.$ElMessage.error(res.msg); 530 foundMode: '2',
514 } 531 editOpt: '1',
515 }) 532 tableGuid: scope.row.tableGuid,
516 533 execGuid: execGuidInfo.value.execGuid,
534 tableChName: scope.row.tableChName,
535 database: scope.row.database,
536 databaseChName: scope.row.databaseChName,
537 databaseGuid: scope.row.databaseGuid,
538 }
539 });
540 }
517 }, 541 },
518 disabled: scope.row.state !== 2 ? false : true 542 disabled: scope.row.state !== 2 ? false : true
519 } 543 }
...@@ -526,7 +550,48 @@ const dataBaseTableInfo = ref({ ...@@ -526,7 +550,48 @@ const dataBaseTableInfo = ref({
526 loading: false 550 loading: false
527 }); 551 });
528 552
529 553 const tableSwitchBeforeChange = (scope, field, callback) => {
554 // 弹窗确认
555 proxy.$confirm('是否修改状态?', '提示', {
556 confirmButtonText: '确定',
557 cancelButtonText: '取消',
558 type: 'warning'
559 }).then(async () => {
560 let params = {};
561 const state = scope.row.isDataAsset === 'Y' ? 'N' : 'Y';
562 if (scope.row.foundMode) {
563 params = {
564 tableGuid: scope.row.tableGuid,
565 isDataAsset: state,
566 foundMode: scope.row.foundMode
567 }
568 } else {
569 params = {
570 tableGuid: scope.row.tableGuid,
571 isDataAsset: state
572 }
573 }
574 const res: any = await updateDataAsset(params);
575 const tableGuid = ref('');
576 const dataBaseGuid = ref('');
577 if (res.code == proxy.$passCode) {
578 getDataBaseTableData({
579 dataBaseGuid: dataBaseGuid.value,
580 tableGuid: tableGuid.value,
581 pageIndex: dataBasePage.value.curr,
582 pageSize: dataBasePage.value.limit
583 });
584 callback();
585 } else {
586 proxy.$ElMessage.error(res.msg);
587 }
588 }).catch(() => {
589 proxy.$ElMessage({
590 type: 'info',
591 message: '已取消修改'
592 });
593 });
594 }
530 595
531 596
532 597
...@@ -743,9 +808,14 @@ const handleTreeItemMenuClick = (data: any, type) => { ...@@ -743,9 +808,14 @@ const handleTreeItemMenuClick = (data: any, type) => {
743 // tab切换 808 // tab切换
744 const activeName = ref('first'); 809 const activeName = ref('first');
745 const handleClick = (tab: any) => { 810 const handleClick = (tab: any) => {
811 // 切换时选中的配置业务规则清空
812 selectedRulesData.value = {};
746 console.log(tab.props.name); 813 console.log(tab.props.name);
747 activeName.value = tab.props.name; 814 activeName.value = tab.props.name;
748 if (tab.props.name === 'second') { 815 if (tab.props.name === 'second') {
816 selectedA.value = null;
817 selectedB.value = null;
818 selectedC.value = null;
749 optionsA.value = []; 819 optionsA.value = [];
750 optionsB.value = []; 820 optionsB.value = [];
751 optionsC.value = []; 821 optionsC.value = [];
...@@ -754,6 +824,9 @@ const handleClick = (tab: any) => { ...@@ -754,6 +824,9 @@ const handleClick = (tab: any) => {
754 getDataBaseFieldData(); 824 getDataBaseFieldData();
755 getDbDirTableSelectData(1, {}); 825 getDbDirTableSelectData(1, {});
756 } else { 826 } else {
827 selectedA.value = null;
828 selectedB.value = null;
829 selectedC.value = null;
757 optionsA.value = []; 830 optionsA.value = [];
758 optionsB.value = []; 831 optionsB.value = [];
759 optionsC.value = []; 832 optionsC.value = [];
...@@ -766,22 +839,18 @@ const handleClick = (tab: any) => { ...@@ -766,22 +839,18 @@ const handleClick = (tab: any) => {
766 const dataBaseTreeData = ref<any>(); 839 const dataBaseTreeData = ref<any>();
767 const getDataBaseTreeData = async () => { 840 const getDataBaseTreeData = async () => {
768 dataBaseTreeInfo.value.loading = true; 841 dataBaseTreeInfo.value.loading = true;
769 try { 842 const res: any = await getDbDirTreeList({});
770 const res: any = await getDbDirTreeList({}); 843 if (res.code == proxy.$passCode) {
771 if (res.code == proxy.$passCode) { 844 const dataArray = [res.data];
772 const dataArray = [res.data]; 845 console.log('dataArray', dataArray, typeof dataArray);
773 // 遍历并添加 GUIDs 846 // 遍历并添加 GUIDs
774 dataArray.forEach(addGuids); 847 dataArray.forEach(addGuids);
775 // 更新到绑定的响应式数据 848 // 更新到绑定的响应式数据
776 dataBaseTreeData.value = dataArray; 849 dataBaseTreeData.value = dataArray;
777 dataBaseTreeInfo.value.data = dataArray; 850 dataBaseTreeInfo.value.data = dataArray;
778 } else {
779 proxy.$ElMessage.error(res.msg);
780 }
781 } catch (error) {
782 proxy.$ElMessage.error('请求失败');
783 } finally {
784 dataBaseTreeInfo.value.loading = false; 851 dataBaseTreeInfo.value.loading = false;
852 } else {
853 proxy.$ElMessage.error(res.msg);
785 } 854 }
786 }; 855 };
787 // 处理数据,给每个节点添加 GUID 856 // 处理数据,给每个节点添加 GUID
...@@ -793,7 +862,7 @@ const addGuids = (node) => { ...@@ -793,7 +862,7 @@ const addGuids = (node) => {
793 node.guid = node.tableGuid; 862 node.guid = node.tableGuid;
794 node.name = node.tableChName; 863 node.name = node.tableChName;
795 } else { 864 } else {
796 node.guid = crypto.randomUUID(); 865 node.guid = '1';
797 node.name = node.cgDirName; 866 node.name = node.cgDirName;
798 } 867 }
799 868
...@@ -808,8 +877,8 @@ const dataBaseTableDataList = ref<any>(); ...@@ -808,8 +877,8 @@ const dataBaseTableDataList = ref<any>();
808 const getDataBaseTableData = async (params = {}) => { 877 const getDataBaseTableData = async (params = {}) => {
809 dataBaseTableInfo.value.loading = true; 878 dataBaseTableInfo.value.loading = true;
810 const dataBaseParams = { 879 const dataBaseParams = {
811 pageIndex: 1, 880 pageIndex: dataBasePage.value.curr,
812 pageSize: 50, 881 pageSize: dataBasePage.value.limit,
813 databaseGuid: "", 882 databaseGuid: "",
814 isDataAsset: '', 883 isDataAsset: '',
815 execGuid: execGuidInfo.value.execGuid, 884 execGuid: execGuidInfo.value.execGuid,
...@@ -826,6 +895,7 @@ const getDataBaseTableData = async (params = {}) => { ...@@ -826,6 +895,7 @@ const getDataBaseTableData = async (params = {}) => {
826 dataBaseTableDataList.value = res.data.records; 895 dataBaseTableDataList.value = res.data.records;
827 dataBaseTableInfo.value.page.rows = res.data.totalRows; 896 dataBaseTableInfo.value.page.rows = res.data.totalRows;
828 dataBaseTableInfo.value.page.limit = res.data.pageSize 897 dataBaseTableInfo.value.page.limit = res.data.pageSize
898 dataBaseTableInfo.value.page.curr = res.data.pageIndex
829 dataBaseTableInfo.value.data = res.data.records; 899 dataBaseTableInfo.value.data = res.data.records;
830 } else { 900 } else {
831 proxy.$ElMessage.error(res.msg); 901 proxy.$ElMessage.error(res.msg);
...@@ -834,7 +904,6 @@ const getDataBaseTableData = async (params = {}) => { ...@@ -834,7 +904,6 @@ const getDataBaseTableData = async (params = {}) => {
834 }; 904 };
835 905
836 const dataBaseTablePageChange = (info) => { 906 const dataBaseTablePageChange = (info) => {
837 console.log('dataBaseTablePageChange', info);
838 dataBasePage.value.curr = Number(info.curr); 907 dataBasePage.value.curr = Number(info.curr);
839 dataBasePage.value.limit = Number(info.limit); 908 dataBasePage.value.limit = Number(info.limit);
840 getDataBaseTableData({ 909 getDataBaseTableData({
...@@ -848,19 +917,17 @@ const dataBaseTablePageChange = (info) => { ...@@ -848,19 +917,17 @@ const dataBaseTablePageChange = (info) => {
848 const tableFieldsLoading = ref(false); 917 const tableFieldsLoading = ref(false);
849 const tableFieldsData = ref([]); 918 const tableFieldsData = ref([]);
850 const getDataBaseFieldData = async (params = {}) => { 919 const getDataBaseFieldData = async (params = {}) => {
851 tableFieldsLoading.value = true; 920 tableFieldsDataInfo.value.loading = true;
852 const dataBaseParams = { 921 const dataBaseParams = {
853 pageIndex: 1, 922 pageIndex: 1,
854 pageSize: 50, 923 pageSize: -1,
855 tableGuid: "", 924 tableGuid: "",
856 execGuid: execGuidInfo.value.execGuid, 925 execGuid: execGuidInfo.value.execGuid,
857 databaseGuid: "", 926 databaseGuid: "",
858 isDataAsset: '',
859 fieldName: '', 927 fieldName: '',
860 gradeDetailName: '', 928 gradeDetailName: '',
861 }; 929 };
862 const finalParams = { ...dataBaseParams, ...params }; 930 const finalParams = { ...dataBaseParams, ...params };
863
864 const res: any = await getDbDirFieldPageList(finalParams); 931 const res: any = await getDbDirFieldPageList(finalParams);
865 if (res.code == proxy.$passCode) { 932 if (res.code == proxy.$passCode) {
866 tableFieldsData.value = res.data.records; 933 tableFieldsData.value = res.data.records;
...@@ -868,7 +935,7 @@ const getDataBaseFieldData = async (params = {}) => { ...@@ -868,7 +935,7 @@ const getDataBaseFieldData = async (params = {}) => {
868 } else { 935 } else {
869 proxy.$ElMessage.error(res.msg); 936 proxy.$ElMessage.error(res.msg);
870 } 937 }
871 tableFieldsLoading.value = false; 938 tableFieldsDataInfo.value.loading = false;
872 }; 939 };
873 940
874 const tableFieldsDataInfo = ref({ 941 const tableFieldsDataInfo = ref({
...@@ -964,6 +1031,9 @@ const handleSubjectTableCommand = (command: string) => { ...@@ -964,6 +1031,9 @@ const handleSubjectTableCommand = (command: string) => {
964 type: 'tableCreateFile', 1031 type: 'tableCreateFile',
965 foundMode: 2, 1032 foundMode: 2,
966 execGuid: execGuidInfo.value.execGuid, 1033 execGuid: execGuidInfo.value.execGuid,
1034 database: dataBaseInfo.value.database,
1035 databaseChName: dataBaseInfo.value.databaseChName,
1036 databaseGuid: dataBaseInfo.value.databaseGuid,
967 } 1037 }
968 }); 1038 });
969 } else if (command === 'existingCreate') { 1039 } else if (command === 'existingCreate') {
...@@ -988,8 +1058,12 @@ const addIsShowClassifyTip = () => { ...@@ -988,8 +1058,12 @@ const addIsShowClassifyTip = () => {
988 isShowClassifyTip.value = false; 1058 isShowClassifyTip.value = false;
989 } 1059 }
990 1060
1061 const tipHeight = ref(200);
1062 const tipHeight1 = ref(165);
991 const addIsShowDatabaseTip = () => { 1063 const addIsShowDatabaseTip = () => {
992 isShowDatabaseTip.value = false; 1064 isShowDatabaseTip.value = false;
1065 tipHeight.value = 148;
1066 tipHeight1.value = 103;
993 } 1067 }
994 1068
995 // 表信息和字段信息切换 1069 // 表信息和字段信息切换
...@@ -1075,7 +1149,7 @@ const getDbDirTableSelectData = async (type, params = {}) => { ...@@ -1075,7 +1149,7 @@ const getDbDirTableSelectData = async (type, params = {}) => {
1075 const finalParams = { ...inParams, ...params }; 1149 const finalParams = { ...inParams, ...params };
1076 const res: any = await getDbDirTableSelectList(finalParams); 1150 const res: any = await getDbDirTableSelectList(finalParams);
1077 if (res.code == proxy.$passCode) { 1151 if (res.code == proxy.$passCode) {
1078 console.log('getDbDirTableSelectData', res); 1152
1079 if (type == 1) { 1153 if (type == 1) {
1080 optionsA.value = res.data.map((item) => ({ 1154 optionsA.value = res.data.map((item) => ({
1081 dbGuid: item.database, // 数据库标识 1155 dbGuid: item.database, // 数据库标识
...@@ -1083,15 +1157,16 @@ const getDbDirTableSelectData = async (type, params = {}) => { ...@@ -1083,15 +1157,16 @@ const getDbDirTableSelectData = async (type, params = {}) => {
1083 })); 1157 }));
1084 } 1158 }
1085 if (type == 2) { 1159 if (type == 2) {
1160 console.log('进来了吗', res);
1086 optionsB.value = res.data.map((item) => ({ 1161 optionsB.value = res.data.map((item) => ({
1087 dbGuid: item.tableName, // 表标识 1162 dbGuid: item.database, // 表标识
1088 name: item.tableName, // 表名称 1163 name: item.database, // 表名称
1089 })); 1164 }));
1090 } 1165 }
1091 if (type == 3) { 1166 if (type == 3) {
1092 optionsC.value = res.data.map((item) => ({ 1167 optionsC.value = res.data.map((item) => ({
1093 dbGuid: item.fieldName, // 字段标识 1168 dbGuid: item.database, // 字段标识
1094 name: item.fieldName, // 字段名称 1169 name: item.database, // 字段名称
1095 })); 1170 }));
1096 } 1171 }
1097 1172
...@@ -1142,7 +1217,9 @@ const onBChange = async () => { ...@@ -1142,7 +1217,9 @@ const onBChange = async () => {
1142 1217
1143 // 导出 1218 // 导出
1144 const btnClick = async () => { 1219 const btnClick = async () => {
1145 exportCgDir().then((res: any) => { 1220 exportCgDir({
1221 execGuid: execGuidInfo.value.execGuid,
1222 }).then((res: any) => {
1146 download(res, '分类分级目录数据.xlsx', 'excel') 1223 download(res, '分类分级目录数据.xlsx', 'excel')
1147 }); 1224 });
1148 1225
...@@ -1161,6 +1238,25 @@ const treeSelectNodeChange = (node, item) => { ...@@ -1161,6 +1238,25 @@ const treeSelectNodeChange = (node, item) => {
1161 const { refGradeGuid } = node; 1238 const { refGradeGuid } = node;
1162 getGradeData(refGradeGuid); 1239 getGradeData(refGradeGuid);
1163 } 1240 }
1241
1242 // 这里应该是onActivated 钩子,路由从configure-路由从configure-rules跳转过来要重新请求数据、
1243 onActivated(async () => {
1244 if (route.query.reload === 'true') {
1245 await getExecGuid();
1246 activeName.value = 'second';
1247 getDataBaseTreeData();
1248 getDataBaseTableData({
1249 exexGuid: execGuidInfo.value.execGuid
1250 });
1251 getDataBaseFieldData(
1252 {
1253 exexGuid: execGuidInfo.value.execGuid
1254 }
1255 );
1256 getDbDirTableSelectData(1, {});
1257 }
1258 });
1259
1164 </script> 1260 </script>
1165 1261
1166 <template> 1262 <template>
...@@ -1215,8 +1311,8 @@ const treeSelectNodeChange = (node, item) => { ...@@ -1215,8 +1311,8 @@ const treeSelectNodeChange = (node, item) => {
1215 </div> 1311 </div>
1216 <div class="btns-area"> 1312 <div class="btns-area">
1217 <div class="left-btns"> 1313 <div class="left-btns">
1218 <el-button type="primary" @click="addStandardSet">查看已生产报告</el-button> 1314 <!-- <el-button type="primary" @click="addStandardSet">查看已生产报告</el-button> -->
1219 <el-button @click="btnClick()">导出</el-button> 1315 <el-button @click="btnClick">导出</el-button>
1220 <el-button @click="batchControlRules">批量配置业务规则</el-button> 1316 <el-button @click="batchControlRules">批量配置业务规则</el-button>
1221 </div> 1317 </div>
1222 </div> 1318 </div>
...@@ -1288,18 +1384,21 @@ const treeSelectNodeChange = (node, item) => { ...@@ -1288,18 +1384,21 @@ const treeSelectNodeChange = (node, item) => {
1288 </el-dropdown> 1384 </el-dropdown>
1289 </div> 1385 </div>
1290 <el-button @click="exportDB">导出</el-button> 1386 <el-button @click="exportDB">导出</el-button>
1291 <el-button>查看已生产报告</el-button> 1387 <!-- <el-button>查看已生产报告</el-button>
1292 <el-button>查看质量规则</el-button> 1388 <el-button>查看质量规则</el-button> -->
1293 </div> 1389 </div>
1294 <div class="right-btns"> 1390 <div class="right-btns">
1295 <el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" /> 1391 <el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" />
1296 </div> 1392 </div>
1297 </div> 1393 </div>
1298 <div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'"> 1394 <div class="table_panel_wrap_database" v-if="!tableGuid && activeTab === 'table'"
1299 <Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange" /> 1395 :style="{ height: `calc(100% - ${tipHeight1}px)`, minHeight: '210px' }">
1396 <Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange"
1397 @tableSwitchBeforeChange="tableSwitchBeforeChange" />
1300 </div> 1398 </div>
1301 <div class="table_field" v-if="tableGuid || activeTab === 'word'"> 1399 <div class="table_field" v-if="tableGuid || activeTab === 'word'"
1302 <Table :tableInfo="tableFieldsDataInfo" :loading="tableFieldsLoading" /> 1400 :style="{ height: `calc(100% - ${tipHeight}px)`, minHeight: '210px' }">
1401 <Table :tableInfo="tableFieldsDataInfo" />
1303 </div> 1402 </div>
1304 </div> 1403 </div>
1305 <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" /> 1404 <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" />
...@@ -1442,14 +1541,12 @@ const treeSelectNodeChange = (node, item) => { ...@@ -1442,14 +1541,12 @@ const treeSelectNodeChange = (node, item) => {
1442 1541
1443 .table_panel_wrap_database { 1542 .table_panel_wrap_database {
1444 width: 100%; 1543 width: 100%;
1445 height: calc(100% - 155px);
1446 min-height: 210px; 1544 min-height: 210px;
1447 overflow: visible; 1545 overflow: visible;
1448 } 1546 }
1449 1547
1450 .table_field { 1548 .table_field {
1451 width: 100%; 1549 width: 100%;
1452 height: calc(100% - 150px);
1453 min-height: 210px; 1550 min-height: 210px;
1454 overflow: visible; 1551 overflow: visible;
1455 } 1552 }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
5 <script lang="ts" setup name="configureRules"> 5 <script lang="ts" setup name="configureRules">
6 import { ref } from "vue"; 6 import { ref } from "vue";
7 import useUserStore from "@/store/modules/user"; 7 import useUserStore from "@/store/modules/user";
8 import { getBizRuleConfigDetail, saveBizRuleConfig, } from '@/api/modules/dataInventory' 8 import { getBizRuleConfigDetail, getNewDataTypeList, saveBizRuleConfig, } from '@/api/modules/dataInventory'
9 const { proxy } = getCurrentInstance() as any; 9 const { proxy } = getCurrentInstance() as any;
10 const router = useRouter(); 10 const router = useRouter();
11 const route = useRoute(); 11 const route = useRoute();
...@@ -13,6 +13,7 @@ const fullPath = route.fullPath; ...@@ -13,6 +13,7 @@ const fullPath = route.fullPath;
13 const userStore = useUserStore(); 13 const userStore = useUserStore();
14 const bizRuleConfigData = ref<any>() 14 const bizRuleConfigData = ref<any>()
15 const getBizRuleConfigDetailData = async () => { 15 const getBizRuleConfigDetailData = async () => {
16 tableFieldsLoading.value = true
16 const params = { 17 const params = {
17 tableGuid: router.currentRoute.value.query.tableGuid, 18 tableGuid: router.currentRoute.value.query.tableGuid,
18 execGuid: router.currentRoute.value.query.execGuid 19 execGuid: router.currentRoute.value.query.execGuid
...@@ -25,22 +26,37 @@ const getBizRuleConfigDetailData = async () => { ...@@ -25,22 +26,37 @@ const getBizRuleConfigDetailData = async () => {
25 item.isEdit = false 26 item.isEdit = false
26 }) 27 })
27 tableData.value = bizRuleConfigData.value 28 tableData.value = bizRuleConfigData.value
29 tableFieldsLoading.value = false
28 } else { 30 } else {
29 proxy.$message.error(res.msg) 31 proxy.$message.error(res.msg)
30 } 32 }
31 } 33 }
34 // 获取字段类型
35 const fieldData = ref<any>([]);
36 const getFieldTypeData = async () => {
37 const params = {
38 dictType: "字段类型"
39 }
40 const res: any = await getNewDataTypeList(params);
41 if (res.code == proxy.$passCode) {
42 fieldData.value = res.data || [];
43 } else {
44 proxy.$ElMessage.error(res.msg);
45 }
46 }
32 47
33 onMounted(() => { 48 onMounted(async () => {
34 getBizRuleConfigDetailData() 49 await getFieldTypeData()
50 await getBizRuleConfigDetailData()
35 }) 51 })
36 52
37 53
38 const tableData1 = ref([ 54 const tableData1 = ref([
39 { 55 {
40 cgDirName: router.currentRoute.value.query.cgDirName, 56 databaseChName: router.currentRoute.value.query.databaseChName || '--',
41 tableName: router.currentRoute.value.query.tableName, 57 tableName: router.currentRoute.value.query.tableName || '--',
42 tableChName: router.currentRoute.value.query.tableChName, 58 tableChName: router.currentRoute.value.query.tableChName || '--',
43 description: router.currentRoute.value.query.description, 59 description: router.currentRoute.value.query.description || '--',
44 }, 60 },
45 ]) 61 ])
46 // 表格数据 62 // 表格数据
...@@ -71,7 +87,7 @@ const moveUp = () => { ...@@ -71,7 +87,7 @@ const moveUp = () => {
71 return; 87 return;
72 } 88 }
73 selectedRows.value.forEach((row: any) => { 89 selectedRows.value.forEach((row: any) => {
74 const index = tableData.value.findIndex((item) => item.guid === row.guid); 90 const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
75 if (index > 0) { 91 if (index > 0) {
76 [tableData.value[index - 1], tableData.value[index]] = [ 92 [tableData.value[index - 1], tableData.value[index]] = [
77 tableData.value[index], 93 tableData.value[index],
...@@ -89,7 +105,7 @@ const moveDown = () => { ...@@ -89,7 +105,7 @@ const moveDown = () => {
89 } 105 }
90 // 倒序遍历选中行 106 // 倒序遍历选中行
91 [...selectedRows.value].reverse().forEach((row: any) => { 107 [...selectedRows.value].reverse().forEach((row: any) => {
92 const index = tableData.value.findIndex((item) => item.guid === row.guid); 108 const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
93 if (index < tableData.value.length - 1) { 109 if (index < tableData.value.length - 1) {
94 [tableData.value[index], tableData.value[index + 1]] = [ 110 [tableData.value[index], tableData.value[index + 1]] = [
95 tableData.value[index + 1], 111 tableData.value[index + 1],
...@@ -98,6 +114,30 @@ const moveDown = () => { ...@@ -98,6 +114,30 @@ const moveDown = () => {
98 } 114 }
99 }); 115 });
100 }; 116 };
117 // 删除行
118 const deleteRow = (index) => {
119 // confirm 弹窗
120 proxy.$confirm('是否删除该行数据?', '提示', {
121 confirmButtonText: '确定',
122 cancelButtonText: '取消',
123 type: 'warning',
124 }).then(() => {
125 tableData.value.splice(index, 1)
126 }).catch(() => {
127 proxy.$message({
128 type: 'info',
129 message: '已取消删除'
130 });
131 });
132 }
133 // 批量删除功能
134 const batchDelete = () => {
135 selectedRows.value.forEach((row: any) => {
136 const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
137 if (index !== -1) tableData.value.splice(index, 1);
138 });
139 selectedRows.value = [];
140 };
101 141
102 // 编辑行 142 // 编辑行
103 const editRow = (row) => { 143 const editRow = (row) => {
...@@ -125,19 +165,6 @@ const saveRow = (row) => { ...@@ -125,19 +165,6 @@ const saveRow = (row) => {
125 } 165 }
126 row.isEdit = false 166 row.isEdit = false
127 } 167 }
128
129 // 删除行
130 const deleteRow = (index) => {
131 tableData.value.splice(index, 1)
132 }
133 // 批量删除功能
134 const batchDelete = () => {
135 selectedRows.value.forEach((row: any) => {
136 const index = tableData.value.findIndex((item) => item.id === row.id);
137 if (index !== -1) tableData.value.splice(index, 1);
138 });
139 selectedRows.value = [];
140 };
141 const data = [ 168 const data = [
142 { 169 {
143 value: '1', 170 value: '1',
...@@ -274,7 +301,7 @@ const cancel = () => { ...@@ -274,7 +301,7 @@ const cancel = () => {
274 'max-height': 'calc(100% - 16px)', 301 'max-height': 'calc(100% - 16px)',
275 display: 'inline-block', 302 display: 'inline-block',
276 }"> 303 }">
277 <el-table-column prop="cgDirName" label="数据源" width="180" /> 304 <el-table-column prop="databaseChName" label="数据源" width="180" />
278 <el-table-column prop="tableName" label="表名称" width="180" /> 305 <el-table-column prop="tableName" label="表名称" width="180" />
279 <el-table-column prop="tableChName" label="数据库表" width="280" /> 306 <el-table-column prop="tableChName" label="数据库表" width="280" />
280 <el-table-column prop="description" label="描述" width="180" show-overflow-tooltip /> 307 <el-table-column prop="description" label="描述" width="180" show-overflow-tooltip />
...@@ -296,33 +323,37 @@ const cancel = () => { ...@@ -296,33 +323,37 @@ const cancel = () => {
296 <!-- 排序列(不可编辑) --> 323 <!-- 排序列(不可编辑) -->
297 <el-table-column type="index" label="排序" width="80" align="center" /> 324 <el-table-column type="index" label="排序" width="80" align="center" />
298 <!-- 字段中文名(不可编辑)fieldChName --> 325 <!-- 字段中文名(不可编辑)fieldChName -->
299 <el-table-column prop="fieldChName" label="字段中文名" width="120"> 326 <el-table-column prop="fieldChName" label="字段中文名" width="120" show-overflow-tooltip>
300 <template #default="scope"> 327 <template #default="scope">
301 {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }} 328 {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
302 </template> 329 </template>
303 </el-table-column> 330 </el-table-column>
304 <!-- 字段英文名(不可编辑) --> 331 <!-- 字段英文名(不可编辑) -->
305 <el-table-column prop="fieldName" label="字段英文名" width="120"> 332 <el-table-column prop="fieldName" label="字段英文名" width="120" show-overflow-tooltip>
306 <template #default="scope"> 333 <template #default="scope">
307 {{ scope.row.fieldName ? scope.row.fieldName : '--' }} 334 {{ scope.row.fieldName ? scope.row.fieldName : '--' }}
308 </template> 335 </template>
309 </el-table-column> 336 </el-table-column>
310 <!-- 分类(不可编辑)classifyName --> 337 <!-- 分类(不可编辑)classifyName -->
311 <!-- <el-table-column prop="fieldEnglish" label="分类" width="120"> 338 <el-table-column prop="classifyName" label="分类" width="80" show-overflow-tooltip>
312 <template #default="scope"> 339 <template #default="scope">
313 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} 340 {{ scope.row.classifyName ? scope.row.classifyName : '--' }}
314 </template> 341 </template>
315 </el-table-column> --> 342 </el-table-column>
316 <!-- 分级(不可编辑) --> 343 <!-- 分级(不可编辑) -->
317 <!-- <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> 344 <el-table-column prop="gradeDetailName" label="分级" width="80" align="center" show-overflow-tooltip>
318 <template #default="scope"> 345 <template #default="scope">
319 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} 346 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }}
320 </template> 347 </template>
321 </el-table-column> --> 348 </el-table-column>
322 <!-- 字段类型fieldType (不可编辑) --> 349 <!-- 字段类型fieldType (不可编辑) -->
323 <el-table-column prop="fieldType" label="字段类型" width="150" align="center"> 350 <el-table-column prop="fieldType" label="字段类型" width="120" align="center">
324 <template #default="scope"> 351 <template #default="scope">
325 {{ scope.row.fieldType ? scope.row.fieldType : '--' }} 352 {{
353
354 fieldData ? (fieldData.find((item: any) => item.value === scope.row.fieldType)?.label || '--')
355 : '--'
356 }}
326 </template> 357 </template>
327 </el-table-column> 358 </el-table-column>
328 359
......
...@@ -78,12 +78,22 @@ const labelPageList = ref<any>() ...@@ -78,12 +78,22 @@ const labelPageList = ref<any>()
78 const getLabelPageData = async () => { 78 const getLabelPageData = async () => {
79 refCount.value++; 79 refCount.value++;
80 tableInfo.value.loading = true; 80 tableInfo.value.loading = true;
81 const params = { 81 let params = {}
82 pageIndex: page.value.curr, 82 if (guids.value.length == 0) {
83 pageSize: page.value.limit, 83 params = {
84 classifyGuid: classifyGuid.value, 84 pageIndex: page.value.curr,
85 detailGuid: classifyDetailGuid.value 85 pageSize: page.value.limit,
86 classifyGuid: classifyGuid.value,
87 detailGuid: classifyDetailGuid.value
88 }
89 } else {
90 params = {
91 pageIndex: page.value.curr,
92 pageSize: page.value.limit,
93 guids: guids.value
94 }
86 } 95 }
96
87 const res: any = await getLabelPageList(params); 97 const res: any = await getLabelPageList(params);
88 if (res.code == proxy.$passCode) { 98 if (res.code == proxy.$passCode) {
89 labelPageList.value = res.data.records; 99 labelPageList.value = res.data.records;
...@@ -254,8 +264,13 @@ const tableInfo = ref({ ...@@ -254,8 +264,13 @@ const tableInfo = ref({
254 { 264 {
255 label: "编辑", value: "edit", click: async (scope) => { 265 label: "编辑", value: "edit", click: async (scope) => {
256 console.log('编辑', scope); 266 console.log('编辑', scope);
267 const index = findIndexInRecursiveData(classGradeTreeData.value, scope.row.classifyDetailGuid);
268 const temp = classGradeTreeData.value.slice(index, index + 1);
269 console.log('temp', temp);
270 newCreateGradeFormItems.value[1].options = transformDataForTree([temp[0]])
257 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 271 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
258 newCreateGradeStandardDialogInfo.value.title = '编辑标签'; 272 newCreateGradeStandardDialogInfo.value.title = '编辑标签';
273 classifyGuid.value = scope.row.classifyGuid;
259 await getGradeListData(scope.row.gradeGuid); 274 await getGradeListData(scope.row.gradeGuid);
260 // 遍历classGradeTreeData 找到对应的guid item的refGradeGuid 275 // 遍历classGradeTreeData 找到对应的guid item的refGradeGuid
261 classGradeTreeData.value.forEach((element: any) => { 276 classGradeTreeData.value.forEach((element: any) => {
...@@ -301,6 +316,28 @@ const tableInfo = ref({ ...@@ -301,6 +316,28 @@ const tableInfo = ref({
301 loading: false 316 loading: false
302 }); 317 });
303 318
319 const findIndexInRecursiveData = (data: any[], targetGuid: string): number => {
320 // 遍历数组
321 for (let i = 0; i < data.length; i++) {
322 const item = data[i];
323
324 // 检查当前项的 guid 是否匹配
325 if (item.guid === targetGuid) {
326 return i; // 返回当前索引
327 }
328
329 // 如果当前项有 children,则递归查询
330 if (item.children) {
331 const childIndex = findIndexInRecursiveData(item.children, targetGuid);
332 if (childIndex !== -1) {
333 return i; // 返回外层索引
334 }
335 }
336 }
337 return -1; // 如果没有找到匹配项,则返回 -1
338 };
339
340
304 // 批量删除 341 // 批量删除
305 const batchRemobe = async () => { 342 const batchRemobe = async () => {
306 // 批量删除,增加confirm确认弹窗 343 // 批量删除,增加confirm确认弹窗
...@@ -401,6 +438,7 @@ const tableBtnClick = async (scope, value) => { ...@@ -401,6 +438,7 @@ const tableBtnClick = async (scope, value) => {
401 // newCreateGradeStandardDialogInfo.value.visible = true; 438 // newCreateGradeStandardDialogInfo.value.visible = true;
402 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 439 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
403 newCreateGradeStandardDialogInfo.value.title = '编辑标签'; 440 newCreateGradeStandardDialogInfo.value.title = '编辑标签';
441 classifyGuid.value = scope.row.classifyGuid;
404 await getGradeListData(scope.row.gradeGuid); 442 await getGradeListData(scope.row.gradeGuid);
405 // 遍历classGradeTreeData 找到对应的guid item的refGradeGuid 443 // 遍历classGradeTreeData 找到对应的guid item的refGradeGuid
406 classGradeTreeData.value.forEach((element: any) => { 444 classGradeTreeData.value.forEach((element: any) => {
...@@ -687,6 +725,7 @@ const classSearchItemList = ref<any>([ ...@@ -687,6 +725,7 @@ const classSearchItemList = ref<any>([
687 725
688 const guids = ref<any>([]) 726 const guids = ref<any>([])
689 const selectChange = async (val: any, row: any) => { 727 const selectChange = async (val: any, row: any) => {
728 console.log('selectChange', val, row);
690 if (val) { 729 if (val) {
691 guids.value = val; 730 guids.value = val;
692 } 731 }
...@@ -798,7 +837,7 @@ const positionOptions = [ ...@@ -798,7 +837,7 @@ const positionOptions = [
798 ]; 837 ];
799 // 语言options 838 // 语言options
800 const languageOptions = [ 839 const languageOptions = [
801 { label: '中文名', value: 'zhName' }, 840 { label: '中文名', value: 'chName' },
802 { label: '英文名', value: 'enName' }, 841 { label: '英文名', value: 'enName' },
803 ]; 842 ];
804 // 当前悬停的行索引 843 // 当前悬停的行索引
......
...@@ -196,7 +196,7 @@ const getPreviewData = () => { ...@@ -196,7 +196,7 @@ 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 console.log('tableName');
200 currDsTableStructureLoading.value = true; 200 currDsTableStructureLoading.value = true;
201 currDsTableStructure.value = []; 201 currDsTableStructure.value = [];
202 getDsTableStructure({ 202 getDsTableStructure({
...@@ -275,7 +275,6 @@ const datasource_selection_all_change = (selection) => { ...@@ -275,7 +275,6 @@ const datasource_selection_all_change = (selection) => {
275 }); 275 });
276 }; 276 };
277 const datasource_selection_change = (selection, row) => { 277 const datasource_selection_change = (selection, row) => {
278 console.log(selection, row);
279 let index = selection.findIndex((s) => s.tableName == row.tableName); 278 let index = selection.findIndex((s) => s.tableName == row.tableName);
280 if (index === -1) { 279 if (index === -1) {
281 datasourceSelectedRows.value.splice( 280 datasourceSelectedRows.value.splice(
...@@ -331,6 +330,7 @@ watch( ...@@ -331,6 +330,7 @@ watch(
331 watch(currDatasourceSelect, (val) => { 330 watch(currDatasourceSelect, (val) => {
332 if (val?.tableName) { 331 if (val?.tableName) {
333 // getPreviewData(); 332 // getPreviewData();
333 console.log('currDatasourceSelect', currDatasourceSelect, val);
334 getTableStructure(); 334 getTableStructure();
335 } 335 }
336 }); 336 });
......
...@@ -13,21 +13,21 @@ import { ...@@ -13,21 +13,21 @@ import {
13 updateDbDirTable, 13 updateDbDirTable,
14 createTableSql, 14 createTableSql,
15 getDsTableStructures, 15 getDsTableStructures,
16 getDbDirFieldClassifyAndGrade,
17 getDbDirTableSelectList,
18 getTaskExeTreeList, 16 getTaskExeTreeList,
19 getGradeList, 17 getGradeList,
20 getNewDataTypeList, 18 getNewDataTypeList,
19 getDbDirDetail,
21 } from "@/api/modules/dataInventory"; 20 } from "@/api/modules/dataInventory";
22 import existingTableSelect from "./existingTableSelect.vue"; 21 import existingTableSelect from "./existingTableSelect.vue";
23 import { ro } from "element-plus/es/locale"; 22 import useUserStore from "@/store/modules/user";
24 23
25 /** 草稿中未建表时就可以编辑表相关信息。如果建表之后就只能编辑字段。 不能修改字段英文名称,数据库修改英文名就相当于删除再添加。都可以直接跳转到*/ 24 /** 草稿中未建表时就可以编辑表相关信息。如果建表之后就只能编辑字段。 不能修改字段英文名称,数据库修改英文名就相当于删除再添加。都可以直接跳转到*/
26 25
27 const { proxy } = getCurrentInstance() as any; 26 const { proxy } = getCurrentInstance() as any;
28 const router = useRouter(); 27 const router = useRouter();
29 const route = useRoute(); 28 const route = useRoute();
30 const isDimTable = route.query.isDim; 29 const fullPath = route.fullPath;
30 const userStore = useUserStore();
31 const execGuid: any = ref(route.query.execGuid); 31 const execGuid: any = ref(route.query.execGuid);
32 32
33 // 获取数据库列表 33 // 获取数据库列表
...@@ -160,8 +160,34 @@ const saveRow = (row) => { ...@@ -160,8 +160,34 @@ const saveRow = (row) => {
160 } 160 }
161 161
162 162
163 const editInfoData = ref<any>({
164 guid: ''
165 });
163 onMounted(async () => { 166 onMounted(async () => {
164 await getDbDirDataSourceListData(); 167 if (route.query.editOpt && route.query.editOpt === '1') {
168 tableFieldsLoading.value = true;
169 stepsInfo.value.step = 1;
170 getDbDirDetail({
171 tableGuid: route.query.tableGuid
172 }).then((res: any) => {
173 if (res.code == proxy.$passCode) {
174 editInfoData.value = res.data;
175 tableDataInfo.value = [{
176 tableName: editInfoData.value.tableName,
177 tableChName: editInfoData.value.tableChName,
178 description: editInfoData.value.description,
179 databaseChName: editInfoData.value.databaseChName,
180 }];
181 tableDataDetailInfo.value = res.data.fieldRSVOS;
182 tableFieldsLoading.value = false;
183 } else {
184 proxy.$ElMessage.error(res.msg);
185 }
186 })
187 getFieldTree();
188 } else {
189 await getDbDirDataSourceListData();
190 }
165 await getFieldTypeData(); 191 await getFieldTypeData();
166 }); 192 });
167 193
...@@ -186,8 +212,9 @@ const handlDsSelectedChange = (v, guid) => { ...@@ -186,8 +212,9 @@ const handlDsSelectedChange = (v, guid) => {
186 execGuid: execGuid.value, 212 execGuid: execGuid.value,
187 }); 213 });
188 }); 214 });
189 215 if (params.length > 0) {
190 getNextTableInfo(params); 216 getNextTableInfo(params);
217 }
191 }; 218 };
192 219
193 220
...@@ -252,6 +279,7 @@ const tableDataInfo = ref([ ...@@ -252,6 +279,7 @@ const tableDataInfo = ref([
252 tableName: '', 279 tableName: '',
253 tableChName: '', 280 tableChName: '',
254 description: '', 281 description: '',
282 databaseChName: route.query.databaseChName || '',
255 }, 283 },
256 ]) 284 ])
257 // 表格数据 285 // 表格数据
...@@ -345,6 +373,7 @@ const batchDelete = () => { ...@@ -345,6 +373,7 @@ const batchDelete = () => {
345 373
346 // 新增一行 374 // 新增一行
347 const addRow = () => { 375 const addRow = () => {
376 console.log('新增一行')
348 refGradeGuid.value = ''; 377 refGradeGuid.value = '';
349 tableDataDetailInfo.value.push({ 378 tableDataDetailInfo.value.push({
350 id: tableDataDetailInfo.value.length + 1, 379 id: tableDataDetailInfo.value.length + 1,
...@@ -435,53 +464,153 @@ const data = [ ...@@ -435,53 +464,153 @@ const data = [
435 }, 464 },
436 ] 465 ]
437 466
438 const submitAsDraft = () => { 467 const saveBtnDraft = ref(false)
439 // 保存为草稿,无论有没有guid 都传入guid 468 const submitAsDraft = async () => {
440 saveOrUpdate({ isDraft: 'Y' }, 0) 469 // 保存为草稿,
470 if (!tableDataInfo.value[0].tableName) {
471 proxy.$ElMessage.error('请填写数据库名称');
472 return;
473 }
474 if (!tableDataInfo.value[0].tableChName) {
475 proxy.$ElMessage.error('请填写数据库表');
476 return;
477 }
478 saveBtnDraft.value = true
479 if (!editInfoData.value.guid) {
480 try {
481 await saveOrUpdate({
482 tableName: tableDataInfo.value[0].tableName,
483 tableChName: tableDataInfo.value[0].tableChName,
484 databaseGuid: route.query.databaseGuid || '',
485 database: route.query.database || '',
486 databaseChName: route.query.databaseChName || '',
487 foundMode: route.query.foundMode,
488 isDraft: 'Y',
489 }, 0)
490 saveBtnDraft.value = false
491 } catch (error) {
492 saveBtnDraft.value = false
493 }
441 494
495 } else {
496 try {
497 await saveOrUpdate({
498 guid: editInfoData.value.guid,
499 tableName: tableDataInfo.value[0].tableName,
500 tableChName: tableDataInfo.value[0].tableChName,
501 databaseGuid: editInfoData.value.databaseGuid || '',
502 database: editInfoData.value.database || '',
503 databaseChName: editInfoData.value.databaseChName || '',
504 foundMode: editInfoData.value.foundMode,
505 isDraft: 'Y',
506 tableGuid: route.query.tableGuid,
507 }, 1)
508 saveBtnDraft.value = false
509 } catch (error) {
510 saveBtnDraft.value = false
511 }
512 }
442 } 513 }
443 514
444 /** 515
445 * 需求写一个校验函数,校验表格数据是否填写完整 516
446 * 1、表名称、数据库表、为空 517 const checkTableData = (tableDataDetailInfo) => {
447 * 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空 518 let hasPrimary = false; // 是否有主键字段
448 */ 519 const enNames: any[] = []; // 用于校验英文名称重复
449 520 const chNames: any[] = []; // 用于校验中文名称重复
450 // const checkTableData = (tableDataInfo, tableDataDetailInfo) => { 521 const regex = /^[a-zA-Z]/; // 校验英文名称必须以字母开头
451 522 let index = 1; // 记录字段序号
452 // const tableDataInfoKeys = ['tableName', 'tableChName'] 523 console.log('tableDataInfo', tableDataDetailInfo)
453 // const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid'] 524 if (!tableDataInfo.value[0].tableName) {
454 // let flag = true 525 proxy.$ElMessage.error('请填写数据库名称');
455 // tableDataInfo.forEach(item => { 526 return;
456 // tableDataInfoKeys.forEach(key => { 527 }
457 // if (!item[key]) { 528 if (!tableDataInfo.value[0].tableChName) {
458 // flag = false 529 proxy.$ElMessage.error('请填写数据库表');
459 // proxy.$ElMessage.error('表名称、数据库表不能为空') 530 return;
460 // } 531 }
461 // }) 532 // 校验列表数组
462 // }) 533 for (const field of tableDataDetailInfo) {
463 // tableDataDetailInfo.forEach(item => { 534 // 校验字段英文名称不能为空
464 // tableDataDetailInfoKeys.forEach(key => { 535 if (!field.fieldName) {
465 // if (!item[key]) { 536 ElMessage.error(`第 ${index} 个字段的英文名称不能为空!`);
466 // flag = false 537 return false;
467 // proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空') 538 }
468 // } 539
469 // }) 540 // 校验英文名称必须以字母开头
470 // }) 541 if (!regex.test(field.fieldName)) {
471 // return flag 542 ElMessage.error(`第 ${index} 个字段的英文名称必须以英文字符开头!`);
472 // } 543 return false;
473 544 }
474 const guid = ref('') 545
546 // 校验英文名称不能重复
547 if (enNames.includes(field.fieldName)) {
548 ElMessage.error(`字段的英文名称 ${field.fieldName} 不能重复!`);
549 return false;
550 }
551
552 // 校验中文名称不能重复
553 if (chNames.includes(field.fieldChName)) {
554 ElMessage.error(`字段的中文名称 ${field.fieldChName} 不能重复!`);
555 return false;
556 }
557
558 // 校验字段类型和相应属性
559 if (field.fieldType === 'decimal') {
560 if (field.fieldPrecision == null) {
561 ElMessage.error(`第 ${index} 个字段的字段类型为浮点型时,精度不能为空!`);
562 return false;
563 }
564 if (field.fieldLength == null) {
565 ElMessage.error(`第 ${index} 个字段的字段类型为浮点型时,长度不能为空!`);
566 return false;
567 }
568 }
569
570 if ((field.fieldType === 'varchar' || field.fieldType === 'char') && field.fieldLength == null) {
571 ElMessage.error(`第 ${index} 个字段的字段类型为字符型时,长度不能为空!`);
572 return false;
573 }
574
575 // 校验主键字段
576 if (field.isPrimary === 'Y') {
577 hasPrimary = true;
578 if (field.isNotNull !== 'Y') {
579 ElMessage.error(`第 ${index} 个字段为主键,应设置为必填!`);
580 return false;
581 }
582 if (['text', 'json', 'bit'].includes(field.fieldType)) {
583 ElMessage.error(`第 ${index} 个字段为主键,字段类型不能设置为 ${field.fieldType} 类型!`);
584 return false;
585 }
586 }
587 // 更新英文和中文名称集合
588 enNames.push(field.fieldName);
589 chNames.push(field.fieldChName);
590 index++;
591 }
592
593 // 校验是否至少有一个主键字段
594 if (!hasPrimary) {
595 ElMessage.error(`字段至少有一个主键字段!`);
596 return false;
597 }
598
599 return true; // 校验通过
600 };
601
602
475 const saveBtn = ref(false) 603 const saveBtn = ref(false)
476 const submit = async () => { 604 const submit = async () => {
477 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) 605 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value)
478 saveBtn.value = true 606 saveBtn.value = true
479 // 校验表格数据是否填写完整 607 // 校验表格数据是否填写完整
480 // if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) { 608 if (!checkTableData(tableDataDetailInfo.value)) {
481 // return 609 saveBtn.value = false
482 // } 610 return
611 }
483 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 612 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参
484 if (!guid.value) { 613 if (!editInfoData.value.guid) {
485 try { 614 try {
486 await saveOrUpdate({ 615 await saveOrUpdate({
487 tableName: tableDataInfo.value[0].tableName, 616 tableName: tableDataInfo.value[0].tableName,
...@@ -500,14 +629,15 @@ const submit = async () => { ...@@ -500,14 +629,15 @@ const submit = async () => {
500 // 修改 saveOrUpdate({}, 1) 629 // 修改 saveOrUpdate({}, 1)
501 try { 630 try {
502 await saveOrUpdate({ 631 await saveOrUpdate({
503 guid: guid.value, 632 guid: editInfoData.value.guid,
504 tableName: tableDataInfo.value[0].tableName, 633 tableName: tableDataInfo.value[0].tableName,
505 tableChName: tableDataInfo.value[0].tableChName, 634 tableChName: tableDataInfo.value[0].tableChName,
506 databaseGuid: route.query.databaseGuid || '', 635 databaseGuid: editInfoData.value.databaseGuid || '',
507 database: route.query.database || '', 636 database: editInfoData.value.database || '',
508 databaseChName: route.query.databaseChName || '', 637 databaseChName: editInfoData.value.databaseChName || '',
509 foundMode: route.query.foundMode, 638 foundMode: editInfoData.value.foundMode,
510 isDraft: 'N', 639 isDraft: 'N',
640 tableGuid: route.query.tableGuid,
511 }, 1) 641 }, 1)
512 saveBtn.value = false 642 saveBtn.value = false
513 } catch (error) { 643 } catch (error) {
...@@ -519,6 +649,34 @@ const submit = async () => { ...@@ -519,6 +649,34 @@ const submit = async () => {
519 649
520 // 单独将保存和修改函数提取出来 type 0 保存 1 修改 2 生成建表语句 650 // 单独将保存和修改函数提取出来 type 0 保存 1 修改 2 生成建表语句
521 const saveOrUpdate = async (params: any = {}, type) => { 651 const saveOrUpdate = async (params: any = {}, type) => {
652 // 要对tableDataDetailInfo.value 进行处理,将其转换为后台需要的格式
653 let TepmTableDataDetailInfo = tableDataDetailInfo.value.map(item => {
654 return {
655 classifyDetailGuid: item.classifyDetailGuid,
656 classifyDetailName: item.classifyDetailName,
657 database: item.database || editInfoData.value.database,
658 databaseChName: item.databaseChName || editInfoData.value.databaseChName,
659 databaseGuid: item.databaseGuid || editInfoData.value.databaseGuid,
660 dictionaryGuid: item.dictionaryGuid,
661 dimGuid: item.dimGuid,
662 fieldChName: item.fieldChName,
663 fieldGuid: item.fieldGuid,
664 fieldLength: item.fieldLength,
665 fieldName: item.fieldName,
666 fieldPrecision: item.fieldPrecision,
667 fieldType: item.fieldType,
668 gradeDetailGuid: item.gradeDetailGuid,
669 gradeDetailName: item.gradeDetailName,
670 guid: item.guid,
671 isFk: item.isFk,
672 isNotNull: item.isNotNull,
673 isPrimary: item.isPrimary,
674 sortValue: item.sortValue,
675 tableChName: tableDataInfo.value[0].tableChName,
676 tableGuid: route.query.tableGuid || '',
677 tableName: tableDataInfo.value[0].tableName,
678 }
679 })
522 const InParams = { 680 const InParams = {
523 guid: '', 681 guid: '',
524 cgDirName: '', 682 cgDirName: '',
...@@ -531,21 +689,27 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -531,21 +689,27 @@ const saveOrUpdate = async (params: any = {}, type) => {
531 databaseChName: '', 689 databaseChName: '',
532 foundMode: 0, 690 foundMode: 0,
533 isDraft: '', 691 isDraft: '',
534 fieldRQVOList: tableDataDetailInfo.value 692 fieldRQVOList: TepmTableDataDetailInfo
535 } 693 }
536 const finalParams = { ...InParams, ...params } 694 const finalParams = { ...InParams, ...params }
537 // 使用switch case 语句 695 // 使用switch case 语句
538 switch (type) { 696 switch (type) {
539 case 0: 697 case 0:
540 // 保存/保存为草稿 698 // 保存/保存为草稿
699 saveBtn.value = true
541 const res: any = await saveDbDirTable(finalParams); 700 const res: any = await saveDbDirTable(finalParams);
542 if (res.code === proxy.$passCode) { 701 if (res.code === proxy.$passCode) {
543 if (params.isDraft === 'Y') { 702 if (params.isDraft === 'Y') {
544 proxy.$ElMessage.success('保存为草稿成功!'); 703 proxy.$ElMessage.success('保存为草稿成功!');
704 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
705 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } });
706 return
545 } 707 }
546 proxy.$ElMessage.success('保存成功!'); 708 proxy.$ElMessage.success('保存成功!');
547 router.push({ name: 'classifyGradeCatalogue' }); 709 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
710 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } });
548 } else { 711 } else {
712 saveBtn.value = false
549 proxy.$ElMessage.error(res.msg); 713 proxy.$ElMessage.error(res.msg);
550 } 714 }
551 break; 715 break;
...@@ -553,9 +717,11 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -553,9 +717,11 @@ const saveOrUpdate = async (params: any = {}, type) => {
553 // 修改 717 // 修改
554 const res1: any = await updateDbDirTable(finalParams); 718 const res1: any = await updateDbDirTable(finalParams);
555 if (res1.code === proxy.$passCode) { 719 if (res1.code === proxy.$passCode) {
556 proxy.$ElMessage.success('修改成功!'); 720 proxy.$ElMessage.success('编辑成功!');
557 router.push({ name: 'classifyGradeCatalogue' }); 721 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
722 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } });
558 } else { 723 } else {
724 saveBtn.value = false
559 proxy.$ElMessage.error(res1.msg); 725 proxy.$ElMessage.error(res1.msg);
560 } 726 }
561 break; 727 break;
...@@ -667,14 +833,35 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -667,14 +833,35 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
667 scope.row[field] = min; 833 scope.row[field] = min;
668 } 834 }
669 } 835 }
836
837 onActivated(() => {
838 const tableChName = route.query.tableChName;
839 let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === fullPath);
840 if (tab) {
841 if (tableChName) {
842 tab.meta.title = `编辑-(${tableChName})`;
843 }
844 if (fullPath === route.fullPath) {
845 document.title = tab.meta.title;
846 }
847 }
848 });
849
850
851
670 </script> 852 </script>
671 853
672 <template> 854 <template>
673 <div class="container_wrap full" v-loading.fullscreen.lock="fullscreenLoading"> 855 <div class="container_wrap full" v-loading.fullscreen.lock="fullscreenLoading">
674 <div class="content_main"> 856 <div class="content_main">
675 <div class="top_tool_wrap"> 857
858 <div class="top_tool_wrap" v-if="!(route.query.editOpt && route.query.editOpt === '1')">
676 <StepBar :steps-info="stepsInfo" /> 859 <StepBar :steps-info="stepsInfo" />
677 </div> 860 </div>
861 <div class="edit-btn-wrap" v-show="(route.query.editOpt && route.query.editOpt === '1')">
862 <el-button type="primary" @click="submitAsDraft" :loading="saveBtnDraft">保存为草稿</el-button>
863 <el-button type="primary" @click="submit" :loading="saveBtn">保存</el-button>
864 </div>
678 <existingTableSelect v-show="stepsInfo.step === 0" :databaseList="databaseList" :table-create-type="2" 865 <existingTableSelect v-show="stepsInfo.step === 0" :databaseList="databaseList" :table-create-type="2"
679 :execGuid="execGuid" @datasource-selected-change="handlDsSelectedChange"></existingTableSelect> 866 :execGuid="execGuid" @datasource-selected-change="handlDsSelectedChange"></existingTableSelect>
680 <div class="second-step-content" v-show="stepsInfo.step === 1"> 867 <div class="second-step-content" v-show="stepsInfo.step === 1">
...@@ -685,6 +872,20 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -685,6 +872,20 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
685 'max-height': 'calc(100% - 16px)', 872 'max-height': 'calc(100% - 16px)',
686 display: 'inline-block', 873 display: 'inline-block',
687 }" v-loading="tableFieldsLoading"> 874 }" v-loading="tableFieldsLoading">
875 <el-table-column prop="databaseChName" label="数据源" width="200px" align="left" show-overflow-tooltip>
876 <template #header>
877 <span>数据源</span>
878 <span style="color:red;margin-left: 2px;">*</span>
879 </template>
880 <template #default="scope">
881 <!-- <el-select v-model="scope.row['dataSourceGuid']" placeholder="请选择" :disabled="tableCreateInfo.isCreate"
882 @change="(val) => selectDatabaseChange(val)" clearable filterable>
883 <el-option v-for="opt in databaseList" :key="opt['guid']" :label="opt['databaseNameZh']"
884 :value="opt['guid']" />
885 </el-select> -->
886 <el-input v-model.trim="scope.row.databaseChName" :disabled="true" />
887 </template>
888 </el-table-column>
688 <!-- 表名称列 --> 889 <!-- 表名称列 -->
689 <el-table-column prop="tableName" label="表名称" width="180"> 890 <el-table-column prop="tableName" label="表名称" width="180">
690 <template #header> 891 <template #header>
...@@ -754,31 +955,31 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -754,31 +955,31 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
754 </template> 955 </template>
755 </el-table-column> 956 </el-table-column>
756 <!-- 源数据库 --> 957 <!-- 源数据库 -->
757 <el-table-column prop="sourceDatabase" label="源数据库" width="150"> 958 <el-table-column prop="databaseChName" label="源数据库" width="150">
758 <template #default="scope"> 959 <template #default="scope">
759 {{ scope.row.sourceDatabase ? scope.row.sourceDatabase : '--' }} 960 {{ scope.row.databaseChName ? scope.row.databaseChName : '--' }}
760 </template> 961 </template>
761 </el-table-column> 962 </el-table-column>
762 <!-- 源数据表 --> 963 <!-- 源数据表 -->
763 <el-table-column prop="sourceTableName" label="源数据表" width="150"> 964 <el-table-column prop="tableName" label="源数据表" width="150">
764 <template #default="scope"> 965 <template #default="scope">
765 {{ scope.row.sourceTableName ? scope.row.sourceTableName : '--' }} 966 {{ scope.row.tableName ? scope.row.tableName : '--' }}
766 </template> 967 </template>
767 </el-table-column> 968 </el-table-column>
768 <!-- 源字段中文 --> 969 <!-- 源字段中文 -->
769 <el-table-column prop="sourceFieldChName" label="源字段中文" width="150"> 970 <el-table-column prop="fieldChName" label="源字段中文" width="150">
770 <template #default="scope"> 971 <template #default="scope">
771 {{ scope.row.sourceFieldChName ? scope.row.sourceFieldChName : '--' }} 972 {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
772 </template> 973 </template>
773 </el-table-column> 974 </el-table-column>
774 <!-- 源字段英文 --> 975 <!-- 源字段英文 -->
775 <el-table-column prop="sourceFieldName" label="源字段英文" width="150"> 976 <el-table-column prop="fieldName" label="源字段英文" width="150">
776 <template #default="scope"> 977 <template #default="scope">
777 <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} --> 978 <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} -->
778 979
779 <span v-if="!scope.row.isEdit || !editableFields.sourceFieldName">{{ scope.row.sourceFieldName ? 980 <span v-if="!scope.row.isEdit || !editableFields.fieldName">{{ scope.row.fieldName ?
780 scope.row.sourceFieldName : '--' }}</span> 981 scope.row.fieldName : '--' }}</span>
781 <el-input v-else v-model="scope.row.sourceFieldName" placeholder="请输入长度" /> 982 <el-input v-else v-model="scope.row.fieldName" placeholder="请输入长度" />
782 </template> 983 </template>
783 </el-table-column> 984 </el-table-column>
784 <!-- 源端字段 fieldType fieldTypeProps--> 985 <!-- 源端字段 fieldType fieldTypeProps-->
...@@ -792,7 +993,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -792,7 +993,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
792 </el-select> 993 </el-select>
793 </div> 994 </div>
794 <div v-else> 995 <div v-else>
795 {{ fieldData.find(item => item.value === scope.row.fieldType)?.label || '--' }} 996 {{ fieldData ? fieldData.find(item => item.value === scope.row.fieldType)?.label : '--' }}
796 </div> 997 </div>
797 </template> 998 </template>
798 </el-table-column> 999 </el-table-column>
...@@ -897,17 +1098,6 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -897,17 +1098,6 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
897 <!-- 操作列 --> 1098 <!-- 操作列 -->
898 <el-table-column label="操作" width="100" align="center" fixed="right"> 1099 <el-table-column label="操作" width="100" align="center" fixed="right">
899 <template #default="scope"> 1100 <template #default="scope">
900
901 <!-- <el-button v-if="!scope.row.isEdit" type="primary" size="small" @click="editRow(scope.row)">
902 编辑
903 </el-button> -->
904 <!-- <el-button v-else type="success" size="small" @click="saveRow(scope.row)">
905 保存
906 </el-button>
907
908 <el-button type="danger" size="small" @click="deleteRow(scope.$index)">
909 删除
910 </el-button> -->
911 <span class="text_btn" v-if="!scope.row.isEdit" @click="editRow(scope.row)">编辑</span> 1101 <span class="text_btn" v-if="!scope.row.isEdit" @click="editRow(scope.row)">编辑</span>
912 <span class="text_btn" v-else @click="saveRow(scope.row)">保存</span> 1102 <span class="text_btn" v-else @click="saveRow(scope.row)">保存</span>
913 <el-divider direction="vertical" /> 1103 <el-divider direction="vertical" />
...@@ -918,14 +1108,14 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -918,14 +1108,14 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
918 </div> 1108 </div>
919 </div> 1109 </div>
920 </div> 1110 </div>
921 <div class="bottom_tool_wrap"> 1111 <div class="bottom_tool_wrap" v-show="!(route.query.editOpt && route.query.editOpt === '1')">
922 <template v-if="stepsInfo.step == 0"> 1112 <template v-if="stepsInfo.step == 0">
923 <el-button type="primary" @click="nextStep">下一步</el-button> 1113 <el-button type="primary" @click="nextStep">下一步</el-button>
924 </template> 1114 </template>
925 <template v-else> 1115 <template v-else>
926 <el-button @click="previousStep">上一步</el-button> 1116 <el-button @click="previousStep">上一步</el-button>
927 <el-button type="primary" @click="submitAsDraft">保存为草稿</el-button> 1117 <el-button type="primary" @click="submitAsDraft" :loading="saveBtnDraft">保存为草稿</el-button>
928 <el-button type="primary" @click="submit" v-loading="saveBtn">提交</el-button> 1118 <el-button type="primary" @click="submit" :loading="saveBtn">提交</el-button>
929 </template> 1119 </template>
930 </div> 1120 </div>
931 <Dialog_form :dialogConfigInfo="newCreateSqlDialogInfo" /> 1121 <Dialog_form :dialogConfigInfo="newCreateSqlDialogInfo" />
...@@ -949,6 +1139,11 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -949,6 +1139,11 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
949 .content_main { 1139 .content_main {
950 height: calc(100% - 40px); 1140 height: calc(100% - 40px);
951 1141
1142 .edit-btn-wrap {
1143 display: flex;
1144 padding: 16px 16px 0 16px;
1145 }
1146
952 .second-step-content { 1147 .second-step-content {
953 height: calc(100% - 80px); 1148 height: calc(100% - 80px);
954 width: 100%; 1149 width: 100%;
......
...@@ -33,9 +33,10 @@ import { ...@@ -33,9 +33,10 @@ import {
33 getSubjectTableDetail, 33 getSubjectTableDetail,
34 checkSubjectTableData 34 checkSubjectTableData
35 } from "@/api/modules/dataCatalogService"; 35 } from "@/api/modules/dataCatalogService";
36 import { getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList } from "@/api/modules/dataInventory"; 36 import { getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList, saveDbDirTable } from "@/api/modules/dataInventory";
37 import { useDefault } from "@/hooks/useDefault"; 37 import { useDefault } from "@/hooks/useDefault";
38 import uploadExcelFile from "./components/uploadExcelFile.vue"; 38 import uploadExcelFile from "./components/uploadExcelFile.vue";
39 import { add } from "lodash-es";
39 40
40 const userStore = useUserStore(); 41 const userStore = useUserStore();
41 const dataCatalogStore = useDataCatalogStore(); 42 const dataCatalogStore = useDataCatalogStore();
...@@ -63,6 +64,7 @@ const tableCreateInfo: Ref<any> = ref({ ...@@ -63,6 +64,7 @@ const tableCreateInfo: Ref<any> = ref({
63 { 64 {
64 //数据库表信息。 65 //数据库表信息。
65 dataSourceGuid: '', 66 dataSourceGuid: '',
67 databaseChName: route.query.databaseChName,
66 dataServerName: "", 68 dataServerName: "",
67 dataServerChName: "", 69 dataServerChName: "",
68 enName: "", 70 enName: "",
...@@ -161,10 +163,10 @@ const handleClassifyChange = (row, value) => { ...@@ -161,10 +163,10 @@ const handleClassifyChange = (row, value) => {
161 } 163 }
162 }); 164 });
163 console.log("选中的节点信息:", selectedNode); 165 console.log("选中的节点信息:", selectedNode);
164 row.classifyName = selectedNode.classifyName; // 假设树节点的 `label` 是分类名 166 row.classifyDetailName = selectedNode.classifyName; // 假设树节点的 `label` 是分类名
165 } else { 167 } else {
166 console.error("未找到对应的节点"); 168 console.error("未找到对应的节点");
167 row.classifyName = ""; // 重置分类名 169 row.classifyDetailName = ""; // 重置分类名
168 } 170 }
169 }; 171 };
170 const getTreeNode = (tree, value) => { 172 const getTreeNode = (tree, value) => {
...@@ -211,16 +213,16 @@ const nextStep = () => { ...@@ -211,16 +213,16 @@ const nextStep = () => {
211 tableCreateInfo.value.isSync = 'Y'; 213 tableCreateInfo.value.isSync = 'Y';
212 } 214 }
213 stepsInfo.value.step = 1; 215 stepsInfo.value.step = 1;
214 getDictionaryList(); 216 // getDictionaryList();
215 getDimListData(); 217 // getDimListData();
216 if (!fieldTypes.value.length) { 218 if (!fieldTypes.value.length) {
217 getFieldTypeList(); 219 getFieldTypeList();
218 getCharacterListData(); 220 // getCharacterListData();
219 } 221 }
220 if (!databaseList.value.length) { 222 if (!databaseList.value.length) {
221 getDatabaseList(); 223 getDatabaseList();
222 } 224 }
223 getDomainDetail(subjectDomainGuid.value); 225 // getDomainDetail(subjectDomainGuid.value);
224 if (!tableCreateInfo.value.tableFields.length) { 226 if (!tableCreateInfo.value.tableFields.length) {
225 getSubjectField(); 227 getSubjectField();
226 } 228 }
...@@ -428,7 +430,7 @@ onActivated(() => { ...@@ -428,7 +430,7 @@ onActivated(() => {
428 document.title = tab.meta.title; 430 document.title = tab.meta.title;
429 } 431 }
430 } 432 }
431 getDomainDetail(subjectDomainGuid.value); 433 // getDomainDetail(subjectDomainGuid.value);
432 } 434 }
433 }); 435 });
434 436
...@@ -461,19 +463,19 @@ watch(() => tableStandardDetail.value, (val) => { ...@@ -461,19 +463,19 @@ watch(() => tableStandardDetail.value, (val) => {
461 }); 463 });
462 464
463 465
464 const getDomainDetail = (domainGuid) => { 466 // const getDomainDetail = (domainGuid) => {
465 getSubjectDomainDetail(domainGuid).then((res: any) => { 467 // getSubjectDomainDetail(domainGuid).then((res: any) => {
466 if (res.code == proxy.$passCode) { 468 // if (res.code == proxy.$passCode) {
467 tableStandardGuid.value = res.data.tableStandardGuid || ''; 469 // tableStandardGuid.value = res.data.tableStandardGuid || '';
468 fieldStandardSetGuids.value = res.data.fieldStandardSetGuids || []; 470 // fieldStandardSetGuids.value = res.data.fieldStandardSetGuids || [];
469 standardSetGuids.value = res.data.fieldStandardSetGuids || []; 471 // standardSetGuids.value = res.data.fieldStandardSetGuids || [];
470 getFieldStandardOptions(fieldStandardSetGuids.value || []); 472 // getFieldStandardOptions(fieldStandardSetGuids.value || []);
471 isOpenStandard.value = res.data.isOpenStandard === 'Y'; 473 // isOpenStandard.value = res.data.isOpenStandard === 'Y';
472 } else { 474 // } else {
473 ElMessage.error(res.msg); 475 // ElMessage.error(res.msg);
474 } 476 // }
475 }); 477 // });
476 } 478 // }
477 479
478 const getFieldStandardOptions = (guids) => { 480 const getFieldStandardOptions = (guids) => {
479 if (!guids?.length) { 481 if (!guids?.length) {
...@@ -1193,7 +1195,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -1193,7 +1195,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
1193 } 1195 }
1194 1196
1195 /** 保存表 */ 1197 /** 保存表 */
1196 const saveTable = () => { 1198 const saveTable = async () => {
1197 let tableData = tableCreateInfo.value.tableData[0]; 1199 let tableData = tableCreateInfo.value.tableData[0];
1198 if (!tableData.chName) { 1200 if (!tableData.chName) {
1199 ElMessage({ 1201 ElMessage({
...@@ -1359,42 +1361,95 @@ const saveTable = () => { ...@@ -1359,42 +1361,95 @@ const saveTable = () => {
1359 staffGuid: userData.staffGuid 1361 staffGuid: userData.staffGuid
1360 } 1362 }
1361 }) 1363 })
1362 if (!tableCreateInfo.value.guid) { //添加 1364 console.log(addInfo, '--------------------------------------');
1363 fullscreenLoading.value = true; 1365
1364 saveSubjectTable(addInfo).then((res: any) => { 1366 let TepmTableDataDetailInfo = addInfo.subjectFieldAddDTOS.map(item => {
1365 fullscreenLoading.value = false; 1367 return {
1366 if (res.code == proxy.$passCode) { 1368 classifyDetailGuid: item.classifyDetailGuid,
1367 ElMessage.success('手动新建表保存成功!'); 1369 classifyDetailName: item.classifyDetailName,
1368 router.push({ 1370 database: route.query.database,
1369 name: 'dataWarehouse' 1371 databaseChName: route.query.databaseChName,
1370 }); 1372 databaseGuid: route.query.databaseGuid,
1371 dataCatalogStore.set(subjectDomainGuid.value); 1373 dictionaryGuid: item.dictionaryGuid,
1372 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); 1374 dimGuid: item.dimGuid,
1373 } else { 1375 fieldChName: item.fieldChName,
1374 ElMessage.error(res.msg); 1376 fieldGuid: item.fieldGuid,
1375 } 1377 fieldLength: item.fieldLength,
1376 }); 1378 fieldName: item.fieldName,
1377 } else { //更新 1379 fieldPrecision: item.fieldPrecision,
1378 addInfo.guid = tableCreateInfo.value.guid; 1380 fieldType: item.dataType,
1379 addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N'; 1381 gradeDetailGuid: item.gradeDetailGuid,
1380 fullscreenLoading.value = true; 1382 gradeDetailName: item.gradeDetailName,
1381 updateSubjectTable(addInfo).then((res: any) => { 1383 guid: item.guid,
1382 fullscreenLoading.value = false; 1384 isFk: item.isFk,
1383 if (res.code == proxy.$passCode) { 1385 isNotNull: item.isNotNull,
1384 ElMessage.success('编辑更新成功!'); 1386 isPrimary: item.isPrimary,
1385 router.push({ 1387 sortValue: item.sortValue,
1386 name: 'dataWarehouse' 1388 tableChName: addInfo.chName,
1387 }); 1389 tableGuid: route.query.tableGuid || '',
1388 dataCatalogStore.set(subjectDomainGuid.value); 1390 tableName: addInfo.enName,
1389 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); 1391 }
1390 } else { 1392 })
1391 ElMessage.error(res.msg); 1393 const InParams = {
1392 } 1394 guid: '',
1393 }); 1395 cgDirName: '',
1396 dirGuid: '',
1397 tableGuid: route.query.tableGuid || '',
1398 tableName: addInfo.enName,
1399 tableChName: addInfo.chName,
1400 databaseGuid: route.query.databaseGuid || '',
1401 database: route.query.database || '',
1402 databaseChName: addInfo.databaseChName,
1403 foundMode: 2,
1404 isDraft: 'N',
1405 fieldRQVOList: TepmTableDataDetailInfo
1394 } 1406 }
1407 console.log(InParams, '--------------------------------------');
1408 const res: any = await saveDbDirTable(InParams);
1409 if (res.code === proxy.$passCode) {
1410 proxy.$ElMessage.success('保存成功!');
1411 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
1412 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } });
1413 } else {
1414 proxy.$ElMessage.error(res.msg);
1415 }
1416
1417 // if (!tableCreateInfo.value.guid) { //添加
1418 // fullscreenLoading.value = true;
1419 // saveSubjectTable(addInfo).then((res: any) => {
1420 // fullscreenLoading.value = false;
1421 // if (res.code == proxy.$passCode) {
1422 // ElMessage.success('手动新建表保存成功!');
1423 // router.push({
1424 // name: 'dataWarehouse'
1425 // });
1426 // dataCatalogStore.set(subjectDomainGuid.value);
1427 // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1428 // } else {
1429 // ElMessage.error(res.msg);
1430 // }
1431 // });
1432 // } else { //更新
1433 // addInfo.guid = tableCreateInfo.value.guid;
1434 // addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N';
1435 // fullscreenLoading.value = true;
1436 // updateSubjectTable(addInfo).then((res: any) => {
1437 // fullscreenLoading.value = false;
1438 // if (res.code == proxy.$passCode) {
1439 // ElMessage.success('编辑更新成功!');
1440 // router.push({
1441 // name: 'dataWarehouse'
1442 // });
1443 // dataCatalogStore.set(subjectDomainGuid.value);
1444 // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1445 // } else {
1446 // ElMessage.error(res.msg);
1447 // }
1448 // });
1449 // }
1395 }; 1450 };
1396 1451
1397 const saveDraftTable = () => { 1452 const saveDraftTable = async () => {
1398 let tableData = tableCreateInfo.value.tableData[0]; 1453 let tableData = tableCreateInfo.value.tableData[0];
1399 if (!tableData.chName) { 1454 if (!tableData.chName) {
1400 ElMessage({ 1455 ElMessage({
...@@ -1430,39 +1485,89 @@ const saveDraftTable = () => { ...@@ -1430,39 +1485,89 @@ const saveDraftTable = () => {
1430 staffGuid: userData.staffGuid 1485 staffGuid: userData.staffGuid
1431 } 1486 }
1432 }) 1487 })
1433 if (!tableCreateInfo.value.guid) { //添加 1488
1434 fullscreenLoading.value = true; 1489 let TepmTableDataDetailInfo = addInfo.subjectFieldAddDTOS.map(item => {
1435 saveSubjectTableDraft(addInfo).then((res: any) => { 1490 return {
1436 fullscreenLoading.value = false; 1491 classifyDetailGuid: item.classifyDetailGuid,
1437 if (res.code == proxy.$passCode) { 1492 classifyDetailName: item.classifyDetailName,
1438 ElMessage.success('手动新建表保存草稿成功!'); 1493 database: route.query.database,
1439 router.push({ 1494 databaseChName: route.query.databaseChName,
1440 name: 'dataWarehouse' 1495 databaseGuid: route.query.databaseGuid,
1441 }); 1496 dictionaryGuid: item.dictionaryGuid,
1442 dataCatalogStore.set(subjectDomainGuid.value); 1497 dimGuid: item.dimGuid,
1443 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath)); 1498 fieldChName: item.fieldChName,
1444 } else { 1499 fieldGuid: item.fieldGuid,
1445 ElMessage.error(res.msg); 1500 fieldLength: item.fieldLength,
1446 } 1501 fieldName: item.fieldName,
1447 }) 1502 fieldPrecision: item.fieldPrecision,
1503 fieldType: item.dataType,
1504 gradeDetailGuid: item.gradeDetailGuid,
1505 gradeDetailName: item.gradeDetailName,
1506 guid: item.guid,
1507 isFk: item.isFk,
1508 isNotNull: item.isNotNull,
1509 isPrimary: item.isPrimary,
1510 sortValue: item.sortValue,
1511 tableChName: addInfo.chName,
1512 tableGuid: route.query.tableGuid || '',
1513 tableName: addInfo.enName,
1514 }
1515 })
1516 const InParams = {
1517 guid: '',
1518 cgDirName: '',
1519 dirGuid: '',
1520 tableGuid: route.query.tableGuid || '',
1521 tableName: addInfo.enName,
1522 tableChName: addInfo.chName,
1523 databaseGuid: route.query.databaseGuid || '',
1524 database: route.query.database || '',
1525 databaseChName: addInfo.databaseChName,
1526 foundMode: 2,
1527 isDraft: 'Y',
1528 fieldRQVOList: TepmTableDataDetailInfo
1529 }
1530 const res: any = await saveDbDirTable(InParams);
1531 if (res.code === proxy.$passCode) {
1532 proxy.$ElMessage.success('保存草稿成功!');
1533 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
1534 router.push({ name: 'classifyGradeCatalogue', query: { reload: 'true' } });
1448 } else { 1535 } else {
1449 addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N'; 1536 proxy.$ElMessage.error(res.msg);
1450 addInfo.guid = tableCreateInfo.value.guid;
1451 fullscreenLoading.value = true;
1452 updateSubjectTableDraft(addInfo).then((res: any) => {
1453 fullscreenLoading.value = false;
1454 if (res.code == proxy.$passCode) {
1455 ElMessage.success('编辑保存草稿成功!');
1456 router.push({
1457 name: 'dataWarehouse'
1458 });
1459 dataCatalogStore.set(subjectDomainGuid.value);
1460 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1461 } else {
1462 ElMessage.error(res.msg);
1463 }
1464 });
1465 } 1537 }
1538 // if (!tableCreateInfo.value.guid) { //添加
1539 // fullscreenLoading.value = true;
1540 // saveSubjectTableDraft(addInfo).then((res: any) => {
1541 // fullscreenLoading.value = false;
1542 // if (res.code == proxy.$passCode) {
1543 // ElMessage.success('手动新建表保存草稿成功!');
1544 // router.push({
1545 // name: 'dataWarehouse'
1546 // });
1547 // dataCatalogStore.set(subjectDomainGuid.value);
1548 // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1549 // } else {
1550 // ElMessage.error(res.msg);
1551 // }
1552 // })
1553 // } else {
1554 // addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N';
1555 // addInfo.guid = tableCreateInfo.value.guid;
1556 // fullscreenLoading.value = true;
1557 // updateSubjectTableDraft(addInfo).then((res: any) => {
1558 // fullscreenLoading.value = false;
1559 // if (res.code == proxy.$passCode) {
1560 // ElMessage.success('编辑保存草稿成功!');
1561 // router.push({
1562 // name: 'dataWarehouse'
1563 // });
1564 // dataCatalogStore.set(subjectDomainGuid.value);
1565 // userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1566 // } else {
1567 // ElMessage.error(res.msg);
1568 // }
1569 // });
1570 // }
1466 }; 1571 };
1467 1572
1468 const batchAddDialogBtnClick = (btn, info) => { 1573 const batchAddDialogBtnClick = (btn, info) => {
...@@ -1541,17 +1646,18 @@ const tableSelectFields = computed(() => { ...@@ -1541,17 +1646,18 @@ const tableSelectFields = computed(() => {
1541 height: 'auto', 1646 height: 'auto',
1542 display: 'inline-block', 1647 display: 'inline-block',
1543 }"> 1648 }">
1544 <el-table-column prop="dataSourceGuid" label="数据源" width="200px" align="left" show-overflow-tooltip> 1649 <el-table-column prop="databaseChName" label="数据源" width="200px" align="left" show-overflow-tooltip>
1545 <template #header> 1650 <template #header>
1546 <span>数据源</span> 1651 <span>数据源</span>
1547 <span style="color:red;margin-left: 2px;">*</span> 1652 <span style="color:red;margin-left: 2px;">*</span>
1548 </template> 1653 </template>
1549 <template #default="scope"> 1654 <template #default="scope">
1550 <el-select v-model="scope.row['dataSourceGuid']" placeholder="请选择" :disabled="tableCreateInfo.isCreate" 1655 <!-- <el-select v-model="scope.row['dataSourceGuid']" placeholder="请选择" :disabled="tableCreateInfo.isCreate"
1551 @change="(val) => selectDatabaseChange(val)" clearable filterable> 1656 @change="(val) => selectDatabaseChange(val)" clearable filterable>
1552 <el-option v-for="opt in databaseList" :key="opt['guid']" :label="opt['databaseNameZh']" 1657 <el-option v-for="opt in databaseList" :key="opt['guid']" :label="opt['databaseNameZh']"
1553 :value="opt['guid']" /> 1658 :value="opt['guid']" />
1554 </el-select> 1659 </el-select> -->
1660 <el-input v-model.trim="scope.row['databaseChName']" :disabled="true" />
1555 </template> 1661 </template>
1556 </el-table-column> 1662 </el-table-column>
1557 <el-table-column prop="enName" label="数据库表" width="200px" align="left" show-overflow-tooltip> 1663 <el-table-column prop="enName" label="数据库表" width="200px" align="left" show-overflow-tooltip>
...@@ -1654,12 +1760,12 @@ const tableSelectFields = computed(() => { ...@@ -1654,12 +1760,12 @@ const tableSelectFields = computed(() => {
1654 <el-input v-model.trim="scope.row['description']" /> 1760 <el-input v-model.trim="scope.row['description']" />
1655 </template> 1761 </template>
1656 </el-table-column> 1762 </el-table-column>
1657 <el-table-column label="操作" width="100px" align="left" fixed="right" show-overflow-tooltip> 1763 <!-- <el-table-column label="操作" width="100px" align="left" fixed="right" show-overflow-tooltip>
1658 <template #default="scope"> 1764 <template #default="scope">
1659 <span class="text_btn" :class="{ 'is-disabled': tableCreateInfo.isCreate }" @click="handleClickExpand()" 1765 <span class="text_btn" :class="{ 'is-disabled': tableCreateInfo.isCreate }" @click="handleClickExpand()"
1660 v-preReClick>扩展属性</span> 1766 v-preReClick>扩展属性</span>
1661 </template> 1767 </template>
1662 </el-table-column> 1768 </el-table-column> -->
1663 </el-table> 1769 </el-table>
1664 <div class="tools_btns"> 1770 <div class="tools_btns">
1665 <el-button v-if="fieldStandardSetGuids?.length" type="primary" @click="batchAddFields" 1771 <el-button v-if="fieldStandardSetGuids?.length" type="primary" @click="batchAddFields"
...@@ -1734,7 +1840,7 @@ const tableSelectFields = computed(() => { ...@@ -1734,7 +1840,7 @@ const tableSelectFields = computed(() => {
1734 <el-option v-for="opt in fieldTypes" :key="opt['value']" :label="opt['label']" 1840 <el-option v-for="opt in fieldTypes" :key="opt['value']" :label="opt['label']"
1735 :value="opt['value']" /> 1841 :value="opt['value']" />
1736 </el-select> 1842 </el-select>
1737 <span v-else>{{ fieldTypes.find(f => f.paramValue === scope.row["dataType"])?.paramName || "--" 1843 <span v-else>{{ fieldTypes.find(f => f.value === scope.row["dataType"])?.label || "--"
1738 }}</span> 1844 }}</span>
1739 </template> 1845 </template>
1740 </el-table-column> 1846 </el-table-column>
...@@ -1816,7 +1922,7 @@ const tableSelectFields = computed(() => { ...@@ -1816,7 +1922,7 @@ const tableSelectFields = computed(() => {
1816 </el-tree-select> 1922 </el-tree-select>
1817 </div> 1923 </div>
1818 <!-- 显示treeSelectOptions classifyDetailGuid所在itemclassifyName--> 1924 <!-- 显示treeSelectOptions classifyDetailGuid所在itemclassifyName-->
1819 <div v-else>{{ scope.row.classifyName || '--' }}</div> 1925 <div v-else>{{ scope.row.classifyDetailName || '--' }}</div>
1820 </template> 1926 </template>
1821 </el-table-column> 1927 </el-table-column>
1822 1928
...@@ -1862,8 +1968,8 @@ const tableSelectFields = computed(() => { ...@@ -1862,8 +1968,8 @@ const tableSelectFields = computed(() => {
1862 <el-button type="primary" @click="nextStep">下一步</el-button> 1968 <el-button type="primary" @click="nextStep">下一步</el-button>
1863 </template> 1969 </template>
1864 <template v-else> 1970 <template v-else>
1865 <el-checkbox v-model="tableCreateInfo.isSync" true-label="Y" :disabled="!fileTableData?.length" 1971 <!-- <el-checkbox v-model="tableCreateInfo.isSync" true-label="Y" :disabled="!fileTableData?.length"
1866 false-label="N">同步数据(说明:勾选代表建表同时写入表格数据。)</el-checkbox> 1972 false-label="N">同步数据(说明:勾选代表建表同时写入表格数据。)</el-checkbox> -->
1867 <el-button @click="previousStep">上一步</el-button> 1973 <el-button @click="previousStep">上一步</el-button>
1868 <el-button type="primary" @click="saveDraftTable">保存为草稿</el-button> 1974 <el-button type="primary" @click="saveDraftTable">保存为草稿</el-button>
1869 <el-button type="primary" @click="saveTable">提交</el-button> 1975 <el-button type="primary" @click="saveTable">提交</el-button>
......
...@@ -104,7 +104,7 @@ const tableInfo = ref({ ...@@ -104,7 +104,7 @@ const tableInfo = ref({
104 actionInfo: { 104 actionInfo: {
105 label: "操作", 105 label: "操作",
106 type: "btn", 106 type: "btn",
107 width: 210, 107 width: 230,
108 fixed: 'right', 108 fixed: 'right',
109 btns: (scope) => { 109 btns: (scope) => {
110 const row = scope.row 110 const row = scope.row
...@@ -114,7 +114,7 @@ const tableInfo = ref({ ...@@ -114,7 +114,7 @@ const tableInfo = ref({
114 } else { 114 } else {
115 btnsArr.splice(0, 0, { label: "立即执行", value: "carry", disabled: row.taskState === 0 || row.execState == 1 }) 115 btnsArr.splice(0, 0, { label: "立即执行", value: "carry", disabled: row.taskState === 0 || row.execState == 1 })
116 } 116 }
117 // btnsArr.push({ label: "编辑", value: "edit", disabled: row.taskState === 1 || row.isCarry || row.execState == 1 }); 117 btnsArr.push({ label: "编辑", value: "edit", disabled: row.taskState === 1 || row.isCarry || row.execState == 1 });
118 btnsArr.push({ label: "删除", value: "delete", disabled: row.isCarry || row.taskState === 1 || row.execState == 1 }); 118 btnsArr.push({ label: "删除", value: "delete", disabled: row.isCarry || row.taskState === 1 || row.execState == 1 });
119 btnsArr.push({ label: "执行日志", value: "log" }); 119 btnsArr.push({ label: "执行日志", value: "log" });
120 return btnsArr 120 return btnsArr
...@@ -472,19 +472,18 @@ const setDetailInfo = (row) => { ...@@ -472,19 +472,18 @@ const setDetailInfo = (row) => {
472 } 472 }
473 473
474 const getDataSourceList = () => { 474 const getDataSourceList = () => {
475 // TODO 475 getDatabase({ connectStatus: 1 }).then((res: any) => {
476 // getDatabase({ connectStatus: 1 }).then((res: any) => { 476 if (res.code == proxy.$passCode) {
477 // if (res.code == proxy.$passCode) { 477 dataSourceList.value = res.data || [];
478 // dataSourceList.value = res.data || []; 478 formItems.value[1].options = dataSourceList.value;
479 // formItems.value[1].options = dataSourceList.value; 479 searchItemList.value[1].options = dataSourceList.value;
480 // searchItemList.value[1].options = dataSourceList.value; 480 } else {
481 // } else { 481 proxy.$ElMessage({
482 // proxy.$ElMessage({ 482 type: "error",
483 // type: "error", 483 message: res.msg,
484 // message: res.msg, 484 });
485 // }); 485 }
486 // } 486 })
487 // })
488 } 487 }
489 488
490 const radioGroupChange = (val, info) => { 489 const radioGroupChange = (val, info) => {
...@@ -598,7 +597,7 @@ onBeforeMount(() => { ...@@ -598,7 +597,7 @@ onBeforeMount(() => {
598 <!-- 头部搜索 --> 597 <!-- 头部搜索 -->
599 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" :init="false" /> 598 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" :init="false" />
600 <div class="tools_btns"> 599 <div class="tools_btns">
601 <!-- <el-button type="primary" @click="loadDrawer">新建</el-button> --> 600 <el-button type="primary" @click="loadDrawer">新建</el-button>
602 <el-button @click="importMeta">导入</el-button> 601 <el-button @click="importMeta">导入</el-button>
603 </div> 602 </div>
604 </div> 603 </div>
......
...@@ -60,8 +60,8 @@ const tabsInfo = ref({ ...@@ -60,8 +60,8 @@ const tabsInfo = ref({
60 activeName: '', 60 activeName: '',
61 tabs: [ 61 tabs: [
62 { label: '基础信息', name: 'first' }, 62 { label: '基础信息', name: 'first' },
63 // / { label: '数据血缘', name: 'second' }, 63 { label: '数据血缘', name: 'second' },
64 //{ label: '变更记录', name: 'third' } 64 { label: '变更记录', name: 'third' }
65 ] 65 ]
66 }) 66 })
67 /** 切换布局 */ 67 /** 切换布局 */
...@@ -192,13 +192,13 @@ const tabsPaneMap = ref({ ...@@ -192,13 +192,13 @@ const tabsPaneMap = ref({
192 tableInfo: fieldTableInfo.value, 192 tableInfo: fieldTableInfo.value,
193 show: true 193 show: true
194 }, 194 },
195 // { 195 {
196 // title: '索引信息', 196 title: '索引信息',
197 // type: 'table', 197 type: 'table',
198 // isIndex: true, 198 isIndex: true,
199 // tableInfo: indexTableInfo.value, 199 tableInfo: indexTableInfo.value,
200 // show: true 200 show: true
201 // }, 201 },
202 ], 202 ],
203 second: [ 203 second: [
204 { 204 {
...@@ -310,10 +310,10 @@ const lineageDataLoading = ref(true); ...@@ -310,10 +310,10 @@ const lineageDataLoading = ref(true);
310 const getDetailInfo = () => { 310 const getDetailInfo = () => {
311 getSheetDetail() 311 getSheetDetail()
312 getSheetField() 312 getSheetField()
313 // getSheetKeys() 313 getSheetKeys()
314 logPage.value.curr = 1 314 logPage.value.curr = 1
315 //getSheetLog(); 315 getSheetLog();
316 // getTableLineageMap(); 316 getTableLineageMap();
317 } 317 }
318 318
319 const getSheetDetail = () => { 319 const getSheetDetail = () => {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!