55e54a07 by lihua

fix: 质量规则支持新建质检表

1 parent 7c1b8e12
...@@ -177,4 +177,10 @@ export const updateModelRule = (params) => request({ ...@@ -177,4 +177,10 @@ export const updateModelRule = (params) => request({
177 url:`${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/conf/update`, 177 url:`${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/conf/update`,
178 method: 'post', 178 method: 'post',
179 data: params 179 data: params
180 })
181
182 // 获取产品目录guid下面的资源表
183 export const getDamCatalogTableList = (damGuid) => request({
184 url:`${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/quality/get-table-list?damGuid=${damGuid}`,
185 method: 'get'
180 }) 186 })
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -258,8 +258,8 @@ const groupTableInfo = ref({ ...@@ -258,8 +258,8 @@ const groupTableInfo = ref({
258 width: 92, 258 width: 92,
259 btns: (scope) => { 259 btns: (scope) => {
260 return [ 260 return [
261 { label: "编辑", value: "edit", disabled: scope.row.dataSource != '5' }, 261 { label: "编辑", value: "edit", disabled: scope.row.dataSource == '4' },
262 { label: "删除", value: "delete", disabled: scope.row.dataSource != '5' }, 262 { label: "删除", value: "delete", disabled: scope.row.dataSource == '4' },
263 ] 263 ]
264 }, 264 },
265 } 265 }
...@@ -675,13 +675,17 @@ const clickCreateGroup = () => { ...@@ -675,13 +675,17 @@ const clickCreateGroup = () => {
675 675
676 /** 新建质检表 */ 676 /** 新建质检表 */
677 const clickCreateTable = () => { 677 const clickCreateTable = () => {
678 let query: any = {
679 groupGuid: page.value.modelGroupGuid,
680 name: lastSelectNode.value.data.name,
681 dataSource: lastSelectNode.value.data.dataSource,
682 };
683 if (lastSelectNode.value.data.damGuid && lastSelectNode.value.data.children?.[0]?.dataSource != 5) {
684 query.damGuid = lastSelectNode.value.data.damGuid
685 }
678 router.push({ 686 router.push({
679 name: 'ruleModel', 687 name: 'ruleModel',
680 query: { 688 query: query
681 groupGuid: page.value.modelGroupGuid,
682 name: lastSelectNode.value.data.name,
683 dataSource: lastSelectNode.value.data.dataSource
684 }
685 }); 689 });
686 } 690 }
687 691
......
...@@ -15,6 +15,7 @@ import { ...@@ -15,6 +15,7 @@ import {
15 getRuleTypeList, 15 getRuleTypeList,
16 getSmallCategoryList, 16 getSmallCategoryList,
17 getLargeCategoryList, 17 getLargeCategoryList,
18 getDamCatalogTableList
18 } from '@/api/modules/dataQuality'; 19 } from '@/api/modules/dataQuality';
19 import { 20 import {
20 getMetaTreeData 21 getMetaTreeData
...@@ -33,6 +34,7 @@ const route = useRoute(); ...@@ -33,6 +34,7 @@ const route = useRoute();
33 34
34 const modelGroupGuid: any = ref(route.query.groupGuid); 35 const modelGroupGuid: any = ref(route.query.groupGuid);
35 const fullPath = route.fullPath; 36 const fullPath = route.fullPath;
37 let damGuid: any = ref(route.query.damGuid);
36 38
37 const fullScreenLoading = ref(false); 39 const fullScreenLoading = ref(false);
38 40
...@@ -61,6 +63,8 @@ const dsToTreeData: any = ref([]); ...@@ -61,6 +63,8 @@ const dsToTreeData: any = ref([]);
61 63
62 const toSubjectTables: any = ref([]); 64 const toSubjectTables: any = ref([]);
63 65
66 const isProductDam = ref(false);
67
64 const getSubjectTableTreeData = () => { 68 const getSubjectTableTreeData = () => {
65 dsFromTreeDataLoading.value = true; 69 dsFromTreeDataLoading.value = true;
66 if (route.query.dataSource == '4') { 70 if (route.query.dataSource == '4') {
...@@ -86,22 +90,74 @@ const getSubjectTableTreeData = () => { ...@@ -86,22 +90,74 @@ const getSubjectTableTreeData = () => {
86 } 90 }
87 }) 91 })
88 } else { 92 } else {
89 getMetaTreeData({ isImportCreate: 'N' }).then((res: any) => { 93 if (damGuid.value) {
90 dsFromTreeDataLoading.value = false; 94 getDamCatalogTableList(damGuid.value).then((res: any) => {
91 if (res.code == proxy.$passCode) { 95 if (res.code == proxy.$passCode) {
92 dsFromTreeData.value = res.data?.children?.map(d => { 96 if (res.data?.length) {
93 d.parentGuid = 0; 97 dsFromTreeDataLoading.value = false;
94 d.label = d.name; 98 isProductDam.value = true;
95 d.children = d.children?.map(child => { 99 dsFromTreeData.value = res.data?.map(d => {
96 child.label = child.name + `(${child.tableName})`; 100 d.parentGuid = 0;
97 child.dataServerName = child.databaseName; 101 d.label = d.name + `(${d.tableName})`;
98 child.dataSourceGuid = d.dataSourceGuid || d.guid; 102 d.dataServerName = d.databaseName;
99 return child; 103 d.dataSourceGuid = d.dataSourceGuid;
104 return d;
105 }) || [];
106 } else {
107 isProductDam.value = false;
108 getMetaTreeData({ isImportCreate: 'N' }).then((res: any) => {
109 dsFromTreeDataLoading.value = false;
110 if (res.code == proxy.$passCode) {
111 dsFromTreeData.value = res.data?.children?.map(d => {
112 d.parentGuid = 0;
113 d.label = d.name;
114 d.children = d.children?.map(child => {
115 child.label = child.name + `(${child.tableName})`;
116 child.dataServerName = child.databaseName;
117 child.dataSourceGuid = d.dataSourceGuid || d.guid;
118 return child;
119 })
120 return d;
121 }) || [];
122 } else {
123 ElMessage({
124 type: 'error',
125 message: res.msg,
126 })
127 }
128 })
129 }
130 } else {
131 dsFromTreeDataLoading.value = false;
132 ElMessage({
133 type: 'error',
134 message: res.msg,
100 }) 135 })
101 return d; 136 }
102 }) || []; 137 })
103 } 138 } else {
104 }) 139 getMetaTreeData({ isImportCreate: 'N' }).then((res: any) => {
140 dsFromTreeDataLoading.value = false;
141 if (res.code == proxy.$passCode) {
142 dsFromTreeData.value = res.data?.children?.map(d => {
143 d.parentGuid = 0;
144 d.label = d.name;
145 d.children = d.children?.map(child => {
146 child.label = child.name + `(${child.tableName})`;
147 child.dataServerName = child.databaseName;
148 child.dataSourceGuid = d.dataSourceGuid || d.guid;
149 return child;
150 })
151 return d;
152 }) || [];
153 } else {
154 ElMessage({
155 type: 'error',
156 message: res.msg,
157 })
158 }
159 })
160 }
105 } 161 }
106 } 162 }
107 163
...@@ -189,7 +245,14 @@ const changeStep = (val, skip = false) => { ...@@ -189,7 +245,14 @@ const changeStep = (val, skip = false) => {
189 } 245 }
190 toSubjectTables.value = []; 246 toSubjectTables.value = [];
191 dsToTreeData.value.forEach(d => { 247 dsToTreeData.value.forEach(d => {
192 d.children.forEach(child => { 248 if (isProductDam.value) {
249 d.enName = d.tableName;
250 d.chName = d.tableChName || d.name;
251 d.dataSourceGuid = d.dataSourceGuid;
252 d.databaseName = d.databaseName,
253 toSubjectTables.value.push(d);
254 } else {
255 d.children.forEach(child => {
193 child.guid = child.tableGuid || child.guid; 256 child.guid = child.tableGuid || child.guid;
194 child.enName = child.tableName; 257 child.enName = child.tableName;
195 child.chName = child.tableChName || child.name; 258 child.chName = child.tableChName || child.name;
...@@ -197,6 +260,7 @@ const changeStep = (val, skip = false) => { ...@@ -197,6 +260,7 @@ const changeStep = (val, skip = false) => {
197 child.databaseName = child.databaseName, 260 child.databaseName = child.databaseName,
198 toSubjectTables.value.push(child); 261 toSubjectTables.value.push(child);
199 }) 262 })
263 }
200 }); 264 });
201 step.value = val - 1; 265 step.value = val - 1;
202 stepsInfo.value.step = val - 1 266 stepsInfo.value.step = val - 1
...@@ -244,7 +308,8 @@ const transformRulesInfo = (info: any) => { ...@@ -244,7 +308,8 @@ const transformRulesInfo = (info: any) => {
244 subjectGuid: tableInfo.guid, 308 subjectGuid: tableInfo.guid,
245 dataSourceGuid: tableInfo.dataSourceGuid, 309 dataSourceGuid: tableInfo.dataSourceGuid,
246 databaseName: tableInfo.dataServerName, 310 databaseName: tableInfo.dataServerName,
247 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 311 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
312 damGuid: isProductDam.value ? damGuid.value : null,
248 modelRuleConfList: [Object.assign({}, info, { 313 modelRuleConfList: [Object.assign({}, info, {
249 qualityModelGuid: modelGuid 314 qualityModelGuid: modelGuid
250 })] 315 })]
...@@ -263,7 +328,8 @@ const transformRulesInfo = (info: any) => { ...@@ -263,7 +328,8 @@ const transformRulesInfo = (info: any) => {
263 subjectGuid: tableInfo.guid, 328 subjectGuid: tableInfo.guid,
264 dataSourceGuid: tableInfo.dataSourceGuid, 329 dataSourceGuid: tableInfo.dataSourceGuid,
265 databaseName: tableInfo.dataServerName, 330 databaseName: tableInfo.dataServerName,
266 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 331 damGuid: isProductDam.value ? damGuid.value : null,
332 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
267 modelRuleConfList: [Object.assign({}, info, { 333 modelRuleConfList: [Object.assign({}, info, {
268 ruleField: fields?.map(f => { 334 ruleField: fields?.map(f => {
269 return { 335 return {
...@@ -287,7 +353,8 @@ const transformRulesInfo = (info: any) => { ...@@ -287,7 +353,8 @@ const transformRulesInfo = (info: any) => {
287 subjectGuid: tableInfo.guid, 353 subjectGuid: tableInfo.guid,
288 dataSourceGuid: tableInfo.dataSourceGuid, 354 dataSourceGuid: tableInfo.dataSourceGuid,
289 databaseName: tableInfo.dataServerName, 355 databaseName: tableInfo.dataServerName,
290 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 356 damGuid: isProductDam.value ? damGuid.value : null,
357 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
291 modelRuleConfList: [Object.assign({}, info, { 358 modelRuleConfList: [Object.assign({}, info, {
292 ruleField: [{ 359 ruleField: [{
293 guid: fields.guid, 360 guid: fields.guid,
...@@ -312,7 +379,8 @@ const transformRulesInfo = (info: any) => { ...@@ -312,7 +379,8 @@ const transformRulesInfo = (info: any) => {
312 subjectGuid: tableInfo.guid, 379 subjectGuid: tableInfo.guid,
313 dataSourceGuid: tableInfo.dataSourceGuid, 380 dataSourceGuid: tableInfo.dataSourceGuid,
314 databaseName: tableInfo.dataServerName, 381 databaseName: tableInfo.dataServerName,
315 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 382 damGuid: isProductDam.value ? damGuid.value : null,
383 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
316 modelRuleConfList: [Object.assign({}, info, { 384 modelRuleConfList: [Object.assign({}, info, {
317 ruleField: fields?.map(f => { 385 ruleField: fields?.map(f => {
318 return { 386 return {
...@@ -337,7 +405,8 @@ const transformRulesInfo = (info: any) => { ...@@ -337,7 +405,8 @@ const transformRulesInfo = (info: any) => {
337 subjectGuid: tableInfo.guid, 405 subjectGuid: tableInfo.guid,
338 dataSourceGuid: tableInfo.dataSourceGuid, 406 dataSourceGuid: tableInfo.dataSourceGuid,
339 databaseName: tableInfo.dataServerName, 407 databaseName: tableInfo.dataServerName,
340 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 408 damGuid: isProductDam.value ? damGuid.value : null,
409 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
341 modelRuleConfList: [Object.assign({}, info, { 410 modelRuleConfList: [Object.assign({}, info, {
342 differenceRange: row.differenceRange, 411 differenceRange: row.differenceRange,
343 rows: [], 412 rows: [],
...@@ -357,7 +426,8 @@ const transformRulesInfo = (info: any) => { ...@@ -357,7 +426,8 @@ const transformRulesInfo = (info: any) => {
357 subjectGuid: tableInfo.guid, 426 subjectGuid: tableInfo.guid,
358 dataSourceGuid: tableInfo.dataSourceGuid, 427 dataSourceGuid: tableInfo.dataSourceGuid,
359 databaseName: tableInfo.dataServerName, 428 databaseName: tableInfo.dataServerName,
360 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 429 damGuid: isProductDam.value ? damGuid.value : null,
430 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
361 modelRuleConfList: [Object.assign({}, info, { 431 modelRuleConfList: [Object.assign({}, info, {
362 ruleField: fields.map(f => { 432 ruleField: fields.map(f => {
363 return { 433 return {
...@@ -386,7 +456,8 @@ const transformRulesInfo = (info: any) => { ...@@ -386,7 +456,8 @@ const transformRulesInfo = (info: any) => {
386 subjectGuid: tableInfo.guid, 456 subjectGuid: tableInfo.guid,
387 dataSourceGuid: tableInfo.dataSourceGuid, 457 dataSourceGuid: tableInfo.dataSourceGuid,
388 databaseName: tableInfo.dataServerName, 458 databaseName: tableInfo.dataServerName,
389 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 459 damGuid: isProductDam.value ? damGuid.value : null,
460 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
390 modelRuleConfList: [Object.assign({}, info, { 461 modelRuleConfList: [Object.assign({}, info, {
391 ruleField: fields.map(f => { 462 ruleField: fields.map(f => {
392 return { 463 return {
...@@ -422,7 +493,8 @@ const transformRulesInfo = (info: any) => { ...@@ -422,7 +493,8 @@ const transformRulesInfo = (info: any) => {
422 subjectGuid: tableInfo.guid, 493 subjectGuid: tableInfo.guid,
423 dataSourceGuid: tableInfo.dataSourceGuid, 494 dataSourceGuid: tableInfo.dataSourceGuid,
424 databaseName: tableInfo.dataServerName, 495 databaseName: tableInfo.dataServerName,
425 dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null, 496 damGuid: isProductDam.value ? damGuid.value : null,
497 dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
426 modelRuleConfList: [Object.assign({}, info, { 498 modelRuleConfList: [Object.assign({}, info, {
427 ruleField: info.ruleFields.map(row => { 499 ruleField: info.ruleFields.map(row => {
428 return { 500 return {
...@@ -452,11 +524,11 @@ const save = () => { ...@@ -452,11 +524,11 @@ const save = () => {
452 saveQualityTable(params).then((res: any) => { 524 saveQualityTable(params).then((res: any) => {
453 fullScreenLoading.value = false; 525 fullScreenLoading.value = false;
454 if (res.code == proxy.$passCode) { 526 if (res.code == proxy.$passCode) {
455 ElMessage.success('新建质检表保存成功');
456 //跳到对应的分组下 527 //跳到对应的分组下
457 router.push({ 528 router.push({
458 name: 'qualityRules' 529 name: 'qualityRules'
459 }); 530 });
531 ElMessage.success('新建质检表保存成功');
460 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath)); 532 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
461 dataQualityStore.set(modelGroupGuid.value); 533 dataQualityStore.set(modelGroupGuid.value);
462 } else { 534 } else {
...@@ -484,7 +556,7 @@ const save = () => { ...@@ -484,7 +556,7 @@ const save = () => {
484 '选择需要添加质检规则的表,请确保数据库为脱产环境,避免数据质检影响您的生产环境,且允许在该脱产环境建脏数据的库,请知晓!' : '选择需要添加质检规则的表' }}</span> 556 '选择需要添加质检规则的表,请确保数据库为脱产环境,避免数据质检影响您的生产环境,且允许在该脱产环境建脏数据的库,请知晓!' : '选择需要添加质检规则的表' }}</span>
485 </div> 557 </div>
486 </div> 558 </div>
487 <TreeTransfer mode="transfer" :title="[route.query.dataSource == '5' ? '可选元数据目录表' : '可选盘点数据库目录表', '已选表']" 559 <TreeTransfer mode="transfer" :title="[route.query.dataSource == '4' ? '可选盘点数据库目录表' : (isProductDam ? '产品目录资源表' : '可选元数据目录表'), '已选表']"
488 pid="parentGuid" :from-tree-data-loading="dsFromTreeDataLoading" :checkOnClickNode="true" 560 pid="parentGuid" :from-tree-data-loading="dsFromTreeDataLoading" :checkOnClickNode="true"
489 :from_checked_all="false" :from_data="dsFromTreeData" :to_data="dsToTreeData" node_key="guid" 561 :from_checked_all="false" :from_data="dsFromTreeData" :to_data="dsToTreeData" node_key="guid"
490 :transferOpenNode="true" width="70%" :defaultProps="{ 562 :transferOpenNode="true" width="70%" :defaultProps="{
...@@ -505,7 +577,7 @@ const save = () => { ...@@ -505,7 +577,7 @@ const save = () => {
505 <div class="panel_content"> 577 <div class="panel_content">
506 <div class="form_panel"> 578 <div class="form_panel">
507 <ruleForm ref="ruleFormRef" :toSubjectTables="toSubjectTables" :ruleTypeList="ruleTypeList" 579 <ruleForm ref="ruleFormRef" :toSubjectTables="toSubjectTables" :ruleTypeList="ruleTypeList"
508 :data-source="route.query.dataSource as string" :largeCategoryList="largeCategoryList" 580 :data-source="(!isProductDam && route.query.dataSource == '1') ? '5' : route.query.dataSource as string" :largeCategoryList="largeCategoryList"
509 :smallCategoryList="smallCategoryList"></ruleForm> 581 :smallCategoryList="smallCategoryList"></ruleForm>
510 </div> 582 </div>
511 </div> 583 </div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!