f278ba6b by xukangle

fix:修改分级分类标准的相关问题

1 parent 751d9bbf
...@@ -36,6 +36,9 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory ...@@ -36,6 +36,9 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
36 # 数据字典接口地址 36 # 数据字典接口地址
37 VITE_APP_CONFIG_URL = 'ms-daop-configure-service' 37 VITE_APP_CONFIG_URL = 'ms-daop-configure-service'
38 38
39 # 文件上传下载接口地址
40 VITE_APP_COMMON_URL = 'ms-daop-common-service'
41
39 42
40 #门户接口 43 #门户接口
41 VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal 44 VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal
......
1 import request from "@/utils/request";
2
3 /** 数仓目录的类型 */
4 export const enum clickTreeNodeType {
5 CATALOG = 'catalog',
6 LEVEL = 'level',
7 SUBJECTTABLE = 'subjectTable'
8 }
9
10 /** 分层属性类型列表 */
11 export const layereAttributeList = [{
12 value: 1,
13 label: '主题表层'
14 }, {
15 value: 2,
16 label: '维度层'
17 }, {
18 value: 4,
19 label: '主数据层'
20 }, {
21 value: 3,
22 label: '未分类'
23 }];
24
25 /** 表分类类型 */
26 export const tableCategoryList = [
27 {
28 value: 1,
29 label: "明细表",
30 },
31 {
32 value: 2,
33 label: "汇总表",
34 },
35 {
36 value: 3,
37 label: "应用表",
38 },
39 {
40 value: 6,
41 label: "业务表",
42 },
43 // {
44 // value: 4,
45 // label: "维度表",
46 // },
47 // {
48 // value: 5,
49 // label: "缓慢变化维",
50 // }
51 ];
52
53 /** 同步策略 */
54 export const syncPolicys = [
55 {
56 value: 1,
57 label: "实时",
58 },
59 {
60 value: 2,
61 label: "增量",
62 },
63 {
64 value: 3,
65 label: "全量",
66 },
67 {
68 value: 4,
69 label: "增量加更新",
70 },
71 ];
72
73 /** 维表类型 */
74 export const dimTypeList = [{
75 label: "列表",
76 value: 1,
77 },
78 {
79 label: "层级",
80 value: 2,
81 },
82 {
83 label: "螺旋",
84 value: 3,
85 },
86 {
87 label: "通用",
88 value: 4,
89 }];
90
91 /** 表模型分类 */
92 export const tableModels = [
93 {
94 label: "主键模型",
95 value: 1,
96 },
97 {
98 label: "聚合模型",
99 value: 2,
100 },
101 {
102 label: "明细模型",
103 value: 3,
104 }
105 ];
106
107 /** 聚合方式 */
108 export const aggMethodList = [{
109 value: 'SUM',
110 }, {
111 value: 'MAX'
112 }, {
113 value: 'MIN'
114 }, {
115 value: 'REPLACE'
116 }, {
117 value: 'REPLACE_IF_NOT_NULL'
118 }, {
119 value: 'HLL_UNION'
120 }, {
121 value: 'BITMAP_UNION'
122 }];
123
124 /** 数仓目录树列表查询 */
125 export const getDataWareCatalogList = (params) => request({
126 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-directory/tree-list`,
127 method: 'post',
128 data: params
129 })
130
131 /** 获取数仓目录对应的所有分层数据 */
132 export const getDataWareLevelData = (params) => request({
133 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-directory/list`,
134 method: 'post',
135 data: params
136 })
137
138 /** 删除数仓分层 */
139 export const deleteDataWareLevel = (guid) => request({
140 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-directory/del?guid=` + guid,
141 method: 'delete'
142 })
143
144 /** 修改数仓分层 */
145 export const updateDataWareLevel = (params) => request({
146 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-directory/update`,
147 method: 'put',
148 data: params
149 })
150
151 // 新增数仓分层。
152 export const addDataWareLevel = (params) => request({
153 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-directory/add`,
154 method: 'post',
155 data: params
156 });
157
158 /** 获取主题域对应的所有分层数据 */
159 export const getSubjectDomainByLevelData = (params) => request({
160 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject-domain/list`,
161 method: 'post',
162 data: params
163 })
164
165 /** 删除主题域 */
166 export const deleteSubjectDomain = (guids) => request({
167 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject-domain/del`,
168 method: 'delete',
169 data: guids
170 })
171
172 // 详情
173 export const getSubjectDomainDetail = (params) => request({
174 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject-domain/detail/${params}`,
175 method: 'get'
176 })
177
178 /** 修改主题域 */
179 export const updateSubjectDomain = (params) => request({
180 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject-domain/update`,
181 method: 'put',
182 data: params
183 })
184
185 // 新增主题域
186 export const addSubjectDomain = (params) => request({
187 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject-domain/add`,
188 method: 'post',
189 data: params
190 })
191
192 /** 获取主题域对应的主题表数据 */
193 export const getSubjectTable = (params) => request({
194 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/page-list`,
195 method: 'post',
196 data: params
197 })
198
199 /** 删除主题表 */
200 export const deleteSubjectTable = (guids) => request({
201 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/del`,
202 method: 'delete',
203 data: guids
204 })
205
206 /** 获取数据库表列表 */
207 // export const getDatabase = (params) => request({
208 // url: `${import.meta.env.VITE_APP_API_BASEURL}/data-source/get-source-list`,
209 // method: 'post',
210 // data: params
211 // })
212 export const getDatabase = (params) => request({
213 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/data-source/list?execGuid=${params.execGuid}`,
214 method: 'post',
215 })
216
217 /** 根据选择的连接池获取表列表 */
218 export const getDsTableByDs = (params) => request({
219 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/schema-table-page-list`,
220 method: 'post',
221 data: params
222 })
223
224 /** 获取字典列表 */
225 export const getDictionary = (params) => request({
226 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/list-all?state=1`,
227 method: 'post'
228 })
229
230 /** 获取维度列表 */
231 export const getDimList = () => request({
232 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/get-dim-list`,
233 method: 'get'
234 })
235
236 /** 获取标准集列表 */
237 export const getDataStandardSet = (params) => request({
238 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-standard-set/list-valid`,
239 method: 'post',
240 data: params
241 })
242
243 /** 获取命名标准列表 */
244 export const getTableStandardList = (params) => request({
245 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/table-name-standard/list-standard?standardSetGuid=` + params,
246 method: 'post'
247 })
248
249 /** 获取命名标准详情,用于懒加载的树形选择,显示正确的标签。 */
250 export const getTableStandardDetail = (params) => request({
251 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/table-name-standard/detail/${params}`,
252 method: 'get'
253 })
254
255 /** 获取字段标准列表 */
256 export const getFieldStandardList = (params) => request({
257 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/field-standard/list-standard?standardSetGuid=` + params,
258 method: 'post'
259 })
260
261 /** 获取字段标准层级 */
262 export const getFieldStandardTree = (params) => request({
263 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-standard-set/standard-set-field-list`,
264 method: 'post',
265 data: params
266 });
267
268 /** 根据标准集获取字段标准列表分页。 */
269 export const getFileStandards = (params) => request({
270 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/field-standard/page-list`,
271 method: 'post',
272 data: params
273 })
274
275 /** 保存主题表设置,直接入库 */
276 export const saveSubjectTable = (params) => request({
277 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/add`,
278 method: 'post',
279 data: params
280 })
281
282 /** 更新主题设置,直接入库 */
283 export const updateSubjectTable = (params) => request({
284 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/update`,
285 method: 'put',
286 data: params
287 })
288
289 /** 保存主题表设置,草稿 */
290 export const saveSubjectTableDraft = (params) => request({
291 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/add-draft`,
292 method: 'post',
293 data: params
294 })
295
296 /** 更新主题表设置,草稿 TODO,现在无接口 */
297 export const updateSubjectTableDraft = (params) => request({
298 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/update-draft`,
299 method: 'put',
300 data: params
301 })
302
303 /** 获取主题表详情 */
304 export const getSubjectTableDetail = (params) => request({
305 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/detail/${params}`,
306 method: 'get'
307 })
308 /** 获取主题表详情 */
309 export const getSubjectTableDetail1 = (params) => request({
310 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/change-detail/${params}`,
311 method: 'get'
312 })
313 /** 根据数据表获取前100行数据 */
314 export const getDsData = (params) => request({
315 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/table-data-preview-page-list`,
316 method: 'post',
317 data: params
318 });
319
320 /** 根据数据表获取表结构 */
321 export const getDsTableStructure = (params) => request({
322 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/table-column-list`,
323 method: 'post',
324 data: params
325 });
326
327 /** 查询主题表的数据 */
328 export const queryData = (params) => request({
329 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/subject-data-preview-page-list/${params}`,
330 method: 'get'
331 });
332
333 // 获取数据类型的接口
334 export const getDataTypeList = () => request({
335 url:`${import.meta.env.VITE_APP_API_BASEURL}/data-dict/get-data-list`,
336 method: 'post',
337 data: { paramCode: "DATA_TYPE" }
338 })
339
340 // 获取字符集接口。
341 export const getCharacterList = () => request({
342 url:`${import.meta.env.VITE_APP_API_BASEURL}/data-dict/get-data-list`,
343 method: 'post',
344 data: { paramCode: "mysql_charset" }
345 })
346
347 //已有表新建查询主题表字段
348 export const getSubjectFieldByTables = (params, guid) => request({
349 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/had-new/subject-field-list?subjectDomainGuid=` + guid,
350 method: 'post',
351 data: params
352 });
353
354 //已有表分类查询主题表字段
355 export const getSubjectFieldByTable = (params) => request({
356 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/had-sort/subject-field-list`,
357 method: 'post',
358 data: params
359 });
360
361 // 根据文件新建表查询匹配主题表字段。
362 export const getSubjectFieldByFile = (params, guid) => request({
363 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/subject-field-by-ch-name?subjectDomainGuid=` + guid,
364 method: 'post',
365 data: params
366 });
367
368 //获取主题表字段。
369 export const getSubjectChangingFields = (params) => request({
370 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/changing-fields-table-list`,
371 method: 'post',
372 data: params
373 });
374
375 /** 同步表结构 */
376 export const syncTableStructure = (params) => request({
377 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/synchronization-table-structure`,
378 method: 'post',
379 data: params
380 });
381
382 /** 已有表分类保存 */
383 export const saveSortSubject = (params) => request({
384 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/had-sort/save-subject`,
385 method: 'post',
386 data: params
387 });
388
389 /** 检查主题表是否有数据 */
390 export const checkSubjectTableData = (params) => request({
391 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/is-check-data`,
392 method: 'post',
393 data: params
394 });
395
396 /** 撤销流程。 */
397 // export const cancelSubjectFlow = (params) => request({
398 // url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/cancel-flow`,
399 // method: 'post',
400 // data: params
401 // });
402 /**导入文件 */
403 export const importData = (params) => request({
404 url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/import-data`,
405 method: 'post',
406 data: params
407 });
1 import request from "@/utils/request";
2 //获取下载签名
3 export const getDownFileSignByUrl = (params) => {
4 return request({
5 url: `${
6 import.meta.env.VITE_APP_COMMON_URL
7 }/obs/generate-download-file-signature?fileName=${params.fileName}`,
8 method: "get",
9 });
10 };
11 //obs下载
12 export const obsDownloadRequest = (params) => {
13 return request({
14 withCredentials: false,
15 headers: params.actualSignedRequestHeaders
16 ? {
17 "Content-Type": params.actualSignedRequestHeaders["Content-Type"],
18 }
19 : {},
20 validateStatus: function (status) {
21 return status >= 200;
22 },
23 url: params.signedUrl,
24 responseType: "blob",
25 maxRedirects: 0,
26 data: { unused: 0 },
27 method: "get",
28 });
29 };
30 //获取上传签名
31 export const getUpFileSignByUrl = (params) => {
32 return request({
33 url: `${
34 import.meta.env.VITE_APP_COMMON_URL
35 }/obs/generate-file-signature?fileName=${params.fileName}`,
36 method: "get",
37 });
38 };
39 //obs上传
40 export const obsUploadRequest = (params) => {
41 return request({
42 withCredentials: false,
43 headers: params.actualSignedRequestHeaders ? {
44 "Content-Type": params.actualSignedRequestHeaders[
45 "Content-Type"
46 ]
47 } : {},
48 validateStatus: function (status) {
49 return status >= 200;
50 },
51
52 url: params.signedUrl,
53 method: "put",
54 data: params.file,
55 });
56 };
57 export const getImageContent = (params) => request({
58 url: `${import.meta.env.VITE_APP_COMMON_URL}/obs/view-pic?filePath=${params.split("?")[0]}`,
59 method: 'get',
60 responseType: 'blob'
61 });
...@@ -19,10 +19,15 @@ import Schedule from "../Schedule/index.vue"; ...@@ -19,10 +19,15 @@ import Schedule from "../Schedule/index.vue";
19 import { setFormFields, setItemsDisabled, getDownloadUrl, download } from '@/utils/common'; 19 import { setFormFields, setItemsDisabled, getDownloadUrl, download } from '@/utils/common';
20 import { ElMessage, ElMessageBox } from 'element-plus'; 20 import { ElMessage, ElMessageBox } from 'element-plus';
21 import useUserStore from "@/store/modules/user"; 21 import useUserStore from "@/store/modules/user";
22 // import {
23 // getFileUrl,
24 // getImageContent
25 // } from '@/api/modules/queryService';
22 import { 26 import {
23 getFileUrl, 27 getImageContent,
24 getImageContent 28 getUpFileSignByUrl,
25 } from '@/api/modules/queryService'; 29 obsUploadRequest
30 } from "@/api/modules/obsSerivice";
26 import { Editor, EditorExpose } from '@/components/Editor' 31 import { Editor, EditorExpose } from '@/components/Editor'
27 32
28 const userStore = useUserStore() 33 const userStore = useUserStore()
...@@ -444,29 +449,35 @@ const uploadFile = (file, item) => { ...@@ -444,29 +449,35 @@ const uploadFile = (file, item) => {
444 return Promise.resolve(); 449 return Promise.resolve();
445 } 450 }
446 ruleFormRef.value?.clearValidate([item.field]); 451 ruleFormRef.value?.clearValidate([item.field]);
447 let formData = new FormData(); 452 // let formData = new FormData();
448 formData.append('file', file.file); 453 // formData.append('file', file.file);
449 formData.append('fileName', file.file.name); 454 // formData.append('fileName', file.file.name);
450 return getFileUrl(formData) 455 return getUpFileSignByUrl({ fileName: file.file.name })
451 .then((res: any) => { 456 .then((res: any) => {
452 if (res.code == '00000') { 457 obsUploadRequest({
453 let fileItem = { 458 signedUrl: res.data.signedUrl,
454 name: file.file.name, 459 file: file.file,
455 url: res.data, 460 actualsignedRequestHeaders: res.data.actualsignedRequestHeaders
456 file: file.file 461 }).then(() => {
457 }; 462 if (res.code == '00000') {
458 if (item.limit === 1) { 463 let fileItem = {
459 formInline.value[item.field] = [fileItem]; 464 name: file.file.name,
465 url: res.data.signedUrl,
466 file: file.file
467 };
468 if (item.limit === 1) {
469 formInline.value[item.field] = [fileItem];
470 } else {
471 formInline.value[item.field].push(fileItem);
472 }
473 ruleFormRef.value?.validateField([item.field]);
474 ElMessage.success('上传成功');
475 emits("uploadFileChange", formInline.value[item.field]);
460 } else { 476 } else {
461 formInline.value[item.field].push(fileItem); 477 uploadRef.value['ref' + item.field].handleRemove(file);
478 ElMessage.error('上传失败,请重新上传!');
462 } 479 }
463 ruleFormRef.value?.validateField([item.field]); 480 })
464 ElMessage.success('上传成功');
465 emits("uploadFileChange", formInline.value[item.field]);
466 } else {
467 uploadRef.value['ref' + item.field].handleRemove(file);
468 ElMessage.error('上传失败,请重新上传!');
469 }
470 }) 481 })
471 .catch(() => { 482 .catch(() => {
472 uploadRef.value['ref' + item.field].handleRemove(file); 483 uploadRef.value['ref' + item.field].handleRemove(file);
......
...@@ -206,7 +206,7 @@ export const getDbDirTreeList = { ...@@ -206,7 +206,7 @@ export const getDbDirTreeList = {
206 return { 206 return {
207 code: '00000', 207 code: '00000',
208 message: '成功', 208 message: '成功',
209 'data|10-30': [{ 209 'data|10-30': {
210 cgDirName: '@cword(3, 5)', 210 cgDirName: '@cword(3, 5)',
211 'children|1-3': [{ 211 'children|1-3': [{
212 databaseGuid: '@guid', 212 databaseGuid: '@guid',
...@@ -218,7 +218,7 @@ export const getDbDirTreeList = { ...@@ -218,7 +218,7 @@ export const getDbDirTreeList = {
218 tableChName: '@cword(3, 5)' 218 tableChName: '@cword(3, 5)'
219 }] 219 }]
220 }] 220 }]
221 }] 221 }
222 } 222 }
223 } 223 }
224 } 224 }
...@@ -616,8 +616,221 @@ export const createTableSql = { ...@@ -616,8 +616,221 @@ export const createTableSql = {
616 } 616 }
617 } 617 }
618 618
619 /** 获取已有数据库目录字段信息 入参是数组
620 export const getDsTableStructures= (data) => request({
621 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guids`,
622 method: 'post',
623 data
624 });
625 * "data": [
626 {
627 "guid": "string",
628 "sourceTableName": "string",
629 "sourceDatabase": "string",
630 "sourceFieldName": "string",
631 "sourceFieldChName": "string",
632 "fieldGuid": "string",
633 "fieldName": "string",
634 "fieldChName": "string",
635 "fieldType": "string",
636 "fieldLength": 0,
637 "fieldPrecision": 0,
638 "dimGuid": "string",
639 "dictionaryGuid": "string",
640 "sortValue": 0,
641 "isPrimary": "string",
642 "isFk": "string",
643 "isNotNull": "string",
644 "classifyDetailGuid": "string",
645 "classifyDetailName": "string",
646 "gradeDetailGuid": "string",
647 "gradeDetailName": "string"
648 }
649 ],
650 */
651
652 // 模拟 getDsTableStructures 接口
653 export const getDsTableStructures = {
654 url: '/mock/db-dir/field/list-by-table-guids',
655 method: 'post',
656 response: ({ body }: { body: any }) => {
657 return {
658 code: '00000',
659 message: '成功',
660 'data|2-5': [
661 {
662 guid: '@guid',
663 sourceTableName: '@cword(3, 5)',
664 sourceDatabase: '@cword(3, 5)',
665 sourceFieldName: '@cword(3, 5)',
666 sourceFieldChName: '@cword(3, 5)',
667 fieldGuid: '@guid',
668 fieldName: '@cword(3, 5)',
669 fieldChName: '@cword(3, 5)',
670 fieldType: '@cword(3, 5)',
671 fieldLength: '@integer(1, 100)',
672 fieldPrecision: '@integer(1, 100)',
673 dimGuid: '@guid',
674 dictionaryGuid: '@guid',
675 sortValue: '@integer(1, 100)',
676 isPrimary: 'Y',
677 isFk: 'Y',
678 isNotNull: 'Y',
679 classifyDetailGuid: () => {
680 return Math.floor(Math.random() * 2) + 3; // 随机生成 3 或 4
681 },
682 classifyDetailName: '@cword(3, 5)',
683 gradeDetailGuid: '@guid',
684 gradeDetailName: '@cword(3, 5)'
685 }
686 ]
687 };
688 }
689 };
690
691 // 模拟 getGradeDetails 接口
692 export const getGradeDetails = {
693 url: '/mock/grade-details',
694 method: 'post',
695 response: ({ body }: { body: any }) => {
696 return {
697 code: '00000',
698 message: '成功',
699 data: [{
700
701 }]
702 };
703 }
704 };
705
706 let currentGuid = 2;
707 // 模拟 getTaskExeTreeList 接口
708 export const getTaskExeTreeList = {
709 url: '/mock/cg-task-exec/classify/tree-list',
710 method: 'get',
711 response: ({ body }: { body: any }) => {
712 return {
713 code: '00000',
714 message: '成功',
715 data: [{
716 "guid": 1,
717 "classifyName": "听参我完",
718 "parentGuid": 1,
719 "gradeGuid":1,
720 "parentGuids": [
721 "39Ec3B98-EA2F-f5FF-Fc3b-EfAfe1fce91C",
722 "14be757b-8f0e-3DB9-5AaE-8cfeC18B2322"
723 ],
724 "children": [
725 {
726 "classifyName": "素新议白",
727 "parentGuid": 4,
728 "gradeGuid":2,
729 "parentGuids": [
730 "de6A2ED4-Dc2f-DBf2-4d14-ceD8fd5BBa7C"
731 ],
732 "children": [
733 {
734 "classifyName": "置表京革",
735 "parentGuid": 5,
736 "gradeGuid":3,
737 "parentGuids": [
738 "E2FAe9b2-3bc3-B6f7-f99a-964C6ae9dFCE",
739 "18EA10f2-7f1a-4ADA-cEba-d1dF44ED74cB"
740 ],
741 "guid": 3
742 }
743 ],
744 "guid": 10
745 }
746 ],
747 },
748 {
749 "guid": 7,
750 "classifyName": "大头儿子",
751 "parentGuid": 1,
752 "gradeGuid":4,
753 "parentGuids": [
754 "39Ec3B98-EA2F-f5FF-Fc3b-EfAfe1fce91C",
755 "14be757b-8f0e-3DB9-5AaE-8cfeC18B2322"
756 ],
757 "children": [
758 {
759 "classifyName": "小头把把",
760 "parentGuid": 4,
761 "gradeGuid":5,
762 "parentGuids": [
763 "de6A2ED4-Dc2f-DBf2-4d14-ceD8fd5BBa7C"
764 ],
765 "children": [
766 {
767 "classifyName": "喜羊羊",
768 "parentGuid": 5,
769 "gradeGuid":6,
770 "parentGuids": [
771 "E2FAe9b2-3bc3-B6f7-f99a-964C6ae9dFCE",
772 "18EA10f2-7f1a-4ADA-cEba-d1dF44ED74cB"
773 ],
774 "guid": 9
775 }
776 ],
777 "guid": 8
778 }
779 ],
780 },
781 ]
782 };
783 }
784 };
785
786 // 模拟 getGradeList 分级接口 用于获取分级列表
787
788 export const getGradeList = {
789 url: '/mock/grade/page-list',
790 method: 'post',
791 response: ({ body }: { body: any }) => {
792 return {
793 code: '00000',
794 message: '成功',
795 data: {
796 records:[{
797 "guid": '1',
798 "name": "一级",
799 "parentGuid": 0,
800 },
801 {
802 "guid": '2',
803 "name": "二级",
804 "parentGuid": 1,
805 },
806 {
807 "guid": '3',
808 "name": "三级",
809 "parentGuid": 2,
810 },
811 {
812 "guid": '4',
813 "name": "四级",
814 "parentGuid": 3,
815 },
816 {
817 "guid": '5',
818 "name": "五级",
819 "parentGuid": 4,
820 },
821 {
822 "guid": '6',
823 "name": "六级",
824 "parentGuid": 5,
825 },
826 ]
827 }}
828 }
829 };
830
831
619 export default [getCgDirTreeList,getCgDirFieldPageList, 832 export default [getCgDirTreeList,getCgDirFieldPageList,
620 getDictionary,saveBizRuleConfig, getDbDirTreeList, 833 getDictionary,saveBizRuleConfig, getDbDirTreeList,
621 getDbDirTablePageList,getDbDirDataSourceList,getDsTableByDs, 834 getDbDirTablePageList,getDbDirDataSourceList,getDsTableByDs,
622 getDsTableStructure,getDbDirFieldPageList,getBizRuleConfigDetail, 835 getDsTableStructure,getDbDirFieldPageList,getBizRuleConfigDetail,
623 updateBizRuleConfig,saveDbDirTable,createTableSql,updateDbDirTable] as MockMethod[] 836 updateBizRuleConfig,saveDbDirTable,createTableSql,updateDbDirTable,getDsTableStructures,getGradeDetails,getTaskExeTreeList,getGradeList] as MockMethod[]
......
...@@ -6,10 +6,9 @@ ...@@ -6,10 +6,9 @@
6 import { ref, onMounted } from "vue"; 6 import { ref, onMounted } from "vue";
7 import useUserStore from "@/store/modules/user"; 7 import useUserStore from "@/store/modules/user";
8 import { useValidator } from '@/hooks/useValidator'; 8 import { useValidator } from '@/hooks/useValidator';
9 import { TableColumnWidth } from '@/utils/enum';
10 import G6 from '@antv/g6'; 9 import G6 from '@antv/g6';
11 import { IGroup, ModelConfig } from '@antv/g6'; 10 import { IGroup, ModelConfig } from '@antv/g6';
12 import { getClassifyGradList, getClassifyTreeList, getGradeList, saveClassify, updateClassify, deleteClassify } from "@/api/modules/dataInventory"; 11 import { getClassifyGradList, getClassifyTreeList, getGradeList, saveClassify, updateClassify, deleteClassify, updateClassifyGrad } from "@/api/modules/dataInventory";
13 12
14 13
15 const { required, orderNum } = useValidator(); 14 const { required, orderNum } = useValidator();
...@@ -30,19 +29,43 @@ const classStandardFormItems = ref([{ ...@@ -30,19 +29,43 @@ const classStandardFormItems = ref([{
30 field: 'classStandardName', 29 field: 'classStandardName',
31 default: router.currentRoute.value.query.classStandardName, 30 default: router.currentRoute.value.query.classStandardName,
32 clearable: true, 31 clearable: true,
33 disabled: true, 32 disabled: false,
34 required: true 33 required: true
35 }, { 34 }, {
35 // label: '分级标准',
36 // type: 'input',
37 // placeholder: '请选择',
38 // field: 'gradeStandard',
39 // default: '',
40 // required: true,
41 // filterable: true,
42 // clearable: true,
43 // disabled: false,
44 // visible: true,
36 label: '分级标准', 45 label: '分级标准',
37 type: 'input', 46 type: 'select',
38 placeholder: '请选择', 47 placeholder: '请选择',
39 field: 'gradeStandard', 48 field: 'gradeStandard',
49 options: [],
50 props: {
51 label: "name",
52 value: "guid",
53 },
54 filterable: true,
55 clearable: true,
40 default: '', 56 default: '',
41 required: true, 57 required: true,
42 filterable: true, 58 block: false,
59 },
60 {
61 label: '分类描述',
62 type: 'textarea',
63 placeholder: '请输入',
64 field: 'description',
65 default: '',
43 clearable: true, 66 clearable: true,
44 disabled: true, 67 required: false,
45 visible: true, 68 block: true
46 }]); 69 }]);
47 70
48 // 定义层级映射1->一级,2->二级,3->三级,4->四级 71 // 定义层级映射1->一级,2->二级,3->三级,4->四级
...@@ -77,7 +100,7 @@ const tableInfo = ref({ ...@@ -77,7 +100,7 @@ const tableInfo = ref({
77 { 100 {
78 label: "最低安全级别参考", field: "name", width: 140, getName: (scope) => { 101 label: "最低安全级别参考", field: "name", width: 140, getName: (scope) => {
79 let dataGrade = scope.row.dataGrade; 102 let dataGrade = scope.row.dataGrade;
80 return dataGrade + '级'; 103 return dataGrade ? dataGrade + '级' : '--';
81 } 104 }
82 }, 105 },
83 { label: "修改人", field: "updateUserName", width: 140 }, 106 { label: "修改人", field: "updateUserName", width: 140 },
...@@ -165,7 +188,7 @@ const classEditFormItems = ref([{ ...@@ -165,7 +188,7 @@ const classEditFormItems = ref([{
165 type: 'select', 188 type: 'select',
166 placeholder: '请选择', 189 placeholder: '请选择',
167 field: 'gradeGuid', 190 field: 'gradeGuid',
168 default: 1, 191 default: '',
169 options: [], //TODO 192 options: [], //TODO
170 props: { 193 props: {
171 label: "name", 194 label: "name",
...@@ -322,7 +345,9 @@ const drawerBtnClick = async (btn, info) => { ...@@ -322,7 +345,9 @@ const drawerBtnClick = async (btn, info) => {
322 const params = { 345 const params = {
323 ...info, 346 ...info,
324 classifyGradeGuid: router.currentRoute.value.query.guid, 347 classifyGradeGuid: router.currentRoute.value.query.guid,
325 guid: currTableInfo.value.guid 348 guid: currTableInfo.value.guid,
349 gradeGuid: info.gradeGuid || '',
350 parentGuid: info.parentGuid || '',
326 } 351 }
327 const res: any = await updateClassify(params); 352 const res: any = await updateClassify(params);
328 if (res.code == proxy.$passCode) { 353 if (res.code == proxy.$passCode) {
...@@ -350,8 +375,10 @@ const getClassifyGradListData = async () => { ...@@ -350,8 +375,10 @@ const getClassifyGradListData = async () => {
350 const res: any = await getClassifyGradList(refGradePageParams.value); 375 const res: any = await getClassifyGradList(refGradePageParams.value);
351 if (res.code == proxy.$passCode) { 376 if (res.code == proxy.$passCode) {
352 classifyGradListData.value = res.data.records || []; 377 classifyGradListData.value = res.data.records || [];
353 const gradeName = findStandardName(router.currentRoute.value.query.refGradeGuid as any); 378 classStandardFormItems.value[1].options = classifyGradListData.value;
354 classStandardFormItems.value[1].default = gradeName; 379 // const gradeName = findStandardName(router.currentRoute.value.query.refGradeGuid as any);
380 classStandardFormItems.value[1].default = router.currentRoute.value.query.refGradeGuid;
381 classStandardFormItems.value[2].default = router.currentRoute.value.query.description;
355 } else { 382 } else {
356 proxy.$ElMessage.error(res.msg); 383 proxy.$ElMessage.error(res.msg);
357 } 384 }
...@@ -445,6 +472,39 @@ const newCreateClass = () => { ...@@ -445,6 +472,39 @@ const newCreateClass = () => {
445 }) 472 })
446 } 473 }
447 474
475
476 const saveLoading = ref(false);
477 const saveUpdate = async () => {
478 console.log(formRef.value.formInline);
479 if (!formRef.value.formInline.classStandardName) {
480 proxy.$ElMessage.error('分类名称不能为空');
481 return;
482 }
483 if (!formRef.value.formInline.gradeStandard) {
484 proxy.$ElMessage.error('分级标准不能为空');
485 return;
486 }
487 saveLoading.value = true;
488 const params = {
489 guid: router.currentRoute.value.query.guid,
490 name: formRef.value.formInline.classStandardName,
491 refGradeGuid: formRef.value.formInline.gradeStandard,
492 type: 'C',
493 description: formRef.value.formInline.description
494 }
495 console.log(params);
496 const res: any = await updateClassifyGrad(params);
497 if (res.code == proxy.$passCode) {
498 proxy.$ElMessage.success('修改成功');
499 router.push({
500 name: 'templateConfig'
501 });
502 saveLoading.value = false;
503 } else {
504 proxy.$ElMessage.error(res.msg);
505 }
506 }
507
448 /** 导入分类。 */ 508 /** 导入分类。 */
449 const importClass = () => { 509 const importClass = () => {
450 510
...@@ -778,6 +838,7 @@ onMounted(() => { ...@@ -778,6 +838,7 @@ onMounted(() => {
778 </div> 838 </div>
779 <div class="bottom_tool_wrap"> 839 <div class="bottom_tool_wrap">
780 <el-button @click="cancel">取消</el-button> 840 <el-button @click="cancel">取消</el-button>
841 <el-button type="primary" @click="saveUpdate" :loading="saveLoading">保存修改</el-button>
781 </div> 842 </div>
782 <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" ref="drawerRef" /> 843 <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" ref="drawerRef" />
783 </div> 844 </div>
...@@ -824,11 +885,11 @@ onMounted(() => { ...@@ -824,11 +885,11 @@ onMounted(() => {
824 } 885 }
825 886
826 .shape-main { 887 .shape-main {
827 height: calc(100% - 58px); 888 height: calc(100% - 160px);
828 } 889 }
829 890
830 .table_panel { 891 .table_panel {
831 height: calc(100% - 58px) !important; 892 height: calc(100% - 160px) !important;
832 } 893 }
833 894
834 .node-details-popup { 895 .node-details-popup {
......
...@@ -6,8 +6,11 @@ ...@@ -6,8 +6,11 @@
6 6
7 import router from "@/router"; 7 import router from "@/router";
8 import { ref } from "vue"; 8 import { ref } from "vue";
9 import { saveGrade, getGradeList, deleteGrade, getLargeCategoryList, updateGrade } from '@/api/modules/dataInventory'; 9 import { saveGrade, getGradeList, deleteGrade, getLargeCategoryList, updateGrade, updateClassifyGrad } from '@/api/modules/dataInventory';
10 10 import useUserStore from "@/store/modules/user";
11 const userStore = useUserStore();
12 const route = useRoute();
13 const fullPath = route.query.fullPath;
11 onBeforeMount(() => { 14 onBeforeMount(() => {
12 getGradeListData(); 15 getGradeListData();
13 getDataGrade(); 16 getDataGrade();
...@@ -16,7 +19,6 @@ onBeforeMount(() => { ...@@ -16,7 +19,6 @@ onBeforeMount(() => {
16 19
17 // 获取分级列表 20 // 获取分级列表
18 const getGradeListData = async () => { 21 const getGradeListData = async () => {
19 console.log('调用了吗~~~');
20 tableInfo.value.loading = true; 22 tableInfo.value.loading = true;
21 const params = { 23 const params = {
22 pageIndex: 1, 24 pageIndex: 1,
...@@ -111,7 +113,8 @@ const tableInfo = ref({ ...@@ -111,7 +113,8 @@ const tableInfo = ref({
111 id: "data-class-standard-table", 113 id: "data-class-standard-table",
112 multiple: true, 114 multiple: true,
113 fields: [ 115 fields: [
114 { label: "序号", field: 'orderNum', width: 56, align: "center" }, 116 { label: "序号", type: 'index', width: 56, align: "center" },
117 { label: "排序", field: 'orderNum', width: 56, align: "center" },
115 { 118 {
116 label: "数据级别", field: "dataGrade", width: 120, getName: (scope) => { 119 label: "数据级别", field: "dataGrade", width: 120, getName: (scope) => {
117 let dataGrade = scope.row.dataGrade; 120 let dataGrade = scope.row.dataGrade;
...@@ -124,7 +127,7 @@ const tableInfo = ref({ ...@@ -124,7 +127,7 @@ const tableInfo = ref({
124 return classDataRef.value.find((item: any) => item.value === dataClassify)?.label; 127 return classDataRef.value.find((item: any) => item.value === dataClassify)?.label;
125 } 128 }
126 }, 129 },
127 { label: "分级描述", field: "gradeDesc", align: "left", width: 480 }, 130 { label: "分级描述", field: "gradeDesc", align: "left" },
128 131
129 ], 132 ],
130 actionInfo: { 133 actionInfo: {
...@@ -328,18 +331,80 @@ const newStandard = () => { ...@@ -328,18 +331,80 @@ const newStandard = () => {
328 newCreateGradeFormItems.value.forEach(item => item.default = ''); 331 newCreateGradeFormItems.value.forEach(item => item.default = '');
329 } 332 }
330 333
334 const formRef = ref<any>();
335
336 const classStandardFormItems = ref([{
337 label: '分级名称',
338 type: 'input',
339 maxlength: 50,
340 placeholder: '请输入',
341 field: 'name',
342 default: router.currentRoute.value.query.classClassifyGradName,
343 block: false,
344 clearable: true,
345 required: true
346 }]);
347
348
349 const saveLoading = ref(false);
350 const saveUpdate = async () => {
351 console.log(formRef.value.formInline);
352 if (!formRef.value.formInline.name) {
353 proxy.$ElMessage.error('分级名称不能为空');
354 return;
355 }
331 356
357 saveLoading.value = true;
358 const params = {
359 guid: router.currentRoute.value.query.guid,
360 name: formRef.value.formInline.name,
361 type: 'G',
362 }
363 console.log(params);
364 const res: any = await updateClassifyGrad(params);
365 if (res.code == proxy.$passCode) {
366 proxy.$ElMessage.success('修改成功');
367 router.push({
368 name: 'templateConfig'
369 });
370 saveLoading.value = false;
371 } else {
372 proxy.$ElMessage.error(res.msg);
373 }
374 }
375
376 const cancel = () => {
377 proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => {
378 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
379 router.push({
380 name: 'templateConfig'
381 });
382 }, () => {
383 proxy.$ElMessage.info("已取消");
384 });
385 }
332 386
333 </script> 387 </script>
334 388
335 <template> 389 <template>
336 <div class="container_wrap" v-loading="fullscreenLoading"> 390 <div class="container_wrap">
337 <div class="content_main"> 391 <div class="content_main">
338 <div class="table-top-btns"> 392 <ContentWrap id="id-baseInfo" title="基础信息" description="" style="margin-top: 8px;">
339 <el-button type="primary" @click="newStandard">新增标准</el-button> 393 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
340 <el-button @click="batchRemobe">批量删除</el-button> 394 </ContentWrap>
341 </div> 395 <ContentWrap id="id-grade-info" title="分级标准" class="detail-content" description="" style="margin-top: 8px;">
342 <Table ref="tableRef" :tableInfo="tableInfo" @tableSelectionChange="onTableSelectChange" /> 396 <div class="content" v-loading="fullscreenLoading">
397 <div class="table-top-btns">
398 <el-button type="primary" @click="newStandard">新增标准</el-button>
399 <el-button @click="batchRemobe">批量删除</el-button>
400 </div>
401 <Table ref="tableRef" :tableInfo="tableInfo" @tableSelectionChange="onTableSelectChange" />
402 </div>
403 </ContentWrap>
404 </div>
405 <div class="bottom_tool_wrap">
406 <el-button @click="cancel">取消</el-button>
407 <el-button type="primary" @click="saveUpdate" :loading="saveLoading">保存修改</el-button>
343 </div> 408 </div>
344 <Dialog_form :dialogConfigInfo="newCreateGradeStandardDialogInfo" /> 409 <Dialog_form :dialogConfigInfo="newCreateGradeStandardDialogInfo" />
345 </div> 410 </div>
...@@ -351,11 +416,48 @@ const newStandard = () => { ...@@ -351,11 +416,48 @@ const newStandard = () => {
351 416
352 .content_main { 417 .content_main {
353 height: calc(100% - 44px); 418 height: calc(100% - 44px);
354 padding: 17px 16px 10px 16px; 419 padding: 10px 16px;
355 420
356 .table-top-btns { 421 .table-top-btns {
357 display: flex;
358 margin-bottom: 12px; 422 margin-bottom: 12px;
359 } 423 }
360 } 424 }
425
426 .bottom_tool_wrap {
427 height: 44px;
428 padding: 0 16px;
429 border-top: 1px solid #d9d9d9;
430 display: flex;
431 justify-content: center;
432 align-items: center;
433 }
434
435 :deep(.detail-content) {
436
437 .el-card__body {
438 height: calc(100% - 50px) !important;
439
440 .card-body-content {
441 height: 100%;
442 }
443 }
444 }
445
446 .tools_btns {
447 position: relative;
448 margin-bottom: 16px;
449
450 .show-change-btn {
451 position: absolute;
452 right: 0px;
453 }
454 }
455
456 .shape-main {
457 height: calc(100% - 40px);
458 }
459
460 .table_panel {
461 height: calc(100% - 40px) !important;
462 }
361 </style> 463 </style>
......
1 <script lang="ts" setup name="existingTableSelect">
2 import { ref } from "vue";
3 import Dialog from "@/components/Dialog/index.vue";
4
5 const emits = defineEmits([
6 "expandValueChange"
7 ]);
8
9 const props = defineProps({
10 tableCreateInfo: {
11 type: Object,
12 default: {},
13 },
14 partitionAttribute: {
15 type: Object,
16 default: {},
17 },
18 isLook: {
19 type: Boolean,
20 default: false
21 }
22 });
23
24 const expandProperties: any = computed(() => {
25 let partitionAttribute = props.tableCreateInfo.partitionAttribute;
26 return {
27 partitionMode: partitionAttribute?.partitionMode || 'dynamic',
28 staticPartitionType: partitionAttribute?.staticPartitionType || 'Range',
29 partitionCol: partitionAttribute?.partitionCol || "",
30 partitionTimeUnit: partitionAttribute?.partitionTimeUnit || "DAY",
31 dynamicPartitionEnd: partitionAttribute?.dynamicPartitionEnd == null ? 3 : partitionAttribute?.dynamicPartitionEnd,
32 staticPartitionRange: partitionAttribute?.staticPartitionRangeBegin ? [partitionAttribute?.staticPartitionRangeBegin,
33 partitionAttribute?.staticPartitionRangeEnd] : null,
34 dynamicPartitionHistory: partitionAttribute?.dynamicPartitionHistory === "Y",
35 dynamicPartitionHistoryNum: partitionAttribute?.dynamicPartitionHistoryNum,
36 staticPartitionEnum: partitionAttribute?.staticPartitionEnum,
37 }
38 })
39
40 const formItems: any = ref([
41 {
42 label: "分区模式",
43 type: "radio-panel",
44 placeholder: "",
45 field: "partitionMode",
46 default: "dynamic",
47 options: [
48 { label: "动态分区", value: "dynamic" },
49 { label: "静态分区", value: "static" },
50 ],
51 children: [],
52 required: true,
53 block: true,
54 col: "no-wrap col2",
55 },
56 {
57 label: "分区类型",
58 type: "select",
59 placeholder: "请选择",
60 options: [
61 {
62 label: "Range",
63 value: "Range",
64 },
65 {
66 label: "List",
67 value: "List",
68 },
69 ],
70 field: "staticPartitionType",
71 default: 'Range',
72 required: true,
73 visible: false,
74 },
75 {
76 label: "分区字段",
77 type: "select",
78 placeholder: "请选择",
79 options: [],
80 field: "partitionCol",
81 default: "",
82 props: {
83 label: 'chName',
84 value: 'enName'
85 },
86 tooltip: true,
87 tooltipContent: '分区字段为日期、日期时间类型且为主键的字段。',
88 clearable: true,
89 required: true,
90 visible: true,
91 },
92 {
93 label: "分区单位",
94 type: "select",
95 placeholder: "请选择",
96 options: [
97 {
98 value: "DAY",
99 label: "按天",
100 },
101 {
102 value: "WEEK",
103 label: "按星期",
104 },
105 {
106 value: "MONTH",
107 label: "按月",
108 },
109 {
110 value: "YEAR",
111 label: "按年",
112 },
113 ],
114 default: "DAY",
115 field: "partitionTimeUnit",
116 required: true,
117 visible: false,
118 },
119 {
120 type: "select-group",
121 field: "dynamicPartitionTimeUnit",
122 children: [
123 {
124 label: "分区单位",
125 type: "select",
126 placeholder: "请选择",
127 options: [
128 {
129 value: "HOUR",
130 label: "按小时",
131 },
132 {
133 value: "DAY",
134 label: "按天",
135 },
136 {
137 value: "WEEK",
138 label: "按星期",
139 },
140 {
141 value: "MONTH",
142 label: "按月",
143 },
144 {
145 value: "YEAR",
146 label: "按年",
147 },
148 ],
149 default: "DAY",
150 field: "partitionTimeUnit",
151 required: true,
152 visible: true,
153 },
154 {
155 label: " ",
156 type: "input",
157 placeholder: "结束偏移量",
158 default: 3,
159 field: "dynamicPartitionEnd",
160 required: true,
161 visible: true,
162 },
163 ],
164 col: "col2",
165 visible: true
166 },
167 {
168 label: "分区范围",
169 type: "date-picker",
170 field: "staticPartitionRange",
171 default: null,
172 placeholder: "开始时间~截止时间",
173 clearable: true,
174 required: true,
175 visible: false,
176 },
177 {
178 type: "checkbox-input",
179 placeholder: "创建历史分区",
180 field: "dynamicPartitionHistory",
181 default: false,
182 children: [
183 {
184 label: "",
185 type: "input",
186 placeholder: "历史分区数量",
187 field: "dynamicPartitionHistoryNum",
188 default: 1,
189 required: false,
190 visible: false,
191 },
192 ],
193 class: "dialog-checkbox-input",
194 visible: true,
195 required: false,
196 },
197 {
198 label: "分区枚举值",
199 type: "textarea",
200 placeholder: "请使用“,”号分隔",
201 field: "staticPartitionEnum",
202 default: "",
203 clearable: true,
204 required: true,
205 block: true,
206 visible: false,
207 },
208 ]);
209 const formRules = ref({
210 staticPartitionType: [
211 {
212 validator: (rule: any, value: any, callback: any) => {
213 if (!value) {
214 callback(new Error("分区类型不为空"));
215 } else {
216 callback();
217 }
218 },
219 trigger: "blur",
220 },
221 ],
222 partitionCol: [{
223 validator: (rule: any, value: any, callback: any) => {
224 if (!value) {
225 callback(new Error("分区字段不为空"));
226 } else {
227 callback();
228 }
229 },
230 trigger: "blur",
231 }],
232 staticPartitionRange: [{
233 validator: (rule: any, value: any, callback: any) => {
234 if (!value?.length) {
235 callback(new Error("分区范围不为空"));
236 } else {
237 callback();
238 }
239 },
240 trigger: "blur",
241 }],
242 staticPartitionEnum: [{
243 trigger: "blur",
244 required: true,
245 message: '分区枚举值不能为空'
246 }],
247 dynamicPartitionHistoryNum: {
248 validator: (rule: any, value: any, callback: any) => {
249 const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头)
250 if (value && !r.test(value)) {
251 callback(new Error('请填写大于或等于零整数'));
252 return;
253 }
254 if ((value + '').length > 6) {
255 callback(new Error('请填写小于7位的整数'));
256 return;
257 }
258 callback();
259 },
260 trigger: "blur",
261 },
262 dynamicPartitionEnd: {
263 validator: (rule: any, value: any, callback: any) => {
264 const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头)
265 if (value && !r.test(value)) {
266 callback(new Error('请填写大于或等于零整数'));
267 return;
268 }
269 if ((value + '').length > 6) {
270 callback(new Error('请填写小于7位的整数'));
271 return;
272 }
273 callback();
274 },
275 trigger: "blur",
276 },
277 });
278
279 const expandPropertyDialogInfo = ref({
280 readonly: false,
281 visible: false,
282 size: 700,
283 height: "270px",
284 header: {
285 title: "扩展属性",
286 },
287 direction: "column",
288 type: "",
289 contents: [
290 {
291 type: "form",
292 title: "",
293 formInfo: {
294 readonly: false,
295 id: "edit-expand-property",
296 items: formItems.value,
297 rules: formRules.value,
298 },
299 },
300 ],
301 footer: {
302 visible: true,
303 btns: [
304 { type: "default", label: "取消", value: "cancel" },
305 { type: "primary", label: "确定", value: "submit" },
306 ],
307 },
308 });
309
310 /** 记录对话框编辑过程中的扩展属性。提交之后才会记录在expandProperties */
311 const editExpandProperties: any = ref({});
312
313 /** 扩展属性弹出对话框 */
314 const handleClickExpand = () => {
315 expandPropertyDialogInfo.value.visible = true;
316 if (props.isLook || props.tableCreateInfo.isCreate) {
317 expandPropertyDialogInfo.value.contents[0].formInfo.readonly = true;
318 expandPropertyDialogInfo.value.footer.visible = false;
319 } else {
320 expandPropertyDialogInfo.value.contents[0].formInfo.readonly = false;
321 expandPropertyDialogInfo.value.footer.visible = true;
322 }
323 if (expandProperties.value.partitionMode === 'dynamic') {
324 formItems.value[1].visible = false;
325 formItems.value[2].visible = true;
326 formItems.value[3].visible = false;
327 formItems.value[4].visible = true;
328 formItems.value[5].visible = false;
329 formItems.value[6].visible = true;
330 formItems.value[7].visible = false;
331 formItems.value[6].children[0].visible = expandProperties.value.dynamicPartitionHistory;
332 formItems.value[2].options = props.tableCreateInfo.tableFields?.filter(field => field.isPrimary === 'Y' && (field.dataType === 'date' || field.dataType === 'datetime')) || [];
333 formItems.value[2].tooltipContent = '分区字段为日期、日期时间类型且为主键的字段。';
334 } else {
335 formItems.value[1].visible = true;
336 formItems.value[2].visible = true;
337 formItems.value[3].visible = true;
338 formItems.value[4].visible = false;
339 formItems.value[5].visible = true;
340 formItems.value[6].visible = false;
341 formItems.value[7].visible = false;
342 let val = expandProperties.value.staticPartitionType;
343 formItems.value[3].visible = val !== 'List';
344 formItems.value[5].visible = val !== 'List';
345 formItems.value[7].visible = val === 'List';
346 if (val !== 'List') {
347 formItems.value[2].options = props.tableCreateInfo.tableFields?.filter(field => field.isPrimary === 'Y' && (field.dataType === 'date' || field.dataType === 'datetime')) || [];
348 formItems.value[2].tooltipContent = '分区字段为日期、日期时间类型且为主键的字段。';
349 } else {
350 formItems.value[2].options = props.tableCreateInfo.tableFields?.filter(field => field.isPrimary === 'Y') || [];
351 formItems.value[2].tooltipContent = '分区字段为主键字段。';
352 }
353 }
354 expandPropertyDialogInfo.value.contents[0].formInfo.items = formItems.value;
355 editExpandProperties.value = Object.assign({}, expandProperties.value);
356 setFormItems(editExpandProperties.value);
357 };
358
359 /** 重置formItems的值 */
360 const setFormItems = (row: any = null) => {
361 formItems.value.forEach(item => {
362 if (item.field === 'dynamicPartitionTimeUnit') {
363 item.children.forEach(child => {
364 child.default = row[child.field];
365 });
366 } else if (item.field === 'dynamicPartitionHistory') {
367 item.default = row[item.field];
368 item.children.forEach(child => {
369 child.default = row[child.field];
370 });
371 } else {
372 item.default = row[item.field];
373 }
374 })
375 }
376
377 const radioGroupChange = (val, info) => {
378 formItems.value[0].default = val;
379 if (val == "dynamic") {
380 formItems.value[1].visible = false;
381 formItems.value[2].visible = true;
382 formItems.value[3].visible = false;
383 formItems.value[4].visible = true;
384 formItems.value[5].visible = false;
385 formItems.value[6].visible = true;
386 formItems.value[7].visible = false;
387 } else if (val == "static") {
388 formItems.value[1].visible = true;
389 formItems.value[2].visible = true;
390 formItems.value[3].visible = true;
391 formItems.value[4].visible = false;
392 formItems.value[5].visible = true;
393 formItems.value[6].visible = false;
394 formItems.value[7].visible = false;
395 }
396 expandPropertyDialogInfo.value.contents[0].formInfo.items = formItems.value;
397 editExpandProperties.value = Object.assign({}, editExpandProperties.value, info)
398 setFormItems(editExpandProperties.value);
399 };
400
401 const dialogCheckboxChange = (val, info) => {
402 let opts: any = formItems.value[6].children;
403 opts[0].visible = val;
404 editExpandProperties.value = Object.assign({}, editExpandProperties.value, info)
405 setFormItems(editExpandProperties.value);
406 };
407
408 const dialogSelectChange = (val, row, info) => {
409 if (row.field == 'staticPartitionType') {
410 formItems.value[3].visible = val !== 'List';
411 formItems.value[5].visible = val !== 'List';
412 formItems.value[7].visible = val === 'List';
413 if (val !== 'List') {
414 formItems.value[2].options = props.tableCreateInfo.tableFields?.filter(field => field.isPrimary === 'Y' && (field.dataType === 'date' || field.dataType === 'datetime')) || [];
415 formItems.value[2].tooltipContent = '分区字段为日期、日期时间类型且为主键的字段。';
416 } else {
417 formItems.value[2].options = props.tableCreateInfo.tableFields?.filter(field => field.isPrimary === 'Y') || [];
418 formItems.value[2].tooltipContent = '分区字段为主键字段。';
419 }
420 }
421 editExpandProperties.value = Object.assign({}, editExpandProperties.value, info)
422 setFormItems(editExpandProperties.value);
423 }
424
425 const expandPropertyDialogBtnClick = (btn, info) => {
426 if (btn.value == 'submit') {
427 emits('expandValueChange', info);
428 expandPropertyDialogInfo.value.visible = false;
429 } else if (btn.value == 'cancel') {
430 expandPropertyDialogInfo.value.visible = false;
431 }
432 };
433
434 defineExpose({
435 handleClickExpand
436 });
437
438 </script>
439
440 <template>
441 <Dialog ref="expandPropertyDialogRef" :dialogInfo="expandPropertyDialogInfo" @radioGroupChange="radioGroupChange"
442 @checkboxChange="dialogCheckboxChange" @selectChange="dialogSelectChange"
443 @btnClick="expandPropertyDialogBtnClick" />
444 </template>
445
446 <style scoped lang="scss"></style>
...@@ -14,7 +14,9 @@ import { ...@@ -14,7 +14,9 @@ import {
14 createTableSql, 14 createTableSql,
15 getDsTableStructures, 15 getDsTableStructures,
16 getDbDirFieldClassifyAndGrade, 16 getDbDirFieldClassifyAndGrade,
17 getDbDirTableSelectList 17 getDbDirTableSelectList,
18 getTaskExeTreeList,
19 getGradeList
18 } from "@/api/modules/dataInventory"; 20 } from "@/api/modules/dataInventory";
19 import existingTableSelect from "./existingTableSelect.vue"; 21 import existingTableSelect from "./existingTableSelect.vue";
20 22
...@@ -52,39 +54,109 @@ const processData = (data) => { ...@@ -52,39 +54,109 @@ const processData = (data) => {
52 const gradeList: any = ref([]); 54 const gradeList: any = ref([]);
53 const classifyList: any = ref([]); 55 const classifyList: any = ref([]);
54 56
55 const getDbDirFieldClassifyAndGradeList = async () => { 57 // const getDbDirFieldClassifyAndGradeList = async () => {
56 const params = { 58 // const params = {
57 execGuid: execGuid.value, 59 // execGuid: execGuid.value,
58 type: 'C', 60 // type: 'C',
59 fieldName: 'classifyName', 61 // fieldName: 'classifyName',
60 } 62 // }
61 63
62 const res: any = await getDbDirFieldClassifyAndGrade(params); 64 // const res: any = await getDbDirFieldClassifyAndGrade(params);
63 if (res.code === proxy.$passCode) { 65 // if (res.code === proxy.$passCode) {
64 console.log('分类分级数据', res.data) 66 // console.log('分类分级数据', res.data)
65 } else { 67 // } else {
66 proxy.$ElMessage.error(res.msg); 68 // proxy.$ElMessage.error(res.msg);
67 } 69 // }
70 // };
71
72 // 获取分类树形数据
73 // 定义树形选择器的属性
74 const treeSelectProps = {
75 label: "classifyName",
76 value: "classifyDetailGuid",
77 children: "children",
68 }; 78 };
79 const treeSelectOptions = ref<any>([]);
80 // 存储引用的refGradeGuid
81 const refGradeGuidList = ref<any>([]);
82 const getFieldTree = () => {
83 getTaskExeTreeList({ execGuid: execGuid.value }).then((res: any) => {
84 if (res.code == proxy.$passCode) {
85 const data = res.data || [];
86 classifyList.value = data;
87 treeSelectOptions.value = data;
88 // 遍历data,找到refGradeGuid,不用递归,找第一层
89 data.forEach(item => {
90 if (item.refGradeGuid) {
91 refGradeGuidList.value.push(item.refGradeGuid);
92 }
93 });
69 94
70 // 联动查询数据getDbDirTableSelectList 95 } else {
71 const getTableSelectList = async (params) => { 96 ElMessage.error(res.msg);
72 const inParams = { 97 }
98 }).catch(() => {
99 ElMessage.error('获取分类树形数据失败');
100 })
101 }
73 102
74 } 103 // 获取分类名称的方法
75 const res: any = await getDbDirTableSelectList(params); 104 const matchedItem = ref<any>();
76 if (res.code === proxy.$passCode) { 105
77 console.log('联动查询数据', res.data) 106 const getClassifyName = (guid) => {
78 } else { 107 const findClassify = (data, guid) => {
79 proxy.$ElMessage.error(res.msg); 108 for (const item of data) {
80 } 109 if (item.guid === guid) {
110 matchedItem.value = item;
111 return item.classifyName;
112 }
113 // 确保 children 是一个数组
114 if (Array.isArray(item.children)) {
115 const childResult = findClassify(item.children, guid);
116 if (childResult) return childResult;
117 }
118 }
119 return null;
120 };
121 const result = findClassify(treeSelectOptions.value, guid);
122
123 return result;
81 }; 124 };
82 125
83 126
127 // 获取分级的数据
128 const gradeSelectProps = {
129 value: 'guid',
130 label: 'name',
131 }
132
133
134 const getGradeName = (guid) => {
135 const grade = gradeList.value.find(item => item.guid === guid);
136 return grade ? grade.gradeName : '';
137 }
138
139
140 // 进入编辑模式
141 const editRow = (row) => {
142 console.log('进入编辑模式', row)
143 // 进入编辑模式时,查找classifyDetailGuid
144
145
146
147 // 这个是指定是否能编辑的字段
148 editableFields.sourceFieldName = false;
149 row.isEdit = true
150 }
151 // 保存数据
152 const saveRow = (row) => {
153 editableFields.sourceFieldName = true;
154 row.isEdit = false
155 }
156
84 157
85 onMounted(async () => { 158 onMounted(async () => {
86 await getDbDirDataSourceListData(); 159 await getDbDirDataSourceListData();
87 await getDbDirFieldClassifyAndGradeList();
88 }); 160 });
89 161
90 const stepsInfo = ref({ 162 const stepsInfo = ref({
...@@ -111,19 +183,14 @@ const handlDsSelectedChange = (v, guid) => { ...@@ -111,19 +183,14 @@ const handlDsSelectedChange = (v, guid) => {
111 execGuid: execGuid.value, 183 execGuid: execGuid.value,
112 }); 184 });
113 }); 185 });
114 selectedDatabaseTable.value = params; 186
115 console.log('params', params) 187 getNextTableInfo(params);
116 // if (isPrevious.value) {
117 // tableCreateInfo.value.tableFields = [];
118 // tableCreateInfo.value.inputNameValue = '';
119 // tableCreateInfo.value.tableData[0].chName = '';
120 // }
121 }; 188 };
122 189
123 190
124 const fullscreenLoading = ref(false); 191 const fullscreenLoading = ref(false);
125 /** 下一步 */ 192 /** 下一步 */
126 const nextStep = () => { 193 const nextStep = async () => {
127 if (!datasourceSelectedRows.value.length) { 194 if (!datasourceSelectedRows.value.length) {
128 ElMessage({ 195 ElMessage({
129 type: "error", 196 type: "error",
...@@ -131,36 +198,60 @@ const nextStep = () => { ...@@ -131,36 +198,60 @@ const nextStep = () => {
131 }); 198 });
132 return; 199 return;
133 } 200 }
134 getNextTableInfo(); 201 getFieldTree();
202 initializeTableData();
135 stepsInfo.value.step = 1; 203 stepsInfo.value.step = 1;
136 }; 204 };
137 205
138 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value 206 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value
139 const getNextTableInfo = async () => { 207 const getNextTableInfo = async (params) => {
140 const res: any = await getDsTableStructures(selectedDatabaseTable.value); 208 const res: any = await getDsTableStructures(params);
141 if (res.code === proxy.$passCode) { 209 if (res.code === proxy.$passCode) {
142 tableDataDetailInfo.value = res.data; 210 tableDataDetailInfo.value = res.data;
143 } else { 211 } else {
144 proxy.$ElMessage.error(res.msg); 212 proxy.$ElMessage.error(res.msg);
145 } 213 }
146 }; 214 };
147 const isPrevious = ref(false);
148 215
216 // 初始化表格分级数据显示
217 const initializeTableData = () => {
218 console.log('初始化表格分级数据显示', refGradeGuidList.value)
219 tableDataDetailInfo.value.forEach((row) => {
220 if (row.refGradeGuid) {
221 getGradeList({ classifyGradeGuid: row.refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
222 console.log('row进来了吗')
223 if (res.code === proxy.$passCode) {
224 row.gradeOptions = res.data.records || [];
225 } else {
226 ElMessage.error(res.msg);
227 }
228 });
229 }
230 });
231 };
232
233 const handleClassifyChange = (row) => {
234 if (!row.classifyDetailGuid) {
235 row.gradeGuid = null;
236 row.gradeOptions = [];
237 return;
238 }
239
240 getGradeList({ classifyGradeGuid: row.classifyDetailGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
241 if (res.code === 200) {
242 row.gradeOptions = res.data.records || [];
243 } else {
244 ElMessage.error(res.msg);
245 }
246 });
247 };
248
249 const isPrevious = ref(false);
149 /** 上一步 */ 250 /** 上一步 */
150 const previousStep = () => { 251 const previousStep = () => {
151 stepsInfo.value.step = 0; 252 stepsInfo.value.step = 0;
152 isPrevious.value = true; 253 isPrevious.value = true;
153 }; 254 };
154 //记录当前正在编辑的表创建信息。
155 const tableCreateInfo: Ref<any> = ref({
156 guid: "",
157 isCreate: false,
158 inputNameValue: '',
159 tableData: [],
160 partitionAttribute: {},
161 tableFields: [], // 字段标准数组。
162 });
163
164 255
165 const tableDataInfo = ref([ 256 const tableDataInfo = ref([
166 { 257 {
...@@ -170,22 +261,19 @@ const tableDataInfo = ref([ ...@@ -170,22 +261,19 @@ const tableDataInfo = ref([
170 }, 261 },
171 ]) 262 ])
172 // 表格数据 263 // 表格数据
173 const tableDataDetailInfo = ref([ 264 const tableDataDetailInfo = ref<any>([])
174 { id: 1, fieldName: '系统唯一标识', fieldEnglish: 'ID', length: '<200', isUnique: '是', isEdit: false },
175 { id: 2, fieldName: '姓名', fieldEnglish: 'NAME', length: '<=200', isUnique: '否', isEdit: false },
176 { id: 3, fieldName: '年纪', fieldEnglish: 'AGE', length: '=200', isUnique: '否', isEdit: false },
177 { id: 4, fieldName: '系统唯一标识', fieldEnglish: 'ID', length: '<200', isUnique: '是', isEdit: false },
178 { id: 5, fieldName: '姓名', fieldEnglish: 'NAME', length: '<=200', isUnique: '否', isEdit: false },
179 { id: 6, fieldName: '年纪', fieldEnglish: 'AGE', length: '=200', isUnique: '否', isEdit: false },
180 ])
181
182 // 配置哪些字段可编辑 265 // 配置哪些字段可编辑
183 const editableFields = { 266 const editableFields = {
184 fieldName: true, // 字段中文名可编辑 267 fieldName: true, // 字段中文名可编辑
185 length: true, // 长度可编辑 268 fieldLength: true, // 长度可编辑
186 isUnique: true, // 数据是否唯一可编辑 269 isUnique: true, // 数据是否唯一可编辑
270 isPrimary: true, // 是否主键可编辑
187 fieldPrecision: true, // 精度可编辑 271 fieldPrecision: true, // 精度可编辑
188 dictionaryGuid: true, // 关联字典可编辑 272 dictionaryGuid: true, // 关联字典可编辑
273 classifyName: true, // 分类可编辑
274 gradeDetailName: true, // 分级可编辑
275 sourceFieldName: true, // 源字段英文名可编辑
276 classifyDetailGuid: true, // 分类可编辑
189 } 277 }
190 278
191 const tableFieldsLoading = ref(false) 279 const tableFieldsLoading = ref(false)
...@@ -238,15 +326,7 @@ const moveDown = () => { ...@@ -238,15 +326,7 @@ const moveDown = () => {
238 } 326 }
239 }; 327 };
240 328
241 // 进入编辑模式
242 const editRow = (row) => {
243 row.isEdit = true
244 }
245 329
246 // 保存数据
247 const saveRow = (row) => {
248 row.isEdit = false
249 }
250 330
251 // 删除行 331 // 删除行
252 const deleteRow = (index) => { 332 const deleteRow = (index) => {
...@@ -278,10 +358,16 @@ const addRow = () => { ...@@ -278,10 +358,16 @@ const addRow = () => {
278 tableDataDetailInfo.value.push({ 358 tableDataDetailInfo.value.push({
279 id: tableDataDetailInfo.value.length + 1, 359 id: tableDataDetailInfo.value.length + 1,
280 fieldName: '', 360 fieldName: '',
281 fieldEnglish: '', // 英文名不可编辑 361 fieldEnglish: '',
362 fieldType: '',
282 length: '', 363 length: '',
364 fieldPrecision: '',
283 isUnique: '', 365 isUnique: '',
284 isEdit: true, // 新增时默认进入编辑模式 366 isRequired: '',
367 fieldValueRange: '',
368 dictionaryGuid: '',
369 isEdit: true,
370 gradeOptions: [],
285 }) 371 })
286 } 372 }
287 373
...@@ -358,7 +444,6 @@ const data = [ ...@@ -358,7 +444,6 @@ const data = [
358 444
359 const submitAsDraft = () => { 445 const submitAsDraft = () => {
360 // 保存为草稿,无论有没有guid 都传入guid 446 // 保存为草稿,无论有没有guid 都传入guid
361
362 saveOrUpdate({ isDraft: 'Y' }, 0) 447 saveOrUpdate({ isDraft: 'Y' }, 0)
363 448
364 } 449 }
...@@ -685,7 +770,11 @@ const createNewSql = () => { ...@@ -685,7 +770,11 @@ const createNewSql = () => {
685 <!-- 源字段英文 --> 770 <!-- 源字段英文 -->
686 <el-table-column prop="sourceFieldName" label="源字段英文" width="150"> 771 <el-table-column prop="sourceFieldName" label="源字段英文" width="150">
687 <template #default="scope"> 772 <template #default="scope">
688 {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} 773 <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} -->
774
775 <span v-if="!scope.row.isEdit || !editableFields.sourceFieldName">{{ scope.row.sourceFieldName ?
776 scope.row.sourceFieldName : '--' }}</span>
777 <el-input v-else v-model="scope.row.sourceFieldName" placeholder="请输入长度" />
689 </template> 778 </template>
690 </el-table-column> 779 </el-table-column>
691 <!-- 源端字段 fieldType--> 780 <!-- 源端字段 fieldType-->
...@@ -698,10 +787,10 @@ const createNewSql = () => { ...@@ -698,10 +787,10 @@ const createNewSql = () => {
698 <!-- 长度(可编辑) --> 787 <!-- 长度(可编辑) -->
699 <el-table-column prop="fieldLength" label="长度" width="120" align="center"> 788 <el-table-column prop="fieldLength" label="长度" width="120" align="center">
700 <template #default="scope"> 789 <template #default="scope">
701 <span v-if="!scope.row.isEdit || !editableFields.length">{{ scope.row.fieldLength ? 790 <span v-if="!scope.row.isEdit || !editableFields.fieldLength">{{ scope.row.fieldLength ?
702 scope.row.fieldLength 791 scope.row.fieldLength
703 : '--' }}</span> 792 : '--' }}</span>
704 <el-input v-else v-model="scope.row.length" placeholder="请输入长度" /> 793 <el-input v-else v-model="scope.row.fieldLength" placeholder="请输入长度" />
705 </template> 794 </template>
706 </el-table-column> 795 </el-table-column>
707 <!-- 精度(可编辑)fieldPrecision --> 796 <!-- 精度(可编辑)fieldPrecision -->
...@@ -725,11 +814,12 @@ const createNewSql = () => { ...@@ -725,11 +814,12 @@ const createNewSql = () => {
725 <!-- 数据是否唯一(可编辑) --> 814 <!-- 数据是否唯一(可编辑) -->
726 <el-table-column prop="isPrimary" label="是否主键" width="150" align="center"> 815 <el-table-column prop="isPrimary" label="是否主键" width="150" align="center">
727 <template #default="scope"> 816 <template #default="scope">
728 <span v-if="!scope.row.isEdit || !editableFields.length">{{ scope.row.isPrimary ? scope.row.isPrimary : 817 <span v-if="!scope.row.isEdit || !editableFields.isPrimary">{{ scope.row.isPrimary ? scope.row.isPrimary
818 :
729 '--' }}</span> 819 '--' }}</span>
730 <el-select v-else v-model="scope.row.isPrimary" placeholder="请选择"> 820 <el-select v-else v-model="scope.row.isPrimary" placeholder="请选择">
731 <el-option label="是" value="是" /> 821 <el-option label="Y" value="Y" />
732 <el-option label="否" value="否" /> 822 <el-option label="N" value="N" />
733 </el-select> 823 </el-select>
734 </template> 824 </template>
735 </el-table-column> 825 </el-table-column>
...@@ -738,22 +828,42 @@ const createNewSql = () => { ...@@ -738,22 +828,42 @@ const createNewSql = () => {
738 <template #default="scope"> 828 <template #default="scope">
739 <span v-if="!scope.row.isEdit">{{ scope.row.isNotNull ? scope.row.isNotNull : '--' }}</span> 829 <span v-if="!scope.row.isEdit">{{ scope.row.isNotNull ? scope.row.isNotNull : '--' }}</span>
740 <el-select v-else v-model="scope.row.isNotNull" placeholder="请选择"> 830 <el-select v-else v-model="scope.row.isNotNull" placeholder="请选择">
741 <el-option label="是" value="是" /> 831 <el-option label="Y" value="Y" />
742 <el-option label="否" value="否" /> 832 <el-option label="N" value="N" />
743 </el-select> 833 </el-select>
744 </template> 834 </template>
745 </el-table-column> 835 </el-table-column>
746 836
747 <!-- 分类(不可编辑)classifyName --> 837 <!-- 分类(不可编辑)classifyName -->
748 <el-table-column prop="classifyName" label="分类" width="150"> 838
839 <el-table-column prop="classifyDetailGuid" label="分类" width="150">
749 <template #default="scope"> 840 <template #default="scope">
750 {{ scope.row.classifyName ? scope.row.classifyName : '--' }} 841 <!-- 如果当前行是编辑状态,显示 tree-select -->
842 <div v-if="scope.row.isEdit">
843 <el-tree-select v-model="scope.row.classifyDetailGuid" :data="treeSelectOptions"
844 :props="treeSelectProps" placeholder="请选择分类" clearable filterable
845 @change="handleClassifyChange(scope.row)">
846 </el-tree-select>
847 </div>
848 <!-- 否则直接显示分类名称 -->
849 <div v-else>
850 {{ scope.row.classifyDetailName || '--' }}
851 </div>
751 </template> 852 </template>
752 </el-table-column> 853 </el-table-column>
753 <!-- 分级(不可编辑) --> 854 <!-- 分级(不可编辑) -->
754 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> 855 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
755 <template #default="scope"> 856 <template #default="scope">
756 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} 857 <div v-if="scope.row.isEdit">
858 <el-select v-model="scope.row.gradeGuid" placeholder="请选择分级" clearable filterable
859 :props="gradeSelectProps">
860 <el-option v-for="(item, index) in scope.row.gradeOptions || []" :key="index" :label="item.name"
861 :value="item.guid"></el-option>
862 </el-select>
863 </div>
864 <div v-else>
865 {{ scope.row.gradeDetailName || '--' }}
866 </div>
757 </template> 867 </template>
758 </el-table-column> 868 </el-table-column>
759 <!-- 操作列 --> 869 <!-- 操作列 -->
......
1 <route lang="yaml"> 1 <route lang="yaml">
2 name: tableCreateFile 2 name: tableCreateFile
3 </route> 3 </route>
4 4
5 <script lang="ts" setup name="tableCreateFile"> 5 <script lang="ts" setup name="tableCreateFile">
6 6
...@@ -10,29 +10,29 @@ import useUserStore from "@/store/modules/user"; ...@@ -10,29 +10,29 @@ import useUserStore from "@/store/modules/user";
10 import useDataCatalogStore from "@/store/modules/dataCatalog"; 10 import useDataCatalogStore from "@/store/modules/dataCatalog";
11 import expandPropertyDialog from "./expandPropertyDialog.vue"; 11 import expandPropertyDialog from "./expandPropertyDialog.vue";
12 import tableDefaultValue from "./components/tableDefaultValue.vue"; 12 import tableDefaultValue from "./components/tableDefaultValue.vue";
13 // import { 13 import {
14 // getDatabase, 14 getDatabase,
15 // getFileStandards, 15 getFileStandards,
16 // getDictionary, 16 getDictionary,
17 // getSubjectFieldByFile, 17 getSubjectFieldByFile,
18 // tableCategoryList, 18 tableCategoryList,
19 // syncPolicys, 19 syncPolicys,
20 // getDataTypeList, 20 getDataTypeList,
21 // tableModels, 21 tableModels,
22 // aggMethodList, 22 aggMethodList,
23 // getCharacterList, 23 getCharacterList,
24 // saveSubjectTable, 24 saveSubjectTable,
25 // updateSubjectTable, 25 updateSubjectTable,
26 // getTableStandardDetail, 26 getTableStandardDetail,
27 // getSubjectDomainDetail, 27 getSubjectDomainDetail,
28 // saveSubjectTableDraft, 28 saveSubjectTableDraft,
29 // updateSubjectTableDraft, 29 updateSubjectTableDraft,
30 // getFieldStandardTree, 30 getFieldStandardTree,
31 // dimTypeList, 31 dimTypeList,
32 // getDimList, 32 getDimList,
33 // getSubjectTableDetail, 33 getSubjectTableDetail,
34 // checkSubjectTableData 34 checkSubjectTableData
35 // } from "@/api/modules/dataCatalogService"; 35 } from "@/api/modules/dataCatalogService";
36 import { useDefault } from "@/hooks/useDefault"; 36 import { useDefault } from "@/hooks/useDefault";
37 import uploadExcelFile from "./components/uploadExcelFile.vue"; 37 import uploadExcelFile from "./components/uploadExcelFile.vue";
38 38
...@@ -109,23 +109,23 @@ const handleFileDataChange = (fileFields, files, sheetName, data) => { ...@@ -109,23 +109,23 @@ const handleFileDataChange = (fileFields, files, sheetName, data) => {
109 109
110 const uploadFileRef = ref(); 110 const uploadFileRef = ref();
111 111
112 // const getSubjectField = () => { 112 const getSubjectField = () => {
113 // tableFieldsLoading.value = true; 113 tableFieldsLoading.value = true;
114 // getSubjectFieldByFile(fileTableFields.value.map(f => f.chName), tableCreateInfo.value.tableData[0].subjectDomainGuid).then((res: any) => { 114 getSubjectFieldByFile(fileTableFields.value.map(f => f.chName), tableCreateInfo.value.tableData[0].subjectDomainGuid).then((res: any) => {
115 // tableFieldsLoading.value = false; 115 tableFieldsLoading.value = false;
116 // if (res.code == proxy.$passCode) { 116 if (res.code == proxy.$passCode) {
117 // tableCreateInfo.value.tableFields = res.data?.map((field, i) => { 117 tableCreateInfo.value.tableFields = res.data?.map((field, i) => {
118 // field.dimOrdictionaryGuid = field.dictionaryGuid; 118 field.dimOrdictionaryGuid = field.dictionaryGuid;
119 // field.fileFieldName = fileTableFields.value[i].chName; 119 field.fileFieldName = fileTableFields.value[i].chName;
120 // field.isEdit = true; 120 field.isEdit = true;
121 // !field.notNull && (field.notNull = 'N'); 121 !field.notNull && (field.notNull = 'N');
122 // return field; 122 return field;
123 // }) || []; 123 }) || [];
124 // } else { 124 } else {
125 // ElMessage.error(res.msg); 125 ElMessage.error(res.msg);
126 // } 126 }
127 // }); 127 });
128 // } 128 }
129 129
130 const nextStep = () => { 130 const nextStep = () => {
131 uploadFileRef.value.fileFormRef.ruleFormRef.validate((valid) => { 131 uploadFileRef.value.fileFormRef.ruleFormRef.validate((valid) => {
...@@ -143,19 +143,19 @@ const nextStep = () => { ...@@ -143,19 +143,19 @@ const nextStep = () => {
143 tableCreateInfo.value.isSync = 'Y'; 143 tableCreateInfo.value.isSync = 'Y';
144 } 144 }
145 stepsInfo.value.step = 1; 145 stepsInfo.value.step = 1;
146 // getDictionaryList(); 146 getDictionaryList();
147 // getDimListData(); 147 getDimListData();
148 // if (!fieldTypes.value.length) { 148 if (!fieldTypes.value.length) {
149 // getFieldTypeList(); 149 getFieldTypeList();
150 // getCharacterListData(); 150 getCharacterListData();
151 // } 151 }
152 // if (!databaseList.value.length) { 152 if (!databaseList.value.length) {
153 // getDatabaseList(); 153 getDatabaseList();
154 // } 154 }
155 // getDomainDetail(subjectDomainGuid.value); 155 getDomainDetail(subjectDomainGuid.value);
156 // if (!tableCreateInfo.value.tableFields.length) { 156 if (!tableCreateInfo.value.tableFields.length) {
157 // getSubjectField(); 157 getSubjectField();
158 // } 158 }
159 } 159 }
160 }); 160 });
161 }; 161 };
...@@ -216,11 +216,1242 @@ const fullscreenLoading = ref(false); ...@@ -216,11 +216,1242 @@ const fullscreenLoading = ref(false);
216 /** 表里有数据时不能修改字段类型,长度,精度 */ 216 /** 表里有数据时不能修改字段类型,长度,精度 */
217 const hasSubjectData = ref(false); 217 const hasSubjectData = ref(false);
218 218
219 onBeforeMount(() => {
220 if (route.query.guid) {
221 init.value = false;
222 fullscreenLoading.value = true;
223 getSubjectTableDetail(route.query.guid).then((res: any) => {
224 fullscreenLoading.value = false;
225 if (res?.code == proxy.$passCode) {
226 let data = res.data;
227 standardSetGuids.value = data.fieldStandardSetGuids
228 if (data.isCreate === 'Y') {
229 checkSubjectTableData({
230 databaseType: data.dbType,
231 dataSourceGuid: data.dataSourceGuid,
232 databaseNameEn: data.dataServerName,
233 enName: data.enName
234 }).then((res: any) => {
235 if (res?.code == proxy.$passCode) {
236 hasSubjectData.value = res.data;
237 } else {
238 ElMessage.error(res.msg);
239 }
240 })
241 }
242 init.value = true;
243 let domainVO = data?.dataCatalogSubjectDomainTableVOS || {};
244 let subjectDomainName = domainVO.subjectDomainName;
245 if (fullPath === route.fullPath) {
246 document.title = `编辑-${data.chName}(${subjectDomainName})`;
247 }
248 let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === fullPath);
249 if (tab) {
250 tab.meta.title = `编辑-${data.chName}(${subjectDomainName})`;
251 }
252 subjectDomainGuid.value = data.subjectDomainGuid;
253 getFieldStandardOptions(domainVO.fieldStandardSetGuids || []);
254 tableStandardGuid.value = domainVO.tableStandardGuid || '';
255 fieldStandardSetGuids.value = domainVO.fieldStandardSetGuids || [];
256
257 isOpenStandard.value = domainVO.isOpenStandard === 'Y';
258 dbType.value = data.dbType;
259 originTableCreateInfo.value = tableCreateInfo.value = {
260 guid: data.guid,
261 isCreate: data.isCreate === 'Y',
262 partitionAttribute: data.partitionAttribute || {},
263 tableCreateType: data.tableCreateType,
264 inputNameValue: data.enName,
265 isSync: data.isSync,
266 sheetName: data.subjectTableAttachmentsVO?.sheetName,
267 tableData: [
268 {
269 dataSourceGuid: data.dataSourceGuid,
270 dataServerName: data.dataServerName,
271 dataServerChName: data.dataServerChName,
272 enName: data.enName,
273 chName: data.chName,
274 subjectDomain: subjectDomainName,
275 subjectDomainGuid: subjectDomainGuid.value,
276 tableCategory: data.tableCategory,
277 dimType: data.dimType,
278 syncPolicy: data.syncPolicy,
279 characterSet: data.characterSet,
280 tableModel: data.tableModel, //若是聚合模型,下方出现一列聚合方式选择。处了主键列,其余列都需要选择。每个表里都要有主键。
281 description: data.description,
282 },
283 ],
284 tableFields: data.subjectFieldVOS?.map((fieldVO, i) => {
285 return {
286 orderNum: fieldVO.orderNum,
287 guid: fieldVO.guid,
288 chName: fieldVO.chName,
289 enName: fieldVO.enName,
290 isPrimary: fieldVO.isPrimary,
291 notNull: fieldVO.notNull,
292 fieldLength: fieldVO.fieldLength,
293 fieldPrecision: fieldVO.fieldPrecision,
294 fileFieldName: fieldVO.fileFieldName,
295 fieldStandardGuid: fieldVO.fieldStandardGuid,
296 fieldStandardCode: fieldVO.fieldStandardCode,
297 fieldStandardName: fieldVO.fieldStandardName,
298 dataType: fieldVO.dataType,
299 aggWay: fieldVO.aggWay,
300 dataTypeChName: fieldVO.dataTypeChName,
301 dictionaryGuid: fieldVO.dictionaryGuid || "",
302 dictionaryChName: fieldVO.dictionaryChName || "",
303 dimGuid: fieldVO.dimGuid,
304 dimChName: fieldVO.dimChName,
305 dimOrdictionaryGuid: (fieldVO.dictionaryGuid ? fieldVO.dictionaryGuid : fieldVO.dimGuid) || '',
306 isCreate: fieldVO.isCreate,
307 defaultValue: fieldVO.defaultValue,
308 }
309 }) || [], // 字段标准数组。
310 };
311 let subjectTableAttachmentsVO = data.subjectTableAttachmentsVO || {};
312 let file = subjectTableAttachmentsVO?.fileUrl ? [{
313 name: subjectTableAttachmentsVO?.fileName,
314 url: subjectTableAttachmentsVO?.fileUrl
315 }] : [];
316 uploadFileRef.value.setFormValue({
317 file: file,
318 sheetName: subjectTableAttachmentsVO.sheetName
319 });
320 uploadDataFileInfo.value = file;
321 fileTableFields.value = tableCreateInfo.value.tableFields?.map((f, i) => {
322 return {
323 index: i,
324 enName: f.fileFieldName,
325 chName: f.fileFieldName,
326 dataType: f.dataType
327 }
328 }) || [];
329 let partitionAttribute = data.partitionAttribute;
330 expandProperties.value = {
331 partitionMode: partitionAttribute?.partitionMode || 'dynamic',
332 staticPartitionType: partitionAttribute?.staticPartitionType || 'Range',
333 partitionCol: partitionAttribute?.partitionCol || "",
334 partitionTimeUnit: partitionAttribute?.partitionTimeUnit || "DAY",
335 dynamicPartitionEnd: partitionAttribute?.dynamicPartitionEnd == null ? 3 : partitionAttribute?.dynamicPartitionEnd,
336 staticPartitionRange: partitionAttribute?.staticPartitionRangeBegin ? [partitionAttribute?.staticPartitionRangeBegin,
337 partitionAttribute?.staticPartitionRangeEnd] : null,
338 dynamicPartitionHistory: partitionAttribute?.dynamicPartitionHistory === "Y",
339 dynamicPartitionHistoryNum: partitionAttribute?.dynamicPartitionHistoryNum,
340 staticPartitionEnum: partitionAttribute?.staticPartitionEnum,
341 };
342 } else {
343 ElMessage.error(res.msg);
344 }
345 });
346 }
347 })
348
349 onActivated(() => {
350 if (init.value) {
351 let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === fullPath);
352 if (tab) {
353 if (route.query.guid) {
354 let chName = tableCreateInfo.value.tableData[0].chName;
355 let subjectDomainName = tableCreateInfo.value.tableData[0].subjectDomain;
356 tab.meta.title = `编辑-${chName}(${subjectDomainName})`;
357 }
358 if (fullPath === route.fullPath) {
359 document.title = tab.meta.title;
360 }
361 }
362 getDomainDetail(subjectDomainGuid.value);
363 }
364 });
365
366 watch(() => tableStandardGuid.value, (val) => {
367 if (val) {
368 getTableStandardDetail(val).then((res: any) => {
369 if (res.code == proxy.$passCode) {
370 tableStandardDetail.value = res.data || {};
371 } else {
372 ElMessage.error(res.msg);
373 }
374 });
375 } else {
376 tableStandardDetail.value = {}
377 }
378 });
379
380 watch(() => tableStandardDetail.value, (val) => {
381 let enName = tableCreateInfo.value.tableData[0].enName;
382 if (!val.abbreviation) {
383 tableCreateInfo.value.inputNameValue = enName;
384 return;
385 }
386 let strLen = val.abbreviation.length;
387 if (val.standardType === 1) {
388 tableCreateInfo.value.inputNameValue = enName.indexOf(val.abbreviation) === 0 ? enName.slice(strLen) : enName;
389 } else if (val.standardType === 2) {
390 tableCreateInfo.value.inputNameValue = enName.lastIndexOf(val.abbreviation) !== -1 ? enName.substring(0, enName.length - strLen) : enName;
391 }
392 });
393
394
395 const getDomainDetail = (domainGuid) => {
396 getSubjectDomainDetail(domainGuid).then((res: any) => {
397 if (res.code == proxy.$passCode) {
398 tableStandardGuid.value = res.data.tableStandardGuid || '';
399 fieldStandardSetGuids.value = res.data.fieldStandardSetGuids || [];
400 standardSetGuids.value = res.data.fieldStandardSetGuids || [];
401 getFieldStandardOptions(fieldStandardSetGuids.value || []);
402 isOpenStandard.value = res.data.isOpenStandard === 'Y';
403 } else {
404 ElMessage.error(res.msg);
405 }
406 });
407 }
408
409 const getFieldStandardOptions = (guids) => {
410 if (!guids?.length) {
411 standardListOptions.value = [];
412 batchAddDialogInfo.value.contents[0].treeInfo.data = [];
413 return;
414 }
415 getFieldStandardTree(guids).then((res: any) => {
416 if (res.code == proxy.$passCode) {
417 standardListOptions.value = res.data || [];
418 batchAddDialogInfo.value.contents[0].treeInfo.data = standardListOptions.value?.map(s => {
419 return {
420 guid: s.guid,
421 chName: s.chName
422 }
423 })
424 } else {
425 ElMessage.error(res.msg);
426 }
427 })
428 }
429
430 const getDatabaseList = () => {
431 getDatabase({ connectStatus: 1 }).then((res: any) => {
432 databaseList.value = [];
433 if (res.code == proxy.$passCode) {
434 databaseList.value = res.data || [];
435 } else {
436 ElMessage.error(res.msg);
437 }
438 })
439 };
440
441 //字典列表
442 const dictionaryList: any = ref([]);
443
444 const getDictionaryList = () => {
445 getDictionary({}).then((res: any) => {
446 dictionaryList.value = [];
447 if (res.code == proxy.$passCode) {
448 dictionaryList.value = res.data || [];
449 dimOrDictList.value[0].children = dictionaryList.value;
450 dimOrDictList.value[0].disabled = !dictionaryList.value.length;
451 } else {
452 ElMessage.error(res.msg);
453 }
454 })
455 };
456
457 // 可选择的关联维度的列表。
458 const dimListData: any = ref([]);
459
460 const getDimListData = () => {
461 getDimList().then((res: any) => {
462 dimListData.value = [];
463 if (res.code == proxy.$passCode) {
464 dimListData.value = res.data?.map(r => {
465 return {
466 guid: r.guid,
467 chName: r.chName,
468 subjectDomainName: r.subjectDomainName,
469 parentGuid: '2'
470 }
471 }) || [];
472 dimOrDictList.value[1].children = dimListData.value;
473 dimOrDictList.value[1].disabled = !dimListData.value.length;
474 } else {
475 ElMessage.error(res.msg);
476 }
477 })
478 };
479
480 const getFieldTypeList = () => {
481 getDataTypeList().then((res: any) => {
482 fieldTypes.value = [];
483 if (res.code == proxy.$passCode) {
484 fieldTypes.value = res.data || [];
485 } else {
486 ElMessage.error(res.msg);
487 }
488 })
489 }
490
491 const getCharacterListData = () => {
492 getCharacterList().then((res: any) => {
493 characterList.value = [];
494 if (res.code == proxy.$passCode) {
495 characterList.value = res.data || [];
496 } else {
497 ElMessage.error(res.msg);
498 }
499 })
500 }
501
502 const getBatchAddFileStandardList = () => {
503 batchAddDialogInfo.value.contents[1].tableInfo.data = [];
504 if (!batchAddFieldStandardPage.value.standardSetLevelCode) {
505 batchAddDialogInfo.value.contents[1].tableInfo.page.rows = 0;
506 return;
507 }
508 let tableInfo: any = batchAddDialogInfo.value.contents[1].tableInfo;
509 tableInfo.loading = true;
510 getFileStandards(batchAddFieldStandardPage.value).then((res: any) => {
511 tableInfo.loading = false;
512 if (res.code == proxy.$passCode) {
513 let tableData: any = [];
514 batchAddDialogInfo.value.contents[1].tableInfo.data = tableData = res.data.records || [];
515 batchAddDialogInfo.value.contents[1].tableInfo.page.rows = res.data.totalRows || 0;
516 nextTick(() => {
517 let rows: any = [];
518 batchAddDialogInfo.value.contents[2].tagInfo.data?.forEach((d) => {
519 let row = tableData.find((v: any) => v.guid == d.guid);
520 if (row) {
521 rows.push(row);
522 }
523 });
524 batchAddDialogRef.value?.setTableRowSelected(rows, true);
525 });
526 } else {
527 ElMessage.error(res.msg);
528 }
529 })
530 };
531
532 /** 第二步的相关代码逻辑 */
533
534 const fieldStandardTableRef = ref<InstanceType<typeof ElTable>>();
535
536 /** 表模型,只有doris数据库才有 */
537 const dbType = ref('');
538
539 const tableFieldsLoading = ref(false);
540
541 /*** 以下是处理数据字典或维表的树形选择框。 */
542
543 const dimOrDictList: any = ref([{
544 guid: '1',
545 chName: '数据字典',
546 children: dictionaryList.value,
547 isLeaf: false,
548 disabled: !dictionaryList.value.length,
549 }, {
550 guid: '2',
551 chName: '维度',
552 isLeaf: false,
553 disabled: !dimListData.value.length,
554 children: dimListData.value
555 }]);
556
557 const dimOrDictInputFilterMethod = (v, data) => {
558 return data.label?.includes(v) || data.chName?.includes(v);
559 };
560
561 const dimOrDictSelectRef = ref();
562
563 const dimOrDictSelectNode = ref();
564
565 const handleDictSelectNodeChange = (node) => {
566 dimOrDictSelectNode.value = node;
567 }
568
569 const handleDictionaryChange = (val, scope) => {
570 if (!val) {
571 scope.row.dictionaryGuid = '';
572 scope.row.dimGuid = '';
573 scope.row.dictionaryChName = '';
574 scope.row.dimChName = '';
575 return;
576 }
577 let info = dimOrDictSelectNode.value;
578 if (!info) {
579 return;
580 }
581 if (info.parentGuid == '2') {
582 scope.row.dimGuid = val;
583 scope.row.dimChName = dimListData.value.find(d => d.guid === val)?.chName;
584 scope.row.dictionaryGuid = '';
585 scope.row.dictionaryChName = '';
586 } else {
587 scope.row.dictionaryGuid = val;
588 scope.row.dictionaryChName = dictionaryList.value.find(d => d.guid === val)?.chName;
589 scope.row.dimGuid = '';
590 scope.row.dimChName = '';
591 }
592 }
593
594 //数据库选择改变,对应的表名称是否需要变化。需要根据此属性带出表名前缀,以及是否是doris数据库。
595 const selectDatabaseChange = (val) => {
596 let d = databaseList.value.find(d => d.guid === val);
597 if (d) {
598 dbType.value = d.databaseType;
599 tableCreateInfo.value.tableData[0].dataSourceGuid = d.guid;
600 tableCreateInfo.value.tableData[0].dataServerName = d.databaseNameEn;
601 } else {
602 dbType.value = '';
603 tableCreateInfo.value.tableData[0].dataSourceGuid = '';
604 tableCreateInfo.value.tableData[0].dataServerName = '';
605 }
606 };
607
608 const batchAddDialogRef = ref();
609
610 const batchAddDialogInfo: any = ref({
611 visible: false,
612 size: 960,
613 modalClass: 'batchDialog',
614 height: "534px",
615 header: {
616 title: "批量新增字段",
617 headerSearchInputVisible: true,
618 headerSearchInputPlaceholder: "模糊搜索中文名称/英文名称",
619 },
620 type: "grid",
621 contents: [
622 {
623 type: "tree",
624 title: "",
625 style: {
626 width: '223px',
627 padding: 0,
628 },
629 treeInfo: {
630 id: "standard_tree",
631 filter: true,
632 // showCheckbox: true,
633 queryPlaceholder: "搜索名称",
634 showAllLevels: false,
635 props: {
636 label: "chName",
637 value: "guid",
638 children: "children"
639 },
640 nodeKey: "guid",
641 expandedKey: [],
642 data: standardListOptions.value?.map(s => {
643
644 return {
645 guid: s.guid,
646 chName: s.chName,
647 children: s.children
648 }
649 })
650 },
651 },
652 {
653 type: "table",
654 title: "",
655 style: {
656 width: '508px',
657 padding: 0,
658 },
659 col: "border",
660 tableInfo: {
661 id: "batchAddFields",
662 loading: false,
663 maxHeight: "calc(100% - 40px)",
664 multiple: true,
665 fields: [
666 {
667 label: "序号",
668 type: "index",
669 width: 56
670 },
671 { label: "标准编码", field: "fieldStandardCode", width: 150 },
672 { label: "中文名称", field: "chName", width: 120 },
673 { label: "英文名称", field: "enName", width: 120 },
674 { label: "数据类型", field: "dataTypeValue", width: 85 },
675 { label: "字段长度", field: "fieldLength", width: 85 },
676 { label: "字段精度", field: "fieldPrecision", width: 85 },
677 ],
678 data: [],
679 page: {
680 type: "concise",
681 rows: 0,
682 curr: 1,
683 limit: 50,
684 showCount: true
685 },
686 actionInfo: {
687 show: false,
688 },
689 },
690 },
691 {
692 type: "tags",
693 title: "",
694 style: {
695 width: '227px',
696 padding: 0,
697 },
698 tagInfo: {
699 id: "field_tag_list",
700 closable: true,
701 effect: "plain",
702 data: [],
703 labelFields: (tag) => {
704 return tag['chName'] + '(' + tag['enName'] + ')';
705 }
706 },
707 tools: {
708 posit: "top",
709 btns: [{ label: "清空", value: "clear" }],
710 },
711 },
712 ],
713 footer: {
714 btns: [
715 { type: "default", label: "取消", value: "cancel" },
716 { type: "primary", label: "确认", value: "submit" },
717 ],
718 },
719 });
720
721 watch(() => batchAddFieldStandardPage.value.pageSize, (val) => {
722 batchAddDialogInfo.value.contents[1].tableInfo.page.limit = val || 50;
723 })
724
725 watch(() => batchAddFieldStandardPage.value.pageIndex, (val) => {
726 batchAddDialogInfo.value.contents[1].tableInfo.page.curr = val || 1;
727 })
728
729 const deepStandardListOptions = (arr) => {
730 const list: any = []
731 for (let i = 0; i < arr.length; i++) {
732 const { children, ...obj } = arr[i]
733 if (children) {
734 if (arr[i].standardSetGuid) {
735 list.push(obj)
736 } else {
737 list.push({ ...obj, children: deepStandardListOptions(children) })
738 }
739 }
740 }
741 return list
742 }
743
744 /** 批量添加字段标准 */
745 const batchAddFields = () => {
746 batchAddDialogInfo.value.visible = true;
747 let treeInfo = batchAddDialogInfo.value.contents[0].treeInfo;
748 treeInfo && (treeInfo.data = deepStandardListOptions(standardListOptions.value));
749 treeInfo && (treeInfo.currentKey = standardListOptions.value?.[0]?.guid);
750 let tags: any = batchAddDialogInfo.value.contents[2];
751 tags.tagInfo.data = [];
752 batchAddFieldStandardPage.value.pageIndex = 1;
753 //batchAddFieldStandardPage.value.standardSetGuid = standardListOptions.value[0]?.guid;
754 batchAddFieldStandardPage.value.standardSetLevelCode = standardListOptions.value[0]?.standardSetLevelCode;
755 batchAddFieldStandardPage.value.standardSetGuids = standardSetGuids.value
756 getBatchAddFileStandardList();
757 };
758
759 // 批量新增字段的对话框中的分页改变。
760 const bacthAddTablePageChange = (info) => {
761 console.log(info);
762 batchAddFieldStandardPage.value.pageSize = info.size;
763 getBatchAddFileStandardList();
764 };
219 765
766 /** 批量新增对话框搜索输入改变 */
767 const batchDialogHeaderSearchInputChanged = (v) => {
768 batchAddFieldStandardPage.value.pageIndex = 1;
769 batchAddFieldStandardPage.value.name = v;
770 getBatchAddFileStandardList();
771 };
772
773 const bacthAddTreeNodeClick = (node) => {
774 batchAddFieldStandardPage.value.pageIndex = 1;
775 batchAddFieldStandardPage.value.standardSetLevelCode = node.standardSetLevelCode;
776 getBatchAddFileStandardList();
777 }
778
779 /** 添加字段标准 */
780 const addField = () => {
781 let len = tableCreateInfo.value.tableFields.length;
782 tableCreateInfo.value.tableFields.push({
783 orderNum: len + 1,
784 isDim: "N",
785 isPrimary: "N",
786 notNull: "N",
787 isEdit: true
788 });
789 //设置选中表格当前新增行。
790 fieldStandardTableRef.value?.setCurrentRow(
791 tableCreateInfo.value.tableFields[tableCreateInfo.value.tableFields.length - 1]
792 );
793 nextTick(() => {
794 let bodyWrapper = fieldStandardTableRef.value?.$el.querySelector('.el-table__body');
795 let domScroll = bodyWrapper.parentElement.parentElement;
796 let rect = domScroll.getBoundingClientRect();
797 let maxNum = len + 1;
798 if (maxNum * 36 > rect.height + domScroll.scrollTop) {
799 fieldStandardTableRef.value?.setScrollTop(maxNum * 36 - rect.height + 2)
800 }
801 })
802 };
803
804 /** 勾选字段标准选中变化。 */
805 const selectionFieldsChange = (val) => {
806 selectTableFieldRows.value = val;
807 };
808
809 /**
810 * 上移规则:
811 * 勾选多个时先从最上面开始逐个上移一行,若已经移到最上面一行,则不处理。
812 */
813 const moveUp = () => {
814 let selectRows = fieldStandardTableRef.value?.getSelectionRows();
815 if (!selectRows.length) {
816 ElMessage.error('请先选择需要勾选的数据进行上移');
817 return;
818 }
819 let data = tableCreateInfo.value.tableFields;
820 let selectRowIndexs: number[] = [];
821 let minNum: number = 0;
822 selectRows.forEach((row, i) => {
823 let orderNum = data.findIndex(d => d === row) + 1;
824 if (orderNum == 1) {
825 selectRowIndexs.push(orderNum);
826 minNum = orderNum;
827 return;
828 }
829 if (selectRowIndexs.includes(orderNum - 1)) {
830 //下一行也是选中的,则不做转换。
831 return;
832 }
833 let topNum = orderNum - 1;
834 if (i === 0) {
835 minNum = topNum;
836 }
837 row.orderNum = topNum;
838 let changeRow = data[topNum - 1];
839 changeRow.orderNum = orderNum;
840 selectRowIndexs.push(topNum);
841 data[topNum] = changeRow;
842 data[topNum - 1] = row;
843 });
844 nextTick().then(() => {
845 let bodyWrapper = fieldStandardTableRef.value?.$el.querySelector('.el-table__body');
846 let domScroll = bodyWrapper.parentElement.parentElement;
847 if ((minNum * 36 - 36 - 2) < domScroll.scrollTop) {
848 fieldStandardTableRef.value?.setScrollTop((domScroll.scrollTop - 36 - 2) < 0 ? 0 : (domScroll.scrollTop - 36 - 2))
849 }
850 });
851 }
852
853 /**
854 * 下移规则:
855 * 勾选多个时先从最下面开始逐个下移一行,若已经移到最下面一行,则不处理。
856 */
857 const moveDown = () => {
858 let selectRows = fieldStandardTableRef.value?.getSelectionRows();
859 if (!selectRows.length) {
860 ElMessage.error('请先选择需要勾选的数据进行下移');
861 return;
862 }
863 let data = tableCreateInfo.value.tableFields;
864 let selectRowIndexs: number[] = [];
865 let maxNum: number = 0;
866 selectRows.slice(0).reverse().forEach((row, i) => {
867 let orderNum = data.findIndex(d => d === row) + 1;
868 if (orderNum === data.length) {
869 maxNum = orderNum;
870 selectRowIndexs.push(orderNum);
871 return;
872 }
873 if (selectRowIndexs.includes(orderNum + 1)) {
874 //下一行也是选中的,则不做转换。
875 return;
876 }
877 let bottomNum = orderNum + 1;
878 row.orderNum = bottomNum;
879 if (i === 0) {
880 maxNum = bottomNum;
881 }
882 let changeRow = data[bottomNum - 1];
883 changeRow.orderNum = orderNum;
884 selectRowIndexs.push(bottomNum);
885 data[orderNum - 1] = changeRow;
886 data[bottomNum - 1] = row;
887 });
888 nextTick(() => {
889 let bodyWrapper = fieldStandardTableRef.value?.$el.querySelector('.el-table__body');
890 let domScroll = bodyWrapper.parentElement.parentElement;
891 let rect = domScroll.getBoundingClientRect();
892 if (maxNum * 36 > rect.height + domScroll.scrollTop) {
893 fieldStandardTableRef.value?.setScrollTop(maxNum * 36 - rect.height + 2)
894 }
895 })
896 }
897
898
899 /** 批量删除字段标准 */
900 const delFeilds = () => {
901 if (selectTableFieldRows.value.length == 0) {
902 ElMessage({
903 type: "info",
904 message: "请选择需要删除的字段",
905 });
906 return;
907 }
908 ElMessageBox.confirm("此操作将永久删除, 是否继续?", "提示", {
909 confirmButtonText: "确定",
910 cancelButtonText: "取消",
911 type: "warning",
912 })
913 .then(() => {
914 //此删除是直接从库里删除,还是点击保存后再删除呢??如果是入库删除,后,调用接口获取数据。
915 let tableFields = tableCreateInfo.value.tableFields;
916 let tableData = tableCreateInfo.value.tableData[0];
917 selectTableFieldRows.value.forEach((r) => {
918 let index = tableFields.findIndex((t: any) => t === r);
919 if (index !== -1) {
920 let row = tableFields[index];
921 tableFields.splice(index, 1);
922 if (tableData.codeName == row.enName) {
923 tableData.codeName = "";
924 }
925 if (tableData.codeColumn == row.enName) {
926 tableData.codeColumn = "";
927 }
928 }
929 });
930 fieldStandardTableRef.value?.clearSelection();
931 ElMessage({
932 type: "success",
933 message: "删除成功",
934 });
935 })
936 .catch(() => {
937 ElMessage({
938 type: "info",
939 message: "已取消删除",
940 });
941 });
942 };
943
944 /** 跳转到新建字段标准 */
945 const createFieldsStandard = () => {
946 //先判断当前内容,与数据库里的是否相同,不通则需要提示是否存为草稿,或者放弃修改。
947 ElMessageBox.confirm(
948 "当前页面存在尚未保存的修改,确定跳转到字段标准吗?",
949 "提示",
950 {
951 confirmButtonText: "确定",
952 cancelButtonText: "取消",
953 type: "warning",
954 }
955 )
956 .then(() => {
957 router.push({
958 name: "structure"
959 });
960 })
961 .catch(() => {
962 ElMessage({
963 type: "info",
964 message: "已取消",
965 });
966 });
967 };
968
969 //点击编辑按钮
970 const handleFieldClickEdit = (scope) => {
971 scope.row['isEdit'] = true;
972 };
973
974 //点击保存按钮
975 const handleFieldClickSave = (scope) => {
976 if (isOpenStandard.value && !scope.row.fieldStandardCode) {
977 ElMessage({
978 type: "error",
979 message: "该主题域开启了字段标准,当前行字段标准不能为空!",
980 });
981 return;
982 }
983 if (!scope.row.enName) {
984 ElMessage({
985 type: "error",
986 message: "字段英文名不能为空!",
987 });
988 return;
989 }
990 if (checkDefault[scope.row.dataType]) {
991 if (!scope.row.fieldLength) { }
992 if (!checkDefault[scope.row.dataType](scope)) {
993 return
994 }
995 }
996 scope.row['isEdit'] = false;
997 };
998
999 const handleFieldDelete = (scope) => {
1000 ElMessageBox.confirm("此操作将永久删除, 是否继续?", "提示", {
1001 confirmButtonText: "确定",
1002 cancelButtonText: "取消",
1003 type: "warning",
1004 })
1005 .then(() => {
1006 //此删除是直接从库里删除,还是点击保存后再删除呢??如果是入库删除,后,调用接口获取数据。
1007 let tableFields = tableCreateInfo.value.tableFields;
1008 tableFields.splice(scope.$index, 1);
1009 tableCreateInfo.value.tableFields.forEach((field, i) => {
1010 field.orderNum = i + 1;
1011 });
1012 let row = scope.row;
1013 let tableData = tableCreateInfo.value.tableData[0];
1014 if (tableData.codeName == row.enName) {
1015 tableData.codeName = "";
1016 }
1017 if (tableData.codeColumn == row.enName) {
1018 tableData.codeColumn = "";
1019 }
1020 ElMessage({
1021 type: "success",
1022 message: "删除成功",
1023 });
1024 })
1025 .catch(() => {
1026 ElMessage({
1027 type: "info",
1028 message: "已取消删除",
1029 });
1030 });
1031 }
1032
1033 const standardInputFilterMethod = (v, data) => {
1034 return data.label?.includes(v) || data.fieldStandardCode?.includes(v) ||
1035 data.chName?.includes(v) ||
1036 data.enName?.includes(v);
1037 };
1038
1039 const standardSelectNode = ref();
1040
1041 const handleStandardNodeChange = (node) => {
1042 standardSelectNode.value = node;
1043 }
1044
1045 /** 通过字段标准自动带出相关信息。 */
1046 const handleStandardValueChange = (v, scope) => {
1047 console.log(v);
1048 if (!v) {
1049 return;
1050 }
1051 let info = standardSelectNode.value;
1052 if (!info) {
1053 return;
1054 }
1055 scope.row.fieldStandardGuid = info.guid;
1056 scope.row.fieldStandardCode = info.fieldStandardCode;
1057 scope.row.fieldStandardName = info.chName;
1058 scope.row.chName = info.chName;
1059 scope.row.enName = info.enName;
1060 scope.row.dataType = info.dataTypeCode;
1061 if (!scope.row.dimGuid) {
1062 scope.row.dictionaryGuid = info.isDataDic === 'Y' ? info.dataDicGuid : scope.row.dictionaryGuid;
1063 scope.row.dictionaryChName = info.isDataDic === 'Y' ? dictionaryList.value.find(d => d.guid === info.dataDicGuid)?.chName : scope.row.dictionaryChName;
1064 }
1065 scope.row.fieldLength = info["fieldLength"];
1066 scope.row.fieldPrecision = info.fieldPrecision;
1067 };
1068
1069 /** 通过中文字段名称匹配到标准,若已有标准,则不匹配 */
1070 const handleFieldChineseNameChange = (v, scope) => {
1071 if (!v) {
1072 return;
1073 }
1074 let info: any = null;
1075 for (const stand of standardListOptions.value) {
1076 info = stand.children?.find((s) => s.chName === v);
1077 if (info) {
1078 break;
1079 }
1080 }
1081 if (!info) {
1082 scope.row.fieldStandardGuid = '';
1083 scope.row.fieldStandardCode = '';
1084 scope.row.fieldStandardName = '';
1085 scope.row.fieldStandardEnName = '';
1086 return;
1087 }
1088 scope.row.fieldStandardGuid = info.guid;
1089 scope.row.fieldStandardCode = info.fieldStandardCode;
1090 scope.row.fieldStandardName = info.chName;
1091 scope.row.chName = info.chName;
1092 scope.row.enName = info.enName;
1093 scope.row.dataType = info.dataTypeCode;
1094 if (!scope.row.dimGuid) {
1095 scope.row.dictionaryGuid = info.isDataDic === 'Y' ? info.dataDicGuid : scope.row.dictionaryGuid;
1096 scope.row.dictionaryChName = info.isDataDic === 'Y' ? dictionaryList.value.find(d => d.guid === info.dataDicGuid)?.chName : scope.row.dictionaryChName;
1097 }
1098 scope.row.fieldLength = info["fieldLength"];
1099 scope.row.fieldPrecision = info.fieldPrecision;
1100 };
1101
1102 const dataTypeChange = (val, scope) => {
1103 scope.row['defaultValue'] = ''
1104 scope.row['fieldLength'] = undefined
1105 scope.row['fieldPrecision'] = undefined
1106 }
1107
1108 /** 限制长度输入框只能输入整型数字,表,字段英文名称,限制输入字符,数字和下划线。 */
1109 const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null) => {
1110 scope.row[field] = scope.row[field].replace(regexp, '');
1111 if (field == 'fieldLength' && scope.row.dataType == 'decimal') {
1112 max = 65;
1113 }
1114 /** 最大值设置2000 */
1115 if (max && scope.row[field] > max) {
1116 scope.row[field] = max;
1117 }
1118 if (min !== null && scope.row[field] != '' && scope.row[field] <= min) {
1119 scope.row[field] = min;
1120 }
1121 }
220 1122
221 /** 保存表 */ 1123 /** 保存表 */
222 const saveTable = () => { 1124 const saveTable = () => {
1125 let tableData = tableCreateInfo.value.tableData[0];
1126 if (!tableData.chName) {
1127 ElMessage({
1128 type: "error",
1129 message: "主题表名称不能为空!",
1130 });
1131 return;
1132 }
1133 if (!tableData.dataServerName) {
1134 ElMessage({
1135 type: "error",
1136 message: "数据源不能为空!",
1137 });
1138 return;
1139 }
1140 if (tableData.dataServerName.indexOf('-') > -1) {
1141 ElMessage.error('数据库表名称不能包含中划线,可以改为下划线!');
1142 return;
1143 }
1144 if (isDimTable && !tableData.codeColumn) {
1145 ElMessage({
1146 type: "error",
1147 message: "编码字段不能为空",
1148 });
1149 return;
1150 }
1151 if (isDimTable && !tableData.codeName) {
1152 ElMessage({
1153 type: "error",
1154 message: "编码名称不能为空",
1155 });
1156 return;
1157 }
1158 if (!tableCreateInfo.value.inputNameValue) {
1159 ElMessage({
1160 type: "error",
1161 message: "主题表名称不能为空!",
1162 });
1163 return;
1164 }
1165 let tableFields = tableCreateInfo.value.tableFields;
1166 if (!tableFields.length) {
1167 ElMessage({
1168 type: "error",
1169 message: "表字段不能为0行",
1170 });
1171 return;
1172 }
1173 // 若开启了字段标准,则不能为空。
1174 // 必须含有主键。若是聚合模型,则除了主键必须有聚合方式。
1175 let isSumModel = tableData.tableModel === 2;
1176 let hasPrimary = false;
1177 let enNames: any = [];
1178 let chNames: any = [];
1179 const regex = /^[a-zA-Z]/;
1180 let index = 1;
1181 for (const field of tableFields) {
1182 if (!field.enName) {
1183 ElMessage.error(`第 ${index} 个字段的英文名称不能为空!`);
1184 return;
1185 }
1186 if (!regex.test(field.enName)) {
1187 ElMessage.error(`第 ${index} 个字段的英文名称必须以英文字符开头`);
1188 return;
1189 }
1190 if (enNames.indexOf(field.enName) > -1) {
1191 ElMessage.error(`字段的英文名称 ${field.enName} 不能重复!`);
1192 return;
1193 }
1194 if (chNames.indexOf(field.chName) > -1) {
1195 ElMessage.error(`字段的英文名称 ${field.chName} 不能重复!`);
1196 return;
1197 }
1198 if (isOpenStandard.value && !field.fieldStandardCode) {
1199 ElMessage.error(`开启了字段强标准,第 ${index} 个字段的标准不能为空!`);
1200 return;
1201 }
1202 if (field.dataType === "decimal" && (!field.fieldPrecision && field.fieldPrecision != 0)) {
1203 ElMessage.error(`第 ${index} 个字段的字段类型为浮点型时,精度不能为空`);
1204 return;
1205 }
1206 if (field.dataType === "varchar" && (!field.fieldLength && field.fieldLength != 0)) {
1207 ElMessage.error(`第 ${index} 个字段的字段类型为字符型时,长度不能为空`);
1208 return;
1209 }
1210 if (field.dataType === "char" && (!field.fieldLength && field.fieldLength != 0)) {
1211 ElMessage.error(`第 ${index} 个字段的字段类型为单字符型时,长度不能为空`);
1212 return;
1213 }
1214 if (field.dataType === "decimal" && (!field.fieldLength && field.fieldLength != 0)) {
1215 ElMessage.error(`第 ${index} 个字段的字段类型为浮点符型时,长度不能为空`);
1216 return;
1217 }
1218 if (field.isPrimary === 'Y') {
1219 hasPrimary = true;
1220 if (field.notNull != 'Y') {
1221 ElMessage.error(`第 ${field.orderNum} 个字段为主键,应设置为必填`);
1222 return;
1223 }
1224 if (field.dataType == 'text') {
1225 ElMessage.error(`第 ${field.orderNum} 个字段为主键,字段类型不能设置为‘大字段型’`);
1226 return;
1227 }
1228 if (field.dataType == 'json') {
1229 ElMessage.error(`第 ${field.orderNum} 个字段为主键,字段类型不能设置为‘JSON类型’`);
1230 return;
1231 }
1232 if (field.dataType == 'bit') {
1233 ElMessage.error(`第 ${field.orderNum} 个字段为主键,字段类型不能设置为‘布尔类型’`);
1234 return;
1235 }
1236 } else {
1237 if (!field.aggWay && isSumModel) {
1238 ElMessage.error(`聚合模型的非主键字段必须设置聚合方式!`);
1239 return;
1240 }
1241 }
1242 if (tableCreateInfo.value.isSync == 'Y' && field.notNull == 'Y' && !field.fileFieldName && (field.defaultValue === "" || field.defaultValue == null)) {
1243 ElMessage.error(`第 ${index} 个字段为必填且建表勾选同步数据时,文件字段名和默认值不能同时为空`);
1244 return;
1245 }
1246 if (field.isEdit) {
1247 if (field.dataType && checkDefault[field.dataType]) {
1248 if (!field.fieldLength) { }
1249 if (!checkDefault[field.dataType]({ row: field })) {
1250 return;
1251 }
1252 }
1253 }
1254 enNames.push(field.enName);
1255 chNames.push(field.chName);
1256 index++;
1257 }
1258 if (!hasPrimary) {
1259 ElMessage.error(`字段至少有一个主键字段!`);
1260 return;
1261 }
1262 let abbreviation = tableStandardDetail.value.abbreviation;
1263 let uploadDataFileInfos = uploadDataFileInfo.value;
1264 let addInfo = Object.assign({}, tableCreateInfo.value.tableData[0], {
1265 enName: !abbreviation ? tableCreateInfo.value.inputNameValue : (tableStandardDetail.value.standardType === 1 ? abbreviation.concat(tableCreateInfo.value.inputNameValue) : tableCreateInfo.value.inputNameValue.concat(abbreviation)),
1266 tableCreateType: 4,//根据文件新建表
1267 saveFlag: 1,
1268 dbType: dbType.value,
1269 layereAttribute: route.query.layereAttribute,
1270 dataState: 1,
1271 tableCategory: isDimTable ? 4 : tableCreateInfo.value.tableData[0].tableCategory,
1272 partitionAttribute: !Object.keys(tableCreateInfo.value.partitionAttribute).length ? null : Object.assign({}, tableCreateInfo.value.partitionAttribute, {
1273 dynamicPartitionHistory: tableCreateInfo.value.partitionAttribute ? "Y" : 'N'
1274 }),
1275 subjectFieldAddDTOS: tableCreateInfo.value.tableFields.map((field, i) => {
1276 return Object.assign({}, field, { orderNum: i + 1 });
1277 }),
1278 standardGuid: tableStandardDetail.value.guid,
1279 standardCode: tableStandardDetail.value.standardCode,
1280 standardDataVersion: tableStandardDetail.value.dataVersion,
1281 abbreviation: abbreviation,
1282 isSync: tableCreateInfo.value.isSync,
1283 attachmentsDTO: {
1284 fileName: uploadDataFileInfos[0]?.name,
1285 sheetName: tableCreateInfo.value.sheetName,
1286 fileUrl: uploadDataFileInfos[0].url || "",
1287 staffGuid: userData.staffGuid
1288 }
1289 })
1290 if (!tableCreateInfo.value.guid) { //添加
1291 fullscreenLoading.value = true;
1292 saveSubjectTable(addInfo).then((res: any) => {
1293 fullscreenLoading.value = false;
1294 if (res.code == proxy.$passCode) {
1295 ElMessage.success('手动新建表保存成功!');
1296 router.push({
1297 name: 'dataWarehouse'
1298 });
1299 dataCatalogStore.set(subjectDomainGuid.value);
1300 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1301 } else {
1302 ElMessage.error(res.msg);
1303 }
1304 });
1305 } else { //更新
1306 addInfo.guid = tableCreateInfo.value.guid;
1307 addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N';
1308 fullscreenLoading.value = true;
1309 updateSubjectTable(addInfo).then((res: any) => {
1310 fullscreenLoading.value = false;
1311 if (res.code == proxy.$passCode) {
1312 ElMessage.success('编辑更新成功!');
1313 router.push({
1314 name: 'dataWarehouse'
1315 });
1316 dataCatalogStore.set(subjectDomainGuid.value);
1317 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1318 } else {
1319 ElMessage.error(res.msg);
1320 }
1321 });
1322 }
1323 };
1324
1325 const saveDraftTable = () => {
1326 let tableData = tableCreateInfo.value.tableData[0];
1327 if (!tableData.chName) {
1328 ElMessage({
1329 type: "error",
1330 message: "主题表名称不能为空!",
1331 });
1332 return;
1333 }
1334 let abbreviation = tableStandardDetail.value.abbreviation;
1335 let uploadDataFileInfos = uploadDataFileInfo.value;
1336 let addInfo = Object.assign({}, tableCreateInfo.value.tableData[0], {
1337 enName: !abbreviation ? tableCreateInfo.value.inputNameValue : (tableStandardDetail.value.standardType === 1 ? abbreviation.concat(tableCreateInfo.value.inputNameValue) : tableCreateInfo.value.inputNameValue.concat(abbreviation)),
1338 tableCreateType: 4,//根据文件新建表
1339 saveFlag: 0,
1340 layereAttribute: route.query.layereAttribute,
1341 dbType: dbType.value,
1342 dataState: 0,
1343 partitionAttribute: !Object.keys(tableCreateInfo.value.partitionAttribute).length ? null : Object.assign({}, tableCreateInfo.value.partitionAttribute, {
1344 dynamicPartitionHistory: tableCreateInfo.value.partitionAttribute ? "Y" : 'N'
1345 }),
1346 subjectFieldAddDTOS: tableCreateInfo.value.tableFields.map((field, i) => {
1347 return Object.assign({}, field, { orderNum: i + 1 });
1348 }),
1349 standardGuid: tableStandardDetail.value.guid,
1350 standardCode: tableStandardDetail.value.standardCode,
1351 standardDataVersion: tableStandardDetail.value.dataVersion,
1352 abbreviation: abbreviation,
1353 isSync: tableCreateInfo.value.isSync,
1354 attachmentsDTO: {
1355 fileName: uploadDataFileInfos[0]?.name,
1356 sheetName: tableCreateInfo.value.sheetName,
1357 fileUrl: uploadDataFileInfos[0].url || "",
1358 staffGuid: userData.staffGuid
1359 }
1360 })
1361 if (!tableCreateInfo.value.guid) { //添加
1362 fullscreenLoading.value = true;
1363 saveSubjectTableDraft(addInfo).then((res: any) => {
1364 fullscreenLoading.value = false;
1365 if (res.code == proxy.$passCode) {
1366 ElMessage.success('手动新建表保存草稿成功!');
1367 router.push({
1368 name: 'dataWarehouse'
1369 });
1370 dataCatalogStore.set(subjectDomainGuid.value);
1371 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1372 } else {
1373 ElMessage.error(res.msg);
1374 }
1375 })
1376 } else {
1377 addInfo.isCreate = tableCreateInfo.value.isCreate ? 'Y' : 'N';
1378 addInfo.guid = tableCreateInfo.value.guid;
1379 fullscreenLoading.value = true;
1380 updateSubjectTableDraft(addInfo).then((res: any) => {
1381 fullscreenLoading.value = false;
1382 if (res.code == proxy.$passCode) {
1383 ElMessage.success('编辑保存草稿成功!');
1384 router.push({
1385 name: 'dataWarehouse'
1386 });
1387 dataCatalogStore.set(subjectDomainGuid.value);
1388 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== route.fullPath));
1389 } else {
1390 ElMessage.error(res.msg);
1391 }
1392 });
1393 }
1394 };
1395
1396 const batchAddDialogBtnClick = (btn, info) => {
1397 if (btn.value == "submit") {
1398 if (!info.length) {
1399 ElMessage.error('已选标准不能为空!');
1400 return;
1401 }
1402 batchAddDialogInfo.value.visible = false;
1403 if (info.length) {
1404 let len = tableCreateInfo.value.tableFields.length;
1405 info.forEach((i) => {
1406 tableCreateInfo.value.tableFields.push({
1407 orderNum: ++len,
1408 fieldStandardGuid: i.guid,
1409 fieldStandardCode: i.fieldStandardCode,
1410 fieldStandardName: i.chName,
1411 chName: i.chName,
1412 enName: i.enName,
1413 dataType: i.dataTypeCode,
1414 dictionaryGuid: i.isDataDic === 'Y' ? i.dataDicGuid : "",
1415 dictionaryChName: i.isDataDic === 'Y' ? dictionaryList.value.find(d => d.guid === i.dataDicGuid)?.chName : "",
1416 fieldLength: i.fieldLength,
1417 fieldPrecision: i.fieldPrecision,
1418 isPrimary: "N",
1419 notNull: "N",
1420 });
1421 });
1422 nextTick(() => {
1423 let bodyWrapper = fieldStandardTableRef.value?.$el.querySelector('.el-table__body');
1424 let domScroll = bodyWrapper.parentElement.parentElement;
1425 let rect = domScroll.getBoundingClientRect();
1426 if (len * 36 > rect.height + domScroll.scrollTop) {
1427 fieldStandardTableRef.value?.setScrollTop(len * 36 - rect.height + 2)
1428 }
1429 })
1430 }
1431 } else if (btn.value == "cancel") {
1432 batchAddDialogInfo.value.visible = false;
1433 }
1434 };
1435
1436 const expandProperties = ref({});
1437
1438 /** 扩展属性弹出对话框 */
1439 const expandPropertyDialogRef = ref();
1440
1441 /** 扩展属性弹出对话框 */
1442 const handleClickExpand = () => {
1443 expandPropertyDialogRef.value?.handleClickExpand();
1444 }
1445
1446 const expandDialogValueChange = (val) => {
1447 tableCreateInfo.value.partitionAttribute = val;
1448 expandProperties.value = val;
223 } 1449 }
1450
1451 const tableSelectFields = computed(() => {
1452 return tableCreateInfo.value.tableFields.filter(t => !!t.enName);
1453 })
1454
224 </script> 1455 </script>
225 1456
226 <template> 1457 <template>
...@@ -232,7 +1463,295 @@ const saveTable = () => { ...@@ -232,7 +1463,295 @@ const saveTable = () => {
232 <uploadExcelFile ref="uploadFileRef" v-show="stepsInfo.step === 0" @fileDataChange="handleFileDataChange"> 1463 <uploadExcelFile ref="uploadFileRef" v-show="stepsInfo.step === 0" @fileDataChange="handleFileDataChange">
233 </uploadExcelFile> 1464 </uploadExcelFile>
234 <div class="second-step-content" v-show="stepsInfo.step === 1"> 1465 <div class="second-step-content" v-show="stepsInfo.step === 1">
235 aaa 1466 <el-table ref="tableRef" :data="tableCreateInfo.tableData" :highlight-current-row="true" stripe border
1467 height="100%" tooltip-effect="light" row-key="guid" :style="{
1468 width: '100%',
1469 height: 'auto',
1470 display: 'inline-block',
1471 }">
1472 <el-table-column prop="dataSourceGuid" label="数据源" width="200px" align="left" show-overflow-tooltip>
1473 <template #header>
1474 <span>数据源</span>
1475 <span style="color:red;margin-left: 2px;">*</span>
1476 </template>
1477 <template #default="scope">
1478 <el-select v-model="scope.row['dataSourceGuid']" placeholder="请选择" :disabled="tableCreateInfo.isCreate"
1479 @change="(val) => selectDatabaseChange(val)" clearable filterable>
1480 <el-option v-for="opt in databaseList" :key="opt['guid']" :label="opt['databaseNameZh']"
1481 :value="opt['guid']" />
1482 </el-select>
1483 </template>
1484 </el-table-column>
1485 <el-table-column prop="enName" label="数据库表" width="200px" align="left" show-overflow-tooltip>
1486 <template #header>
1487 <span>数据库表</span>
1488 <span style="color:red;margin-left: 2px;">*</span>
1489 </template>
1490 <template #default="scope">
1491 <div class="prefix-or-suffix-cell">
1492 <div v-if="tableStandardDetail.standardType === 1">{{ tableStandardDetail.abbreviation }}</div>
1493 <el-input :disabled="tableCreateInfo.isCreate" v-model.trim="tableCreateInfo.inputNameValue"
1494 :maxlength="50" placeholder="必填" />
1495 <div v-if="tableStandardDetail.standardType === 2">{{ tableStandardDetail.abbreviation }}</div>
1496 </div>
1497 </template>
1498 </el-table-column>
1499 <el-table-column prop="chName" label="主题表名称" width="200px" align="left" show-overflow-tooltip>
1500 <template #header>
1501 <span>主题表名称</span>
1502 <span style="color:red;margin-left: 2px;">*</span>
1503 </template>
1504 <template #default="scope">
1505 <el-input v-model.trim="scope.row['chName']" placeholder="必填" :maxlength="50" />
1506 </template>
1507 </el-table-column>
1508 <el-table-column prop="subjectDomain" label="主题域" width="180px" align="left" show-overflow-tooltip>
1509 <template #default="scope">
1510 <el-input disabled v-model.trim="scope.row['subjectDomain']" />
1511 </template>
1512 </el-table-column>
1513 <el-table-column prop="tableModel" label="表模型" width="150px" align="left" show-overflow-tooltip>
1514 <template #default="scope">
1515 <el-select v-if="dbType == 'doris'" v-model="scope.row['tableModel']" placeholder="请选择"
1516 :disabled="tableCreateInfo.isCreate">
1517 <el-option v-for="opt in tableModels" :key="opt['value']" :label="opt['label']" :value="opt['value']" />
1518 </el-select>
1519 <span v-else>--</span>
1520 </template>
1521 </el-table-column>
1522 <el-table-column prop="tableCategory" v-if="!isDimTable" label="表分类" width="150px" align="left"
1523 show-overflow-tooltip>
1524 <template #default="scope">
1525 <el-select v-model="scope.row['tableCategory']" placeholder="请选择" :disabled="tableCreateInfo.isCreate">
1526 <el-option v-for="opt in tableCategoryList" :key="opt['value']" :label="opt['label']"
1527 :value="opt['value']" />
1528 </el-select>
1529 </template>
1530 </el-table-column>
1531 <el-table-column prop="dimType" v-if="isDimTable" label="维表类型" width="150px" align="left"
1532 show-overflow-tooltip>
1533 <template #default="scope">
1534 <el-select v-model="scope.row['dimType']" placeholder="请选择">
1535 <el-option v-for="opt in dimTypeList" :key="opt['value']" :label="opt['label']" :value="opt['value']" />
1536 </el-select>
1537 </template>
1538 </el-table-column>
1539 <el-table-column prop="codeColumn" v-if="isDimTable" label="编码字段" width="150px" align="left"
1540 show-overflow-tooltip>
1541 <template #header>
1542 <span>编码字段</span>
1543 <span style="color:red;margin-left: 2px;">*</span>
1544 </template>
1545 <template #default="scope">
1546 <el-select v-model="scope.row['codeColumn']" placeholder="请选择">
1547 <el-option v-for="opt in tableSelectFields" :key="opt['enName']" :label="opt['chName']"
1548 :value="opt['enName']" />
1549 </el-select>
1550 </template>
1551 </el-table-column>
1552 <el-table-column prop="codeName" v-if="isDimTable" label="编码名称" width="150px" align="left"
1553 show-overflow-tooltip>
1554 <template #header>
1555 <span>编码名称</span>
1556 <span style="color:red;margin-left: 2px;">*</span>
1557 </template>
1558 <template #default="scope">
1559 <el-select v-model="scope.row['codeName']" placeholder="请选择">
1560 <el-option v-for="opt in tableSelectFields" :key="opt['enName']" :label="opt['chName']"
1561 :value="opt['enName']" />
1562 </el-select>
1563 </template>
1564 </el-table-column>
1565 <el-table-column prop="syncPolicy" label="同步策略" width="150px" align="left" show-overflow-tooltip>
1566 <template #default="scope">
1567 <el-select v-model="scope.row['syncPolicy']" placeholder="请选择" :disabled="tableCreateInfo.isCreate">
1568 <el-option v-for="opt in syncPolicys" :key="opt['value']" :label="opt['label']" :value="opt['value']" />
1569 </el-select>
1570 </template>
1571 </el-table-column>
1572 <el-table-column prop="characterSet" label="字符集" width="150px" align="left" show-overflow-tooltip>
1573 <template #default="scope">
1574 <el-select v-model="scope.row['characterSet']" placeholder="请选择" :disabled="tableCreateInfo.isCreate">
1575 <el-option v-for="opt in characterList" :key="opt['paramValue']" :label="opt['paramName']"
1576 :value="opt['paramValue']" />
1577 </el-select>
1578 </template>
1579 </el-table-column>
1580 <el-table-column prop="description" label="描述" width="220px" align="left" show-overflow-tooltip>
1581 <template #default="scope">
1582 <el-input v-model.trim="scope.row['description']" />
1583 </template>
1584 </el-table-column>
1585 <el-table-column label="操作" width="100px" align="left" fixed="right" show-overflow-tooltip>
1586 <template #default="scope">
1587 <span class="text_btn" :class="{ 'is-disabled': tableCreateInfo.isCreate }" @click="handleClickExpand()"
1588 v-preReClick>扩展属性</span>
1589 </template>
1590 </el-table-column>
1591 </el-table>
1592 <div class="tools_btns">
1593 <el-button v-if="fieldStandardSetGuids?.length" type="primary" @click="batchAddFields"
1594 v-preReClick>批量新增</el-button>
1595 <el-button type="primary" @click="addField" v-preReClick>新增</el-button>
1596 <el-button @click="moveUp">上移</el-button>
1597 <el-button @click="moveDown">下移</el-button>
1598 <el-button @click="delFeilds" v-preReClick>批量删除</el-button>
1599 <el-button v-if="fieldStandardSetGuids?.length" type="primary" @click="createFieldsStandard"
1600 v-preReClick>新建字段标准</el-button>
1601 </div>
1602 <div class="table_panel">
1603 <el-table ref="fieldStandardTableRef" :data="tableCreateInfo.tableFields" v-loading="tableFieldsLoading"
1604 :highlight-current-row="true" stripe border height="100%" @selection-change="selectionFieldsChange"
1605 tooltip-effect="light" :style="{
1606 width: '100%',
1607 'max-height': '100%',
1608 display: 'inline-block',
1609 }">
1610 <el-table-column type="selection" :width="32" align="center" />
1611 <el-table-column label="排序" type="index" width="56px" align="center" show-overflow-tooltip>
1612 </el-table-column>
1613 <el-table-column v-if="fieldStandardSetGuids?.length" prop="fieldStandardGuid" label="标准名称" width="160px"
1614 align="left" show-overflow-tooltip>
1615 <template #default="scope">
1616 <el-tree-select ref="treeSelectRef" v-if="scope.row['isEdit']" filterable clearable
1617 :data="standardListOptions" v-model="scope.row['fieldStandardGuid']" placeholder="请选择"
1618 :filter-node-method="standardInputFilterMethod" :props="{
1619 label: 'chName',
1620 value: 'guid',
1621 children: 'children',
1622 isLeaf: 'isLeaf'
1623 }" @change="(v) => handleStandardValueChange(v, scope)" @current-change="handleStandardNodeChange">
1624 <template #default="{ node, data }">
1625 <template v-if="node.level > 1 && !node.data.children && node.data.standardSetGuid">
1626 <span>{{ data["chName"] + `(${data["enName"]})` }}</span>
1627 </template>
1628 <span v-else>{{ data['chName'] }}</span>
1629 </template>
1630 </el-tree-select>
1631 <span v-else>{{ scope.row["fieldStandardName"] || "--" }}</span>
1632 </template>
1633 </el-table-column>
1634 <el-table-column prop="chName" label="目标字段名" width="150px" align="left" show-overflow-tooltip>
1635 <template #default="scope">
1636 <el-input v-if="scope.row['isEdit'] && !isOpenStandard"
1637 :placeholder="fieldStandardSetGuids?.length ? '输入匹配标准' : ''" v-model.trim="scope.row['chName']"
1638 @change="(v) => handleFieldChineseNameChange(v, scope)" />
1639 <span v-else>{{ scope.row["chName"] || '--' }}</span>
1640 </template>
1641 </el-table-column>
1642 <el-table-column prop="enName" label="目标字段英文名" width="150px" align="left" show-overflow-tooltip>
1643 <template #default="scope">
1644 <el-input v-if="scope.row['isEdit'] && !isOpenStandard" v-model.trim="scope.row['enName']"
1645 placeholder="必填" @input="inputLengthKeyUp(/[^a-zA-Z0-9_]/g, scope, 'enName')" />
1646 <span v-else>{{ scope.row["enName"] || '--' }}</span>
1647 </template>
1648 </el-table-column>
1649 <el-table-column prop="fileFieldName" label="文件字段名" width="150px" align="left" show-overflow-tooltip>
1650 <template #default="scope">
1651 <el-select v-if="scope.row['isEdit']" v-model="scope.row['fileFieldName']" clearable filterable
1652 placeholder="请选择">
1653 <el-option v-for="opt in fileTableFields" :key="opt['index']" :label="opt['chName']"
1654 :value="opt['enName']" />
1655 </el-select>
1656 <span v-else>{{ scope.row['fileFieldName'] || "--" }}</span>
1657 </template>
1658 </el-table-column>
1659 <el-table-column prop="dataType" label="字段类型" width="120px" align="left" show-overflow-tooltip>
1660 <template #default="scope">
1661 <el-select v-if="scope.row['isEdit'] && !isOpenStandard" v-model="scope.row['dataType']"
1662 @change="(val) => dataTypeChange(val, scope)" placeholder="请选择">
1663 <el-option v-for="opt in fieldTypes" :key="opt['paramValue']" :label="opt['paramName']"
1664 :value="opt['paramValue']" />
1665 </el-select>
1666 <span v-else>{{ fieldTypes.find(f => f.paramValue === scope.row["dataType"])?.paramName || "--"
1667 }}</span>
1668 </template>
1669 </el-table-column>
1670 <el-table-column prop="fieldLength" label="长度" width="115px" align="left" show-overflow-tooltip>
1671 <template #default="scope">
1672 <el-input
1673 v-if="scope.row['isEdit'] && !isOpenStandard && (scope.row['dataType'] == 'varchar' || scope.row['dataType'] == 'decimal' || scope.row['dataType'] == 'char')"
1674 v-model.trim="scope.row['fieldLength']" placeholder="必填"
1675 @input="inputLengthKeyUp(/\D/g, scope, 'fieldLength', 2000, 1)" />
1676 <span v-else>{{ scope.row["fieldLength"] == null ? '--' : scope.row["fieldLength"] }}</span>
1677 </template>
1678 </el-table-column>
1679 <el-table-column prop="fieldPrecision" label="精度" width="115px" align="left" show-overflow-tooltip>
1680 <template #default="scope">
1681 <el-input v-if="scope.row['isEdit'] && !isOpenStandard && scope.row['dataType'] == 'decimal'"
1682 v-model.trim="scope.row['fieldPrecision']" placeholder="必填"
1683 @input="inputLengthKeyUp(/\D/g, scope, 'fieldPrecision', 30, 1)" />
1684 <span v-else>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span>
1685 </template>
1686 </el-table-column>
1687 <el-table-column prop="dimOrdictionaryGuid" v-if="!isDimTable" label="关联维度/字典" width="130px" align="left"
1688 show-overflow-tooltip>
1689 <template #default="scope">
1690 <el-tree-select ref="dimOrDictSelectRef" v-if="scope.row['isEdit']" filterable clearable
1691 :data="dimOrDictList" v-model="scope.row['dimOrdictionaryGuid']" node-key="guid"
1692 :default-expanded-keys="scope.row['dictionaryGuid'] ? ['1'] : (scope.row['dimGuid'] ? ['2'] : [])"
1693 placeholder="请选择" :filter-node-method="dimOrDictInputFilterMethod" :props="{
1694 label: 'chName',
1695 value: 'guid',
1696 children: 'children',
1697 isLeaf: 'isLeaf'
1698 }" @change="(v) => handleDictionaryChange(v, scope)" @current-change="handleDictSelectNodeChange">
1699 <template #default="{ node, data }">
1700 <template v-if="node.level > 1 && data.parentGuid == '2'">
1701 <span>{{ data["chName"] + `(${data["subjectDomainName"]})` }}</span>
1702 </template>
1703 <span v-else>{{ data['chName'] }}</span>
1704 </template>
1705 </el-tree-select>
1706 <span v-else>{{ (scope.row['dictionaryGuid'] ? scope.row["dictionaryChName"] : (scope.row['dimGuid'] ?
1707 scope.row['dimChName'] : '--')) || '--' }}</span>
1708 </template>
1709 </el-table-column>
1710 <el-table-column prop="isPrimary" label="是否主键" width="90px" align="left" show-overflow-tooltip>
1711 <template #default="scope">
1712 <el-select v-if="scope.row['isEdit']" v-model="scope.row['isPrimary']" placeholder="请选择">
1713 <el-option v-for="opt in isNotList" :key="opt['value']" :label="opt['label']" :value="opt['value']" />
1714 </el-select>
1715 <span v-else>{{ scope.row["isPrimary"] || '--' }}</span>
1716 </template>
1717 </el-table-column>
1718 <el-table-column v-if="tableCreateInfo.tableData[0].tableModel == 2" prop="aggWay" label="聚合方式"
1719 width="120px" align="left" show-overflow-tooltip>
1720 <template #default="scope">
1721 <el-select v-if="scope.row['isEdit']" v-model="scope.row['aggWay']" placeholder="请选择">
1722 <el-option v-for="opt in aggMethodList" :key="opt['value']" :label="opt['label']"
1723 :value="opt['value']" />
1724 </el-select>
1725 <span v-else>{{ scope.row["aggWay"] || '--' }}</span>
1726 </template>
1727 </el-table-column>
1728 <el-table-column prop="notNull" label="是否必填" width="90px" align="left" show-overflow-tooltip>
1729 <template #default="scope">
1730 <el-select v-if="scope.row['isEdit'] && !(scope.row.isCreate == 'Y' && scope.row['notNull'] == 'N')"
1731 v-model="scope.row['notNull']" placeholder="请选择">
1732 <el-option v-for="opt in isNotList" :key="opt['value']" :label="opt['label']" :value="opt['value']" />
1733 </el-select>
1734 <span v-else>{{ scope.row["notNull"] || '--' }}</span>
1735 </template>
1736 </el-table-column>
1737 <el-table-column prop="defaultValue" label="默认值" width="205px" align="left" show-overflow-tooltip>
1738 <template #default="scope">
1739 <tableDefaultValue :scope="scope" :dbType="dbType"></tableDefaultValue>
1740 </template>
1741 </el-table-column>
1742 <el-table-column label="操作" width="100px" align="left" fixed="right" show-overflow-tooltip>
1743 <template #default="scope">
1744 <span class="text_btn" v-if="!scope.row['isEdit']" @click="handleFieldClickEdit(scope)"
1745 v-preReClick>编辑</span>
1746 <span class="text_btn" v-else @click="handleFieldClickSave(scope)" v-preReClick>保存</span>
1747 <el-divider direction="vertical" />
1748 <span class="text_btn" @click="handleFieldDelete(scope)">删除</span>
1749 </template>
1750 </el-table-column>
1751 </el-table>
1752 </div>
1753 <Dialog ref="batchAddDialogRef" :dialogInfo="batchAddDialogInfo" @btnClick="batchAddDialogBtnClick"
1754 @tablePageChange="bacthAddTablePageChange" @headerSearchInputChanged="batchDialogHeaderSearchInputChanged" />
236 </div> 1755 </div>
237 </div> 1756 </div>
238 <div class="bottom_tool_wrap"> 1757 <div class="bottom_tool_wrap">
...@@ -243,11 +1762,15 @@ const saveTable = () => { ...@@ -243,11 +1762,15 @@ const saveTable = () => {
243 <el-checkbox v-model="tableCreateInfo.isSync" true-label="Y" :disabled="!fileTableData?.length" 1762 <el-checkbox v-model="tableCreateInfo.isSync" true-label="Y" :disabled="!fileTableData?.length"
244 false-label="N">同步数据(说明:勾选代表建表同时写入表格数据。)</el-checkbox> 1763 false-label="N">同步数据(说明:勾选代表建表同时写入表格数据。)</el-checkbox>
245 <el-button @click="previousStep">上一步</el-button> 1764 <el-button @click="previousStep">上一步</el-button>
246 <el-button type="primary">保存为草稿</el-button> 1765 <el-button type="primary" @click="saveDraftTable">保存为草稿</el-button>
247 <el-button type="primary" @click="saveTable">提交</el-button> 1766 <el-button type="primary" @click="saveTable">提交</el-button>
248 </template> 1767 </template>
249 </div> 1768 </div>
250 1769 <Dialog ref="batchAddDialogRef" :dialogInfo="batchAddDialogInfo" @btnClick="batchAddDialogBtnClick"
1770 @tablePageChange="bacthAddTablePageChange" @treeNodeClick="bacthAddTreeNodeClick"
1771 @headerSearchInputChanged="batchDialogHeaderSearchInputChanged" />
1772 <expandPropertyDialog ref="expandPropertyDialogRef" :partitionAttribute="expandProperties"
1773 :table-create-info="tableCreateInfo" @expandValueChange="expandDialogValueChange" />
251 </div> 1774 </div>
252 </template> 1775 </template>
253 1776
......
...@@ -149,6 +149,7 @@ const handleClassDataEdit = (params) => { ...@@ -149,6 +149,7 @@ const handleClassDataEdit = (params) => {
149 149
150 // 配置分类 150 // 配置分类
151 const handleClassDataClick = (item, des = '') => { 151 const handleClassDataClick = (item, des = '') => {
152 console.log(item, 'i111tem');
152 // 获取分级标准 153 // 获取分级标准
153 router.push({ 154 router.push({
154 name: 'classStandardEdit', 155 name: 'classStandardEdit',
...@@ -156,7 +157,8 @@ const handleClassDataClick = (item, des = '') => { ...@@ -156,7 +157,8 @@ const handleClassDataClick = (item, des = '') => {
156 guid: item.guid, 157 guid: item.guid,
157 type: des === '' ? '配置' : des, 158 type: des === '' ? '配置' : des,
158 classStandardName: item.name, 159 classStandardName: item.name,
159 refGradeGuid: item.refGradeGuid 160 refGradeGuid: item.refGradeGuid,
161 description: item.description
160 } 162 }
161 }); 163 });
162 } 164 }
...@@ -248,6 +250,7 @@ const newCreateClassStandardDialogInfo = ref({ ...@@ -248,6 +250,7 @@ const newCreateClassStandardDialogInfo = ref({
248 newCreateClassStandardDialogInfo.value.visible = false; 250 newCreateClassStandardDialogInfo.value.visible = false;
249 }, 251 },
250 submit: async (btn, info) => { 252 submit: async (btn, info) => {
253
251 if (newCreateClassStandardDialogInfo.value.title === '新增分类') { 254 if (newCreateClassStandardDialogInfo.value.title === '新增分类') {
252 newCreateClassStandardDialogInfo.value.submitBtnLoading = true; 255 newCreateClassStandardDialogInfo.value.submitBtnLoading = true;
253 const params = { 256 const params = {
...@@ -263,6 +266,22 @@ const newCreateClassStandardDialogInfo = ref({ ...@@ -263,6 +266,22 @@ const newCreateClassStandardDialogInfo = ref({
263 type: 'success', 266 type: 'success',
264 message: '新增分类成功' 267 message: '新增分类成功'
265 }) 268 })
269
270 nextTick(() => {
271 // 拿到新增的分类数据,跳转到配置页面
272 const item = classListData.value.find(item => item.name === info.classStandardName);
273 console.log(item, 'item---------------');
274 if (item) {
275 const params = {
276 name: item.name,
277 guid: item.guid,
278 refGradeGuid: item.refGradeGuid,
279 description: item.description
280 }
281 handleClassDataClick(params, '');
282 }
283 })
284
266 newCreateClassStandardDialogInfo.value.submitBtnLoading = false; 285 newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
267 newCreateClassStandardDialogInfo.value.visible = false; 286 newCreateClassStandardDialogInfo.value.visible = false;
268 } else { 287 } else {
...@@ -343,7 +362,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -343,7 +362,7 @@ const newCreateGradeStandardDialogInfo = ref({
343 await getClassifyGradListData(); 362 await getClassifyGradListData();
344 proxy.$ElMessage({ 363 proxy.$ElMessage({
345 type: 'success', 364 type: 'success',
346 message: '新增分成功' 365 message: '新增分成功'
347 }) 366 })
348 367
349 // 拿到新增的分级数据,跳转到配置页面 368 // 拿到新增的分级数据,跳转到配置页面
...@@ -372,7 +391,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -372,7 +391,7 @@ const newCreateGradeStandardDialogInfo = ref({
372 getClassifyGradListData(); 391 getClassifyGradListData();
373 proxy.$ElMessage({ 392 proxy.$ElMessage({
374 type: 'success', 393 type: 'success',
375 message: '修改分成功' 394 message: '修改分成功'
376 }) 395 })
377 newCreateGradeStandardDialogInfo.value.visible = false; 396 newCreateGradeStandardDialogInfo.value.visible = false;
378 } else { 397 } else {
...@@ -437,6 +456,7 @@ const handleClassifyGradDataClick = (item) => { ...@@ -437,6 +456,7 @@ const handleClassifyGradDataClick = (item) => {
437 } 456 }
438 457
439 const newCreateGrade = () => { 458 const newCreateGrade = () => {
459 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
440 newCreateGradeStandardDialogInfo.value.visible = true; 460 newCreateGradeStandardDialogInfo.value.visible = true;
441 newCreateGradeFormItems.value.forEach(item => item.default = ''); 461 newCreateGradeFormItems.value.forEach(item => item.default = '');
442 } 462 }
...@@ -539,7 +559,7 @@ const newCreateGrade = () => { ...@@ -539,7 +559,7 @@ const newCreateGrade = () => {
539 </template> 559 </template>
540 <div class="levitation-ul"> 560 <div class="levitation-ul">
541 <span class="levitation-li" @click="handleClassDataClick(item)">配置</span> 561 <span class="levitation-li" @click="handleClassDataClick(item)">配置</span>
542 <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> 562 <!-- <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> -->
543 <span class="levitation-li" @click="handleClassDataDel(item)">删除</span> 563 <span class="levitation-li" @click="handleClassDataDel(item)">删除</span>
544 </div> 564 </div>
545 </el-popover> 565 </el-popover>
...@@ -572,7 +592,7 @@ const newCreateGrade = () => { ...@@ -572,7 +592,7 @@ const newCreateGrade = () => {
572 </template> 592 </template>
573 <div class="levitation-ul"> 593 <div class="levitation-ul">
574 <span class="levitation-li" @click="handleClassifyGradDataClick(item)">配置</span> 594 <span class="levitation-li" @click="handleClassifyGradDataClick(item)">配置</span>
575 <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> 595 <!-- <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> -->
576 <span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span> 596 <span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span>
577 </div> 597 </div>
578 </el-popover> 598 </el-popover>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!