04ce4f78 by lihua

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

1 parent 8f052f79
......@@ -177,4 +177,10 @@ export const updateModelRule = (params) => request({
url:`${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/conf/update`,
method: 'post',
data: params
})
// 获取产品目录guid下面的资源表
export const getDamCatalogTableList = (damGuid) => request({
url:`${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/quality/get-table-list?damGuid=${damGuid}`,
method: 'get'
})
\ No newline at end of file
......
......@@ -258,8 +258,8 @@ const groupTableInfo = ref({
width: 92,
btns: (scope) => {
return [
{ label: "编辑", value: "edit", disabled: scope.row.dataSource != '5' },
{ label: "删除", value: "delete", disabled: scope.row.dataSource != '5' },
{ label: "编辑", value: "edit", disabled: scope.row.dataSource == '4' },
{ label: "删除", value: "delete", disabled: scope.row.dataSource == '4' },
]
},
}
......@@ -675,13 +675,17 @@ const clickCreateGroup = () => {
/** 新建质检表 */
const clickCreateTable = () => {
let query: any = {
groupGuid: page.value.modelGroupGuid,
name: lastSelectNode.value.data.name,
dataSource: lastSelectNode.value.data.dataSource,
};
if (lastSelectNode.value.data.damGuid && lastSelectNode.value.data.children?.[0]?.dataSource != 5) {
query.damGuid = lastSelectNode.value.data.damGuid
}
router.push({
name: 'ruleModel',
query: {
groupGuid: page.value.modelGroupGuid,
name: lastSelectNode.value.data.name,
dataSource: lastSelectNode.value.data.dataSource
}
query: query
});
}
......
......@@ -15,6 +15,7 @@ import {
getRuleTypeList,
getSmallCategoryList,
getLargeCategoryList,
getDamCatalogTableList
} from '@/api/modules/dataQuality';
import {
getMetaTreeData
......@@ -33,6 +34,7 @@ const route = useRoute();
const modelGroupGuid: any = ref(route.query.groupGuid);
const fullPath = route.fullPath;
let damGuid: any = ref(route.query.damGuid);
const fullScreenLoading = ref(false);
......@@ -61,6 +63,8 @@ const dsToTreeData: any = ref([]);
const toSubjectTables: any = ref([]);
const isProductDam = ref(false);
const getSubjectTableTreeData = () => {
dsFromTreeDataLoading.value = true;
if (route.query.dataSource == '4') {
......@@ -86,22 +90,74 @@ const getSubjectTableTreeData = () => {
}
})
} else {
getMetaTreeData({ isImportCreate: 'N' }).then((res: any) => {
dsFromTreeDataLoading.value = false;
if (res.code == proxy.$passCode) {
dsFromTreeData.value = res.data?.children?.map(d => {
d.parentGuid = 0;
d.label = d.name;
d.children = d.children?.map(child => {
child.label = child.name + `(${child.tableName})`;
child.dataServerName = child.databaseName;
child.dataSourceGuid = d.dataSourceGuid || d.guid;
return child;
if (damGuid.value) {
getDamCatalogTableList(damGuid.value).then((res: any) => {
if (res.code == proxy.$passCode) {
if (res.data?.length) {
dsFromTreeDataLoading.value = false;
isProductDam.value = true;
dsFromTreeData.value = res.data?.map(d => {
d.parentGuid = 0;
d.label = d.name + `(${d.tableName})`;
d.dataServerName = d.databaseName;
d.dataSourceGuid = d.dataSourceGuid;
return d;
}) || [];
} else {
isProductDam.value = false;
getMetaTreeData({ isImportCreate: 'N' }).then((res: any) => {
dsFromTreeDataLoading.value = false;
if (res.code == proxy.$passCode) {
dsFromTreeData.value = res.data?.children?.map(d => {
d.parentGuid = 0;
d.label = d.name;
d.children = d.children?.map(child => {
child.label = child.name + `(${child.tableName})`;
child.dataServerName = child.databaseName;
child.dataSourceGuid = d.dataSourceGuid || d.guid;
return child;
})
return d;
}) || [];
} else {
ElMessage({
type: 'error',
message: res.msg,
})
}
})
}
} else {
dsFromTreeDataLoading.value = false;
ElMessage({
type: 'error',
message: res.msg,
})
return d;
}) || [];
}
})
}
})
} else {
getMetaTreeData({ isImportCreate: 'N' }).then((res: any) => {
dsFromTreeDataLoading.value = false;
if (res.code == proxy.$passCode) {
dsFromTreeData.value = res.data?.children?.map(d => {
d.parentGuid = 0;
d.label = d.name;
d.children = d.children?.map(child => {
child.label = child.name + `(${child.tableName})`;
child.dataServerName = child.databaseName;
child.dataSourceGuid = d.dataSourceGuid || d.guid;
return child;
})
return d;
}) || [];
} else {
ElMessage({
type: 'error',
message: res.msg,
})
}
})
}
}
}
......@@ -189,7 +245,14 @@ const changeStep = (val, skip = false) => {
}
toSubjectTables.value = [];
dsToTreeData.value.forEach(d => {
d.children.forEach(child => {
if (isProductDam.value) {
d.enName = d.tableName;
d.chName = d.tableChName || d.name;
d.dataSourceGuid = d.dataSourceGuid;
d.databaseName = d.databaseName,
toSubjectTables.value.push(d);
} else {
d.children.forEach(child => {
child.guid = child.tableGuid || child.guid;
child.enName = child.tableName;
child.chName = child.tableChName || child.name;
......@@ -197,6 +260,7 @@ const changeStep = (val, skip = false) => {
child.databaseName = child.databaseName,
toSubjectTables.value.push(child);
})
}
});
step.value = val - 1;
stepsInfo.value.step = val - 1
......@@ -244,7 +308,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
damGuid: isProductDam.value ? damGuid.value : null,
modelRuleConfList: [Object.assign({}, info, {
qualityModelGuid: modelGuid
})]
......@@ -263,7 +328,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
damGuid: isProductDam.value ? damGuid.value : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields?.map(f => {
return {
......@@ -287,7 +353,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
damGuid: isProductDam.value ? damGuid.value : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
modelRuleConfList: [Object.assign({}, info, {
ruleField: [{
guid: fields.guid,
......@@ -312,7 +379,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
damGuid: isProductDam.value ? damGuid.value : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields?.map(f => {
return {
......@@ -337,7 +405,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
damGuid: isProductDam.value ? damGuid.value : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
modelRuleConfList: [Object.assign({}, info, {
differenceRange: row.differenceRange,
rows: [],
......@@ -357,7 +426,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
damGuid: isProductDam.value ? damGuid.value : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields.map(f => {
return {
......@@ -386,7 +456,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
damGuid: isProductDam.value ? damGuid.value : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields.map(f => {
return {
......@@ -422,7 +493,8 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
damGuid: isProductDam.value ? damGuid.value : null,
dataSource: route.query.dataSource != '1' ? parseInt(route.query.dataSource) : (!isProductDam.value ? 5 : parseInt(route.query.dataSource)),
modelRuleConfList: [Object.assign({}, info, {
ruleField: info.ruleFields.map(row => {
return {
......@@ -452,11 +524,11 @@ const save = () => {
saveQualityTable(params).then((res: any) => {
fullScreenLoading.value = false;
if (res.code == proxy.$passCode) {
ElMessage.success('新建质检表保存成功');
//跳到对应的分组下
router.push({
name: 'qualityRules'
});
ElMessage.success('新建质检表保存成功');
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
dataQualityStore.set(modelGroupGuid.value);
} else {
......@@ -484,7 +556,7 @@ const save = () => {
'选择需要添加质检规则的表,请确保数据库为脱产环境,避免数据质检影响您的生产环境,且允许在该脱产环境建脏数据的库,请知晓!' : '选择需要添加质检规则的表' }}</span>
</div>
</div>
<TreeTransfer mode="transfer" :title="[route.query.dataSource == '5' ? '可选元数据目录表' : '可选盘点数据库目录表', '已选表']"
<TreeTransfer mode="transfer" :title="[route.query.dataSource == '4' ? '可选盘点数据库目录表' : (isProductDam ? '产品目录资源表' : '可选元数据目录表'), '已选表']"
pid="parentGuid" :from-tree-data-loading="dsFromTreeDataLoading" :checkOnClickNode="true"
:from_checked_all="false" :from_data="dsFromTreeData" :to_data="dsToTreeData" node_key="guid"
:transferOpenNode="true" width="70%" :defaultProps="{
......@@ -505,7 +577,7 @@ const save = () => {
<div class="panel_content">
<div class="form_panel">
<ruleForm ref="ruleFormRef" :toSubjectTables="toSubjectTables" :ruleTypeList="ruleTypeList"
:data-source="route.query.dataSource as string" :largeCategoryList="largeCategoryList"
:data-source="(!isProductDam && route.query.dataSource == '1') ? '5' : route.query.dataSource as string" :largeCategoryList="largeCategoryList"
:smallCategoryList="smallCategoryList"></ruleForm>
</div>
</div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!