820266a3 by xukangle

Merge branch 'develop' into dev_20241202_xukangle

2 parents bdc72733 4f8e081a
......@@ -69,7 +69,7 @@ export const saveMetaReportAnalysis = (params) => request({
**/
// 树形数据
export const getMetaTreeData = (params) => request({
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-table/meta-tree-list`,
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/meta-table/meta-tree-list?isImportCreate=${params.isImportCreate}`,
method: 'post',
data: params
})
......
......@@ -81,6 +81,13 @@ export const getDatabase = (params) => request({
data: params
})
/** 获取盘点的数据库目录 */
export const getInventoryDsDir = () => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/tree-list`,
method: 'post',
data: {}
})
/** 新建质检表,获取主题域分层的主题表树结构 */
export const getSubjectTableTree = (params) => request({
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-directory/directory-tree-list`,
......@@ -95,10 +102,10 @@ export const getSubjectTableByDomain = (params) => request({
data: params
})
/** 获取主题表的字段列表 */
export const getSubjectFields = (params) => request({
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-catalog-subject/field/list?subjectGuid=${params}`,
method: 'get',
/** 获取主题表的字段列表,目前应包括盘点目录和元数据目录的表及字段 */
export const getSubjectFields = (tableGuid, dataSource) => request({
url: `${import.meta.env.VITE_APP_QUALITY_BASEURL}/quality-model/field/list-by-subject-guid?tableGuid=${tableGuid}&dataSource=${dataSource}`,
method: 'post',
})
/** 表的逻辑条件和sql检验。 */
......
......@@ -255,10 +255,12 @@ const groupTableInfo = ref({
label: "操作",
type: "btn",
width: 92,
btns: [
{ label: "编辑", value: "edit" },
{ label: "删除", value: "delete" },
],
btns: (scope) => {
return [
{ label: "编辑", value: "edit", disabled: scope.row.dataSource != '5' },
{ label: "删除", value: "delete", disabled: scope.row.dataSource != '5' },
]
},
}
});
......@@ -402,7 +404,8 @@ const tableBtnClick = (scope, btn) => {
name: 'ruleTemplate',
query: {
modelGuid: row.guid,
name: row.name
name: row.name,
dataSource: row.dataSource
}
});
} else if (type == "delete") {
......@@ -429,9 +432,10 @@ const open = (msg, type, isBatch = false) => {
if (res.code == proxy.$passCode) {
page.value.curr = 1;
getTableData();
let node = qualityModelTreeRef.value.treeRef.store.nodesMap[currTableData.value.modelGroupGuid];
node.loaded = false;
node.expand();
// let node = qualityModelTreeRef.value.treeRef.store.nodesMap[currTableData.value.modelGroupGuid];
// node.loaded = false;
// node.expand();
getQualityGroupTreeData();
ElMessage.success('删除成功');
} else {
ElMessage.error(res.msg);
......@@ -489,6 +493,7 @@ const groupTableBtnClick = (scope, btn) => {
type: "success",
message: "删除分组成功",
});
getQualityGroupTreeData();
} else {
ElMessage({
type: "error",
......@@ -608,9 +613,10 @@ const ruleOpen = (msg, type, isBatch = false) => {
deleteQualityTableRule(guids).then((res: any) => {
if (res.code == proxy.$passCode) {
getRuleTableData();
let node = qualityModelTreeRef.value.treeRef.store.nodesMap[lastSelectNode.value.data.guid];
node.loaded = false;
node.expand();
// let node = qualityModelTreeRef.value.treeRef.store.nodesMap[lastSelectNode.value.data.guid];
// node.loaded = false;
// node.expand();
getQualityGroupTreeData();
ElMessage.success('删除质检表成功');
} else {
ElMessage.error(res.msg);
......@@ -639,7 +645,8 @@ const clickCreateTable = () => {
name: 'ruleModel',
query: {
groupGuid: page.value.modelGroupGuid,
name: lastSelectNode.value.data.name
name: lastSelectNode.value.data.name,
dataSource: lastSelectNode.value.data.dataSource
}
});
}
......@@ -650,7 +657,8 @@ const clickCreateRule = () => {
name: 'ruleTemplate',
query: {
modelGuid: lastSelectNode.value.data.guid,
name: lastSelectNode.value.data.name
name: lastSelectNode.value.data.name,
dataSource: lastSelectNode.value.parent.data.dataSource
}
});
}
......@@ -744,6 +752,7 @@ let editSubmitPromise: any = ref(null);
/** 新建分组对话框确定。 */
const dialogBtnClick = (btn, info) => {
if (btn.value == 'submit') {
info.dataSource = '5';
if (dialogInfo.value.type == 'add') {
if (submitPromise.value) {
return;
......@@ -753,6 +762,7 @@ const dialogBtnClick = (btn, info) => {
if (res.code == proxy.$passCode) {
groupPage.value.curr = 1;
getGroupTableData();
getQualityGroupTreeData();
ElMessage({
type: 'success',
message: '新建分组成功'
......@@ -779,6 +789,7 @@ const dialogBtnClick = (btn, info) => {
type: 'success',
message: '编辑分组成功'
})
getQualityGroupTreeData();
dialogInfo.value.visible = false;
} else {
ElMessage({
......@@ -862,8 +873,9 @@ onActivated(async () => {
if (lastSelectNode.value && lastSelectNode.value.data.guid == dataQualityStore.modelGroupGuid) {
getTableData();
}
let node = qualityModelTreeRef.value.treeRef.store.nodesMap[dataQualityStore.modelGroupGuid];
node?.expand();
// let node = qualityModelTreeRef.value.treeRef.store.nodesMap[dataQualityStore.modelGroupGuid];
// node?.expand();
getQualityGroupTreeData();
dataQualityStore.set(null);
});
} else {
......@@ -871,8 +883,9 @@ onActivated(async () => {
if (lastSelectNode.value && lastSelectNode.value.data.guid == dataQualityStore.modelGroupGuid) {
getTableData();
}
let node = qualityModelTreeRef.value.treeRef.store.nodesMap[dataQualityStore.modelGroupGuid];
node.expand();
// let node = qualityModelTreeRef.value.treeRef.store.nodesMap[dataQualityStore.modelGroupGuid];
// node.expand();
getQualityGroupTreeData();
dataQualityStore.set(null);
}
}
......
......@@ -6,8 +6,12 @@ import {
getSubjectFields,
getSubjectTableTree,
getSubjectTableByDomain,
getCheckRulesList
getCheckRulesList,
getInventoryDsDir
} from '@/api/modules/dataQuality';
import {
getMetaTreeData
} from '@/api/modules/dataMetaService';
import Table from "@/components/Table/index.vue";
import Form from "@/components/Form/index.vue";
import { ElMessage } from "element-plus";
......@@ -48,7 +52,11 @@ const props = defineProps({
readonly: {
type: Boolean,
default: false
}
},
dataSource: {
type: String,
default: ''
},
});
watch(() => props.toSubjectTables, (val: any[]) => {
......@@ -138,15 +146,15 @@ const rulesListByType: any = computed(() => {
char: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'ch_rule' || r.value == 'en_rule' || r.value == 'num_value_rule' || r.value == 'custom_regular_rule'),
varchar: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'id_card_rule' || r.value == 'phone_number_rule' || r.value == 'ch_rule' || r.value == 'en_rule' || r.value == 'num_value_rule' || r.value == 'custom_regular_rule'),
int: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'num_value_rule' || r.value == 'custom_regular_rule'),
date: checkRulesList.value.filter(r => r.value == 'date_format_rule' || r.value == 'custom_regular_rule'),
datetime: checkRulesList.value.filter(r => r.value == 'date_format_rule' || r.value == 'custom_regular_rule'),
timestamp: checkRulesList.value.filter(r => r.value == 'custom_regular_rule' || r.value == 'custom_regular_rule'),
date: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'date_format_rule' || r.value == 'custom_regular_rule'),
datetime: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'date_format_rule' || r.value == 'custom_regular_rule'),
timestamp: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'custom_regular_rule' || r.value == 'custom_regular_rule'),
// text: checkRulesList.value.filter(r => r.value == ''),
decimal: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'precision_rule' || r.value == 'num_value_rule' || r.value == 'custom_regular_rule'),
// json: checkRulesList.value.filter(r => r.value == ''),
tinyint: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'num_value_rule' || r.value == 'custom_regular_rule'),
time: checkRulesList.value.filter(r => r.value == 'custom_regular_rule'),
bit: checkRulesList.value.filter(r => r.value == 'ch_rule' || r.value == 'en_rule' || r.value == 'custom_regular_rule'),
time: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'custom_regular_rule'),
bit: checkRulesList.value.filter(r => r.value == 'length_rule' || r.value == 'ch_rule' || r.value == 'en_rule' || r.value == 'custom_regular_rule'),
}
});
......@@ -615,12 +623,52 @@ const submit = () => {
}
const getSubjectTableTreeData = () => {
return getSubjectTableTree({}).then((res: any) => {
if (res.code == proxy.$passCode) {
contrastSubjects.value = res.data || [];
return res.data || [];
}
})
if (props.dataSource == '4' || props.value.dataSource == '4') {
return getInventoryDsDir().then((res: any) => {
if (res.code == proxy.$passCode) {
contrastSubjects.value = res.data?.map(d => {
d.parentGuid = 0;
d.guid = d.databaseGuid;
d.name = d.databaseChName;
d.label = d.databaseChName + `(${d.database})`;
d.children = d.children?.map(child => {
child.parentGuid = d.guid;
child.label = child.tableChName + `(${child.tableName})`;
child.guid = child.tableGuid;
child.isLeaf = true;
child.dataServerName = d.database;
child.dataSourceGuid = d.databaseGuid;
child.parentGuid = d.databaseGuid;
return child;
})
return d;
}) || [];
}
})
} else {
return getMetaTreeData({ isImportCreate: 'N' }).then((res: any) => {
if (res.code == proxy.$passCode) {
contrastSubjects.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.isLeaf = true;
child.dataServerName = d.name;
child.dataSourceGuid = d.guid;
return child;
})
return d;
}) || [];
}
})
}
// return getSubjectTableTree({}).then((res: any) => {
// if (res.code == proxy.$passCode) {
// contrastSubjects.value = res.data || [];
// return res.data || [];
// }
// })
}
const formBtnClick = (btn) => {
......@@ -633,7 +681,7 @@ const formBtnClick = (btn) => {
nullSelectFields.value = cloneDeep(panelList.value[index].defaultValue);
if (props.toSubjectTables[0]?.guid) {
nullTableInfo.value.loading = true;
getSubjectFields(props.toSubjectTables[0]?.guid).then((res: any) => {
getSubjectFields(props.toSubjectTables[0]?.guid, props.dataSource || props.value.dataSource).then((res: any) => {
nullTableInfo.value.loading = false;
if (res.code == proxy.$passCode) {
nullTableInfo.value.data = res.data || [];
......@@ -673,7 +721,7 @@ const formBtnClick = (btn) => {
tableInfo.value.data = [];
if (props.toSubjectTables[0]?.guid) {
tableInfo.value.loading = true;
getSubjectFields(props.toSubjectTables[0]?.guid).then((res: any) => {
getSubjectFields(props.toSubjectTables[0]?.guid, props.dataSource || props.value.dataSource).then((res: any) => {
tableInfo.value.loading = false;
if (res.code == proxy.$passCode) {
tableInfo.value.data = res.data || [];
......@@ -704,7 +752,7 @@ const formBtnClick = (btn) => {
sqlTableFieldInfo.value.data = [];
if (props.toSubjectTables[0]?.guid) {
sqlTableFieldInfo.value.loading = true;
getSubjectFields(props.toSubjectTables[0]?.guid).then((res: any) => {
getSubjectFields(props.toSubjectTables[0]?.guid, props.dataSource || props.value.dataSource).then((res: any) => {
sqlTableFieldInfo.value.loading = false;
if (res.code == proxy.$passCode) {
sqlTableFieldInfo.value.data = res.data || [];
......@@ -734,7 +782,7 @@ const formBtnClick = (btn) => {
valueRangeTableListData.value[dialogSelectSubjectTable.value.enName] = [];
if (props.toSubjectTables[0]?.guid) {
valueRangeTableListLoading.value[dialogSelectSubjectTable.value.enName] = true;
getSubjectFields(props.toSubjectTables[0]?.guid).then((res: any) => {
getSubjectFields(props.toSubjectTables[0]?.guid, props.dataSource || props.value.dataSource).then((res: any) => {
valueRangeTableListLoading.value[dialogSelectSubjectTable.value.enName] = false;
if (res.code == proxy.$passCode) {
let data = res.data || [];
......@@ -792,7 +840,7 @@ const formBtnClick = (btn) => {
normCheckTableListData.value[dialogSelectSubjectTable.value.enName] = [];
if (props.toSubjectTables[0]?.guid) {
normCheckTableListLoading.value[dialogSelectSubjectTable.value.enName] = true;
getSubjectFields(props.toSubjectTables[0]?.guid).then((res: any) => {
getSubjectFields(props.toSubjectTables[0]?.guid, props.dataSource || props.value.dataSource).then((res: any) => {
normCheckTableListLoading.value[dialogSelectSubjectTable.value.enName] = false;
if (res.code == proxy.$passCode) {
let data = res.data || [];
......@@ -1017,7 +1065,6 @@ const setPanelListValue = (item, isSelectChange = false, init = false, radioGrou
}
});
formItems.value[0].children = panelList.value;
console.log(panelList.value);
}
const radioGroupChange = (val, inlineValue, init) => {
......@@ -1099,7 +1146,7 @@ const listItemClick = (data) => {
if (ruleType.value === 'custom_sql') {
sqlTableFilters.value[dialogSelectSubjectTable.value.enName] = sqlTableFilters.value[dialogSelectSubjectTable.value.enName] || "";
sqlTableFieldInfo.value.loading = true;
getSubjectFields(data.guid).then((res: any) => {
getSubjectFields(data.guid, props.dataSource || props.value.dataSource).then((res: any) => {
sqlTableFieldInfo.value.loading = false;
if (res.code == proxy.$passCode) {
sqlTableFieldInfo.value.data = res.data || [];
......@@ -1110,7 +1157,7 @@ const listItemClick = (data) => {
} else if (ruleType.value === 'logic_check') {
tableFilters.value[dialogSelectSubjectTable.value.enName] = tableFilters.value[dialogSelectSubjectTable.value.enName] || "";
tableInfo.value.loading = true;
getSubjectFields(data.guid).then((res: any) => {
getSubjectFields(data.guid, props.dataSource || props.value.dataSource).then((res: any) => {
tableInfo.value.loading = false;
if (res.code == proxy.$passCode) {
tableInfo.value.data = res.data || [];
......@@ -1120,7 +1167,7 @@ const listItemClick = (data) => {
})
} else if (ruleType.value == 'null_value_check' || ruleType.value == 'repeate_data_check') {
nullTableInfo.value.loading = true;
getSubjectFields(data.guid).then((res: any) => {
getSubjectFields(data.guid, props.dataSource || props.value.dataSource).then((res: any) => {
nullTableInfo.value.loading = false;
if (res.code == proxy.$passCode) {
nullTableInfo.value.data = res.data || [];
......@@ -1143,7 +1190,7 @@ const listItemClick = (data) => {
}
let defaultValue = panelList.value[12].defaultValue;
valueRangeTableListLoading.value[dialogSelectSubjectTable.value.enName] = true;
getSubjectFields(data.guid).then((res: any) => {
getSubjectFields(data.guid, props.dataSource || props.value.dataSource).then((res: any) => {
valueRangeTableListLoading.value[dialogSelectSubjectTable.value.enName] = false;
if (res.code == proxy.$passCode) {
let data = res.data || [];
......@@ -1178,7 +1225,7 @@ const listItemClick = (data) => {
}
let defaultValue = panelList.value[14].defaultValue;
normCheckTableListLoading.value[dialogSelectSubjectTable.value.enName] = true;
getSubjectFields(data.guid).then((res: any) => {
getSubjectFields(data.guid, props.dataSource || props.value.dataSource).then((res: any) => {
normCheckTableListLoading.value[dialogSelectSubjectTable.value.enName] = false;
if (res.code == proxy.$passCode) {
let data = res.data || [];
......@@ -1226,7 +1273,7 @@ const tableInfo: any = ref({
fields: [
{ label: "字段名", field: "enName", width: 140, type: 'text_btn', value: 'enName', columClass: 'text_btn' },
{ label: "注释", field: "chName", width: 120 },
{ label: "数据类型", field: "dataTypeChName", width: 100 },
{ label: "数据类型", field: "dataTypeName", width: 100 },
],
data: [],
showPage: false,
......@@ -1440,7 +1487,7 @@ const sqlTableFieldInfo: any = ref({
fields: [
{ label: "字段名", field: "enName", width: 140, type: 'text_btn', value: 'enName', columClass: 'text_btn' },
{ label: "注释", field: "chName", width: 120 },
{ label: "数据类型", field: "dataTypeChName", width: 100 },
{ label: "数据类型", field: "dataTypeName", width: 100 },
],
data: [],
showPage: false,
......@@ -1584,7 +1631,7 @@ const nullTableInfo: any = ref({
fields: [
{ label: "字段名", field: "enName", width: 140 },
{ label: "注释", field: "chName", width: 120 },
{ label: "数据类型", field: "dataTypeChName", width: 100 },
{ label: "数据类型", field: "dataTypeName", width: 100 },
],
data: [],
showPage: false,
......@@ -1680,7 +1727,7 @@ const getSubjectTableByDomainData = (guid) => {
}
const defaultExpandedKeys = computed(() => {
return props.value && contrastSubjects.value?.length ? [contrastSubjects.value.find(c => c.children?.some(cc => cc.guid == props.value.contrastSubjectDomainGuid)).guid, props.value.contrastSubjectDomainGuid] : [];
return props.value && contrastSubjects.value?.length ? [props.value.contrastSubjectDomainGuid] : [];
})
const contrastSubjectInputFilterMethod = (v, data) => {
......@@ -1731,14 +1778,14 @@ const submitValueRange = () => {
let valueTableFields = valueRangeTableListData.value[table];
let ruleFields: any = []
for (const field of valueTableFields) {
if (field.startValue != null && field.endValue == null || (field.endValue != null && field.startValue == null)) {
if (field.startValue == null && field.endValue == null) {
if (dialogSelectSubjectTable.value.enName != table) {
valueCheckFormListRef.value.setSelectList(table, 'enName');
}
ElMessage.error(`表【${table}】的字段【${field.enName}】设置了值域,但范围未填写完整`);
return;
}
if (field.startValue) {
if (field.startValue != null || field.endValue != null) {
ruleFields.push(field);
} else if (field.dataRange) {
ruleFields.push(field);
......@@ -1788,7 +1835,7 @@ const compareTableFields = ref({}); //选择对比表对应的字段列表
/** 主表下拉选择变化 */
const tableInteMainSelectChange = (val) => {
mainTableFields.value[val] = [];
getSubjectFields(val).then((res: any) => {
getSubjectFields(val, props.dataSource || props.value.dataSource).then((res: any) => {
if (res.code == proxy.$passCode) {
mainTableFields.value[val] = res.data?.map(d => {
return Object.assign({}, d, {
......@@ -1804,7 +1851,7 @@ const tableInteMainSelectChange = (val) => {
/** 对比表下拉选择变化 */
const tableInteCompareSelectChange = (val) => {
compareTableFields.value[val] = [];
getSubjectFields(val).then((res: any) => {
getSubjectFields(val, props.dataSource || props.value.dataSource).then((res: any) => {
if (res.code == proxy.$passCode) {
compareTableFields.value[val] = res.data?.map(d => {
return Object.assign({}, d, {
......@@ -2165,33 +2212,29 @@ defineExpose({
</el-table-column>
<el-table-column prop="chName" label="注释" width="120px" align="left" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="dataTypeChName" label="数据类型" width="100px" show-overflow-tooltip>
<el-table-column prop="dataTypeName" label="数据类型" width="100px" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row["dataTypeChName"] || '--' }}</span>
<span>{{ scope.row["dataTypeName"] || '--' }}</span>
</template>
</el-table-column>
<el-table-column label="值域" width="280px" align="left" fixed="right">
<template #default="scope">
<span
v-if="scope.row.dataType == 'json' || scope.row.dataType == 'text' || !scope.row.dataType || scope.row.dataType == 'string'">--</span>
<template v-else>
<el-input
v-show="scope.row.dataType == 'varchar' || scope.row.dataType == 'char' || scope.row.dataType == 'bit'"
<el-input
v-show="!scope.row.dataType || scope.row.dataType == 'varchar' || scope.row.dataType == 'char' || scope.row.dataType == 'bit' || scope.row.dataType == 'json' || scope.row.dataType == 'text' || !scope.row.dataType || scope.row.dataType == 'string' || scope.row.dataType == 'numeric'"
v-model.trim="scope.row.dataRange" clearable placeholder="多值按照分号;分隔"> </el-input>
<div class="range-sum" v-show="scope.row.dataType == 'datetime' || scope.row.dataType == 'date'">
<!-- <div class="range-sum" v-show="scope.row.dataType == 'datetime' || scope.row.dataType == 'date'">
<el-date-picker v-model="scope.row.dateValueRange" type="daterange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
:unlink-panels="false" :disabled="props.readonly" />
</div>
</div> -->
<div class="range-sum"
v-show="scope.row.dataType == 'int' || scope.row.dataType == 'decimal' || scope.row.dataType == 'tinyint' || scope.row.dataType == 'timestamp' || scope.row.dataType == 'time'">
v-show="scope.row.dataType == 'datetime' || scope.row.dataType == 'date' || scope.row.dataType == 'int' || scope.row.dataType == 'decimal' || scope.row.dataType == 'tinyint' || scope.row.dataType == 'timestamp' || scope.row.dataType == 'time'">
<el-input :disabled="props.readonly" v-model.trim="scope.row.startValue" placeholder="请输入" clearable>
</el-input>
<span class="text"></span>
<el-input :disabled="props.readonly" v-model.trim="scope.row.endValue" placeholder="请输入" clearable>
</el-input>
</div>
</template>
</template>
</el-table-column>
</el-table>
......@@ -2236,12 +2279,12 @@ defineExpose({
<template #default="scope">
<el-tree-select v-if="!props.readonly" ref="compareTreeSelectRef" filterable clearable
@change="tableInteCompareSelectChange" v-model="scope.row['compareTableGuid']" node-key="guid"
:data="contrastSubjects" placeholder="请选择" lazy :load="(node, resolve) => treeSelectLoad(node, resolve)"
:default-expanded-keys="contrastSubjects?.length ? [contrastSubjects.find(c => c.children?.some(cc => cc.guid == scope.row['compareSubjectDomainGuid'])).guid, scope.row.compareSubjectDomainGuid] : []"
:data="contrastSubjects" placeholder="请选择"
:default-expanded-keys="contrastSubjects?.length ? [scope.row.compareSubjectDomainGuid] : []"
:auto-expand-parent="true" :default-checked-keys="[scope.row['compareTableGuid']]"
:filter-node-method="contrastSubjectInputFilterMethod" :props="{
value: 'guid',
label: 'name',
label: 'label',
children: 'children',
isLeaf: 'isLeaf'
}">
......@@ -2297,16 +2340,16 @@ defineExpose({
</el-table-column>
<el-table-column prop="chName" label="注释" width="120px" align="left" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="dataTypeChName" label="数据类型" width="100px" show-overflow-tooltip>
<el-table-column prop="dataTypeName" label="数据类型" width="100px" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row["dataTypeChName"] || '--' }}</span>
<span>{{ scope.row["dataTypeName"] || '--' }}</span>
</template>
</el-table-column>
<el-table-column prop="checkRule" label="选择检验规则" width="150px" align="left" show-overflow-tooltip>
<template #default="scope">
<el-select v-if="!props.readonly || (scope.row.dataType == 'text' || scope.row.dataType == 'json')"
v-model="scope.row['checkRule']" placeholder="请选择" filterable clearable>
<el-option v-for="opt in rulesListByType[scope.row.dataType]" :key="opt['value']"
<el-option v-for="opt in (rulesListByType[scope.row.dataType] || checkRulesList)" :key="opt['value']"
:label="opt['label']" :value="opt['value']" />
</el-select>
<span v-else>{{ scope.row.checkRuleName ?? '--' }}</span>
......@@ -2378,8 +2421,7 @@ defineExpose({
<el-table-column prop="contrastSubjectGuid" label="选择对比表" width="200px" align="left" show-overflow-tooltip>
<template #default="scope">
<el-tree-select v-if="!props.readonly" ref="treeSelectRef" filterable clearable
v-model="scope.row['contrastSubjectGuid']" node-key="guid" :data="contrastSubjects" placeholder="请选择" lazy
:load="(node, resolve) => treeSelectLoad(node, resolve)" :default-expanded-keys="defaultExpandedKeys"
v-model="scope.row['contrastSubjectGuid']" node-key="guid" :data="contrastSubjects" placeholder="请选择" :default-expanded-keys="defaultExpandedKeys"
:auto-expand-parent="true" :default-checked-keys="[props.value.contrastSubjectGuid]"
:filter-node-method="contrastSubjectInputFilterMethod" :props="{
value: 'guid',
......
......@@ -9,7 +9,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
import StepBar from "@/components/StepBar/index.vue";
import TreeTransfer from "@/components/TreeTransfer/index.vue";
import {
getSubjectTableTree,
getInventoryDsDir,
getSubjectTableByDomain,
saveQualityTable,
getRuleTypeList,
......@@ -63,15 +63,46 @@ const toSubjectTables: any = ref([]);
const getSubjectTableTreeData = () => {
dsFromTreeDataLoading.value = true;
getMetaTreeData({}).then((res: any) => {
dsFromTreeDataLoading.value = false;
if (res.code == proxy.$passCode) {
dsFromTreeData.value = res.data?.map(d => {
d.parentGuid = 0;
return d;
}) || [];
}
})
if (route.query.dataSource == '4') {
getInventoryDsDir().then((res: any) => {
dsFromTreeDataLoading.value = false;
if (res.code == proxy.$passCode) {
dsFromTreeData.value = res.data?.map(d => {
d.parentGuid = 0;
d.guid = d.databaseGuid;
d.name = d.databaseChName;
d.label = d.databaseChName + `(${d.database})`;
d.children = d.children?.map(child => {
child.parentGuid = d.guid;
child.label = child.tableChName + `(${child.tableName})`;
child.guid = child.tableGuid;
child.dataServerName = d.database;
child.dataSourceGuid = d.databaseGuid;
child.parentGuid = d.databaseGuid;
return child;
})
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 = d.name;
child.dataSourceGuid = d.guid;
return child;
})
return d;
}) || [];
}
})
}
}
const getSubjectTableByDomainData = (guid) => {
......@@ -158,11 +189,13 @@ const changeStep = (val, skip = false) => {
}
toSubjectTables.value = [];
dsToTreeData.value.forEach(d => {
d.children.forEach(c => {
c.children.forEach(child => {
child.label = `${child.enName}(${child.chName})`;
d.children.forEach(child => {
child.guid = child.tableGuid || child.guid;
child.enName = child.tableName;
child.chName = child.tableChName || child.name;
child.dataSourceGuid = child.parentGuid;
child.databaseName = child.databaseName,
toSubjectTables.value.push(child);
})
})
});
step.value = val - 1;
......@@ -211,6 +244,7 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
qualityModelGuid: modelGuid
})]
......@@ -229,6 +263,7 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields?.map(f => {
return {
......@@ -252,6 +287,7 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
ruleField: [{
guid: fields.guid,
......@@ -276,6 +312,7 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields?.map(f => {
return {
......@@ -300,6 +337,7 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
differenceRange: row.differenceRange,
rows: [],
......@@ -319,6 +357,7 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields.map(f => {
return {
......@@ -347,6 +386,7 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
ruleField: fields.map(f => {
return {
......@@ -382,11 +422,19 @@ const transformRulesInfo = (info: any) => {
subjectGuid: tableInfo.guid,
dataSourceGuid: tableInfo.dataSourceGuid,
databaseName: tableInfo.dataServerName,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
modelRuleConfList: [Object.assign({}, info, {
enName: row.mainTableField,
compareTableGuid: row.compareTableGuid,
compareTableName: row.compareTableName,
compareEnName: row.compareEnName
ruleField: info.ruleFields.map(row => {
return {
// guid: row.mainTable,
enName: row.mainTableField,
//chName: row.chName,
compareTableGuid: row.compareTableGuid,
compareTableName: row.compareTableName,
compareEnName: row.compareEnName
}
}),
ruleFields: ''
})]
}));
}
......@@ -432,17 +480,17 @@ const save = () => {
<div class="panel_title">
<div class="title_text">
<span>选择表</span>
<span class="tips_text">选择需要添加质检规则的表,请确保数据库为脱产环境,避免数据质检影响您的生产环境,且允许在该脱产环境建脏数据的库,请知晓!</span>
<span class="tips_text">{{ route.query.dataSource == '5' ?
'选择需要添加质检规则的表,请确保数据库为脱产环境,避免数据质检影响您的生产环境,且允许在该脱产环境建脏数据的库,请知晓!' : '选择需要添加质检规则的表' }}</span>
</div>
</div>
<TreeTransfer mode="transfer" :title="['可选表', '已选表']" pid="parentGuid"
:from-tree-data-loading="dsFromTreeDataLoading" :checkOnClickNode="true"
<TreeTransfer mode="transfer" :title="[route.query.dataSource == '5' ? '可选元数据目录表' : '可选盘点数据库目录表', '已选表']"
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="{
label: 'name',
label: 'label',
value: 'guid'
}"
height="calc(100% - 64px)">
}" height="calc(100% - 64px)">
</TreeTransfer>
</div>
</div>
......@@ -457,7 +505,8 @@ const save = () => {
<div class="panel_content">
<div class="form_panel">
<ruleForm ref="ruleFormRef" :toSubjectTables="toSubjectTables" :ruleTypeList="ruleTypeList"
:largeCategoryList="largeCategoryList" :smallCategoryList="smallCategoryList"></ruleForm>
:data-source="route.query.dataSource as string" :largeCategoryList="largeCategoryList"
:smallCategoryList="smallCategoryList"></ruleForm>
</div>
</div>
</div>
......
......@@ -204,15 +204,14 @@ const save = () => {
subjectGuid: modelDetailInfo.value.subjectGuid,
subjectName: modelDetailInfo.value.subjectName,
dataSourceGuid: modelDetailInfo.value.dataSourceGuid,
modelRuleConfList: submitInfos
modelRuleConfList: submitInfos,
dataSource: route.query.dataSource ? parseInt(<string>route.query.dataSource) : null,
}]).then((res: any) => {
fullScreenLoading.value = false;
if (res.code == proxy.$passCode) {
ElMessage.success('新建规则保存成功');
router.push({
name: 'qualityRules'
});
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.go(-1);
dataQualityStore.setModelGuid(modelGuid);
} else {
ElMessage.error(res.msg);
......@@ -317,7 +316,7 @@ const cancel = () => {
</div>
<div class="panel_content" v-show="item.open">
<div class="form_panel">
<ruleForm ref="ruleFormRef" :toSubjectTables="toSubjectTables" :ruleTypeList="ruleTypeList"
<ruleForm ref="ruleFormRef" :toSubjectTables="toSubjectTables" :ruleTypeList="ruleTypeList" :dataSource="route.query.dataSource as string"
:largeCategoryList="largeCategoryList" :smallCategoryList="smallCategoryList" :isSingle="true">
</ruleForm>
</div>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!