Commit 3126334d authored by chenjiahao's avatar chenjiahao

数据加载bug修正

parent 488b6595
......@@ -2,7 +2,7 @@
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="全局新增字段规则"
title="批量表名映射"
@ok="handleSubmit"
width="700px"
minHeight="50"
......@@ -38,7 +38,7 @@
import { fieldNameMappingRuleTableList } from '@/views/dataIntegration/dataLoading/dataEntryLake/mock';
import BasicTable from '@/components/Table/src/BasicTable.vue';
import { useTable } from '@/components/Table';
import { fieldNameMappingRuleColumns } from '@/views/dataIntegration/dataLoading/dataEntryLake/offlineLoading.data';
import { batchScaleNameMappingColumns } from '@/views/dataIntegration/dataLoading/dataEntryLake/offlineLoading.data';
const fieldNameMappingRuleTable = ref();
const emit = defineEmits(['success', 'register']);
......@@ -73,7 +73,7 @@
formConfig: {
labelWidth: 160,
},
columns: fieldNameMappingRuleColumns,
columns: batchScaleNameMappingColumns,
showTableSetting: false,
showIndexColumn: false,
bordered: false,
......
......@@ -250,7 +250,15 @@ export const NewFieldRuleFormSchema: FormSchema[] = [
{
field: 'newFieldType',
label: '新增字段类型',
component: 'Input',
component: 'Select',
componentProps: {
options: [
{ label: 'INT', value: 'INT' },
{ label: 'BIGINT', value: 'BIGINT' },
{ label: 'DECIMAL', value: 'DECIMAL' },
{ label: 'VARCHAR', value: 'VARCHAR' },
],
},
required: true,
},
{
......@@ -275,7 +283,15 @@ export const FieldTypeMappingRuleFormSchema: FormSchema[] = [
{
field: 'sourceFieldType',
label: '源字段类型',
component: 'Input',
component: 'Select',
componentProps: {
options: [
{ label: 'INT', value: 'INT' },
{ label: 'BIGINT', value: 'BIGINT' },
{ label: 'DECIMAL', value: 'DECIMAL' },
{ label: 'VARCHAR', value: 'VARCHAR' },
],
},
required: true,
},
{
......@@ -329,6 +345,14 @@ export const DataTransformationRuleFormSchema: FormSchema[] = [
field: 'selectExistingField',
label: '选择已有字段',
component: 'Select',
componentProps: {
options: [
{ label: 'total_amount', value: 'total_amount' },
{ label: 'payment_id', value: 'payment_id' },
{ label: 'position', value: 'position' },
{ label: 'employee_id', value: 'employee_id' },
],
},
required: true,
ifShow: false,
},
......@@ -343,10 +367,14 @@ export const DataTransformationRuleFormSchema: FormSchema[] = [
field: 'newFieldType',
label: '新增字段类型',
component: 'Select',
componentProps: {
options: [
{ label: '覆盖已有字段', value: '覆盖已有字段' },
{ label: '写入新增字段', value: '写入新增字段' },
{ label: 'INT', value: 'INT' },
{ label: 'BIGINT', value: 'BIGINT' },
{ label: 'DECIMAL', value: 'DECIMAL' },
{ label: 'VARCHAR', value: 'VARCHAR' },
],
},
required: true,
ifShow: false,
},
......@@ -354,7 +382,7 @@ export const DataTransformationRuleFormSchema: FormSchema[] = [
field: 'conversionRule',
label: '转换规则',
component: 'RadioGroup',
defaultValue: '自定义',
defaultValue: '配置规则',
componentProps: ({ formModel, formActionType }) => ({
onChange: () => {
const flag = formModel.conversionRule === '自定义';
......@@ -553,7 +581,7 @@ export const SingleTableFieldMappingRuleFormSchema: FormSchema[] = [
},
{
field: 'selectiveDataTable',
label: '选择数据表',
label: '源表名',
component: 'Select',
componentProps: {
options: [
......@@ -576,6 +604,7 @@ export const PartitionedDataProcessingFormSchema: FormSchema[] = [
field: 'partitionType',
label: '分区类型',
component: 'RadioGroup',
defaultValue: '单值分区',
componentProps: {
options: [{ label: '单值分区', value: '单值分区' }],
},
......
......@@ -2,7 +2,7 @@
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="全局新增字段规则"
title="数据转换规则"
@ok="handleSubmit"
minHeight="50"
>
......
......@@ -76,10 +76,7 @@
<a-button type="primary">导入文件</a-button>
</template>
</BasicForm>
<div
v-if="isGetMeta === 'true'"
style="width: 20%; background: #f4f7fa"
>
<div v-if="isGetMeta === 'true'" style="width: 20%">
<BasicTree
class="btStyle"
toolbar
......@@ -90,12 +87,11 @@
:treeData="tableTreeData"
v-model:checkedKeys="myCheckedKeys"
@select="handleSelect"
style="background-color: #f4f7fa !important"
>
<template #headerTitle>
<span style="margin-left: 20px">表名</span>
<a v-if="myCheckedKeys.length > 0" @click="handleDeplys" style="margin-left: 2px"
>批量配置</a
<a v-if="myCheckedKeys.length > 0" @click="handleDeplys" style="margin-left: 2px">
批量配置</a
>
<a v-else style="color: grey; margin-left: 2px">批量配置</a>
</template>
......@@ -113,7 +109,7 @@
<BasicForm
v-if="isGetMeta === 'true'"
@register="registerLoadingStrategyForm"
style="background-color: #f4f7fa !important; width: 50%"
style="padding-left: 20px; width: 50%"
>
<template #incrementalRepresentationColumnAlert>
<Alert
......@@ -281,22 +277,23 @@
<!--左侧配置表-->
<template #configurationTable>
<!--配置表-->
<BasicTable @register="registerConfigurationTable">
<template #toolbar>
<BasicTable title=" " @register="registerConfigurationTable">
<template #headerTop>
<div>
<!--展开按钮&配置按钮-->
<div style="margin-right: 600px">
<div style="display: flex; gap: 5px">
<div style="display: flex; gap: 5px; justify-content: space-between">
<!--展开按照序号批量选择按钮-->
<div style="display: flex; gap: 5px">
<a-button @click="handleConfigurationTableSelectClick">
通过序号批量选择
<Icon v-if="unfoldConfigurationTableSelect" icon="fe:arrow-up" />
<Icon v-else icon="fe:arrow-down" />
</a-button>
<a-input-search style="width: 220px" @search="onSearch" />
</div>
<!--配置按钮-->
<div style="display: flex; gap: 5px">
<a-button
style="margin-left: 60px"
:disabled="getConfigurationTableRowSelection().selectedRowKeys <= 0"
@click="handlePartitionedDataProcessing"
>分区数据处理
......@@ -499,6 +496,11 @@
<BatchScaleNameMappingModal @register="registerBatchScaleNameMappingModal" />
<ClearConfigurationModal @register="registerClearConfigurationModal" />
<ViewLogModal @register="registerViewLogsModal" />
<NewFieldRuleModal @register="registerNewFieldRuleModal" />
<FieldNameMappingRuleModal @register="registerFieldNameMappingRuleModal" />
<FieldTypeMappingRuleModal @register="registerFieldTypeMappingRuleModal" />
<DataTransformationRuleModal @register="registerDataTransformationRuleModal" />
<SingleTableFieldMappingRuleModal @register="registerSingleTableFieldMappingRuleModal" />
</PageWrapper>
</template>
<script lang="ts" setup>
......@@ -527,7 +529,7 @@
tabularPresentationColumns,
compareColumns,
tabularPresentationSearchFormSchema,
compareSearchFormSchema,
compareSearchFormSchema, noConfigurationColumns,
} from './offlineLoading.data';
import Icon from '@/components/Icon/Icon.vue';
import { useMessage } from '@/hooks/web/useMessage';
......@@ -564,6 +566,11 @@
import VersionManageModal from '@/views/dataIntegration/dataLoading/dataEntryLake/versionManageModal.vue';
import RunOptionsModal from '@/views/dataIntegration/dataLoading/dataEntryLake/runOptionsModal.vue';
import ViewLogModal from '@/views/dataIntegration/dataLoading/dataEntryLake/ViewLogModal.vue';
import NewFieldRuleModal from '@/views/dataIntegration/dataLoading/dataEntryLake/newFieldRuleModal.vue';
import FieldNameMappingRuleModal from '@/views/dataIntegration/dataLoading/dataEntryLake/fieldNameMappingRuleModal.vue';
import FieldTypeMappingRuleModal from '@/views/dataIntegration/dataLoading/dataEntryLake/fieldTypeMappingRuleModal.vue';
import DataTransformationRuleModal from '@/views/dataIntegration/dataLoading/dataEntryLake/dataTransformationRuleModal.vue';
import SingleTableFieldMappingRuleModal from '@/views/dataIntegration/dataLoading/dataEntryLake/singleTableFieldMappingRuleModal.vue';
const route = useRoute();
const emit = defineEmits(['success', 'register']);
......@@ -594,7 +601,7 @@
let customSQLFlag = ref();
let isAutomaticTableConstructionFlag = ref(false);
let isParsingSQL = ref(false);
let isClearTargetTable = ref(false);
let isClearTargetTable = ref('否');
const isSave = ref('false');
const isRun = ref('false');
const key = ref('1');
......@@ -632,6 +639,18 @@
},
];
const [registerNewFieldRuleModal, { openModal: openNewFieldRuleModal }] = useModal();
const [registerFieldNameMappingRuleModal, { openModal: openFieldNameMappingRuleModal }] =
useModal();
const [registerFieldTypeMappingRuleModal, { openModal: openFieldTypeMappingRuleModal }] =
useModal();
const [registerDataTransformationRuleModal, { openModal: openDataTransformationRuleModal }] =
useModal();
const [
registerSingleTableFieldMappingRuleModal,
{ openModal: openSingleTableFieldMappingRuleModal },
] = useModal();
const sourceSideConfigurationFormSchema: FormSchema[] = [
{
field: 'loadType',
......@@ -991,6 +1010,7 @@
label: '允许最大并发数',
component: 'Input',
colProps: { lg: 12, md: 12 },
defaultValue: '10',
componentProps: {
placeholder: '',
},
......@@ -1045,6 +1065,13 @@
componentProps: ({ formModel, formActionType }) => ({
onChange: () => {
isAutomaticTableConstructionFlag.value = formModel.isAutomaticTableConstruction === '是';
if(isAutomaticTableConstructionFlag.value){
setColumns(configurationColumns);
reload();
}else {
setColumns(noConfigurationColumns);
reload();
}
// formActionType.updateSchema([{ field: 'quantityBasedAlert', ifShow: flag }]);
// formActionType.updateSchema([{ field: 'conditionBasedAlert', ifShow: !flag }]);
},
......@@ -1318,7 +1345,7 @@
});
const [registerLoadingStrategyForm, { updateSchema, setFieldsValue }] = useForm({
labelWidth: 180,
labelWidth: 120,
labelAlign: 'left',
baseColProps: { lg: 24, md: 24 },
schemas: LoadingStrategyFormSchema,
......@@ -1480,6 +1507,7 @@
getDataSource,
getRowSelection: getConfigurationTableRowSelection,
setSelectedRowKeys,
setColumns,
},
] = useTable({
api: async () => {
......@@ -1499,7 +1527,7 @@
rowSelection: true,
striped: false,
customRow: configurationTableOnClick,
columns: configurationColumns,
columns: noConfigurationColumns,
showTableSetting: false,
showIndexColumn: true,
bordered: false,
......@@ -1884,11 +1912,42 @@
}
function handleEdit(record) {
createMessage.success('编辑:' + record);
switch (record.ruleName) {
case '[全局] 新增字段规则':
console.log('Handling new field rule');
openNewFieldRuleModal(true);
break;
case '[全局] 字段名称映射规则':
console.log('Handling field name mapping rule');
openFieldNameMappingRuleModal(true);
break;
case '[全局] 字段类型映射规则':
console.log('Handling field type mapping rule');
openFieldTypeMappingRuleModal(true);
break;
case '数据转换规则':
console.log('Handling data transformation rule');
openDataTransformationRuleModal(true);
break;
case '[单表] 字段映射规则':
console.log('Handling single table field mapping rule');
openSingleTableFieldMappingRuleModal(true);
break;
default:
console.log('Unknown rule type');
}
// createMessage.success('编辑:' + record);
}
function handleDeleteRule(record) {
createMessage.success('删除规则成功' + record);
createConfirm({
iconType: 'warning',
title: '删除规则',
content: '是否确认删除规则?',
onOk() {
createMessage.success('删除规则成功');
},
});
}
function handleDeleteRules() {
......@@ -2163,12 +2222,11 @@
reloadOtherConfigurationTable();
}
</script>
<style lang="scss" scoped>
<style lang="less" scoped>
.content-padding {
background-color: white;
}
.modal_top {
padding: 0 0 20px 0;
display: flex;
align-items: center;
.title {
......@@ -2189,4 +2247,16 @@
.selected-row {
background-color: #5cb3ff; /* 可以根据需要调整颜色 */
}
:deep(.vben-basic-table-form-container) {
padding: 0;
}
:deep(.ant-page-header) {
padding: 5px 24px;
}
:deep(.ant-col-lg-12) {
padding: 5px;
}
</style>
......@@ -2,9 +2,9 @@
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="全局新增字段规则"
title="全局字段名称映射规则"
@ok="handleSubmit"
style="width: 35%"
width="35%"
minHeight="50"
>
<BasicForm @register="registerForm">
......
......@@ -2,7 +2,7 @@
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="全局新增字段规则"
title="全局字段类型映射规则"
@ok="handleSubmit"
minHeight="50"
>
......
......@@ -48,6 +48,29 @@ export const configurationColumns: BasicColumn[] = [
width: 90,
},
];
export const noConfigurationColumns: BasicColumn[] = [
{
title: '源端',
dataIndex: 'sourceTableName',
},
{
title: '目标端',
dataIndex: 'targetTableName',
edit: true,
},
{
title: '分区数据配置',
dataIndex: 'partitionQuantityConfiguration',
slots: { customRender: 'partitionQuantityConfiguration' },
width: 90,
},
{
title: '清理配置',
dataIndex: 'clearConfiguration',
slots: { customRender: 'clearConfiguration' },
width: 90,
},
];
export const partitionKeyColumns: BasicColumn[] = [
{
......@@ -157,6 +180,18 @@ export const fieldNameMappingRuleColumns: BasicColumn[] = [
},
];
export const batchScaleNameMappingColumns: BasicColumn[] = [
{
title: '源表名',
dataIndex: 'tableName',
labelWidth: 160,
},
{
title: '目标表名',
dataIndex: 'targetTableName',
},
];
export const singleSourceFieldNameMappingRuleColumns: BasicColumn[] = [
{
title: '字段名',
......
......@@ -2,10 +2,10 @@
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="全局新增字段规则"
title="单表字段映射规则"
@ok="handleSubmit"
style="width: 35%"
minHeight="50"
width="50%"
>
<BasicForm @register="registerForm">
<template #mappingTable>
......
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