c7b77154 by lxs

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

2 parents 429ed263 82a6de26
...@@ -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 });
...@@ -172,6 +172,14 @@ export const getLargeCategoryList = (params) => request({ ...@@ -172,6 +172,14 @@ export const getLargeCategoryList = (params) => request({
172 method: 'get', 172 method: 'get',
173 }) 173 })
174 174
175 /**
176 * 获取字段类型
177 */
178 export const getFieldTypeList = (params) => request({
179 url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType?dictType=${params.dictType}`,
180 method: 'get',
181 })
182
175 183
176 /** 分类分级模板数据 */ 184 /** 分类分级模板数据 */
177 export const getTempleteClassifyData = (data) => request({ 185 export const getTempleteClassifyData = (data) => request({
...@@ -595,7 +603,7 @@ export const getDictionary = (params) => request({ ...@@ -595,7 +603,7 @@ export const getDictionary = (params) => request({
595 * @path /biz-rule-config/save 603 * @path /biz-rule-config/save
596 */ 604 */
597 export const saveBizRuleConfig = (data) => request({ 605 export const saveBizRuleConfig = (data) => request({
598 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save`, 606 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save-or-update`,
599 method: 'post', 607 method: 'post',
600 data 608 data
601 }) 609 })
...@@ -644,15 +652,46 @@ export const getDbDirFieldPageList = (data) => request({ ...@@ -644,15 +652,46 @@ export const getDbDirFieldPageList = (data) => request({
644 data 652 data
645 }) 653 })
646 654
655 /**
656 * 数据库目录-表联动查询
657 * @param data
658 * @returns
659 * @path /db-dir/table/select-list
660 */
661 export const getDbDirTableSelectList = (data) => request({
662 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/select-list`,
663 method: 'post',
664 data
665 })
666
647 667
648 668
649 /** 获取已有字段信息 */ 669 /** 获取已有字段信息 */
650 export const getDsTableStructure= (data) => request({ 670 export const getDsTableStructure= (data) => request({
651 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid`, 671 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid?tableGuid=${data.tableGuid}&execGuid=${data.execGuid}`,
672 method: 'post',
673 });
674
675 /** 获取已有数据库目录字段信息 入参是数组 */
676 export const getDsTableStructures= (data) => request({
677 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guids`,
652 method: 'post', 678 method: 'post',
653 data 679 data
654 }); 680 });
655 681
682 /**
683 * 数据库目录-字段查询分类分级
684 * @param {Object}
685 * @path /db-dir/field/get-classify-and-grade
686 */
687 export const getDbDirFieldClassifyAndGrade = (data) => request({
688 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/get-classify-and-grade`,
689 method: 'post',
690 data
691 })
692
693
694
656 /** 根据选择的连接池获取表列表 */ 695 /** 根据选择的连接池获取表列表 */
657 export const getDsTableByDs = (params) => request({ 696 export const getDsTableByDs = (params) => request({
658 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`, 697 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`,
......
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 });
...@@ -24,7 +24,8 @@ const props = defineProps({ ...@@ -24,7 +24,8 @@ const props = defineProps({
24 24
25 const emits = defineEmits(["expand"]); 25 const emits = defineEmits(["expand"]);
26 26
27 const isExpanded = ref(true); 27 // const isExpanded = ref(true);
28 const isExpanded = ref(props.isExpand);
28 29
29 watch( 30 watch(
30 () => props.isExpand, 31 () => props.isExpand,
...@@ -46,14 +47,10 @@ const expandSwicthHandler = () => { ...@@ -46,14 +47,10 @@ const expandSwicthHandler = () => {
46 </script> 47 </script>
47 48
48 <template> 49 <template>
49 <ElCard 50 <ElCard class="v-content-wrap" shadow="never" :body-style="{
50 class="v-content-wrap"
51 shadow="never"
52 :body-style="{
53 padding: `0px`, 51 padding: `0px`,
54 height: `${isExpanded ? contentHeight + 28 : 0}px`, 52 height: `${isExpanded ? contentHeight + 28 : 0}px`,
55 }" 53 }">
56 >
57 <template v-if="title" #header> 54 <template v-if="title" #header>
58 <div class="card-title" @click="expandSwicthHandler"> 55 <div class="card-title" @click="expandSwicthHandler">
59 <span v-if="expandSwicth" style="padding-right: 5px; cursor: pointer"> 56 <span v-if="expandSwicth" style="padding-right: 5px; cursor: pointer">
......
...@@ -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,15 +449,20 @@ const uploadFile = (file, item) => { ...@@ -444,15 +449,20 @@ 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) => {
457 obsUploadRequest({
458 signedUrl: res.data.signedUrl,
459 file: file.file,
460 actualsignedRequestHeaders: res.data.actualsignedRequestHeaders
461 }).then(() => {
452 if (res.code == '00000') { 462 if (res.code == '00000') {
453 let fileItem = { 463 let fileItem = {
454 name: file.file.name, 464 name: file.file.name,
455 url: res.data, 465 url: res.data.signedUrl,
456 file: file.file 466 file: file.file
457 }; 467 };
458 if (item.limit === 1) { 468 if (item.limit === 1) {
...@@ -468,6 +478,7 @@ const uploadFile = (file, item) => { ...@@ -468,6 +478,7 @@ const uploadFile = (file, item) => {
468 ElMessage.error('上传失败,请重新上传!'); 478 ElMessage.error('上传失败,请重新上传!');
469 } 479 }
470 }) 480 })
481 })
471 .catch(() => { 482 .catch(() => {
472 uploadRef.value['ref' + item.field].handleRemove(file); 483 uploadRef.value['ref' + item.field].handleRemove(file);
473 ElMessage.error('上传失败,请重新上传'); 484 ElMessage.error('上传失败,请重新上传');
......
...@@ -99,8 +99,9 @@ onMounted(() => { ...@@ -99,8 +99,9 @@ onMounted(() => {
99 <el-form-item v-if="item.visible ?? true" :key="'item_' + index" 99 <el-form-item v-if="item.visible ?? true" :key="'item_' + index"
100 :class="{ 'width_auto': item.type == 'radio-button' }" :prop="item.field"> 100 :class="{ 'width_auto': item.type == 'radio-button' }" :prop="item.field">
101 <template v-if="item.type == 'select'"> 101 <template v-if="item.type == 'select'">
102 <el-select :class="{ 'is-multiple': item.multiple }" v-model="formInline[item.field]" 102 <el-select collapse-tags collapse-tags-tooltip :class="{ 'is-multiple': item.multiple }"
103 :placeholder="item.placeholder" :clearable="item.clearable" :filterable="item.filterable" 103 v-model="formInline[item.field]" :placeholder="item.placeholder" :clearable="item.clearable"
104 :filterable="item.filterable" :multiple="item.multiple" :max-collapse-tags="3"
104 :disabled="item.disabled ?? false" @change="(val) => selectChange(val, item)"> 105 :disabled="item.disabled ?? false" @change="(val) => selectChange(val, item)">
105 <el-option v-for="opt in item.options" :label="item.props?.label ? opt[item.props.label] : opt.label" 106 <el-option v-for="opt in item.options" :label="item.props?.label ? opt[item.props.label] : opt.label"
106 :value="item.props?.value ? opt[item.props.value] : opt.value" /> 107 :value="item.props?.value ? opt[item.props.value] : opt.value" />
......
...@@ -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[]
......
...@@ -82,7 +82,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -82,7 +82,7 @@ const routes: RouteRecordRaw[] = [
82 name: 'templateConfig', 82 name: 'templateConfig',
83 component: () => import('@/views/data_inventory/templateConfig.vue'), 83 component: () => import('@/views/data_inventory/templateConfig.vue'),
84 meta: { 84 meta: {
85 title: '分类分级标准', 85 title: '分类分级规则',
86 breadcrumb: false, 86 breadcrumb: false,
87 cache: true 87 cache: true
88 }, 88 },
......
...@@ -6,17 +6,16 @@ ...@@ -6,17 +6,16 @@
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();
16 const { proxy } = getCurrentInstance() as any; 15 const { proxy } = getCurrentInstance() as any;
17 const router = useRouter(); 16 const router = useRouter();
18 const route = useRoute(); 17 const route = useRoute();
19 const fullPath = route.query.fullPath; 18 const fullPath = route.fullPath;
20 const userStore = useUserStore(); 19 const userStore = useUserStore();
21 20
22 const fullscreenLoading = ref(false); 21 const fullscreenLoading = ref(false);
...@@ -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 }, {
36 label: '分级标准', 35 // label: '分级标准',
37 type: 'input', 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,
45 label: '分级名称',
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->四级
...@@ -60,7 +83,7 @@ const tableInfo = ref({ ...@@ -60,7 +83,7 @@ const tableInfo = ref({
60 multiple: false, 83 multiple: false,
61 fields: [ 84 fields: [
62 { label: "序号", type: "index", width: 56, align: "center" }, 85 { label: "序号", type: "index", width: 56, align: "center" },
63 { label: "分类", field: "classifyName", width: 160, type: 'expand' }, 86 { label: "规则名称", field: "classifyName", width: 160, type: 'expand' },
64 { 87 {
65 label: "层级", field: "level", width: 120, getName: (scope) => { 88 label: "层级", field: "level", width: 120, getName: (scope) => {
66 let level = scope.row.level; 89 let level = scope.row.level;
...@@ -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 },
...@@ -93,12 +116,12 @@ const tableInfo = ref({ ...@@ -93,12 +116,12 @@ const tableInfo = ref({
93 btns: [ 116 btns: [
94 { 117 {
95 label: "编辑", value: "edit", click: (scope) => { 118 label: "编辑", value: "edit", click: (scope) => {
96 // console.log(drawerRef.value.drawerFormRef[0].ruleFormRef); 119 console.log(scope.row);
97 currentEditingGuid.value = scope.row.guid; 120 currentEditingGuid.value = scope.row.guid;
98 selectParentEdit(scope.row.guid); 121 selectParentEdit(scope.row.guid);
99 currTableInfo.value = scope.row; 122 currTableInfo.value = scope.row;
100 drawerInfo.value.visible = true; 123 drawerInfo.value.visible = true;
101 drawerInfo.value.header.title = '编辑分类'; 124 drawerInfo.value.header.title = '编辑规则';
102 classEditFormItems.value.forEach(item => { 125 classEditFormItems.value.forEach(item => {
103 item.default = scope.row[item.field] 126 item.default = scope.row[item.field]
104 }) 127 })
...@@ -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",
...@@ -187,7 +210,7 @@ const classEditFormItems = ref([{ ...@@ -187,7 +210,7 @@ const classEditFormItems = ref([{
187 }, { 210 }, {
188 label: '定义说明', 211 label: '定义说明',
189 type: 'textarea', 212 type: 'textarea',
190 placeholder: '请输入', 213 placeholder: '分类规则的描述说明',
191 field: 'description', 214 field: 'description',
192 default: '', 215 default: '',
193 clearable: true, 216 clearable: true,
...@@ -282,7 +305,7 @@ const drawerInfo = ref({ ...@@ -282,7 +305,7 @@ const drawerInfo = ref({
282 direction: 'rtl', 305 direction: 'rtl',
283 size: 600, 306 size: 600,
284 header: { 307 header: {
285 title: '添加分类', 308 title: '添加规则',
286 }, 309 },
287 type: '', 310 type: '',
288 container: { 311 container: {
...@@ -301,7 +324,7 @@ const drawerBtnClick = async (btn, info) => { ...@@ -301,7 +324,7 @@ const drawerBtnClick = async (btn, info) => {
301 if (btn.value == 'cancel') { 324 if (btn.value == 'cancel') {
302 drawerInfo.value.visible = false; 325 drawerInfo.value.visible = false;
303 } else { 326 } else {
304 if (drawerInfo.value.header.title == '添加分类') { 327 if (drawerInfo.value.header.title == '添加规则') {
305 drawerInfo.value.footer.btns.map((item: any) => (item.disabled = true)); 328 drawerInfo.value.footer.btns.map((item: any) => (item.disabled = true));
306 const params = { 329 const params = {
307 ...info, 330 ...info,
...@@ -309,7 +332,7 @@ const drawerBtnClick = async (btn, info) => { ...@@ -309,7 +332,7 @@ const drawerBtnClick = async (btn, info) => {
309 } 332 }
310 const res: any = await saveClassify(params); 333 const res: any = await saveClassify(params);
311 if (res.code == proxy.$passCode) { 334 if (res.code == proxy.$passCode) {
312 proxy.$ElMessage.success('添加成功!'); 335 proxy.$ElMessage.success('添加规则成功!');
313 drawerInfo.value.visible = false; 336 drawerInfo.value.visible = false;
314 getTreeListData(); 337 getTreeListData();
315 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled); 338 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled);
...@@ -322,11 +345,13 @@ const drawerBtnClick = async (btn, info) => { ...@@ -322,11 +345,13 @@ 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) {
329 proxy.$ElMessage.success('修改成功!'); 354 proxy.$ElMessage.success('编辑规则成功!');
330 drawerInfo.value.visible = false; 355 drawerInfo.value.visible = false;
331 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled); 356 drawerInfo.value.footer.btns.map((item: any) => delete item.disabled);
332 getTreeListData(); 357 getTreeListData();
...@@ -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 }
...@@ -360,7 +387,7 @@ const findStandardName = (guid: string) => { ...@@ -360,7 +387,7 @@ const findStandardName = (guid: string) => {
360 const item: any = classifyGradListData.value.find((item: any) => item.guid == guid); 387 const item: any = classifyGradListData.value.find((item: any) => item.guid == guid);
361 return item ? item.name : ''; 388 return item ? item.name : '';
362 } 389 }
363 390 const tableRef = ref(null); // 表格的 ref
364 // 获取分类树形列表 391 // 获取分类树形列表
365 const treeListParams = ref({ 392 const treeListParams = ref({
366 pageIndex: 1, 393 pageIndex: 1,
...@@ -377,6 +404,7 @@ const getTreeListData = async () => { ...@@ -377,6 +404,7 @@ const getTreeListData = async () => {
377 classEditFormItems.value[2].options = treeListData.value; 404 classEditFormItems.value[2].options = treeListData.value;
378 shapeTreeListData.value = treeListData.value; 405 shapeTreeListData.value = treeListData.value;
379 tableInfo.value.loading = false; 406 tableInfo.value.loading = false;
407
380 } else { 408 } else {
381 proxy.$ElMessage.error(res.msg); 409 proxy.$ElMessage.error(res.msg);
382 } 410 }
...@@ -435,7 +463,7 @@ const newCreateClass = () => { ...@@ -435,7 +463,7 @@ const newCreateClass = () => {
435 463
436 drawerInfo.value.visible = true; 464 drawerInfo.value.visible = true;
437 classEditFormItems.value[2].options = treeListData.value; 465 classEditFormItems.value[2].options = treeListData.value;
438 drawerInfo.value.header.title = '添加分类'; 466 drawerInfo.value.header.title = '添加规则';
439 classEditFormItems.value.forEach(item => { 467 classEditFormItems.value.forEach(item => {
440 if (item.field == 'status') { 468 if (item.field == 'status') {
441 item.default = 'Y'; 469 item.default = 'Y';
...@@ -445,18 +473,66 @@ const newCreateClass = () => { ...@@ -445,18 +473,66 @@ const newCreateClass = () => {
445 }) 473 })
446 } 474 }
447 475
476
477 const saveLoading = ref(false);
478 const saveUpdate = async () => {
479 console.log(formRef.value.formInline);
480 if (!formRef.value.formInline.classStandardName) {
481 proxy.$ElMessage.error('分类名称不能为空');
482 return;
483 }
484 if (!formRef.value.formInline.gradeStandard) {
485 proxy.$ElMessage.error('分级名称不能为空');
486 return;
487 }
488 saveLoading.value = true;
489 const params = {
490 guid: router.currentRoute.value.query.guid,
491 name: formRef.value.formInline.classStandardName,
492 refGradeGuid: formRef.value.formInline.gradeStandard,
493 type: 'C',
494 description: formRef.value.formInline.description
495 }
496 console.log(params);
497 const res: any = await updateClassifyGrad(params);
498 if (res.code == proxy.$passCode) {
499 proxy.$ElMessage.success('修改分类成功');
500 router.push({
501 name: 'templateConfig'
502 });
503 saveLoading.value = false;
504 } else {
505 saveLoading.value = false;
506 proxy.$ElMessage.error(res.msg);
507 }
508 }
509
448 /** 导入分类。 */ 510 /** 导入分类。 */
449 const importClass = () => { 511 const importClass = () => {
450 512
451 } 513 }
452 514
453 const dataShowMethod = ref('table'); 515 const dataShowMethod = ref('table');
516 // 创建聚合数据
517 const updatedTreeData = ref<any>();
454 /** 切换是图形展示,还是表格展示。 */ 518 /** 切换是图形展示,还是表格展示。 */
455 const changeShowMethod = () => { 519 const changeShowMethod = () => {
456 dataShowMethod.value = dataShowMethod.value == 'table' ? 'shape' : 'table'; 520 dataShowMethod.value = dataShowMethod.value == 'table' ? 'shape' : 'table';
521 console.log(shapeTreeListData.value);
522 if (dataShowMethod.value == 'shape') {
523 const tempArr = {
524 classifyName: router.currentRoute.value.query.classStandardName,
525 guid: "1",
526 children: shapeTreeListData.value
527 }
528 updatedTreeData.value = [tempArr];
529 console.log('updatedTreeData', [tempArr]);
530 }
457 } 531 }
458 532
459 const cancel = () => { 533 const cancel = () => {
534 console.log(userStore.tabbar);
535 console.log(fullPath);
460 proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => { 536 proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => {
461 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 537 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
462 router.push({ 538 router.push({
...@@ -613,13 +689,14 @@ const initGraph = () => { ...@@ -613,13 +689,14 @@ const initGraph = () => {
613 }, 689 },
614 getHGap: function getHGap() { 690 getHGap: function getHGap() {
615 return 80; 691 return 80;
616 } 692 },
617 } 693 }
618 }); 694 });
619 graph.data(shapeTreeListData.value[0]); 695 graph.data(updatedTreeData.value[0]);
620 graph.on('node:mouseenter', (e) => { 696 graph.on('node:mouseenter', (e) => {
621 const nodeItem = e.item; // 获取鼠标进入的节点元素对象 697 const nodeItem = e.item; // 获取鼠标进入的节点元素对象
622 const nodeModel = nodeItem.getModel(); 698 const nodeModel = nodeItem.getModel();
699 if (nodeModel.guid == '1') return; // 根节点不显示
623 // 更新弹窗位置和显示节点详情 700 // 更新弹窗位置和显示节点详情
624 nodeDetails.value = nodeModel; 701 nodeDetails.value = nodeModel;
625 showNodeDetails.value = true; 702 showNodeDetails.value = true;
...@@ -739,22 +816,30 @@ onMounted(() => { ...@@ -739,22 +816,30 @@ onMounted(() => {
739 // }); 816 // });
740 }) 817 })
741 818
819 const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true');
820 const isExpand1 = ref<boolean>(true);
821 const expand = (item) => {
822 console.log(item);
823 isExpand1.value = item
824 }
825
742 </script> 826 </script>
743 827
744 <template> 828 <template>
745 <div class="container_wrap" v-loading="fullscreenLoading"> 829 <div class="container_wrap" v-loading="fullscreenLoading">
746 <div class="content_main"> 830 <div class="content_main">
747 <ContentWrap id="id-baseInfo" title="基础信息" description="" style="margin-top: 8px;"> 831 <ContentWrap id="id-baseInfo" title="基础信息" description="" style="margin-top: 8px;" :expandSwicth="true"
832 :isExpand="isExpand">
748 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" /> 833 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
749 </ContentWrap> 834 </ContentWrap>
750 <ContentWrap id="id-classStandard" class="detail-content" title="分类标准" description="" 835 <ContentWrap id="id-classStandard" class="detail-content" title="分类规则" description=""
751 style="margin-top:16px; height: calc(100% - 161px)"> 836 style="margin-top:16px; height: calc(100% - 161px)" :expandSwicth="true" :isExpand="isExpand1" @expand="expand">
752 <div class="tools_btns"> 837 <div class="tools_btns">
753 <el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加分类</el-button> 838 <el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加规则</el-button>
754 <!-- <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> --> 839 <!-- <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> -->
755 <el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button> 840 <el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button>
756 </div> 841 </div>
757 <Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" /> 842 <Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" :ref="tableRef" />
758 <div ref="shapeMain" class="shape-main" v-show="dataShowMethod != 'table'"></div> 843 <div ref="shapeMain" class="shape-main" v-show="dataShowMethod != 'table'"></div>
759 <div v-if="showNodeDetails" class="node-details-popup" 844 <div v-if="showNodeDetails" class="node-details-popup"
760 :style="{ top: popupPosition.top + 'px', left: popupPosition.left + 'px' }"> 845 :style="{ top: popupPosition.top + 'px', left: popupPosition.left + 'px' }">
...@@ -778,6 +863,7 @@ onMounted(() => { ...@@ -778,6 +863,7 @@ onMounted(() => {
778 </div> 863 </div>
779 <div class="bottom_tool_wrap"> 864 <div class="bottom_tool_wrap">
780 <el-button @click="cancel">取消</el-button> 865 <el-button @click="cancel">取消</el-button>
866 <el-button type="primary" @click="saveUpdate" :loading="saveLoading">保存修改</el-button>
781 </div> 867 </div>
782 <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" ref="drawerRef" /> 868 <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" ref="drawerRef" />
783 </div> 869 </div>
...@@ -791,6 +877,7 @@ onMounted(() => { ...@@ -791,6 +877,7 @@ onMounted(() => {
791 .content_main { 877 .content_main {
792 height: calc(100% - 44px); 878 height: calc(100% - 44px);
793 padding: 10px 16px; 879 padding: 10px 16px;
880 overflow: auto;
794 } 881 }
795 882
796 .bottom_tool_wrap { 883 .bottom_tool_wrap {
...@@ -809,6 +896,7 @@ onMounted(() => { ...@@ -809,6 +896,7 @@ onMounted(() => {
809 896
810 .card-body-content { 897 .card-body-content {
811 height: 100%; 898 height: 100%;
899 overflow: auto;
812 } 900 }
813 } 901 }
814 } 902 }
...@@ -824,11 +912,11 @@ onMounted(() => { ...@@ -824,11 +912,11 @@ onMounted(() => {
824 } 912 }
825 913
826 .shape-main { 914 .shape-main {
827 height: calc(100% - 58px); 915 height: calc(100% - 44px);
828 } 916 }
829 917
830 .table_panel { 918 .table_panel {
831 height: calc(100% - 58px) !important; 919 height: calc(100% - 44px) !important;
832 } 920 }
833 921
834 .node-details-popup { 922 .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.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: {
...@@ -137,7 +140,7 @@ const tableInfo = ref({ ...@@ -137,7 +140,7 @@ const tableInfo = ref({
137 console.log(scope); 140 console.log(scope);
138 filterDataGradeEdit(scope.row.dataGrade); 141 filterDataGradeEdit(scope.row.dataGrade);
139 newCreateGradeStandardDialogInfo.value.visible = true; 142 newCreateGradeStandardDialogInfo.value.visible = true;
140 newCreateGradeStandardDialogInfo.value.title = '编辑分类'; 143 newCreateGradeStandardDialogInfo.value.title = '编辑规则';
141 newCreateGradeFormItems.value.forEach(item => { 144 newCreateGradeFormItems.value.forEach(item => {
142 item.default = scope.row[item.field]; 145 item.default = scope.row[item.field];
143 }) 146 })
...@@ -228,7 +231,7 @@ const newCreateGradeFormItems = ref([{ ...@@ -228,7 +231,7 @@ const newCreateGradeFormItems = ref([{
228 visible: true, 231 visible: true,
229 }, 232 },
230 { 233 {
231 label: '序号', 234 label: '序号',
232 type: 'input', 235 type: 'input',
233 maxlength: 19, 236 maxlength: 19,
234 placeholder: '请输入', 237 placeholder: '请输入',
...@@ -239,10 +242,10 @@ const newCreateGradeFormItems = ref([{ ...@@ -239,10 +242,10 @@ const newCreateGradeFormItems = ref([{
239 regexp: /\D/g 242 regexp: /\D/g
240 }, 243 },
241 { 244 {
242 label: '分级描述', 245 label: '规则描述',
243 type: 'textarea', 246 type: 'textarea',
244 maxlength: 500, 247 maxlength: 500,
245 placeholder: '分类分级的描述说明', 248 placeholder: '分级规则的描述说明',
246 field: 'gradeDesc', 249 field: 'gradeDesc',
247 default: '', 250 default: '',
248 clearable: true, 251 clearable: true,
...@@ -265,7 +268,7 @@ const newCreateGradeFormRules = ref({ ...@@ -265,7 +268,7 @@ const newCreateGradeFormRules = ref({
265 const newCreateGradeStandardDialogInfo = ref({ 268 const newCreateGradeStandardDialogInfo = ref({
266 visible: false, 269 visible: false,
267 size: 860, 270 size: 860,
268 title: "添加分类", 271 title: "新增规则",
269 type: "", 272 type: "",
270 formInfo: { 273 formInfo: {
271 id: "grade-form", 274 id: "grade-form",
...@@ -278,9 +281,8 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -278,9 +281,8 @@ const newCreateGradeStandardDialogInfo = ref({
278 newCreateGradeStandardDialogInfo.value.visible = false; 281 newCreateGradeStandardDialogInfo.value.visible = false;
279 }, 282 },
280 submit: async (btn, info) => { 283 submit: async (btn, info) => {
281 console.log(info, guid);
282 newCreateGradeStandardDialogInfo.value.submitBtnLoading = true; 284 newCreateGradeStandardDialogInfo.value.submitBtnLoading = true;
283 if (newCreateGradeStandardDialogInfo.value.title === '编辑分类') { 285 if (newCreateGradeStandardDialogInfo.value.title === '编辑规则') {
284 const params = { 286 const params = {
285 ...info, 287 ...info,
286 guid: editClassifyGradeGuid.value, 288 guid: editClassifyGradeGuid.value,
...@@ -291,7 +293,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -291,7 +293,7 @@ const newCreateGradeStandardDialogInfo = ref({
291 if (res.code == proxy.$passCode) { 293 if (res.code == proxy.$passCode) {
292 proxy.$ElMessage({ 294 proxy.$ElMessage({
293 type: 'success', 295 type: 'success',
294 message: '修改分类成功' 296 message: '编辑规则成功'
295 }) 297 })
296 getGradeListData(); 298 getGradeListData();
297 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 299 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
...@@ -309,7 +311,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -309,7 +311,7 @@ const newCreateGradeStandardDialogInfo = ref({
309 if (res.code == proxy.$passCode) { 311 if (res.code == proxy.$passCode) {
310 proxy.$ElMessage({ 312 proxy.$ElMessage({
311 type: 'success', 313 type: 'success',
312 message: '新增分类成功' 314 message: '新增规则成功'
313 }) 315 })
314 getGradeListData(); 316 getGradeListData();
315 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 317 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
...@@ -324,23 +326,87 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -324,23 +326,87 @@ const newCreateGradeStandardDialogInfo = ref({
324 326
325 const newStandard = () => { 327 const newStandard = () => {
326 filterDataGrade(); 328 filterDataGrade();
329 newCreateGradeStandardDialogInfo.value.title = '新增规则';
327 newCreateGradeStandardDialogInfo.value.visible = true; 330 newCreateGradeStandardDialogInfo.value.visible = true;
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 }]);
331 347
332 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 }
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 saveLoading.value = false;
373 proxy.$ElMessage.error(res.msg);
374 }
375 }
376
377 const cancel = () => {
378 proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => {
379 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
380 router.push({
381 name: 'templateConfig'
382 });
383 }, () => {
384 proxy.$ElMessage.info("已取消");
385 });
386 }
387
333 </script> 388 </script>
334 389
335 <template> 390 <template>
336 <div class="container_wrap" v-loading="fullscreenLoading"> 391 <div class="container_wrap">
337 <div class="content_main"> 392 <div class="content_main">
393 <ContentWrap id="id-baseInfo" title="基础信息" description="" style="margin-top: 8px;">
394 <Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
395 </ContentWrap>
396 <ContentWrap id="id-grade-info" title="分级规则" class="detail-content" description="" style="margin-top: 8px;">
397 <div class="content" v-loading="fullscreenLoading">
338 <div class="table-top-btns"> 398 <div class="table-top-btns">
339 <el-button type="primary" @click="newStandard">新增标准</el-button> 399 <el-button type="primary" @click="newStandard">新增规则</el-button>
340 <el-button @click="batchRemobe">批量删除</el-button> 400 <el-button @click="batchRemobe">批量删除</el-button>
341 </div> 401 </div>
342 <Table ref="tableRef" :tableInfo="tableInfo" @tableSelectionChange="onTableSelectChange" /> 402 <Table ref="tableRef" :tableInfo="tableInfo" @tableSelectionChange="onTableSelectChange" />
343 </div> 403 </div>
404 </ContentWrap>
405 </div>
406 <div class="bottom_tool_wrap">
407 <el-button @click="cancel">取消</el-button>
408 <el-button type="primary" @click="saveUpdate" :loading="saveLoading">保存修改</el-button>
409 </div>
344 <Dialog_form :dialogConfigInfo="newCreateGradeStandardDialogInfo" /> 410 <Dialog_form :dialogConfigInfo="newCreateGradeStandardDialogInfo" />
345 </div> 411 </div>
346 </template> 412 </template>
...@@ -351,11 +417,49 @@ const newStandard = () => { ...@@ -351,11 +417,49 @@ const newStandard = () => {
351 417
352 .content_main { 418 .content_main {
353 height: calc(100% - 44px); 419 height: calc(100% - 44px);
354 padding: 17px 16px 10px 16px; 420 padding: 10px 16px;
421 overflow: auto;
355 422
356 .table-top-btns { 423 .table-top-btns {
357 display: flex;
358 margin-bottom: 12px; 424 margin-bottom: 12px;
359 } 425 }
360 } 426 }
427
428 .bottom_tool_wrap {
429 height: 44px;
430 padding: 0 16px;
431 border-top: 1px solid #d9d9d9;
432 display: flex;
433 justify-content: center;
434 align-items: center;
435 }
436
437 :deep(.detail-content) {
438
439 .el-card__body {
440 height: calc(100% - 50px) !important;
441
442 .card-body-content {
443 height: 100%;
444 }
445 }
446 }
447
448 .tools_btns {
449 position: relative;
450 margin-bottom: 16px;
451
452 .show-change-btn {
453 position: absolute;
454 right: 0px;
455 }
456 }
457
458 .shape-main {
459 height: calc(100% - 40px);
460 }
461
462 .table_panel {
463 height: calc(100% - 40px) !important;
464 }
361 </style> 465 </style>
......
...@@ -7,7 +7,9 @@ import { Warning } from "@element-plus/icons-vue"; ...@@ -7,7 +7,9 @@ import { Warning } from "@element-plus/icons-vue";
7 import TableTools from '@/components/Tools/table_tools.vue'; 7 import TableTools from '@/components/Tools/table_tools.vue';
8 import { 8 import {
9 getCgDirTreeList, getCgDirFieldPageList, getDictionary, saveBizRuleConfig, 9 getCgDirTreeList, getCgDirFieldPageList, getDictionary, saveBizRuleConfig,
10 getDbDirTreeList, getDbDirTablePageList, getDbDirFieldPageList, getExecGuidAndName 10 getDbDirTreeList, getDbDirTablePageList, getDbDirFieldPageList, getExecGuidAndName,
11 getClassifyTreeList, getCgLabelPageList, execTaskFieldList, execTaskSheetList, getTaskExeTreeList,
12 getDbFieldList
11 } from '@/api/modules/dataInventory'; 13 } from '@/api/modules/dataInventory';
12 import { TableColumnWidth } from "@/utils/enum"; 14 import { TableColumnWidth } from "@/utils/enum";
13 import router from "@/router"; 15 import router from "@/router";
...@@ -20,15 +22,16 @@ const CgDirTreeList = ref(); ...@@ -20,15 +22,16 @@ const CgDirTreeList = ref();
20 const getCgDirTreeData = async () => { 22 const getCgDirTreeData = async () => {
21 treeInfo.value.loading = true; 23 treeInfo.value.loading = true;
22 const params = { 24 const params = {
23 classifyName: '', 25 execGuid: execGuidInfo.value.execGuid
24 } 26 }
25 const res: any = await getCgDirTreeList(params); 27 const res: any = await getTaskExeTreeList(params);
26 if (res.code == proxy.$passCode) { 28 if (res.code == proxy.$passCode) {
27 CgDirTreeList.value = res.data; 29 CgDirTreeList.value = res.data;
28 treeInfo.value.data = res.data; 30 treeInfo.value.data = res.data;
29 currentPath.value = [res.data[0].classifyName]; 31 currentPath.value = [res.data[0].classifyName];
30 treeInfo.value.expandedKey = [res.data[0].guid]; 32 treeInfo.value.expandedKey = [res.data[0].guid];
31 treeInfo.value.currentNodeKey = res.data[0].guid; 33 treeInfo.value.currentNodeKey = res.data[0].guid;
34 searchItemList.value[1].options = res.data;
32 treeInfo.value.loading = false; 35 treeInfo.value.loading = false;
33 } else { 36 } else {
34 proxy.$ElMessage.error(res.msg); 37 proxy.$ElMessage.error(res.msg);
...@@ -41,18 +44,16 @@ const getCgDirFieldPage = async (params = {}) => { ...@@ -41,18 +44,16 @@ const getCgDirFieldPage = async (params = {}) => {
41 // 在这里你可以根据需要扩展或修改 params 44 // 在这里你可以根据需要扩展或修改 params
42 const defaultParams = { 45 const defaultParams = {
43 pageIndex: 1, 46 pageIndex: 1,
44 pageSize: 10, 47 pageSize: 50,
45 dirGuid: '', 48 execGuid: '',
46 label: '', 49 classifyDetail: '',
47 fieldName: '', 50 gradeDetailGuid: '',
48 classifyName: '', 51 databaseGuid: '',
49 gradeDetailName: '', 52 tableGuid: '',
50 tableName: '', 53 fieldGuid: '',
51 database: '',
52 dirGuids: [],
53 }; 54 };
54 const finalParams = { ...defaultParams, ...params }; 55 const finalParams = { ...defaultParams, ...params };
55 const res: any = await getCgDirFieldPageList(finalParams); 56 const res: any = await execTaskFieldList(finalParams);
56 if (res.code == proxy.$passCode) { 57 if (res.code == proxy.$passCode) {
57 CgDirFieldPageList.value = res.data.records; 58 CgDirFieldPageList.value = res.data.records;
58 tableInfo.value.page.rows = res.data.totalRows; 59 tableInfo.value.page.rows = res.data.totalRows;
...@@ -90,11 +91,15 @@ const getExecGuid = async () => { ...@@ -90,11 +91,15 @@ const getExecGuid = async () => {
90 } 91 }
91 92
92 93
93 onMounted(() => { 94 onMounted(async () => {
94 getCgDirTreeData(); 95 await getExecGuid();
95 getCgDirFieldPage(); 96 await getCgDirTreeData();
97 await getCgDirFieldPage({
98 execGuid: execGuidInfo.value.execGuid
99 });
96 getDictionaryList(); 100 getDictionaryList();
97 getExecGuid(); 101 getSearchTableList();
102
98 }) 103 })
99 104
100 // 左侧tree-list 105 // 左侧tree-list
...@@ -104,12 +109,12 @@ const treeInfo = ref({ ...@@ -104,12 +109,12 @@ const treeInfo = ref({
104 editTreeItem: false, 109 editTreeItem: false,
105 queryValue: "", 110 queryValue: "",
106 className: 'tree-list', 111 className: 'tree-list',
107 queryPlaceholder: "输入标准集名称搜索", 112 queryPlaceholder: "输入名称搜索",
108 props: { 113 props: {
109 label: "classifyName", 114 label: "classifyName",
110 value: "guid", 115 value: "classifyDetailGuid",
111 }, 116 },
112 nodeKey: 'guid', 117 nodeKey: 'classifyDetailGuid',
113 expandedKey: ['0'], 118 expandedKey: ['0'],
114 currentNodeKey: '', 119 currentNodeKey: '',
115 expandOnNodeClick: false, 120 expandOnNodeClick: false,
...@@ -117,6 +122,7 @@ const treeInfo = ref({ ...@@ -117,6 +122,7 @@ const treeInfo = ref({
117 loading: false 122 loading: false
118 }); 123 });
119 124
125
120 const addStandardSet = () => { 126 const addStandardSet = () => {
121 console.log('addStandardSet'); 127 console.log('addStandardSet');
122 } 128 }
...@@ -139,33 +145,24 @@ const searchItemList = ref([ ...@@ -139,33 +145,24 @@ const searchItemList = ref([
139 }, 145 },
140 clearable: true, 146 clearable: true,
141 }, 147 },
142 // {
143 // label: '字段名',
144 // type: 'select',
145 // maxlength: 19,
146 // placeholder: '选择字段名',
147 // field: 'fieldName',
148 // default: '',
149 // options: [],
150 // props: {
151 // label: 'name',
152 // value: 'guid',
153 // },
154 // clearable: true,
155 // },
156 { 148 {
157 label: '分类', 149 label: "",
158 type: 'select', 150 placeholder: '分类',
159 maxlength: 19,
160 placeholder: '选择分类',
161 field: 'classifyName', 151 field: 'classifyName',
152 type: 'tree-select',
162 default: '', 153 default: '',
163 options: [], 154 options: [],
155 showAllLevels: false,
156 checkStrictly: true,
157 lazy: false,
164 props: { 158 props: {
165 label: 'name', 159 label: "classifyName",
166 value: 'guid', 160 value: "classifyDetailGuid",
167 }, 161 },
168 clearable: true, 162 block: false,
163 filterable: false,
164 clearable: false,
165 required: false
169 }, { 166 }, {
170 label: '分级', 167 label: '分级',
171 type: 'select', 168 type: 'select',
...@@ -199,8 +196,14 @@ const toSearch = (val: any, clear: boolean = false) => { ...@@ -199,8 +196,14 @@ const toSearch = (val: any, clear: boolean = false) => {
199 // return getTableData(params); 196 // return getTableData(params);
200 }; 197 };
201 198
202 const nodeClick = (data: any) => { 199 const nodeClick = async (data: any) => {
203 const { guid, classifyName } = data 200 console.log('nodeClick', data);
201 const { guid, classifyDetailGuid } = data
202 searchItemList.value[1].default = data.classifyName;
203 await getCgDirFieldPage({
204 execGuid: execGuidInfo.value.execGuid,
205 classifyDetail: classifyDetailGuid,
206 });
204 // 递归tempData找到所有祖先元素的standardName,存入currentPath中 207 // 递归tempData找到所有祖先元素的standardName,存入currentPath中
205 const path = findPath(CgDirTreeList.value, guid); 208 const path = findPath(CgDirTreeList.value, guid);
206 if (path) { 209 if (path) {
...@@ -210,6 +213,7 @@ const nodeClick = (data: any) => { ...@@ -210,6 +213,7 @@ const nodeClick = (data: any) => {
210 console.error('未找到路径'); 213 console.error('未找到路径');
211 } 214 }
212 } 215 }
216
213 const findPath = (data: any[], targetGuid: string, path: string[] = []) => { 217 const findPath = (data: any[], targetGuid: string, path: string[] = []) => {
214 for (const item of data) { 218 for (const item of data) {
215 path.push(item.classifyName); // 添加当前节点名称 219 path.push(item.classifyName); // 添加当前节点名称
...@@ -292,7 +296,7 @@ const tableCheckboxSelectChange = (select, row) => { ...@@ -292,7 +296,7 @@ const tableCheckboxSelectChange = (select, row) => {
292 let rulesName: any = []; 296 let rulesName: any = [];
293 let rulesGuid: any = []; 297 let rulesGuid: any = [];
294 select.forEach((item: any) => { 298 select.forEach((item: any) => {
295 rulesName.push(item.classifyName); 299 rulesName.push(item.fieldName);
296 rulesGuid.push(item.guid); 300 rulesGuid.push(item.guid);
297 }); 301 });
298 selectedRulesData.value = { 302 selectedRulesData.value = {
...@@ -305,7 +309,7 @@ const tableCheckboxAllSelectChange = (select) => { ...@@ -305,7 +309,7 @@ const tableCheckboxAllSelectChange = (select) => {
305 let rulesName: any = []; 309 let rulesName: any = [];
306 let rulesGuid: any = []; 310 let rulesGuid: any = [];
307 select.forEach((item: any) => { 311 select.forEach((item: any) => {
308 rulesName.push(item.classifyName); 312 rulesName.push(item.fieldName);
309 rulesGuid.push(item.guid); 313 rulesGuid.push(item.guid);
310 }); 314 });
311 selectedRulesData.value = { 315 selectedRulesData.value = {
...@@ -364,9 +368,9 @@ const dataBaseTableInfo = ref({ ...@@ -364,9 +368,9 @@ const dataBaseTableInfo = ref({
364 fixedSelection: true, 368 fixedSelection: true,
365 fields: [ 369 fields: [
366 { label: "序号", type: "index", width: 56, align: "center" }, 370 { label: "序号", type: "index", width: 56, align: "center" },
367 { label: "数据源", field: "cgDirName", width: 140 }, 371 { label: "数据源", field: "databaseChName", width: 140 },
368 { label: "表名称", field: "tableName", width: 180 }, 372 { label: "表名称", field: "tableChName", width: 180 },
369 { label: "数据库表", field: "tableChName", width: 120 }, 373 { label: "数据库表", field: "tableName", width: 120 },
370 { 374 {
371 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => { 375 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => {
372 let dataGrade = scope.row.foundMode; 376 let dataGrade = scope.row.foundMode;
...@@ -380,7 +384,7 @@ const dataBaseTableInfo = ref({ ...@@ -380,7 +384,7 @@ const dataBaseTableInfo = ref({
380 return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表'; 384 return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表';
381 } 385 }
382 }, 386 },
383 { label: "任务修改人", field: "damName", width: 120 }, 387 { label: "任务修改人", field: "updateUserName", width: 120 },
384 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME }, 388 { label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
385 { label: "描述", field: "description", width: 120, align: 'center' }, 389 { label: "描述", field: "description", width: 120, align: 'center' },
386 { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' }, 390 { label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' },
...@@ -397,7 +401,8 @@ const dataBaseTableInfo = ref({ ...@@ -397,7 +401,8 @@ const dataBaseTableInfo = ref({
397 type: "btn", 401 type: "btn",
398 width: 300, 402 width: 300,
399 fixed: 'right', 403 fixed: 'right',
400 btns: [ 404 btns: (scope) => {
405 return [
401 { 406 {
402 label: "配置业务规则", value: "edit", click: (scope) => { 407 label: "配置业务规则", value: "edit", click: (scope) => {
403 console.log('编辑', scope); 408 console.log('编辑', scope);
...@@ -415,13 +420,16 @@ const dataBaseTableInfo = ref({ ...@@ -415,13 +420,16 @@ const dataBaseTableInfo = ref({
415 }); 420 });
416 } 421 }
417 }, 422 },
418
419 { 423 {
420 label: "编辑表结构", value: "copy", click: (scope) => { 424 label: "编辑表结构", value: "edit", click: (scope) => {
421 console.log('复制', scope); 425 console.log('复制', scope);
422 } 426 },
427 disabled: scope.row.state !== 2 ? false : true
423 } 428 }
424 ] 429 ]
430 }
431
432
425 433
426 }, 434 },
427 loading: false 435 loading: false
...@@ -595,17 +603,31 @@ const drawerBtnClick = async (btn, info) => { ...@@ -595,17 +603,31 @@ const drawerBtnClick = async (btn, info) => {
595 proxy.$ElMessage.error('字段取值范围结束值不能小于开始值'); 603 proxy.$ElMessage.error('字段取值范围结束值不能小于开始值');
596 return; 604 return;
597 } 605 }
598 fieldValueRange = [numberStart, numberEnd]; 606 fieldValueRange = numberStart + '#' + numberEnd;
599 } 607 }
600 const params = { 608 const params: any = [];
609 selectedRulesData.value.guids.forEach((item: any) => {
610 params.push({
601 fieldPrecision, 611 fieldPrecision,
602 dictionaryGuid, 612 dictionaryGuid,
603 isUnique, 613 isUnique,
604 isNotNull, 614 isNotNull,
605 fieldLengthCondition, 615 fieldLengthCondition,
606 fieldValueRange, 616 fieldValueRange,
607 fieldGuid: selectedRulesData.value.guids 617 fieldGuid: item,
608 } 618 execGuid: execGuidInfo.value.execGuid
619 })
620 });
621 // const params = {
622 // fieldPrecision,
623 // dictionaryGuid,
624 // isUnique,
625 // isNotNull,
626 // fieldLengthCondition,
627 // fieldValueRange,
628 // fieldGuid: selectedRulesData.value.guids,
629 // execGuid: execGuidInfo.value.execGuid
630 // }
609 const res: any = await saveBizRuleConfig(params); 631 const res: any = await saveBizRuleConfig(params);
610 if (res.code == proxy.$passCode) { 632 if (res.code == proxy.$passCode) {
611 btn.loading = false; 633 btn.loading = false;
...@@ -613,6 +635,7 @@ const drawerBtnClick = async (btn, info) => { ...@@ -613,6 +635,7 @@ const drawerBtnClick = async (btn, info) => {
613 drawerInfo.value.visible = false; 635 drawerInfo.value.visible = false;
614 getCgDirFieldPage(); 636 getCgDirFieldPage();
615 } else { 637 } else {
638 btn.loading = false;
616 proxy.$ElMessage.error(res.msg); 639 proxy.$ElMessage.error(res.msg);
617 } 640 }
618 641
...@@ -687,7 +710,7 @@ const getDataBaseTableData = async (params = {}) => { ...@@ -687,7 +710,7 @@ const getDataBaseTableData = async (params = {}) => {
687 pageIndex: 1, 710 pageIndex: 1,
688 pageSize: 10, 711 pageSize: 10,
689 databaseGuid: "", 712 databaseGuid: "",
690 isDataAsset: checked.value ? 'Y' : 'N', 713 isDataAsset: '',
691 execGuid: execGuidInfo.value.execGuid, 714 execGuid: execGuidInfo.value.execGuid,
692 }; 715 };
693 const finalParams = { ...dataBaseParams, ...params }; 716 const finalParams = { ...dataBaseParams, ...params };
...@@ -727,7 +750,9 @@ const getDataBaseFieldData = async (params = {}) => { ...@@ -727,7 +750,9 @@ const getDataBaseFieldData = async (params = {}) => {
727 tableGuid: "", 750 tableGuid: "",
728 execGuid: execGuidInfo.value.execGuid, 751 execGuid: execGuidInfo.value.execGuid,
729 databaseGuid: "", 752 databaseGuid: "",
730 isDataAsset: checked.value ? 'Y' : 'N', 753 isDataAsset: '',
754 fieldName: '',
755 gradeDetailName: '',
731 }; 756 };
732 const finalParams = { ...dataBaseParams, ...params }; 757 const finalParams = { ...dataBaseParams, ...params };
733 758
...@@ -773,11 +798,14 @@ const tableFieldsDataInfo = ref({ ...@@ -773,11 +798,14 @@ const tableFieldsDataInfo = ref({
773 798
774 799
775 const showTableOrDatabase = ref(true); 800 const showTableOrDatabase = ref(true);
801 const isShowCreateBtn = ref(false);
776 // 定义tableGuid 802 // 定义tableGuid
777 const tableGuid = ref(''); 803 const tableGuid = ref('');
778 const dataBaseGuid = ref(''); 804 const dataBaseGuid = ref('');
805 const dataBaseInfo = ref<any>({});
779 806
780 const dataBasenodeClick = (data: any) => { 807 const dataBasenodeClick = (data: any) => {
808 isShowCreateBtn.value = false;
781 console.log('dataBasenodeClick', data); 809 console.log('dataBasenodeClick', data);
782 if (data.cgDirName) { 810 if (data.cgDirName) {
783 tableGuid.value = ''; 811 tableGuid.value = '';
...@@ -786,7 +814,9 @@ const dataBasenodeClick = (data: any) => { ...@@ -786,7 +814,9 @@ const dataBasenodeClick = (data: any) => {
786 getDataBaseTableData(); 814 getDataBaseTableData();
787 } 815 }
788 if (data.databaseGuid) { 816 if (data.databaseGuid) {
817 dataBaseInfo.value = data;
789 dataBaseGuid.value = data.databaseGuid; 818 dataBaseGuid.value = data.databaseGuid;
819 isShowCreateBtn.value = true;
790 tableGuid.value = ''; 820 tableGuid.value = '';
791 getDataBaseFieldData({ 821 getDataBaseFieldData({
792 databaseGuid: data.databaseGuid 822 databaseGuid: data.databaseGuid
...@@ -801,9 +831,9 @@ const dataBasenodeClick = (data: any) => { ...@@ -801,9 +831,9 @@ const dataBasenodeClick = (data: any) => {
801 getDataBaseFieldData({ 831 getDataBaseFieldData({
802 tableGuid: data.tableGuid 832 tableGuid: data.tableGuid
803 }); 833 });
804 getDataBaseTableData({ 834 // getDataBaseTableData({
805 tableGuid: data.tableGuid 835 // tableGuid: data.tableGuid
806 }); 836 // });
807 } 837 }
808 838
809 if (data.databaseGuid || data.cgDirName) { 839 if (data.databaseGuid || data.cgDirName) {
...@@ -826,7 +856,8 @@ const handleSubjectTableCommand = (command: string) => { ...@@ -826,7 +856,8 @@ const handleSubjectTableCommand = (command: string) => {
826 router.push({ 856 router.push({
827 name: 'tableCreateFile', 857 name: 'tableCreateFile',
828 query: { 858 query: {
829 type: 'tableCreateFile' 859 type: 'tableCreateFile',
860 foundMode: 2
830 } 861 }
831 }); 862 });
832 } else if (command === 'existingCreate') { 863 } else if (command === 'existingCreate') {
...@@ -834,7 +865,11 @@ const handleSubjectTableCommand = (command: string) => { ...@@ -834,7 +865,11 @@ const handleSubjectTableCommand = (command: string) => {
834 router.push({ 865 router.push({
835 name: 'tableCreateExisting', 866 name: 'tableCreateExisting',
836 query: { 867 query: {
837 execGuid: execGuidInfo.value.execGuid 868 execGuid: execGuidInfo.value.execGuid,
869 foundMode: 1,
870 database: dataBaseInfo.value.database,
871 databaseChName: dataBaseInfo.value.databaseChName,
872 databaseGuid: dataBaseInfo.value.databaseGuid,
838 } 873 }
839 }); 874 });
840 } 875 }
...@@ -860,53 +895,27 @@ const setActiveTab = (tab) => { ...@@ -860,53 +895,27 @@ const setActiveTab = (tab) => {
860 }; 895 };
861 896
862 // 模拟后端接口 897 // 模拟后端接口
863 const fetchOptionsA = () => { 898 // 获取查询的数据库名 execTaskSheetList
864 return new Promise((resolve) => {
865 setTimeout(() => {
866 resolve([
867 { label: "选项 A1", value: "a1" },
868 { label: "选项 A2", value: "a2" },
869 ]);
870 }, 500);
871 });
872 };
873 899
874 const fetchOptionsB = (aValue) => { 900 const getSearchTableList = async (type = 1, dbGuid = '') => {
875 return new Promise((resolve) => {
876 setTimeout(() => {
877 const data = {
878 a1: [
879 { label: "B1-1", value: "b1" },
880 { label: "B1-2", value: "b2" },
881 ],
882 a2: [
883 { label: "B2-1", value: "b3" },
884 { label: "B2-2", value: "b4" },
885 ],
886 };
887 resolve(data[aValue] || []);
888 }, 500);
889 });
890 };
891 901
892 const fetchOptionsC = (bValue) => { 902 const res: any = await getDbFieldList({
893 return new Promise((resolve) => { 903 execGuid: execGuidInfo.value.execGuid,
894 setTimeout(() => { 904 dbGuid,
895 const data = { 905 type,
896 b1: [
897 { label: "C1-1", value: "c1" },
898 { label: "C1-2", value: "c2" },
899 ],
900 b3: [
901 { label: "C2-1", value: "c3" },
902 { label: "C2-2", value: "c4" },
903 ],
904 };
905 resolve(data[bValue] || []);
906 }, 500);
907 }); 906 });
907 if (res.code == proxy.$passCode) {
908 if (type == 1) {
909 optionsA.value = res.data;
910 } else if (type == 2) {
911 optionsB.value = res.data;
912 } else {
913 optionsC.value = res.data;
914 }
915 } else {
916 proxy.$ElMessage.error(res.msg);
917 }
908 }; 918 };
909
910 const selectedA = ref<any>(null); 919 const selectedA = ref<any>(null);
911 const selectedB = ref<any>(null); 920 const selectedB = ref<any>(null);
912 const selectedC = ref<any>(null); 921 const selectedC = ref<any>(null);
...@@ -915,29 +924,33 @@ const optionsA = ref<any>([]); ...@@ -915,29 +924,33 @@ const optionsA = ref<any>([]);
915 const optionsB = ref<any>([]); 924 const optionsB = ref<any>([]);
916 const optionsC = ref<any>([]); 925 const optionsC = ref<any>([]);
917 926
918 // 初始化加载第一个下拉框的选项
919 const loadOptionsA = async () => {
920 optionsA.value = await fetchOptionsA();
921 };
922
923 // 第一个下拉框值改变时 927 // 第一个下拉框值改变时
924 const onAChange = async () => { 928 const onAChange = async () => {
925 selectedB.value = null; 929 selectedB.value = null;
926 selectedC.value = null; 930 selectedC.value = null;
927 optionsB.value = []; 931 optionsB.value = [];
928 optionsC.value = []; 932 optionsC.value = [];
929 optionsB.value = await fetchOptionsB(selectedA.value); // 根据 A 动态加载 B 的选项 933 await getSearchTableList(2, selectedA.value); // 根据 A 动态加载 B 的选项
930 }; 934 };
931 935
932 // 第二个下拉框值改变时 936 // 第二个下拉框值改变时
933 const onBChange = async () => { 937 const onBChange = async () => {
938 console.log('onBChange', selectedB.value);
934 selectedC.value = null; 939 selectedC.value = null;
935 optionsC.value = []; 940 optionsC.value = [];
936 optionsC.value = await fetchOptionsC(selectedB.value); // 根据 B 动态加载 C 的选项 941 await getSearchTableList(3, selectedB.value); // 根据 B 动态加载 C 的选项
942 };
943
944 // 导出
945 const btnClick = async () => {
946
937 }; 947 };
938 948
939 // 页面加载时初始化 A 的数据 949 // 分类选择
940 loadOptionsA(); 950 const treeSelectNodeChange = (node, item) => {
951 console.log('treeSelectNodeChange', node, item);
952 }
953
941 954
942 </script> 955 </script>
943 956
...@@ -946,23 +959,25 @@ loadOptionsA(); ...@@ -946,23 +959,25 @@ loadOptionsA();
946 <div class="v-table-tools"> 959 <div class="v-table-tools">
947 <el-select v-model="selectedA" placeholder="选择数据库名" @change="onAChange" style="width: 140px; margin-right: 8px" 960 <el-select v-model="selectedA" placeholder="选择数据库名" @change="onAChange" style="width: 140px; margin-right: 8px"
948 clearable> 961 clearable>
949 <el-option v-for="item in optionsA" :key="item.value" :label="item.label" :value="item.value" /> 962 <el-option v-for="item in optionsA" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
950 </el-select> 963 </el-select>
951 <el-select v-model="selectedB" placeholder="选择表名" :disabled="!selectedA" @change="onBChange" 964 <el-select v-model="selectedB" placeholder="选择表名" :disabled="!selectedA" @change="onBChange"
952 style="width: 140px; margin-right: 8px" clearable> 965 style="width: 140px; margin-right: 8px" clearable>
953 <el-option v-for="item in optionsB" :key="item.value" :label="item.label" :value="item.value" /> 966 <el-option v-for="item in optionsB" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
954 </el-select> 967 </el-select>
955 <el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px" 968 <el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px"
956 clearable> 969 clearable>
957 <el-option v-for="item in optionsC" :key="item.value" :label="item.label" :value="item.value" /> 970 <el-option v-for="item in optionsC" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
958 </el-select> 971 </el-select>
959 <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch" /> 972 <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch"
973 @treeSelectNodeChange="treeSelectNodeChange" />
960 </div> 974 </div>
961 <div class="container_wrap full flex"> 975 <div class="container_wrap full flex">
962 <div class="aside_wrap"> 976 <div class="aside_wrap">
963 <el-tabs v-model="activeName" class="v-tabs" @tab-click="handleClick"> 977 <el-tabs v-model="activeName" class="v-tabs" @tab-click="handleClick">
964 <el-tab-pane label="分类分级目录" name="first"> 978 <el-tab-pane label="分类分级目录" name="first">
965 <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="handleTreeItemMenuClick" /> 979 <Tree :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="handleTreeItemMenuClick" />
980 <!-- <Tree ref="treeInfoRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> -->
966 </el-tab-pane> 981 </el-tab-pane>
967 <el-tab-pane label="数据库目录" name="second"> 982 <el-tab-pane label="数据库目录" name="second">
968 <Tree :treeInfo="dataBaseTreeInfo" @nodeClick="dataBasenodeClick" @nodeSelectChange='nodeSelectChange' /> 983 <Tree :treeInfo="dataBaseTreeInfo" @nodeClick="dataBasenodeClick" @nodeSelectChange='nodeSelectChange' />
...@@ -992,7 +1007,7 @@ loadOptionsA(); ...@@ -992,7 +1007,7 @@ loadOptionsA();
992 <div class="btns-area"> 1007 <div class="btns-area">
993 <div class="left-btns"> 1008 <div class="left-btns">
994 <el-button type="primary" @click="addStandardSet">查看已生产报告</el-button> 1009 <el-button type="primary" @click="addStandardSet">查看已生产报告</el-button>
995 <el-button>导出</el-button> 1010 <el-button @click="btnClick()">导出</el-button>
996 <el-button @click="batchControlRules">批量配置业务规则</el-button> 1011 <el-button @click="batchControlRules">批量配置业务规则</el-button>
997 </div> 1012 </div>
998 </div> 1013 </div>
...@@ -1033,7 +1048,7 @@ loadOptionsA(); ...@@ -1033,7 +1048,7 @@ loadOptionsA();
1033 1048
1034 <div class="btns-area" v-if="!tableGuid && activeTab === 'table'"> 1049 <div class="btns-area" v-if="!tableGuid && activeTab === 'table'">
1035 <div class="left-btns"> 1050 <div class="left-btns">
1036 <div class="dropdown_btn"> 1051 <div class="dropdown_btn" v-if="isShowCreateBtn">
1037 <el-dropdown popper-class="table-create-menu" @command="handleSubjectTableCommand" 1052 <el-dropdown popper-class="table-create-menu" @command="handleSubjectTableCommand"
1038 placement="bottom-start" trigger="click"> 1053 placement="bottom-start" trigger="click">
1039 <span class="el-dropdown-link"> 1054 <span class="el-dropdown-link">
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
6 import { ref } from "vue"; 6 import { ref } from "vue";
7 import router from "@/router"; 7 import router from "@/router";
8 import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory' 8 import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory'
9
10 const { proxy } = getCurrentInstance() as any; 9 const { proxy } = getCurrentInstance() as any;
11 const bizRuleConfigData = ref<any>() 10 const bizRuleConfigData = ref<any>()
12 const getBizRuleConfigDetailData = async () => { 11 const getBizRuleConfigDetailData = async () => {
...@@ -105,9 +104,25 @@ const moveDown = () => { ...@@ -105,9 +104,25 @@ const moveDown = () => {
105 // 编辑行 104 // 编辑行
106 const editRow = (row) => { 105 const editRow = (row) => {
107 if (!row.isEdit) { 106 if (!row.isEdit) {
107 // 编辑fieldLengthCondition
108 if (row.fieldLengthCondition) {
108 const [symbol, value] = row.fieldLengthCondition.split('#'); 109 const [symbol, value] = row.fieldLengthCondition.split('#');
109 row.lengthSymbol = symbol; // 初始化符号部分 110 row.lengthSymbol = symbol; // 初始化符号部分
110 row.lengthValue = value; // 初始化数值部分 111 row.lengthValue = value; // 初始化数值部分
112 } else {
113 row.lengthSymbol = ''; // 默认值
114 row.lengthValue = ''; // 默认值
115 }
116 //编辑fieldValueRange
117 if (row.fieldValueRange) {
118 const [start, end] = row.fieldValueRange.split('-');
119 row.rangeStart = start; // 初始化符号部分
120 row.rangeEnd = end; // 初始化数值部分
121 } else {
122 row.rangeStart = ''; // 默认值
123 row.rangeEnd = ''; // 默认值
124 }
125
111 row.isEdit = true; // 进入编辑模式 126 row.isEdit = true; // 进入编辑模式
112 } 127 }
113 }; 128 };
...@@ -115,6 +130,7 @@ const editRow = (row) => { ...@@ -115,6 +130,7 @@ const editRow = (row) => {
115 // 保存数据 130 // 保存数据
116 const saveRow = (row) => { 131 const saveRow = (row) => {
117 row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`; 132 row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`;
133 row.fieldValueRange = [row.rangeStart || '', row.rangeEnd || ''];
118 row.isEdit = false 134 row.isEdit = false
119 } 135 }
120 136
...@@ -213,19 +229,23 @@ const saveData = async () => { ...@@ -213,19 +229,23 @@ const saveData = async () => {
213 "isNotNull": "string", 229 "isNotNull": "string",
214 "fieldValueRange": "string" 230 "fieldValueRange": "string"
215 */ 231 */
216 const params = tableData.value.map((item: any) => { 232 const inParams = [] as any
217 return { 233 tableData.value.forEach((item: any) => {
218 guid: item.guid, 234 const obj = {
235 guid: router.currentRoute.value.query.tableGuid,
219 fieldGuid: item.fieldGuid, 236 fieldGuid: item.fieldGuid,
220 fieldLengthCondition: item.fieldLengthCondition, 237 fieldLengthCondition: item.fieldLengthCondition,
221 fieldPrecision: item.fieldPrecision, 238 fieldPrecision: item.fieldPrecision,
222 dictionaryGuid: item.dictionaryGuid, 239 dictionaryGuid: item.dictionaryGuid,
223 isUnique: item.isUnique, 240 isUnique: item.isUnique,
224 isNotNull: item.isNotNull, 241 isNotNull: item.isRequired,
225 fieldValueRange: item.fieldValueRange 242 fieldValueRange: item.fieldValueRange
226 } 243 }
244 inParams.push(obj)
227 }) 245 })
228 const res: any = await updateBizRuleConfig(params) 246
247 console.log('finalParams', inParams)
248 const res: any = await updateBizRuleConfig(inParams)
229 if (res.code === proxy.$passCode) { 249 if (res.code === proxy.$passCode) {
230 proxy.$message.success('修改配置规则成功!') 250 proxy.$message.success('修改配置规则成功!')
231 router.back() 251 router.back()
...@@ -270,29 +290,29 @@ const cancel = () => { ...@@ -270,29 +290,29 @@ const cancel = () => {
270 <!-- 排序列(不可编辑) --> 290 <!-- 排序列(不可编辑) -->
271 <el-table-column type="index" label="排序" width="80" align="center" /> 291 <el-table-column type="index" label="排序" width="80" align="center" />
272 <!-- 字段中文名(不可编辑)fieldChName --> 292 <!-- 字段中文名(不可编辑)fieldChName -->
273 <el-table-column prop="fieldName" label="字段中文名" width="120"> 293 <el-table-column prop="fieldChName" label="字段中文名" width="120">
274 <template #default="scope"> 294 <template #default="scope">
275 {{ scope.row.fieldName ? scope.row.fieldName : '--' }} 295 {{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
276 </template> 296 </template>
277 </el-table-column> 297 </el-table-column>
278 <!-- 字段英文名(不可编辑) --> 298 <!-- 字段英文名(不可编辑) -->
279 <el-table-column prop="fieldEnglish" label="字段英文名" width="120"> 299 <el-table-column prop="fieldName" label="字段英文名" width="120">
280 <template #default="scope"> 300 <template #default="scope">
281 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} 301 {{ scope.row.fieldName ? scope.row.fieldName : '--' }}
282 </template> 302 </template>
283 </el-table-column> 303 </el-table-column>
284 <!-- 分类(不可编辑)classifyName --> 304 <!-- 分类(不可编辑)classifyName -->
285 <el-table-column prop="fieldEnglish" label="分类" width="120"> 305 <!-- <el-table-column prop="fieldEnglish" label="分类" width="120">
286 <template #default="scope"> 306 <template #default="scope">
287 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} 307 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }}
288 </template> 308 </template>
289 </el-table-column> 309 </el-table-column> -->
290 <!-- 分级(不可编辑) --> 310 <!-- 分级(不可编辑) -->
291 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> 311 <!-- <el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
292 <template #default="scope"> 312 <template #default="scope">
293 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} 313 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }}
294 </template> 314 </template>
295 </el-table-column> 315 </el-table-column> -->
296 <!-- 字段类型fieldType (不可编辑) --> 316 <!-- 字段类型fieldType (不可编辑) -->
297 <el-table-column prop="fieldType" label="字段类型" width="150" align="center"> 317 <el-table-column prop="fieldType" label="字段类型" width="150" align="center">
298 <template #default="scope"> 318 <template #default="scope">
...@@ -367,11 +387,20 @@ const cancel = () => { ...@@ -367,11 +387,20 @@ const cancel = () => {
367 </el-select> 387 </el-select>
368 </template> 388 </template>
369 </el-table-column> 389 </el-table-column>
390
370 <!-- 字段取值范围 fieldValueRange(可编辑)--> 391 <!-- 字段取值范围 fieldValueRange(可编辑)-->
371 <el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center"> 392 <el-table-column prop="fieldValueRange" label="字段取值范围" width="260" align="center">
372 <template #default="scope"> 393 <template #default="scope">
373 <span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span> 394 <!-- 非编辑模式,展示取值范围 -->
374 <el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" /> 395 <span v-if="!scope.row.isEdit">
396 {{ scope.row.fieldValueRange ? scope.row.fieldValueRange.join('-') : '--' }}
397 </span>
398 <!-- 编辑模式,显示两个输入框 -->
399 <div v-else style="display: flex; gap: 5px; align-items: center;">
400 <el-input v-model="scope.row.rangeStart" placeholder="最小值" style="width: 45%;" type="number" />
401 <span>-</span>
402 <el-input v-model="scope.row.rangeEnd" placeholder="最大值" style="width: 45%;" type="number" />
403 </div>
375 </template> 404 </template>
376 </el-table-column> 405 </el-table-column>
377 406
......
...@@ -9,6 +9,7 @@ import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, de ...@@ -9,6 +9,7 @@ import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, de
9 import { CirclePlus, Delete } from "@element-plus/icons-vue"; 9 import { CirclePlus, Delete } from "@element-plus/icons-vue";
10 10
11 11
12
12 const { proxy } = getCurrentInstance() as any; 13 const { proxy } = getCurrentInstance() as any;
13 const dialogLabelFormRef = ref(); 14 const dialogLabelFormRef = ref();
14 15
...@@ -74,6 +75,7 @@ const transformDataForTree = (data: any[]) => { ...@@ -74,6 +75,7 @@ const transformDataForTree = (data: any[]) => {
74 const labelPageList = ref<any>() 75 const labelPageList = ref<any>()
75 76
76 const getLabelPageData = async () => { 77 const getLabelPageData = async () => {
78 refCount.value++;
77 tableInfo.value.loading = true; 79 tableInfo.value.loading = true;
78 const params = { 80 const params = {
79 pageIndex: page.value.curr, 81 pageIndex: page.value.curr,
...@@ -111,7 +113,7 @@ const getLabelListData = async () => { ...@@ -111,7 +113,7 @@ const getLabelListData = async () => {
111 } 113 }
112 } 114 }
113 115
114 onMounted(async () => { 116 onBeforeMount(async () => {
115 await getClassifyGradeTree(); 117 await getClassifyGradeTree();
116 await getLabelPageData(); 118 await getLabelPageData();
117 await getLabelListData(); 119 await getLabelListData();
...@@ -136,8 +138,46 @@ const treeInfo = ref<any>({ ...@@ -136,8 +138,46 @@ const treeInfo = ref<any>({
136 loading: false 138 loading: false
137 }); 139 });
138 // 点击树节点修改分类guid 和 分类明细guid 140 // 点击树节点修改分类guid 和 分类明细guid
139 const nodeClick = (data: any) => { 141 // 存储大类的数据。
140 console.log('nodeClick', data); 142 const findNodeDetails = ref<any>('');
143 const isLastLayer = ref<boolean>(false);
144 // 所在层级的info
145 const atGradeinfo = ref<any>('');
146
147 const findTopParentNode = (node: any) => {
148 if (!node) return;
149
150 // 判断是否为最后一层
151 isLastLayer.value = node.childNodes.length === 0;
152 if (isLastLayer.value) {
153 atGradeinfo.value = node.data;
154 }
155
156 // 递归向上查找符合条件的祖先节点
157 const findCParent = (currentNode: any): any => {
158 if (!currentNode?.parent) return null; // 没有父节点,停止递归
159 if (currentNode.parent.data?.type === 'C') {
160 return currentNode.parent; // 找到符合条件的节点
161 }
162 return findCParent(currentNode.parent); // 继续向上查找
163 };
164
165 // 查找最接近的符合条件的祖先节点
166 const topParent = findCParent(node);
167
168 // 更新结果
169 if (topParent) {
170 findNodeDetails.value = topParent.data;
171 }
172 };
173
174
175
176 const nodeClick = (data, node) => {
177
178 findTopParentNode(node);
179 newCreateGradeFormItems.value[1].options = transformDataForTree([findNodeDetails.value])
180
141 // 分类guid 181 // 分类guid
142 if (Object.keys(data).includes("type")) { 182 if (Object.keys(data).includes("type")) {
143 classifyGuid.value = data.guid; 183 classifyGuid.value = data.guid;
...@@ -180,8 +220,13 @@ const tableInfo = ref({ ...@@ -180,8 +220,13 @@ const tableInfo = ref({
180 fixedSelection: true, 220 fixedSelection: true,
181 fields: [ 221 fields: [
182 { label: "序号", type: "index", width: 56, align: "center" }, 222 { label: "序号", type: "index", width: 56, align: "center" },
183 { label: "标签名", field: "label", type: 'text_btn', class: 'drawer-detail-cell', width: 120, value: 'detail', columClass: 'text_btn' }, 223 { label: "标签名", field: "label", type: 'text_btn', class: 'drawer-detail-cell', width: 160, value: 'detail', columClass: 'text_btn' },
184 { label: "分类", field: "classifyDetailName", width: 140 }, 224 {
225 label: "分类", field: "classifyNames", getName: (scope) => {
226 let tempInfo = scope.row.classifyNames;
227 return tempInfo.join('/')
228 },
229 },
185 { label: "分级", field: "gradeDetailName", width: 140 }, 230 { label: "分级", field: "gradeDetailName", width: 140 },
186 { 231 {
187 label: '状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 100, align: 'center' 232 label: '状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 100, align: 'center'
...@@ -280,7 +325,6 @@ const batchRemobe = async () => { ...@@ -280,7 +325,6 @@ const batchRemobe = async () => {
280 message: '已取消删除' 325 message: '已取消删除'
281 }); 326 });
282 }); 327 });
283
284 }; 328 };
285 329
286 const tableSwitchBeforeChange = (scope, field, callback) => { 330 const tableSwitchBeforeChange = (scope, field, callback) => {
...@@ -410,7 +454,7 @@ const newCreateGradeFormItems = ref<any>([{ ...@@ -410,7 +454,7 @@ const newCreateGradeFormItems = ref<any>([{
410 { 454 {
411 label: '精确匹配', 455 label: '精确匹配',
412 type: 'textarea', 456 type: 'textarea',
413 maxlength: 500, 457 maxlength: 260,
414 placeholder: '请输入字段中文,中间用英文“,”分号隔开', 458 placeholder: '请输入字段中文,中间用英文“,”分号隔开',
415 field: 'matchChValue', 459 field: 'matchChValue',
416 default: '', 460 default: '',
...@@ -421,7 +465,7 @@ const newCreateGradeFormItems = ref<any>([{ ...@@ -421,7 +465,7 @@ const newCreateGradeFormItems = ref<any>([{
421 { 465 {
422 label: '', 466 label: '',
423 type: 'textarea', 467 type: 'textarea',
424 maxlength: 500, 468 maxlength: 260,
425 placeholder: '请输入字段中文,中间用英文“,”分号隔开', 469 placeholder: '请输入字段中文,中间用英文“,”分号隔开',
426 field: 'matchEnValue', 470 field: 'matchEnValue',
427 default: '', 471 default: '',
...@@ -459,7 +503,18 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -459,7 +503,18 @@ const newCreateGradeStandardDialogInfo = ref({
459 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 503 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
460 }, 504 },
461 submit: async (btn, info) => { 505 submit: async (btn, info) => {
462 console.log(info); 506
507 for (let i = 0; i < formRows.value.length; i++) {
508 const row = formRows.value[i];
509 // 如果某一条数据的 matchValue, position, name 都为空,则跳过,不校验
510 if (!row.matchValue && !row.position && !row.name) {
511 continue; // 如果全为空,跳过这一行的校验
512 }
513 if (!row.matchValue || !row.position || !row.name) {
514 proxy.$ElMessage.error('请填写完整的模糊匹配规则');
515 return;
516 }
517 }
463 newCreateGradeStandardDialogInfo.value.submitBtnLoading = true; 518 newCreateGradeStandardDialogInfo.value.submitBtnLoading = true;
464 if (newCreateGradeStandardDialogInfo.value.title === "添加标签") { 519 if (newCreateGradeStandardDialogInfo.value.title === "添加标签") {
465 const tempParams = formRows.value.map((item) => ({ 520 const tempParams = formRows.value.map((item) => ({
...@@ -482,6 +537,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -482,6 +537,7 @@ const newCreateGradeStandardDialogInfo = ref({
482 getLabelPageData(); 537 getLabelPageData();
483 getLabelListData(); 538 getLabelListData();
484 } else { 539 } else {
540 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
485 proxy.$ElMessage.error(res.msg); 541 proxy.$ElMessage.error(res.msg);
486 } 542 }
487 } 543 }
...@@ -508,6 +564,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -508,6 +564,7 @@ const newCreateGradeStandardDialogInfo = ref({
508 getLabelPageData(); 564 getLabelPageData();
509 getLabelListData(); 565 getLabelListData();
510 } else { 566 } else {
567 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
511 proxy.$ElMessage.error(res.msg); 568 proxy.$ElMessage.error(res.msg);
512 } 569 }
513 } 570 }
...@@ -516,30 +573,63 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -516,30 +573,63 @@ const newCreateGradeStandardDialogInfo = ref({
516 }) 573 })
517 574
518 // 新增标签 575 // 新增标签
519 const addNewLabel = () => { 576 const addNewLabel = async () => {
520 console.log('addNewLabel'); 577 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
521 newCreateGradeFormItems.value.forEach(item => { 578 newCreateGradeFormItems.value.forEach(item => {
522 item.default = ''; 579 item.default = '';
523 item.disabled = false; 580 item.disabled = false;
524 }); 581 });
525 formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }]; 582 formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }];
583
584 //
585 if (isLastLayer.value) {
586 // 选择了最后一级
587 newCreateGradeFormItems.value[1].default = atGradeinfo.value.guid;
588 treeInfo.value.expandedKey = [];
589 treeInfo.value.currentNodeKey = atGradeinfo.value.guid;
590 treeInfo.value.expandedKey.push(atGradeinfo.value.classifyGradeGuid);
591 if (atGradeinfo.value?.classifyGradeGuid) {
592 classifyGuid.value = atGradeinfo.value.classifyGradeGuid;
593 tempName.value = atGradeinfo.value.name;
594 classifyDetailGuid.value = atGradeinfo.value.guid;
595 }
596 // 遍历classGradeTreeData 找到对应的guid item的refGradeGuid
597 classGradeTreeData.value.forEach((element: any) => {
598 if (element.guid === classifyGuid.value) {
599 tempRefGradeGuid.value = element.refGradeGuid;
600 }
601 });
602
603 if (tempRefGradeGuid.value) {
604 await getGradeListData(tempRefGradeGuid.value);
605 const matchedGrade = gradeListData.value.find(
606 (element: any) => element.name === tempName.value
607 );
608 if (matchedGrade) {
609 newCreateGradeFormItems.value[2].default = matchedGrade.guid;
610 }
611 }
612 }
613
526 newCreateGradeStandardDialogInfo.value.title = '添加标签'; 614 newCreateGradeStandardDialogInfo.value.title = '添加标签';
527 newCreateGradeStandardDialogInfo.value.visible = true; 615 newCreateGradeStandardDialogInfo.value.visible = true;
616 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
528 } 617 }
529 618
530 619
531 const classSearchItemList = ref<any>([ 620 const classSearchItemList = ref<any>([
532 { 621 {
533 type: 'select-slots', 622 type: 'select',
534 multiple: true, 623 multiple: true,
535 label: '', 624 label: '',
536 field: 'labelName', 625 field: 'labelName',
537 default: [], 626 default: [],
538 options: [], 627 options: [],
539 placeholder: '请选择标签名称', 628 placeholder: '请选择标签名称',
540 clearable: false, 629 clearable: true,
541 filterable: true, 630 filterable: true,
542 visible: true 631 visible: true
632
543 } 633 }
544 ]); 634 ]);
545 635
...@@ -551,6 +641,7 @@ const selectChange = async (val: any, row: any) => { ...@@ -551,6 +641,7 @@ const selectChange = async (val: any, row: any) => {
551 }; 641 };
552 642
553 /** 搜索查询分类标准 */ 643 /** 搜索查询分类标准 */
644 const refCount = ref(0);
554 const searchClass = async (val: any, clear: boolean = false) => { 645 const searchClass = async (val: any, clear: boolean = false) => {
555 console.log('searchClass', val, clear); 646 console.log('searchClass', val, clear);
556 if (clear) { 647 if (clear) {
...@@ -559,7 +650,7 @@ const searchClass = async (val: any, clear: boolean = false) => { ...@@ -559,7 +650,7 @@ const searchClass = async (val: any, clear: boolean = false) => {
559 getLabelPageData(); 650 getLabelPageData();
560 return; 651 return;
561 } 652 }
562 if (val?.labelName?.length !== 0) { 653 if (val?.labelName?.length !== 0 || refCount.value >= 1) {
563 tableInfo.value.loading = true; 654 tableInfo.value.loading = true;
564 const params = { 655 const params = {
565 pageIndex: page.value.curr, 656 pageIndex: page.value.curr,
...@@ -579,7 +670,6 @@ const searchClass = async (val: any, clear: boolean = false) => { ...@@ -579,7 +670,6 @@ const searchClass = async (val: any, clear: boolean = false) => {
579 } 670 }
580 } 671 }
581 672
582
583 }; 673 };
584 674
585 675
...@@ -601,12 +691,13 @@ const handleSelectChange = async (val, row, info) => { ...@@ -601,12 +691,13 @@ const handleSelectChange = async (val, row, info) => {
601 newCreateGradeFormItems.value[2].default = matchedGrade.guid; 691 newCreateGradeFormItems.value[2].default = matchedGrade.guid;
602 newCreateGradeFormItems.value[0].default = tempFormData.value.label; 692 newCreateGradeFormItems.value[0].default = tempFormData.value.label;
603 newCreateGradeFormItems.value[1].default = tempFormData.value.classifyDetailGuid; 693 newCreateGradeFormItems.value[1].default = tempFormData.value.classifyDetailGuid;
694 newCreateGradeFormItems.value[3].default = tempFormData.value.matchChValue;
695 newCreateGradeFormItems.value[4].default = tempFormData.value.matchEnValue;
604 } 696 }
605 } 697 }
606 }; 698 };
607 699
608 const handleTreeSelectNodeChange = (node, item, nodeObj) => { 700 const handleTreeSelectNodeChange = (node, item, nodeObj) => {
609 console.log('handleTreeSelectNodeChange', node, item, nodeObj);
610 treeInfo.value.expandedKey = []; 701 treeInfo.value.expandedKey = [];
611 treeInfo.value.currentNodeKey = node.guid; 702 treeInfo.value.currentNodeKey = node.guid;
612 treeInfo.value.expandedKey.push(node.classifyGradeGuid); 703 treeInfo.value.expandedKey.push(node.classifyGradeGuid);
...@@ -702,8 +793,8 @@ const deleteRow = (index: number) => { ...@@ -702,8 +793,8 @@ const deleteRow = (index: number) => {
702 </div> 793 </div>
703 <div> 794 <div>
704 <el-button type="primary" class="v-add" @click="addNewLabel">新增</el-button> 795 <el-button type="primary" class="v-add" @click="addNewLabel">新增</el-button>
705 <el-button class="v-import">导入</el-button> 796 <!-- <el-button class="v-import">导入</el-button>
706 <el-button>导出</el-button> 797 <el-button>导出</el-button> -->
707 </div> 798 </div>
708 <div class="table_panel_wrap"> 799 <div class="table_panel_wrap">
709 <Table :tableInfo="tableInfo" @tableSwitchBeforeChange="tableSwitchBeforeChange" 800 <Table :tableInfo="tableInfo" @tableSwitchBeforeChange="tableSwitchBeforeChange"
...@@ -868,6 +959,11 @@ const deleteRow = (index: number) => { ...@@ -868,6 +959,11 @@ const deleteRow = (index: number) => {
868 line-height: 24px; 959 line-height: 24px;
869 font-weight: 600; 960 font-weight: 600;
870 } 961 }
962
963 .el-dialog__body {
964 height: 510px;
965 overflow: auto;
966 }
871 } 967 }
872 } 968 }
873 </style> 969 </style>
......
...@@ -196,13 +196,16 @@ const getPreviewData = () => { ...@@ -196,13 +196,16 @@ const getPreviewData = () => {
196 196
197 const getTableStructure = () => { 197 const getTableStructure = () => {
198 let tableName = currDatasourceSelect.value.tableName; 198 let tableName = currDatasourceSelect.value.tableName;
199 console.log('tableName', currDatasourceSelect.value);
199 currDsTableStructureLoading.value = true; 200 currDsTableStructureLoading.value = true;
200 currDsTableStructure.value = []; 201 currDsTableStructure.value = [];
201 getDsTableStructure({ 202 getDsTableStructure({
202 tableName: tableName, 203 // tableName: tableName,
203 dataSourceGuid: databaseInfo.value.guid, 204 // dataSourceGuid: databaseInfo.value.guid,
204 database: databaseInfo.value.databaseNameEn, 205 // database: databaseInfo.value.databaseNameEn,
205 databaseType: databaseInfo.value.databaseType 206 // databaseType: databaseInfo.value.databaseType,
207 tableGuid: currDatasourceSelect.value.tableGuid,
208 execGuid: props.execGuid
206 }).then((res: any) => { 209 }).then((res: any) => {
207 currDsTableStructureLoading.value = false; 210 currDsTableStructureLoading.value = false;
208 if (res.code == proxy.$passCode) { 211 if (res.code == proxy.$passCode) {
...@@ -318,7 +321,7 @@ watch( ...@@ -318,7 +321,7 @@ watch(
318 if (val?.length && !currDatasourceSelect.value?.tableName) { 321 if (val?.length && !currDatasourceSelect.value?.tableName) {
319 currDatasourceSelect.value = val[0]; 322 currDatasourceSelect.value = val[0];
320 } 323 }
321 emits("datasourceSelectedChange", val); 324 emits("datasourceSelectedChange", val, databaseGuid.value);
322 }, 325 },
323 { 326 {
324 deep: true, 327 deep: true,
......
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>
...@@ -9,10 +9,15 @@ import StepBar from "@/components/StepBar/index.vue"; ...@@ -9,10 +9,15 @@ import StepBar from "@/components/StepBar/index.vue";
9 import { 9 import {
10 getDbDirDataSourceList, 10 getDbDirDataSourceList,
11 getDsData, 11 getDsData,
12 getDsTableStructure,
13 saveDbDirTable, 12 saveDbDirTable,
14 updateDbDirTable, 13 updateDbDirTable,
15 createTableSql, 14 createTableSql,
15 getDsTableStructures,
16 getDbDirFieldClassifyAndGrade,
17 getDbDirTableSelectList,
18 getTaskExeTreeList,
19 getGradeList,
20 getFieldTypeList,
16 } from "@/api/modules/dataInventory"; 21 } from "@/api/modules/dataInventory";
17 import existingTableSelect from "./existingTableSelect.vue"; 22 import existingTableSelect from "./existingTableSelect.vue";
18 23
...@@ -45,8 +50,111 @@ const processData = (data) => { ...@@ -45,8 +50,111 @@ const processData = (data) => {
45 databaseGuid: undefined, // 删除旧键 "databaseGuid" 50 databaseGuid: undefined, // 删除旧键 "databaseGuid"
46 })).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键 51 })).map(({ databaseGuid, ...rest }) => rest); // 过滤掉 undefined 键
47 }; 52 };
53 const classifyList: any = ref([]);
54 // 获取分类树形数据
55 // 定义树形选择器的属性
56 const treeSelectProps = {
57 label: "classifyName",
58 value: "classifyDetailGuid",
59 children: "children",
60 };
61 const treeSelectOptions = ref<any>([]);
62 // 存储引用的refGradeGuid
63 const refGradeGuid = ref<any>();
64 const getFieldTree = () => {
65 getTaskExeTreeList({ execGuid: execGuid.value }).then((res: any) => {
66 if (res.code == proxy.$passCode) {
67 const data = res.data || [];
68 classifyList.value = data;
69 treeSelectOptions.value = data;
70 // 遍历data,找到refGradeGuid,不用递归,找第一层
71
72 } else {
73 ElMessage.error(res.msg);
74 }
75 }).catch(() => {
76 ElMessage.error('获取分类树形数据失败');
77 })
78 }
79 // 分级的数据props
80 const gradeSelectProps = {
81 value: 'guid',
82 label: 'name',
83 }
84
85 // 字段类型props
86 const fieldTypeProps = {
87 value: 'value',
88 label: 'label',
89 }
90
91 // 获取字段类型
92 const fieldData = ref<any>();
93 const getFieldTypeData = async () => {
94 const params = {
95 dictType: "字段类型"
96 }
97 const res: any = await getFieldTypeList(params);
98 if (res.code == proxy.$passCode) {
99 fieldData.value = res.data;
100 } else {
101 proxy.$ElMessage.error(res.msg);
102 }
103 }
104
105 // 进入编辑模式
106 const findRefGradeGuid = (data, targetClassifyDetailGuid) => {
107 // 遍历当前数据
108 for (const item of data) {
109 // 判断当前节点是否匹配
110 if (item.classifyDetailGuid === targetClassifyDetailGuid) {
111 return item.refGradeGuid; // 找到匹配的,返回 refGradeGuid
112 }
113
114 // 如果当前节点有 children,则递归查找子节点
115 if (Array.isArray(item.children) && item.children.length > 0) {
116 const result = findRefGradeGuid(item.children, targetClassifyDetailGuid);
117 if (result) {
118 return result; // 如果子节点中找到匹配,返回结果
119 }
120 }
121 }
122 return null; // 没有找到匹配项时返回 null
123 };
124 const editRow = (row) => {
125 // 进入编辑模式时,查找classifyDetailGuid所在的refGradeGuid
126 let refGradeGuid = findRefGradeGuid(treeSelectOptions.value, row.classifyDetailGuid);
127 getGradeList({ classifyGradeGuid: refGradeGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
128 if (res.code === proxy.$passCode) {
129 row.gradeOptions = res.data.records || [];
130 } else {
131 ElMessage.error(res.msg);
132 }
133 });
134 // 这个是指定是否能编辑的字段
135 editableFields.sourceFieldName = false;
136 row.isEdit = true
137 }
138
139 const handleGradeChange = (row) => {
140 console.log('分级改变', row)
141 const gradeOptions = row.gradeOptions || [];
142 const matchedItem = gradeOptions.find((item) => item.guid === row.gradeDetailGuid);
143 if (matchedItem) {
144 row.gradeDetailName = matchedItem.name;
145 }
146 };
147 // 保存数据
148 const saveRow = (row) => {
149 console.log('保存数据', row)
150 editableFields.sourceFieldName = true;
151 row.isEdit = false
152 }
153
154
48 onMounted(async () => { 155 onMounted(async () => {
49 await getDbDirDataSourceListData(); 156 await getDbDirDataSourceListData();
157 await getFieldTypeData();
50 }); 158 });
51 159
52 const stepsInfo = ref({ 160 const stepsInfo = ref({
...@@ -60,32 +168,24 @@ const stepsInfo = ref({ ...@@ -60,32 +168,24 @@ const stepsInfo = ref({
60 168
61 169
62 const datasourceSelectedRows: Ref<any> = ref([]); 170 const datasourceSelectedRows: Ref<any> = ref([]);
63 171 // 记录数据库databaseGuid
64 //记录下一步时选中的库表信息。 172 const handlDsSelectedChange = (v, guid) => {
65 const selectedDatabaseTable: Ref<any> = ref([]);
66
67 const handlDsSelectedChange = (v) => {
68 datasourceSelectedRows.value = v || []; 173 datasourceSelectedRows.value = v || [];
69 const params: any = []; 174 const params: any = [];
70 v.forEach((item) => { 175 v.forEach((item) => {
71 params.push({ 176 params.push({
72 tableName: item.tableName, 177 tableGuid: item.tableGuid,
73 database: item.database, 178 execGuid: execGuid.value,
74 }); 179 });
75 }); 180 });
76 selectedDatabaseTable.value = params; 181
77 console.log('params', params) 182 getNextTableInfo(params);
78 // if (isPrevious.value) {
79 // tableCreateInfo.value.tableFields = [];
80 // tableCreateInfo.value.inputNameValue = '';
81 // tableCreateInfo.value.tableData[0].chName = '';
82 // }
83 }; 183 };
84 184
85 185
86 const fullscreenLoading = ref(false); 186 const fullscreenLoading = ref(false);
87 /** 下一步 */ 187 /** 下一步 */
88 const nextStep = () => { 188 const nextStep = async () => {
89 if (!datasourceSelectedRows.value.length) { 189 if (!datasourceSelectedRows.value.length) {
90 ElMessage({ 190 ElMessage({
91 type: "error", 191 type: "error",
...@@ -93,36 +193,44 @@ const nextStep = () => { ...@@ -93,36 +193,44 @@ const nextStep = () => {
93 }); 193 });
94 return; 194 return;
95 } 195 }
96 getNextTableInfo(); 196 getFieldTree();
97 stepsInfo.value.step = 1; 197 stepsInfo.value.step = 1;
98 }; 198 };
99 199
100 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value 200 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value
101 const getNextTableInfo = async () => { 201 const getNextTableInfo = async (params) => {
102 const res: any = await getDsTableStructure(selectedDatabaseTable.value); 202 const res: any = await getDsTableStructures(params);
103 if (res.code === proxy.$passCode) { 203 if (res.code === proxy.$passCode) {
104 tableDataDetailInfo.value = res.data; 204 tableDataDetailInfo.value = res.data;
105 } else { 205 } else {
106 proxy.$ElMessage.error(res.msg); 206 proxy.$ElMessage.error(res.msg);
107 } 207 }
108 }; 208 };
109 const isPrevious = ref(false);
110 209
210
211
212 const handleClassifyChange = (row) => {
213 if (!row.classifyDetailGuid) {
214 row.gradeGuid = null;
215 row.gradeOptions = [];
216 return;
217 }
218
219 getGradeList({ classifyGradeGuid: row.classifyDetailGuid, pageIndex: 1, pageSize: -1 }).then((res: any) => {
220 if (res.code === 200) {
221 row.gradeOptions = res.data.records || [];
222 } else {
223 ElMessage.error(res.msg);
224 }
225 });
226 };
227
228 const isPrevious = ref(false);
111 /** 上一步 */ 229 /** 上一步 */
112 const previousStep = () => { 230 const previousStep = () => {
113 stepsInfo.value.step = 0; 231 stepsInfo.value.step = 0;
114 isPrevious.value = true; 232 isPrevious.value = true;
115 }; 233 };
116 //记录当前正在编辑的表创建信息。
117 const tableCreateInfo: Ref<any> = ref({
118 guid: "",
119 isCreate: false,
120 inputNameValue: '',
121 tableData: [],
122 partitionAttribute: {},
123 tableFields: [], // 字段标准数组。
124 });
125
126 234
127 const tableDataInfo = ref([ 235 const tableDataInfo = ref([
128 { 236 {
...@@ -132,22 +240,21 @@ const tableDataInfo = ref([ ...@@ -132,22 +240,21 @@ const tableDataInfo = ref([
132 }, 240 },
133 ]) 241 ])
134 // 表格数据 242 // 表格数据
135 const tableDataDetailInfo = ref([ 243 const tableDataDetailInfo = ref<any>([])
136 { id: 1, fieldName: '系统唯一标识', fieldEnglish: 'ID', length: '<200', isUnique: '是', isEdit: false },
137 { id: 2, fieldName: '姓名', fieldEnglish: 'NAME', length: '<=200', isUnique: '否', isEdit: false },
138 { id: 3, fieldName: '年纪', fieldEnglish: 'AGE', length: '=200', isUnique: '否', isEdit: false },
139 { id: 4, fieldName: '系统唯一标识', fieldEnglish: 'ID', length: '<200', isUnique: '是', isEdit: false },
140 { id: 5, fieldName: '姓名', fieldEnglish: 'NAME', length: '<=200', isUnique: '否', isEdit: false },
141 { id: 6, fieldName: '年纪', fieldEnglish: 'AGE', length: '=200', isUnique: '否', isEdit: false },
142 ])
143
144 // 配置哪些字段可编辑 244 // 配置哪些字段可编辑
145 const editableFields = { 245 const editableFields = {
146 fieldName: true, // 字段中文名可编辑 246 fieldName: true, // 字段中文名可编辑
147 length: true, // 长度可编辑 247 fieldLength: true, // 长度可编辑
148 isUnique: true, // 数据是否唯一可编辑 248 isUnique: true, // 数据是否唯一可编辑
249 isPrimary: true, // 是否主键可编辑
149 fieldPrecision: true, // 精度可编辑 250 fieldPrecision: true, // 精度可编辑
150 dictionaryGuid: true, // 关联字典可编辑 251 dictionaryGuid: true, // 关联字典可编辑
252 classifyName: true, // 分类可编辑
253 gradeDetailName: true, // 分级可编辑
254 sourceFieldName: true, // 源字段英文名可编辑
255 classifyDetailGuid: true, // 分类可编辑
256 fieldType: true, // 字段类型可编辑
257 fieldChName: true, // 字段中文名可编辑
151 } 258 }
152 259
153 const tableFieldsLoading = ref(false) 260 const tableFieldsLoading = ref(false)
...@@ -200,15 +307,7 @@ const moveDown = () => { ...@@ -200,15 +307,7 @@ const moveDown = () => {
200 } 307 }
201 }; 308 };
202 309
203 // 进入编辑模式
204 const editRow = (row) => {
205 row.isEdit = true
206 }
207 310
208 // 保存数据
209 const saveRow = (row) => {
210 row.isEdit = false
211 }
212 311
213 // 删除行 312 // 删除行
214 const deleteRow = (index) => { 313 const deleteRow = (index) => {
...@@ -240,10 +339,16 @@ const addRow = () => { ...@@ -240,10 +339,16 @@ const addRow = () => {
240 tableDataDetailInfo.value.push({ 339 tableDataDetailInfo.value.push({
241 id: tableDataDetailInfo.value.length + 1, 340 id: tableDataDetailInfo.value.length + 1,
242 fieldName: '', 341 fieldName: '',
243 fieldEnglish: '', // 英文名不可编辑 342 fieldEnglish: '',
343 fieldType: '',
244 length: '', 344 length: '',
345 fieldPrecision: '',
245 isUnique: '', 346 isUnique: '',
246 isEdit: true, // 新增时默认进入编辑模式 347 isRequired: '',
348 fieldValueRange: '',
349 dictionaryGuid: '',
350 isEdit: true,
351 gradeOptions: [],
247 }) 352 })
248 } 353 }
249 354
...@@ -320,7 +425,6 @@ const data = [ ...@@ -320,7 +425,6 @@ const data = [
320 425
321 const submitAsDraft = () => { 426 const submitAsDraft = () => {
322 // 保存为草稿,无论有没有guid 都传入guid 427 // 保存为草稿,无论有没有guid 都传入guid
323
324 saveOrUpdate({ isDraft: 'Y' }, 0) 428 saveOrUpdate({ isDraft: 'Y' }, 0)
325 429
326 } 430 }
...@@ -331,37 +435,42 @@ const submitAsDraft = () => { ...@@ -331,37 +435,42 @@ const submitAsDraft = () => {
331 * 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空 435 * 2、tableDataDetailInfo.value 每一项中的字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典、不能为空
332 */ 436 */
333 437
334 const checkTableData = (tableDataInfo, tableDataDetailInfo) => { 438 // const checkTableData = (tableDataInfo, tableDataDetailInfo) => {
335 439
336 const tableDataInfoKeys = ['tableName', 'tableChName'] 440 // const tableDataInfoKeys = ['tableName', 'tableChName']
337 const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid'] 441 // const tableDataDetailInfoKeys = ['fieldName', 'fieldEnglish', 'fieldType', 'length', 'fieldPrecision', 'isUnique', 'isRequired', 'fieldValueRange', 'dictionaryGuid']
338 let flag = true 442 // let flag = true
339 tableDataInfo.forEach(item => { 443 // tableDataInfo.forEach(item => {
340 tableDataInfoKeys.forEach(key => { 444 // tableDataInfoKeys.forEach(key => {
341 if (!item[key]) { 445 // if (!item[key]) {
342 flag = false 446 // flag = false
343 proxy.$ElMessage.error('表名称、数据库表不能为空') 447 // proxy.$ElMessage.error('表名称、数据库表不能为空')
344 } 448 // }
345 }) 449 // })
346 }) 450 // })
347 tableDataDetailInfo.forEach(item => { 451 // tableDataDetailInfo.forEach(item => {
348 tableDataDetailInfoKeys.forEach(key => { 452 // tableDataDetailInfoKeys.forEach(key => {
349 if (!item[key]) { 453 // if (!item[key]) {
350 flag = false 454 // flag = false
351 proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空') 455 // proxy.$ElMessage.error('字段名称、字段英文名、字段类型、长度、精度、是否唯一、是否必填、字段取值范围、关联字典不能为空')
352 } 456 // }
353 }) 457 // })
354 }) 458 // })
355 return flag 459 // return flag
356 } 460 // }
357 461
358 const guid = ref('') 462 const guid = ref('')
359 const submit = async () => { 463 const submit = async () => {
360 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) 464 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value)
361 // 校验表格数据是否填写完整 465 const params = {
362 if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) { 466 tableName: tableDataInfo.value[0].tableName,
363 return 467 tableChName: tableDataInfo.value[0].tableChName,
468 foundMode: route.query.foundMode,
364 } 469 }
470 // 校验表格数据是否填写完整
471 // if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) {
472 // return
473 // }
365 /** 474 /**
366 "guid": "string", 475 "guid": "string",
367 "cgDirName": "string", 476 "cgDirName": "string",
...@@ -407,7 +516,15 @@ const submit = async () => { ...@@ -407,7 +516,15 @@ const submit = async () => {
407 */ 516 */
408 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 517 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参
409 if (!guid.value) { 518 if (!guid.value) {
410 saveOrUpdate({}, 0) 519 saveOrUpdate({
520 tableName: tableDataInfo.value[0].tableName,
521 tableChName: tableDataInfo.value[0].tableChName,
522 databaseGuid: route.query.databaseGuid || '',
523 database: route.query.database || '',
524 databaseChName: route.query.databaseChName || '',
525 foundMode: route.query.foundMode,
526 isDraft: 'N',
527 }, 0)
411 } else { 528 } else {
412 saveOrUpdate({}, 1) 529 saveOrUpdate({}, 1)
413 } 530 }
...@@ -425,10 +542,8 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -425,10 +542,8 @@ const saveOrUpdate = async (params: any = {}, type) => {
425 tableChName: '', 542 tableChName: '',
426 databaseGuid: '', 543 databaseGuid: '',
427 database: '', 544 database: '',
428 dbType: '',
429 databaseChName: '', 545 databaseChName: '',
430 foundMode: 0, 546 foundMode: 0,
431 state: 0,
432 isDraft: '', 547 isDraft: '',
433 fieldRQVOList: tableDataDetailInfo.value 548 fieldRQVOList: tableDataDetailInfo.value
434 } 549 }
...@@ -519,6 +634,10 @@ const newCreateSqlDialogInfo = ref({ ...@@ -519,6 +634,10 @@ const newCreateSqlDialogInfo = ref({
519 newCreateSqlDialogInfo.value.submitBtnLoading = true; 634 newCreateSqlDialogInfo.value.submitBtnLoading = true;
520 const params = { 635 const params = {
521 ...info, 636 ...info,
637 tableName: tableDataInfo.value[0].tableName,
638 tableChName: tableDataInfo.value[0].tableChName,
639 foundMode: route.query.foundMode,
640 isDraft: 'N',
522 }; 641 };
523 await saveOrUpdate(params, 2); 642 await saveOrUpdate(params, 2);
524 newCreateSqlDialogInfo.value.submitBtnLoading = false; 643 newCreateSqlDialogInfo.value.submitBtnLoading = false;
...@@ -597,44 +716,78 @@ const createNewSql = () => { ...@@ -597,44 +716,78 @@ const createNewSql = () => {
597 }"> 716 }">
598 <el-table-column type="selection" :width="32" align="center" /> 717 <el-table-column type="selection" :width="32" align="center" />
599 <!-- 排序列(不可编辑) --> 718 <!-- 排序列(不可编辑) -->
600 <el-table-column prop="id" label="排序" width="80" align="center" /> 719 <el-table-column type="index" label="排序" width="80" align="center" />
601 <!-- 字段中文名(不可编辑)fieldChName --> 720 <!-- 字段中文名(可编辑)fieldChName -->
602 <el-table-column prop="fieldName" label="字段中文名" width="150"> 721 <el-table-column prop="fieldChName" label="目标字段中文名" width="150">
722 <!-- 可以编辑 -->
603 <template #default="scope"> 723 <template #default="scope">
604 {{ scope.row.fieldName ? scope.row.fieldName : '--' }} 724 <span v-if="!scope.row.isEdit || !editableFields.fieldChName">{{ scope.row.fieldChName ?
725 scope.row.fieldChName
726 : '--' }}</span>
727 <el-input v-else v-model="scope.row.fieldChName" placeholder="请输入" />
605 </template> 728 </template>
729
606 </el-table-column> 730 </el-table-column>
607 <!-- 字段英文名(可编辑) --> 731 <!-- 字段英文名(可编辑) -->
608 <el-table-column prop="fieldEnglish" label="字段英文名" width="150"> 732 <el-table-column prop="fieldName" label="目标字段英文名" width="150">
609 <template #default="scope"> 733 <template #default="scope">
610 {{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }} 734 <span v-if="!scope.row.isEdit || !editableFields.fieldName">{{ scope.row.fieldName ?
735 scope.row.fieldName
736 : '--' }}</span>
737 <el-input v-else v-model="scope.row.fieldName" placeholder="请输入" />
611 </template> 738 </template>
612 </el-table-column> 739 </el-table-column>
613 <!-- 分类(不可编辑)classifyName --> 740 <!-- 源数据库 -->
614 <el-table-column prop="classifyName" label="分类" width="150"> 741 <el-table-column prop="sourceDatabase" label="源数据库" width="150">
615 <template #default="scope"> 742 <template #default="scope">
616 {{ scope.row.classifyName ? scope.row.classifyName : '--' }} 743 {{ scope.row.sourceDatabase ? scope.row.sourceDatabase : '--' }}
617 </template> 744 </template>
618 </el-table-column> 745 </el-table-column>
619 <!-- 分级(不可编辑) --> 746 <!-- 源数据表 -->
620 <el-table-column prop="gradeDetailName" label="分级" width="120" align="center"> 747 <el-table-column prop="sourceTableName" label="源数据表" width="150">
748 <template #default="scope">
749 {{ scope.row.sourceTableName ? scope.row.sourceTableName : '--' }}
750 </template>
751 </el-table-column>
752 <!-- 源字段中文 -->
753 <el-table-column prop="sourceFieldChName" label="源字段中文" width="150">
621 <template #default="scope"> 754 <template #default="scope">
622 {{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }} 755 {{ scope.row.sourceFieldChName ? scope.row.sourceFieldChName : '--' }}
623 </template> 756 </template>
624 </el-table-column> 757 </el-table-column>
625 <!-- 字段类型fieldType (不可编辑) --> 758 <!-- 源字段英文 -->
626 <el-table-column prop="fieldType" label="字段类型" width="150" align="center"> 759 <el-table-column prop="sourceFieldName" label="源字段英文" width="150">
627 <template #default="scope"> 760 <template #default="scope">
628 {{ scope.row.fieldType ? scope.row.fieldType : '--' }} 761 <!-- {{ scope.row.sourceFieldName ? scope.row.sourceFieldName : '--' }} -->
762
763 <span v-if="!scope.row.isEdit || !editableFields.sourceFieldName">{{ scope.row.sourceFieldName ?
764 scope.row.sourceFieldName : '--' }}</span>
765 <el-input v-else v-model="scope.row.sourceFieldName" placeholder="请输入长度" />
766 </template>
767 </el-table-column>
768 <!-- 源端字段 fieldType fieldTypeProps-->
769 <el-table-column prop="fieldType" label="源端字段类型" width="150">
770 <template #default="scope">
771 <div v-if="scope.row.isEdit">
772 <el-select v-model="scope.row.fieldType" placeholder="选择类型" clearable filterable
773 :props="fieldTypeProps">
774 <el-option v-for="(item, index) in fieldData" :key="index" :label="item.label"
775 :value="item.value"></el-option>
776 </el-select>
777 </div>
778 <div v-else>
779 {{ fieldData.find(item => item.value === scope.row.fieldType)?.label || '--' }}
780 </div>
629 </template> 781 </template>
630 </el-table-column> 782 </el-table-column>
631 783
632 <!-- 长度(可编辑) --> 784 <!-- 长度(可编辑) -->
633 <el-table-column prop="length" label="长度" width="120" align="center"> 785 <el-table-column prop="fieldLength" label="长度" width="120" align="center">
634 <template #default="scope"> 786 <template #default="scope">
635 <span v-if="!scope.row.isEdit || !editableFields.length">{{ scope.row.length ? scope.row.length 787 <span v-if="!scope.row.isEdit || !editableFields.fieldLength">{{ scope.row.fieldLength ?
788 scope.row.fieldLength
636 : '--' }}</span> 789 : '--' }}</span>
637 <el-input v-else v-model="scope.row.length" placeholder="请输入长度" /> 790 <el-input v-else v-model="scope.row.fieldLength" placeholder="请输入长度" />
638 </template> 791 </template>
639 </el-table-column> 792 </el-table-column>
640 <!-- 精度(可编辑)fieldPrecision --> 793 <!-- 精度(可编辑)fieldPrecision -->
...@@ -656,34 +809,60 @@ const createNewSql = () => { ...@@ -656,34 +809,60 @@ const createNewSql = () => {
656 </el-table-column> 809 </el-table-column>
657 810
658 <!-- 数据是否唯一(可编辑) --> 811 <!-- 数据是否唯一(可编辑) -->
659 <el-table-column prop="isUnique" label="数据是否唯一" width="150" align="center"> 812 <el-table-column prop="isPrimary" label="是否主键" width="150" align="center">
660 <template #default="scope"> 813 <template #default="scope">
661 <span v-if="!scope.row.isEdit || !editableFields.isUnique">{{ scope.row.isUnique ? scope.row.isUnique : 814 <span v-if="!scope.row.isEdit || !editableFields.isPrimary">{{ scope.row.isPrimary ? scope.row.isPrimary
815 :
662 '--' }}</span> 816 '--' }}</span>
663 <el-select v-else v-model="scope.row.isUnique" placeholder="请选择"> 817 <el-select v-else v-model="scope.row.isPrimary" placeholder="请选择">
664 <el-option label="是" value="是" /> 818 <el-option label="Y" value="Y" />
665 <el-option label="否" value="否" /> 819 <el-option label="N" value="N" />
666 </el-select> 820 </el-select>
667 </template> 821 </template>
668 </el-table-column> 822 </el-table-column>
669 <!-- 是否必填(可编辑) --> 823 <!-- 是否必填(可编辑) -->
670 <el-table-column prop="isRequired" label="是否必填" width="120" align="center"> 824 <el-table-column prop="isNotNull" label="是否必填" width="120" align="center">
671 <template #default="scope"> 825 <template #default="scope">
672 <span v-if="!scope.row.isEdit">{{ scope.row.isRequired ? scope.row.isRequired : '--' }}</span> 826 <span v-if="!scope.row.isEdit">{{ scope.row.isNotNull ? scope.row.isNotNull : '--' }}</span>
673 <el-select v-else v-model="scope.row.isRequired" placeholder="请选择"> 827 <el-select v-else v-model="scope.row.isNotNull" placeholder="请选择">
674 <el-option label="是" value="是" /> 828 <el-option label="Y" value="Y" />
675 <el-option label="否" value="否" /> 829 <el-option label="N" value="N" />
676 </el-select> 830 </el-select>
677 </template> 831 </template>
678 </el-table-column> 832 </el-table-column>
679 <!-- 字段取值范围 fieldValueRange(可编辑)--> 833
680 <el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center"> 834 <!-- 分类(不可编辑)classifyName -->
835
836 <el-table-column prop="classifyDetailGuid" label="分类" width="150">
681 <template #default="scope"> 837 <template #default="scope">
682 <span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span> 838 <!-- 如果当前行是编辑状态,显示 tree-select -->
683 <el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" /> 839 <div v-if="scope.row.isEdit">
840 <el-tree-select v-model="scope.row.classifyDetailGuid" :data="treeSelectOptions"
841 :props="treeSelectProps" placeholder="请选择分类" clearable filterable
842 @change="handleClassifyChange(scope.row)">
843 </el-tree-select>
844 </div>
845 <!-- 否则直接显示分类名称 -->
846 <div v-else>
847 {{ scope.row.classifyDetailName || '--' }}
848 </div>
849 </template>
850 </el-table-column>
851 <!-- 分级(不可编辑) -->
852 <el-table-column prop="gradeDetailGuid" label="分级" width="120" align="center">
853 <template #default="scope">
854 <div v-if="scope.row.isEdit">
855 <el-select v-model="scope.row.gradeDetailGuid" placeholder="请选择分级" clearable filterable
856 :props="gradeSelectProps" @change="handleGradeChange(scope.row)">
857 <el-option v-for="(item, index) in scope.row.gradeOptions || []" :key="index" :label="item.name"
858 :value="item.guid"></el-option>
859 </el-select>
860 </div>
861 <div v-else>
862 {{ scope.row.gradeDetailName || '--' }}
863 </div>
684 </template> 864 </template>
685 </el-table-column> 865 </el-table-column>
686
687 <!-- 操作列 --> 866 <!-- 操作列 -->
688 <el-table-column label="操作" width="100" align="center" fixed="right"> 867 <el-table-column label="操作" width="100" align="center" fixed="right">
689 <template #default="scope"> 868 <template #default="scope">
......
...@@ -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 || [];
219 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 };
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
......
...@@ -57,9 +57,18 @@ const getClassifyGradListData = async () => { ...@@ -57,9 +57,18 @@ const getClassifyGradListData = async () => {
57 } 57 }
58 58
59 //获取分类列表 59 //获取分类列表
60 const getClassListData = async () => { 60 const getClassListData = async (params = {}) => {
61 const inParams = {
62 type: 'C',
63 pageIndex: 1,
64 pageSize: -1
65 }
66 const finalParams = {
67 ...inParams,
68 ...params
69 }
61 classListDataLoading.value = true; 70 classListDataLoading.value = true;
62 const res: any = await getClassifyGradList(refClassifyPageParams.value); 71 const res: any = await getClassifyGradList(finalParams);
63 if (res.code == proxy.$passCode) { 72 if (res.code == proxy.$passCode) {
64 classListData.value = res.data.records || []; 73 classListData.value = res.data.records || [];
65 classListDataLoading.value = false; 74 classListDataLoading.value = false;
...@@ -70,7 +79,7 @@ const getClassListData = async () => { ...@@ -70,7 +79,7 @@ const getClassListData = async () => {
70 79
71 onMounted(() => { 80 onMounted(() => {
72 getClassifyGradListData(); 81 getClassifyGradListData();
73 getClassListData(); 82 // getClassListData();
74 }) 83 })
75 84
76 85
...@@ -108,24 +117,30 @@ const cardBtnVisible: any = ref(false); ...@@ -108,24 +117,30 @@ const cardBtnVisible: any = ref(false);
108 117
109 /** 搜索查询分类标准 */ 118 /** 搜索查询分类标准 */
110 const searchClass = async (val: any, clear: boolean = false) => { 119 const searchClass = async (val: any, clear: boolean = false) => {
120 console.log(val, 'val');
121
111 if (clear) { 122 if (clear) {
112 classSearchItemList.value.map(item => item.default = '') 123 classSearchItemList.value.map(item => item.default = '')
113 getClassListData(); 124 getClassListData();
114 return; 125 return;
115 } 126 }
116 const params = { 127 // const params = {
117 type: 'C', 128 // type: 'C',
118 name: val.classStandardName, 129 // name: val.classStandardName,
119 pageIndex: 1, 130 // pageIndex: 1,
120 pageSize: -1 131 // pageSize: -1
121 } 132 // }
122 const res: any = await getClassifyGradList(params); 133 // const res: any = await getClassifyGradList(params);
123 if (res.code == proxy.$passCode) { 134 // if (res.code == proxy.$passCode) {
124 classListData.value = res.data.records || []; 135 // classListData.value = res.data.records || [];
125 } else { 136 // } else {
126 proxy.$ElMessage.error(res.msg); 137 // proxy.$ElMessage.error(res.msg);
138 // }
139 getClassListData(
140 {
141 name: val.classStandardName
127 } 142 }
128 143 );
129 }; 144 };
130 145
131 /** 编辑分类 */ 146 /** 编辑分类 */
...@@ -149,6 +164,7 @@ const handleClassDataEdit = (params) => { ...@@ -149,6 +164,7 @@ const handleClassDataEdit = (params) => {
149 164
150 // 配置分类 165 // 配置分类
151 const handleClassDataClick = (item, des = '') => { 166 const handleClassDataClick = (item, des = '') => {
167 console.log(item, 'i111tem');
152 // 获取分级标准 168 // 获取分级标准
153 router.push({ 169 router.push({
154 name: 'classStandardEdit', 170 name: 'classStandardEdit',
...@@ -156,7 +172,9 @@ const handleClassDataClick = (item, des = '') => { ...@@ -156,7 +172,9 @@ const handleClassDataClick = (item, des = '') => {
156 guid: item.guid, 172 guid: item.guid,
157 type: des === '' ? '配置' : des, 173 type: des === '' ? '配置' : des,
158 classStandardName: item.name, 174 classStandardName: item.name,
159 refGradeGuid: item.refGradeGuid 175 refGradeGuid: item.refGradeGuid,
176 description: item.description,
177 isExpand: item.isExpand || false
160 } 178 }
161 }); 179 });
162 } 180 }
...@@ -229,7 +247,7 @@ const classStandardFormItems = ref([{ ...@@ -229,7 +247,7 @@ const classStandardFormItems = ref([{
229 247
230 const classStandardFormRules = ref({ 248 const classStandardFormRules = ref({
231 classStandardName: [required('请填写分类名称')], 249 classStandardName: [required('请填写分类名称')],
232 gradeStandard: [required('请选择分级标准')] 250 refGradeGuid: [required('请选择分级标准')]
233 }); 251 });
234 252
235 const newCreateClassStandardDialogInfo = ref({ 253 const newCreateClassStandardDialogInfo = ref({
...@@ -248,6 +266,7 @@ const newCreateClassStandardDialogInfo = ref({ ...@@ -248,6 +266,7 @@ const newCreateClassStandardDialogInfo = ref({
248 newCreateClassStandardDialogInfo.value.visible = false; 266 newCreateClassStandardDialogInfo.value.visible = false;
249 }, 267 },
250 submit: async (btn, info) => { 268 submit: async (btn, info) => {
269
251 if (newCreateClassStandardDialogInfo.value.title === '新增分类') { 270 if (newCreateClassStandardDialogInfo.value.title === '新增分类') {
252 newCreateClassStandardDialogInfo.value.submitBtnLoading = true; 271 newCreateClassStandardDialogInfo.value.submitBtnLoading = true;
253 const params = { 272 const params = {
...@@ -263,9 +282,26 @@ const newCreateClassStandardDialogInfo = ref({ ...@@ -263,9 +282,26 @@ const newCreateClassStandardDialogInfo = ref({
263 type: 'success', 282 type: 'success',
264 message: '新增分类成功' 283 message: '新增分类成功'
265 }) 284 })
285
286 nextTick(() => {
287 // 拿到新增的分类数据,跳转到配置页面
288 const item = classListData.value.find(item => item.name === info.classStandardName);
289 console.log(item, 'item---------------');
290 if (item) {
291 const params = {
292 name: item.name,
293 guid: item.guid,
294 refGradeGuid: item.refGradeGuid,
295 description: item.description,
296 isExpand: true
297 }
298 handleClassDataClick(params, '');
299 }
300 })
266 newCreateClassStandardDialogInfo.value.submitBtnLoading = false; 301 newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
267 newCreateClassStandardDialogInfo.value.visible = false; 302 newCreateClassStandardDialogInfo.value.visible = false;
268 } else { 303 } else {
304 newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
269 proxy.$ElMessage.error(res.msg); 305 proxy.$ElMessage.error(res.msg);
270 } 306 }
271 } else { 307 } else {
...@@ -293,6 +329,7 @@ const newCreateClassStandardDialogInfo = ref({ ...@@ -293,6 +329,7 @@ const newCreateClassStandardDialogInfo = ref({
293 }) 329 })
294 330
295 const newCreateClass = () => { 331 const newCreateClass = () => {
332 newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
296 newCreateClassStandardDialogInfo.value.visible = true; 333 newCreateClassStandardDialogInfo.value.visible = true;
297 classStandardFormItems.value.forEach(item => item.default = ''); 334 classStandardFormItems.value.forEach(item => item.default = '');
298 } 335 }
...@@ -343,12 +380,10 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -343,12 +380,10 @@ const newCreateGradeStandardDialogInfo = ref({
343 await getClassifyGradListData(); 380 await getClassifyGradListData();
344 proxy.$ElMessage({ 381 proxy.$ElMessage({
345 type: 'success', 382 type: 'success',
346 message: '新增分成功' 383 message: '新增分成功'
347 }) 384 })
348
349 // 拿到新增的分级数据,跳转到配置页面 385 // 拿到新增的分级数据,跳转到配置页面
350 const item = classifyGradListData.value.find(item => item.name === info.name); 386 const item = classifyGradListData.value.find(item => item.name === info.name);
351
352 if (item) { 387 if (item) {
353 const params = { 388 const params = {
354 name: item.name, 389 name: item.name,
...@@ -359,6 +394,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -359,6 +394,7 @@ const newCreateGradeStandardDialogInfo = ref({
359 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false; 394 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
360 newCreateGradeStandardDialogInfo.value.visible = false; 395 newCreateGradeStandardDialogInfo.value.visible = false;
361 } else { 396 } else {
397 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
362 proxy.$ElMessage.error(res.msg); 398 proxy.$ElMessage.error(res.msg);
363 } 399 }
364 } else { 400 } else {
...@@ -372,7 +408,7 @@ const newCreateGradeStandardDialogInfo = ref({ ...@@ -372,7 +408,7 @@ const newCreateGradeStandardDialogInfo = ref({
372 getClassifyGradListData(); 408 getClassifyGradListData();
373 proxy.$ElMessage({ 409 proxy.$ElMessage({
374 type: 'success', 410 type: 'success',
375 message: '修改分成功' 411 message: '修改分成功'
376 }) 412 })
377 newCreateGradeStandardDialogInfo.value.visible = false; 413 newCreateGradeStandardDialogInfo.value.visible = false;
378 } else { 414 } else {
...@@ -437,6 +473,7 @@ const handleClassifyGradDataClick = (item) => { ...@@ -437,6 +473,7 @@ const handleClassifyGradDataClick = (item) => {
437 } 473 }
438 474
439 const newCreateGrade = () => { 475 const newCreateGrade = () => {
476 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
440 newCreateGradeStandardDialogInfo.value.visible = true; 477 newCreateGradeStandardDialogInfo.value.visible = true;
441 newCreateGradeFormItems.value.forEach(item => item.default = ''); 478 newCreateGradeFormItems.value.forEach(item => item.default = '');
442 } 479 }
...@@ -538,8 +575,8 @@ const newCreateGrade = () => { ...@@ -538,8 +575,8 @@ const newCreateGrade = () => {
538 </el-icon> 575 </el-icon>
539 </template> 576 </template>
540 <div class="levitation-ul"> 577 <div class="levitation-ul">
541 <span class="levitation-li" @click="handleClassDataClick(item)">配置</span> 578 <span class="levitation-li" @click="handleClassDataClick(item)">编辑</span>
542 <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> 579 <!-- <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> -->
543 <span class="levitation-li" @click="handleClassDataDel(item)">删除</span> 580 <span class="levitation-li" @click="handleClassDataDel(item)">删除</span>
544 </div> 581 </div>
545 </el-popover> 582 </el-popover>
...@@ -571,8 +608,8 @@ const newCreateGrade = () => { ...@@ -571,8 +608,8 @@ const newCreateGrade = () => {
571 </el-icon> 608 </el-icon>
572 </template> 609 </template>
573 <div class="levitation-ul"> 610 <div class="levitation-ul">
574 <span class="levitation-li" @click="handleClassifyGradDataClick(item)">配置</span> 611 <span class="levitation-li" @click="handleClassifyGradDataClick(item)">编辑</span>
575 <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> 612 <!-- <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> -->
576 <span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span> 613 <span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span>
577 </div> 614 </div>
578 </el-popover> 615 </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!