Commit ef2ec034 authored by LiXuyang's avatar LiXuyang

审核配置/通用配置

parent 6a580353
......@@ -6,16 +6,49 @@
@ok="handleSubmit"
minHeight="50"
>
<BasicForm @register="registerForm" />
<BasicForm @register="registerForm">
<template #exFunction="{ field, model }">
<Select v-model:value="model[field]" :options="exFunctionOptions" />
</template>
<template #configTable>
<div style="width: 100%; margin-bottom: 20px">
<a-button style="width: 100%" type="primary" @click="handleConfig">参数解析</a-button>
</div>
<div>
<BasicTable @register="registerDataTransformationRuleTable" />
</div>
</template>
</BasicForm>
</BasicModal>
</template>
<script lang="ts" setup>
import { onMounted } from 'vue';
import { Select } from 'ant-design-vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicTable, useTable } from '@/components/Table';
import { BasicForm, useForm } from '@/components/Form';
import { dataChangeRuleFormSchema } from './file.data';
import { configTableColumn, dataChangeRuleFormSchema } from './file.data';
import { configTableData, exFunctionOptions } from './fileData';
const [registerForm, { validate }] = useForm({
onMounted(() => {
setModalProps({ canFullscreen: false });
});
/**
* 方法
*/
function handleConfig() {
reload();
}
function getData() {
const exFunction = getFieldsValue().exFunction;
const index = configTableData.findIndex((item) => item.key === exFunction);
return [...configTableData[index].value];
}
/**
* form
*/
const [registerForm, { validate, getFieldsValue }] = useForm({
labelWidth: 100,
baseColProps: { span: 24 },
schemas: dataChangeRuleFormSchema,
......@@ -37,7 +70,27 @@
}
// closeModal();
}
onMounted(() => {
setModalProps({ canFullscreen: false });
/**
* table
*/
const [registerDataTransformationRuleTable, { reload, setTableData }] = useTable({
api: async () => {
const response = {
pageNu: '1',
pageSize: '5',
pages: '1',
total: getData().length,
code: '',
message: '',
data: getData(),
};
return { ...response };
},
scroll: { y: 300 },
rowKey: 'businessId',
columns: configTableColumn,
showTableSetting: false,
showIndexColumn: false,
bordered: false,
});
</script>
......@@ -689,6 +689,22 @@ export const dataChangeRuleFormSchema: FormSchema[] = [
return model.conversionRule === '自定义';
},
},
{
field: 'exFunction',
label: '函数表达式',
required: true,
slot: 'exFunction',
show: ({ model }) => {
return model.conversionRule === '配置规则';
},
},
{
field: 'configTable',
slot: 'configTable',
show: ({ model }) => {
return model.conversionRule === '配置规则';
},
},
];
export const partDataHandleFormSchema: FormSchema[] = [
{
......@@ -898,3 +914,75 @@ export const runOptionsColumns: BasicColumn[] = [
editable: true,
},
];
export const SingleTableFieldMappingRuleFormSchema: FormSchema[] = [
{
field: 'ruleName',
label: '规则名称',
component: 'Input',
required: true,
},
{
field: 'selectiveDataTable',
label: '源表名',
component: 'Select',
componentProps: {
options: [
{ label: 'table_1', value: 'table_1' },
{ label: 'table_2', value: 'table_2' },
{ label: 'table_3', value: 'table_3' },
{ label: 'table_4', value: 'table_4' },
],
},
required: true,
},
{
field: 'mappingTable',
slot: 'mappingTable',
},
];
export const singleGoalFieldNameMappingRuleColumns: BasicColumn[] = [
{
title: '字段名',
dataIndex: 'targetFieldName',
edit: true,
},
{
title: '字段类型',
dataIndex: 'fieldType',
edit: true,
},
{
title: '注释',
dataIndex: 'annotation',
},
];
export const singleSourceFieldNameMappingRuleColumns: BasicColumn[] = [
{
title: '字段名',
dataIndex: 'fieldName',
},
{
title: '字段类型',
dataIndex: 'fieldType',
},
{
title: '注释',
dataIndex: 'annotation',
},
];
export const configTableColumn: BasicColumn[] = [
{
title: '参数名',
dataIndex: 'field',
},
{
title: '实际值',
dataIndex: 'value',
editable: true,
edit: true,
editComponent: 'Input',
editComponentProps: {
placeholder: '请输入',
}
},
];
......@@ -118,3 +118,226 @@ export const runOptionsData: any[] = [
data: 'false',
},
];
export const exFunctionOptions = [
{
label: '变更字段名',
value: '变更字段名',
},
{
label: '变更字段数据类型',
value: '变更字段数据类型',
},
{
label: '添加新字段',
value: '添加新字段',
},
{
label: '删除字段',
value: '删除字段',
},
{
label: '重命名表',
value: '重命名表',
},
{
label: '创建索引',
value: '创建索引',
},
{
label: '删除索引',
value: '删除索引',
},
{
label: '添加主键',
value: '添加主键',
},
{
label: '移除主键',
value: '移除主键',
},
{
label: '添加外键约束',
value: '添加外键约束',
},
{
label: '移除外键约束',
value: '移除外键约束',
},
];
export const configTableData = [
{
key: '变更字段名',
value: [
{
field: 'table_name',
value: null,
},
{
field: 'old_column_name',
value: null,
},
{
field: 'new_column_name',
value: null,
},
{
field: 'column_type',
value: null,
},
],
},
{
key: '变更字段数据类型',
value: [
{
field: 'table_name',
value: null,
},
{
field: 'column_name',
value: null,
},
{
field: 'new_column_type',
value: null,
},
],
},
{
key: '添加新字段',
value: [
{
field: 'table_name',
value: null,
},
{
field: 'new_column_name',
value: null,
},
{
field: 'column_type',
value: null,
},
{
field: 'default_value',
value: null,
},
],
},
{
key: '删除字段',
value: [
{
field: 'table_name',
value: null,
},
{
field: 'column_name',
value: null,
},
],
},
{
key: '重命名表',
value: [
{
field: 'old_table_name',
value: null,
},
{
field: 'new_table_name',
value: null,
},
],
},
{
key: '创建索引',
value: [
{
field: 'index_name',
value: null,
},
{
field: 'table_name',
value: null,
},
{
field: 'column_name',
value: null,
},
],
},
{
key: '删除索引',
value: [
{
field: 'index_name',
value: null,
},
{
field: 'table_name',
value: null,
},
],
},
{
key: '添加主键',
value: [
{
field: 'table_name',
value: null,
},
{
field: 'column_name',
value: null,
},
],
},
{
key: '移除主键',
value: [
{
field: 'table_name',
value: null,
},
],
},
{
key: '添加外键约束',
value: [
{
field: 'table_name',
value: null,
},
{
field: 'constraint_name',
value: null,
},
{
field: 'column_name',
value: null,
},
{
field: 'referenced_table_name',
value: null,
},
{
field: 'referenced_column_name',
value: null,
},
],
},
{
key: '移除外键约束',
value: [
{
field: 'table_name',
value: null,
},
{
field: 'constraint_name',
value: null,
},
],
},
];
......@@ -172,8 +172,13 @@
onClick: handleEdit.bind(null, record),
},
{
icon: 'ic:outline-delete-outline',
onClick: handleDeleteRule.bind(null, record),
icon: 'ant-design:delete-outlined',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleRemove.bind(null, record),
},
color: 'error',
},
]"
/>
......@@ -433,6 +438,7 @@
<DataOptionsModal @register="registerDataOptionsModal" />
<VersionManageModal @register="registerVersionManageModal" />
<RunOptionsModal @register="registerRunOptionsModal" @success="RunOptionsSuccess" />
<SingleTableFieldMappingRuleModal @register="registerSingleTableFieldMappingRuleModal" />
</PageWrapper>
</template>
......@@ -515,6 +521,7 @@
import VersionManageModal from '@/views/dataIntegration/dataLoading/dataEntryLake/versionManageModal.vue';
import PartitionDataHandleModal from '@/views/dataIntegration/dataLoading/fileLoading/partitionDataHandleModal.vue';
import RunOptionsModal from '@/views/dataIntegration/dataLoading/fileLoading/runOptionsModal.vue';
import SingleTableFieldMappingRuleModal from './singleTableFieldMappingRuleModal.vue';
const [registerSaveModal, { openModal: openSaveModal }] = useModal();
const [registerGlobalOptionsModal, { openModal: openGlobalOptionsModal }] = useModal();
......@@ -522,6 +529,10 @@
const [registerVersionManageModal, { openModal: openVersionManageModal }] = useModal();
const [partitionDataHandleModal, { openModal: openPartitionDataHandleModal }] = useModal();
const [registerRunOptionsModal, { openModal: openRunOptionsModal }] = useModal();
const [
registerSingleTableFieldMappingRuleModal,
{ openModal: openSingleTableFieldMappingRuleModal },
] = useModal();
const isSave = ref(false);
async function handleSave() {
......@@ -538,7 +549,7 @@
if (data.isDebug) {
successDebug();
} else {
createMessage.success('运行成功')!
createMessage.success('运行成功')!;
}
}
function successDebug() {
......@@ -593,7 +604,6 @@
title: '参数列表',
isDebug: true,
});
}
function handleExitDebug() {
......@@ -965,9 +975,14 @@
// tabs2
function handleDeleteRules() {
createMessage.success(
'批量删除数据转换规则成功' + getMappingRuleConfigurationRowSelection().selectedRowKeys,
);
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '确认批量删除选中数据吗?',
onOk() {
createMessage.success('删除成功!');
},
});
}
const [registerAddRuleModal, { openModal: openAddRuleModal }] = useModal();
......@@ -1008,7 +1023,7 @@
}
function handleEdit(record) {
createMessage.success('编辑:' + record);
openSingleTableFieldMappingRuleModal(true, {});
}
function handleDeleteRule(record) {
......@@ -1016,6 +1031,9 @@
}
let mappingRuleConfigurationTable = ref(mappingRuleConfigurationTableList);
function handleRemove() {
createMessage.success('删除成功!');
}
const [
registerMappingRuleConfigurationTable,
{ getRowSelection: getMappingRuleConfigurationRowSelection },
......
<template>
<BasicModal
v-bind="$attrs"
@register="registerModal"
title="单表字段映射规则"
@ok="handleSubmit"
minHeight="50"
width="50%"
>
<BasicForm @register="registerForm">
<template #mappingTable>
<div style="display: flex">
<BasicTable title="源端" @register="registerSourceFieldNameMappingRuleTable" />
<BasicTable title="目标端" @register="registerGoalFieldNameMappingRuleTable" />
</div>
</template>
</BasicForm>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue';
import { BasicModal, useModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import {
sourceFieldNameMappingRuleTableList,
goalFieldNameMappingRuleTableList,
} from '@/views/dataIntegration/dataLoading/dataEntryLake/mock';
import BasicTable from '@/components/Table/src/BasicTable.vue';
import { useTable } from '@/components/Table';
import {
singleGoalFieldNameMappingRuleColumns, singleSourceFieldNameMappingRuleColumns,
SingleTableFieldMappingRuleFormSchema,
} from '@/views/dataIntegration/dataLoading/fileLoading/file.data';
const sourceFieldNameMappingRuleTable = ref(sourceFieldNameMappingRuleTableList);
const goalFieldNameMappingRuleTable = ref(goalFieldNameMappingRuleTableList);
const emit = defineEmits(['success', 'register']);
const [registerForm, { validate, setFieldsValue }] = useForm({
labelWidth: 100,
labelAlign: 'left',
baseColProps: { span: 24 },
schemas: SingleTableFieldMappingRuleFormSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
//初始化弹框
const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
await setFieldsValue({ ...data });
});
const [registerSourceFieldNameMappingRuleTable] = useTable({
api: async () => {
const response = {
pageNu: '1',
pageSize: '5',
pages: '1',
total: sourceFieldNameMappingRuleTable.value.length,
code: '',
message: '',
data: sourceFieldNameMappingRuleTable.value,
};
return { ...response };
},
scroll: { y: 300 },
rowKey: 'businessId',
formConfig: {
labelWidth: 160,
},
columns: singleSourceFieldNameMappingRuleColumns,
showTableSetting: false,
showIndexColumn: false,
bordered: false,
pagination: false,
});
const [registerGoalFieldNameMappingRuleTable] = useTable({
api: async () => {
const response = {
pageNu: '1',
pageSize: '5',
pages: '1',
total: goalFieldNameMappingRuleTable.value.length,
code: '',
message: '',
data: goalFieldNameMappingRuleTable.value,
};
return { ...response };
},
scroll: { y: 300 },
rowKey: 'businessId',
formConfig: {
labelWidth: 160,
},
columns: singleGoalFieldNameMappingRuleColumns,
showTableSetting: false,
showIndexColumn: false,
bordered: false,
pagination: false,
});
async function handleSubmit() {
try {
setModalProps({ confirmLoading: true });
await validate();
closeModal();
} finally {
setModalProps({ confirmLoading: false });
}
// closeModal();
}
onMounted(() => {
setModalProps({ canFullscreen: false });
});
</script>
<template>
<!-- 审核配置 -->
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
<!-- 审核配置 -->
<template #headerContent>
<div class="flex">
<div class="flex-1 header">
......@@ -61,11 +61,11 @@
</div>
</template>
</BasicTable>
<!-- 流程编辑 - 弹窗 -->
<ProcessEditModal @register="registerProcessEditModal" @success="handleSuccess" />
<!-- 需要审批的资产类型 - 弹窗 -->
<AssetTypeModal @register="registerAssetTypeModal" @success="handleSuccess" />
</PageWrapper>
<!-- 流程编辑 - 弹窗 -->
<ProcessEditModal @register="registerProcessEditModal" @success="handleSuccess" />
<!-- 需要审批的资产类型 - 弹窗 -->
<AssetTypeModal @register="registerAssetTypeModal" @success="handleSuccess" />
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue';
......
<template>
<!-- 权限管理 -->
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
<!-- 权限管理 -->
<template #headerContent>
<div class="flex">
<div class="flex-1 header">
......
<template>
<!-- 标签管理 -->
<PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
<!-- 标签管理 -->
<template #headerContent>
<div class="flex">
<div class="flex-1 header">
......
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