Commit 738be5b3 authored by LiXuyang's avatar LiXuyang

数据表-改

parent 5c8fe63a
...@@ -787,7 +787,7 @@ export const QualityRuleRoute: AppRouteRecordRaw = { ...@@ -787,7 +787,7 @@ export const QualityRuleRoute: AppRouteRecordRaw = {
name: 'rule', name: 'rule',
component: () => import('@/views/dataQuality/dataSheet/rule/index.vue'), component: () => import('@/views/dataQuality/dataSheet/rule/index.vue'),
meta: { meta: {
title: '质量规则批量创建', title: '质量规则',
icon: '', icon: '',
}, },
}, },
......
<template> <template>
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex"> <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
<div class="w-1/4 xl:w-1/5"> <div class="w-1/4 xl:w-1/5" style="padding: 0 0 0 16px">
<Tabs default-active-key="1"> <Tabs default-active-key="1">
<Tabs.TabPane key="1" tab="数据库"> <Tabs.TabPane key="1" tab="数据库">
<BasicTree :treeData="treeData" :checkable="true" defaultExpandLevel="1" /> <BasicTree :treeData="treeData" :checkable="true" defaultExpandLevel="1" />
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <= 0">导出</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="handleAdd">新建规则</a-button>
<a-button type="primary" @click="handleMoreAdd">批量新建规则</a-button> <a-button type="primary" @click="handleMoreAdd">批量新建规则</a-button>
<a-button type="primary">新建质量任务</a-button> <a-button type="primary" @click="handleAddQuality">新建质量任务</a-button>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
import { useMessage } from '@/hooks/web/useMessage'; import { useMessage } from '@/hooks/web/useMessage';
import { h, ref } from 'vue'; import { h, ref } from 'vue';
import { FolderAddOutlined, SettingOutlined } from '@ant-design/icons-vue'; import { FolderAddOutlined, SettingOutlined } from '@ant-design/icons-vue';
import ImportModal from "@/views/dataQuality/dataSheet/rule/rulesExport.vue"; import ImportModal from '@/views/dataQuality/dataSheet/rule/rulesExport.vue';
// 模态框 // 模态框
const isAdd = ref(true); const isAdd = ref(true);
const { push } = useRouter(); const { push } = useRouter();
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
]; ];
// 新增 // 新增
function handleAdd() { function handleAdd() {
isAdd.value = true isAdd.value = true;
openRuleEditModel(true, { openRuleEditModel(true, {
isUpdate: false, isUpdate: false,
}); });
...@@ -151,6 +151,11 @@ ...@@ -151,6 +151,11 @@
path: '/dataQuality/ruleMoreAdd', path: '/dataQuality/ruleMoreAdd',
}); });
} }
function handleAddQuality() {
push({
path: '/dataQuality/dataSheet/task',
});
}
function handlePlus(node) {} function handlePlus(node) {}
/** /**
...@@ -175,7 +180,7 @@ ...@@ -175,7 +180,7 @@
* 列表编辑 * 列表编辑
*/ */
function handleEdit(record) { function handleEdit(record) {
isAdd.value = false isAdd.value = false;
openRuleEditModel(true, { openRuleEditModel(true, {
record, record,
isUpdate: true, isUpdate: true,
...@@ -206,8 +211,6 @@ ...@@ -206,8 +211,6 @@
}); });
} }
/** 导入按钮*/ /** 导入按钮*/
function handleImport() { function handleImport() {
openImportModal(true, {}); openImportModal(true, {});
......
...@@ -129,10 +129,7 @@ export const ruleModelFormSchema: any[] = [ ...@@ -129,10 +129,7 @@ export const ruleModelFormSchema: any[] = [
field: 'model', field: 'model',
label: '关键模板', label: '关键模板',
required: true, required: true,
component: 'Select', slot: 'model',
componentProps: {
options: [{ label: '公民身份号码', value: '公民身份号码' }],
},
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
}, },
{ {
...@@ -147,7 +144,6 @@ export const ruleModelFormSchema: any[] = [ ...@@ -147,7 +144,6 @@ export const ruleModelFormSchema: any[] = [
component: 'Select', component: 'Select',
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
show: ({ values }) => { show: ({ values }) => {
console.log('values', values);
return values.group ? values.group.substring(0, 2) === '主体' : false; return values.group ? values.group.substring(0, 2) === '主体' : false;
}, },
}, },
...@@ -156,8 +152,11 @@ export const ruleModelFormSchema: any[] = [ ...@@ -156,8 +152,11 @@ export const ruleModelFormSchema: any[] = [
label: 'SQL预览', label: 'SQL预览',
component: 'InputTextArea', component: 'InputTextArea',
componentProps: { componentProps: {
placeholder: '请输入描述', placeholder: ' ',
rows: 4, rows: 4,
style: {
pointerEvents: 'none',
},
}, },
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
}, },
...@@ -206,10 +205,7 @@ export const ruleEditModelFormSchema: any[] = [ ...@@ -206,10 +205,7 @@ export const ruleEditModelFormSchema: any[] = [
field: 'model', field: 'model',
label: '关键模板', label: '关键模板',
required: true, required: true,
component: 'Select', slot: 'model',
componentProps: {
options: [{ label: '公民身份号码', value: '公民身份号码' }],
},
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
}, },
{ {
...@@ -224,7 +220,6 @@ export const ruleEditModelFormSchema: any[] = [ ...@@ -224,7 +220,6 @@ export const ruleEditModelFormSchema: any[] = [
component: 'Select', component: 'Select',
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
show: ({ values }) => { show: ({ values }) => {
console.log('values', values);
return values.group ? values.group.substring(0, 2) === '主体' : false; return values.group ? values.group.substring(0, 2) === '主体' : false;
}, },
}, },
...@@ -233,8 +228,11 @@ export const ruleEditModelFormSchema: any[] = [ ...@@ -233,8 +228,11 @@ export const ruleEditModelFormSchema: any[] = [
label: 'SQL预览', label: 'SQL预览',
component: 'InputTextArea', component: 'InputTextArea',
componentProps: { componentProps: {
placeholder: '请输入描述', placeholder: ' ',
rows: 4, rows: 4,
style: {
pointerEvents: 'none',
},
}, },
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
}, },
......
...@@ -68,6 +68,9 @@ ...@@ -68,6 +68,9 @@
<template #dataSourceTxt="{ model, field }"> <template #dataSourceTxt="{ model, field }">
{{ model[field] }} {{ model[field] }}
</template> </template>
<template #model="{ field, model }">
<Select v-model:value="model[field]" @change="changeModel" :options="modelOptions" />
</template>
<template #config> <template #config>
<div> <div>
<BasicTable @register="configTable"> <BasicTable @register="configTable">
...@@ -130,8 +133,10 @@ ...@@ -130,8 +133,10 @@
//获取接口数据并放在下拉框里(这里是打开了一个弹框) //获取接口数据并放在下拉框里(这里是打开了一个弹框)
const [ruleGroupAddModel, { openModal: openRuleGroupAddModel }] = useModal(); const [ruleGroupAddModel, { openModal: openRuleGroupAddModel }] = useModal();
const [addNewVersion, { openModal: openAddNewVersion }] = useModal(); const [addNewVersion, { openModal: openAddNewVersion }] = useModal();
const modelOptions = [{ label: '公民身份号码', value: '公民身份号码' }];
//初始化表单 //初始化表单
const [registerForm, { setFieldsValue, resetSchema, resetFields, validate }] = useForm({ const [registerForm, { setFieldsValue, getFieldsValue, resetSchema, resetFields, validate }] =
useForm({
labelWidth: 100, labelWidth: 100,
baseColProps: { lg: 12, md: 24 }, baseColProps: { lg: 12, md: 24 },
// schemas: props.isAdd ? ruleModelFormSchema : ruleEditModelFormSchema, // schemas: props.isAdd ? ruleModelFormSchema : ruleEditModelFormSchema,
...@@ -161,8 +166,42 @@ ...@@ -161,8 +166,42 @@
await resetSchema([...ruleModelFormSchema]); await resetSchema([...ruleModelFormSchema]);
} }
}); });
const [configTable, { reload, updateTableDataRecord, getSearchInfo, getForm, getRowSelection }] = // 关键模板-修改后
useTable({ function changeModel() {
// 更新表单
reload();
// 更新sql预览
getSql();
}
function getSql() {
const model = getFieldsValue();
if (model.model) {
// 修改表单-SQL预览
setFieldsValue({
preview:
'SELECT COUNT(*)\n' +
'FROM $(table a}\n' +
'WHERE ${column a}IS NOT NULL AND ${column a}NOT IN (${range a})',
});
} else {
setFieldsValue({
preview: null,
});
}
}
// 获取数据 判断表单
function getData() {
const model = getFieldsValue();
if (model.model) {
return [...configData];
} else {
return [];
}
}
const [
configTable,
{ reload, updateTableDataRecord, getSearchInfo, getForm, getRowSelection, setTableData },
] = useTable({
title: '', title: '',
// 定高 // 定高
scroll: { y: 150 }, scroll: { y: 150 },
...@@ -172,10 +211,10 @@ ...@@ -172,10 +211,10 @@
pageNu: '1', pageNu: '1',
pageSize: '10', pageSize: '10',
pages: '1', pages: '1',
total: configData.length, total: getData().length,
code: '', code: '',
message: '', message: '',
data: configData, data: getData(),
}; };
return { ...response }; return { ...response };
}, },
......
<template> <template>
<PageWrapper contentBackground headerSticky> <PageWrapper dense contentBackground headerSticky>
<template #headerContent> <template #headerContent>
<div class="flex" style="gap: 10px"> <div class="flex" style="gap: 10px">
<div class="flex-1 flex" style="gap: 10px"> <div class="flex-1 flex" style="gap: 10px">
......
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