Commit 8a760e0e authored by LiXuyang's avatar LiXuyang

数据质量规则

parent 2ce97677
......@@ -352,6 +352,29 @@ export const WorkSpaceRoute: AppRouteRecordRaw = {
},
],
};
export const QualityRuleRoute: AppRouteRecordRaw = {
path: '/dataQuality',
name: 'QualityRule',
component: LAYOUT,
meta: {
title: '质量规则管理',
icon: '',
hidden: true,
currentActiveMenu: '/dataQuality/rule',
},
children: [
{
path: 'ruleMoreAdd',
name: 'RuleMoreAdd',
component: () => import('@/views/dataQuality/rule/ruleMoreAdd.vue'),
meta: {
title: '质量规则批量创建',
icon: '',
},
},
],
};
// Basic routing without permission
// 没有权限要求的基本路由
export const basicRoutes = [
......@@ -370,4 +393,5 @@ export const basicRoutes = [
DataWarehousePlanningRoute,
DataWarehousephysicalModelRoute,
PAGE_NOT_FOUND_ROUTE,
QualityRuleRoute,
];
<template>
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
<div class="w-1/4 xl:w-1/5">
<Tabs default-active-key="1">
<Tabs.TabPane key="1" tab="数据库">
<BasicTree :treeData="treeData" defaultExpandLevel="1" />
</Tabs.TabPane>
<Tabs.TabPane key="2" tab="规则组">
<BasicTree :treeData="treeData1" defaultExpandLevel="1" />
</Tabs.TabPane>
<Tabs.TabPane key="3" tab="质量主体">
<BasicTree :treeData="treeData2" defaultExpandLevel="1" />
</Tabs.TabPane>
</Tabs>
</div>
<BasicTable @register="registerTable" class="w-3/4 xl:w-4/5" :searchInfo="searchInfo">
<template #toolbar>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <= 0">编辑</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <= 0">删除</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <= 0"
>移入规则组</a-button
>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <= 0"
>移出规则组</a-button
>
<a-button type="primary">导入</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <= 0">导出</a-button>
<a-button type="primary" @click="handleAdd">新建规则</a-button>
<a-button type="primary" @click="handleMoreAdd">批量新建规则</a-button>
<a-button type="primary">新建质量任务</a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
},
{
icon: 'ion:chevron-down-circle-outline',
},
{
icon: 'ion:trash-outline',
color: 'error',
},
]"
/>
</template>
</template>
</BasicTable>
<RuleModel @register="ruleModal" />
</PageWrapper>
</template>
<script lang="ts" setup>
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { PageWrapper } from '@/components/Page';
import { searchFormSchema } from '@/views/dataWarehousePlanning/logicalModel/model.data';
import { BasicTree } from '@/components/Tree';
import { ruleTable } from '@/views/dataQuality/rule/rule.data';
import { Tabs } from 'ant-design-vue';
import { ruleData, treeData, treeData1, treeData2 } from './ruleData';
import RuleModel from './ruleModel.vue';
import { useModal } from '@/components/Modal';
import { useRouter } from 'vue-router';
// 模态框
const { push } = useRouter();
const [ruleModal, { openModal: openRuleModel }] = useModal();
// 新增
function handleAdd() {
openRuleModel(true, {
isUpdate: false,
});
}
// 批量新增
function handleMoreAdd() {
push({
path: '/dataQuality/ruleMoreAdd',
});
}
const [
registerTable,
{ reload, updateTableDataRecord, getSearchInfo, getForm, getRowSelection },
] = useTable({
title: '质量规则',
api: async (params) => {
console.log('params:', params);
const response = {
pageNu: '1',
pageSize: '10',
pages: '1',
total: ruleData.length,
code: '',
message: '',
data: ruleData,
};
return { ...response };
},
rowKey: 'businessId',
columns: ruleTable,
rowSelection: true,
striped: false,
showIndexColumn: false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true,
},
useSearchForm: true,
showTableSetting: false,
bordered: true,
handleSearchInfoFn(info) {
return info;
},
actionColumn: {
minWidth: 150,
title: '操作',
dataIndex: 'action',
},
});
</script>
import {BasicColumn} from "@/components/Table";
export const ruleTable: BasicColumn[] = [
{
title: '质量规则',
dataIndex: 'rule',
width: 88,
},
{
title: '数据源',
dataIndex: 'dataSouce',
width: 88,
},
{
title: '目录',
dataIndex: 'catalog',
width: 88,
},
{
title: '数据库',
dataIndex: 'database',
width: 88,
},
{
title: '数据表/主体',
dataIndex: 'dataTable',
width: 88,
},
{
title: '字段',
dataIndex: 'field',
width: 88,
},
{
title: '质量模板',
dataIndex: 'model',
width: 88,
},
{
title: '规则组',
dataIndex: 'group',
width: 88,
},
{
title: '质量维度',
dataIndex: 'dimension',
width: 88,
},
];
export const ruleModelFormSchema: any[] = [
{
field: 'ruleName',
label: '规则名称',
required: true,
component: 'Input',
colProps: { lg: 24, md: 24 },
},
{
field: 'distinct',
label: '规则描述',
component: 'Input',
colProps: { lg: 24, md: 24 },
},
{
field: 'group',
label: '所属规则组',
slot: 'group',
component: 'Select',
colProps: { lg: 24, md: 24 },
},
{
field: 'dataSouce',
label: '检查数据源',
required: true,
component: 'Select',
colProps: { lg: 24, md: 24 },
},
{
field: 'model',
label: '关键模板',
required: true,
component: 'Select',
colProps: { lg: 24, md: 24 },
},
{
field: 'config',
label: '参数配置',
slot: 'config',
colProps: { lg: 24, md: 24 },
},
{
field: 'whiteList',
label: '质量白名单',
component: 'Select',
colProps: { lg: 24, md: 24 },
},
{
field: 'preview',
label: 'SQL预览',
component: 'InputTextArea',
componentProps: {
placeholder: '请输入描述',
rows: 4,
},
colProps: { lg: 24, md: 24 },
},
{
field: 'task',
label: '关联质量任务',
slot: 'task',
colProps: { lg: 24, md: 24 },
},
];
export const configColumn: BasicColumn[] = [
{
title: '参数',
dataIndex: 'config',
width: 60,
},
{
title: '参数类型',
dataIndex: 'type',
width: 60,
},
{
title: '模板描述',
dataIndex: 'describe',
width: 60,
},
{
title: '值',
dataIndex: 'value',
slots: { customRender: 'value' },
width: 60,
},
];
export const taskColumn: BasicColumn[] = [
{
title: '质量任务',
dataIndex: 'task',
width: 120,
},
{
title: '质量任务描述',
dataIndex: 'describe',
width: 120,
},
];
import { TreeItem } from '@/components/Tree';
export const treeData: TreeItem[] = [
{
title: '数据库对象资源',
key: '0-0',
children: [
{ title: 'ArgoDB_Dev01', key: '0-0-0' },
{ title: 'ArgoDB_Gov01', key: '0-0-1' },
{ title: 'ArgoDB_Sev01', key: '0-0-2' },
{ title: 'MySQL_Public', key: '0-0-3' },
],
},
];
export const treeData1: TreeItem[] = [
{
title: '规则组资源',
key: '0-0',
children: [
{ title: 'ArgoDB_Dev01', key: '0-0-0' },
{ title: 'ArgoDB_Gov01', key: '0-0-1' },
{ title: 'ArgoDB_Sev01', key: '0-0-2' },
{ title: 'MySQL_Public', key: '0-0-3' },
],
},
];
export const treeData2: TreeItem[] = [
{
title: '质量主体',
key: '0-0',
children: [
{ title: 'ArgoDB_Dev01', key: '0-0-0' },
{ title: 'ArgoDB_Gov01', key: '0-0-1' },
{ title: 'ArgoDB_Sev01', key: '0-0-2' },
{ title: 'MySQL_Public', key: '0-0-3' },
],
},
];
export const ruleData: any[] = [
{
businessId: 1,
rule: 'identity公用规则',
dataSouce: 'ArgoDB_Gov01',
catalog: null,
database: 'dmp01',
dataTable: 'landing_graduat',
field: 'identity',
model: '公民身份号码',
group: 'landing',
dimension: '规范性',
},
{
businessId: 2,
rule: 'identity公用规则',
dataSouce: 'ArgoDB_Gov01',
catalog: null,
database: 'dmp01',
dataTable: 'landing_lowinc',
field: 'identity',
model: '公民身份号码',
group: 'landing',
dimension: '规范性',
},
];
export const configData: any[] = [
{
config: 'table_a',
type: '主体类',
describe: null,
value: '毕业生',
},
{
config: 'column_a',
type: '主体字段类',
describe: null,
value: 'is_full_time',
},
];
export const taskData: any[] = null;
<template>
<BasicModal
width="40%"
v-bind="$attrs"
@register="registerModal"
:title="getTitle"
@ok="handleSubmit"
>
<BasicForm @register="registerForm">
<template #config>
<div>
<BasicTable @register="configTable">
<template #value="{ record }">
<Select
:options="[
{
label: '毕业生',
value: '毕业生',
},
{
label: 'is_full_time',
value: 'is_full_time',
},
]"
style="width: 88px"
v-model:value="record.value"
/>
</template>
</BasicTable>
</div>
</template>
<template #task>
<div> <BasicTable @register="taskTable" /></div>
</template>
</BasicForm>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue';
import { Select } from 'ant-design-vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import {configColumn, ruleModelFormSchema, taskColumn} from '@/views/dataQuality/rule/rule.data';
import BasicTable from '@/components/Table/src/BasicTable.vue';
import { useTable } from '@/components/Table';
import {configData, taskData} from '@/views/dataQuality/rule/ruleData';
const isUpdate = ref(true);
const getTitle = computed(() => (isUpdate.value ? '编辑规则' : '新建规则'));
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({
labelWidth: 100,
baseColProps: { lg: 12, md: 24 },
schemas: ruleModelFormSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
// 确认按钮配置
submitButtonOptions: {
text: '提交新版本',
},
});
//初始化弹框
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields();
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [configTable, { reload, updateTableDataRecord, getSearchInfo, getForm, getRowSelection }] =
useTable({
title: '',
// 定高
scroll: { y: 150 },
api: async (params) => {
console.log('params:', params);
const response = {
pageNu: '1',
pageSize: '10',
pages: '1',
total: configData.length,
code: '',
message: '',
data: configData,
};
return { ...response };
},
rowKey: 'businessId',
columns: configColumn,
striped: false,
showIndexColumn: false,
showTableSetting: false,
bordered: true,
pagination: false,
});
const [taskTable] = useTable({
title: '',
// 定高
scroll: { y: 150 },
api: async (params) => {
console.log('params:', params);
const response = {
pageNu: '1',
pageSize: '10',
pages: '1',
total: taskData.length,
code: '',
message: '',
data: taskData,
};
return { ...response };
},
rowKey: 'businessId',
columns: taskColumn,
striped: false,
showIndexColumn: false,
showTableSetting: false,
bordered: true,
pagination: false,
});
/**确定按钮*/
async function handleSubmit() {
await validate();
closeModal();
}
</script>
<template>
<PageWrapper title="质量规则批量创建" dense contentFullHeight fixedHeight contentClass="flex">
</PageWrapper>
</template>
<script lang="ts" setup>
import { PageWrapper } from '@/components/Page';
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment