Commit eb42aac7 authored by 罗林杰's avatar 罗林杰

修改元数据

parent ea6890cd
......@@ -1152,6 +1152,14 @@ export const tagDataSourceColumns: BasicColumn[] = [
edit: true,
},
];
export const tagDataBaseColumns: BasicColumn[] = [
{
title: '数据库名',
dataIndex: 'name',
width: 120,
edit: true,
},
];
export const tagSourceColumns: BasicColumn[] = [
{
title: '标签名',
......
......@@ -111,7 +111,27 @@
// 选中节点
async function onNodeSelect(node: any) {
selectedNode.value = node;
if (
node.workSpaceName == '数据源1' ||
node.workSpaceName == '数据库1' ||
node.workSpaceName == '数据表1'
) {
title.value = 'admin-个人工作区';
} else if (
node.workSpaceName == '数据源2' ||
node.workSpaceName == '数据库2' ||
node.workSpaceName == '数据表2'
) {
title.value = '共享工作区';
} else if (
node.workSpaceName == '数据源3' ||
node.workSpaceName == '数据库3' ||
node.workSpaceName == '数据表3'
) {
title.value = '高级工作区';
} else {
title.value = node.workSpaceName;
}
await getForm().setFieldsValue({
workSpaceName: title.value,
});
......
......@@ -7,7 +7,30 @@
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
<BasicTable @register="registerPartitionTable">
<BasicTable v-show="!tableChange" @register="registerPartitionTable">
<template #toolbar>
<a-button type="primary" v-show="isCopy" @click="handDelete">删除</a-button>
<a-button type="primary" v-show="isCopy" @click="handleNewSource">添加</a-button>
</template>
<template #bodyCell="{ column }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
color: 'error',
label: '删除',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null),
},
},
]"
/>
</template>
</template>
</BasicTable>
<BasicTable v-show="tableChange" @register="registerDataBaseTable">
<template #toolbar>
<a-button type="primary" v-show="isCopy" @click="handDelete">删除</a-button>
<a-button type="primary" v-show="isCopy" @click="handleNewSource">添加</a-button>
......@@ -65,9 +88,9 @@
import { sourceFormData, tagFormData, tagRecordData } from '@/views/metadata/metadataData';
import { BasicForm, useForm } from '@/components/Form';
import {
tagDataBaseColumns,
tagDataSourceColumns,
tagRuleSchema,
tagSchema,
tagSourceColumns,
} from '@/views/metadata/data';
import { BasicTable, TableAction, useTable } from '@/components/Table';
......@@ -86,12 +109,58 @@
const rowId = ref('');
const isCopy = ref(false);
const isForm = ref(false);
const tableChange = ref(false);
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const [registerForm, { setFieldsValue, resetFields }] = useForm({
labelWidth: 120,
baseColProps: { lg: 12, md: 24 },
schemas: tagSchema,
schemas: [
{
field: 'typeNum',
label: '操作类型',
component: 'RadioGroup',
colProps: { lg: 24, md: 24 },
componentProps: {
options: [
{ label: '新增标签', value: '0' },
{ label: '删除标签', value: '1' },
],
},
required: true,
},
{
field: 'workName',
label: '任务名',
component: 'Input',
colProps: { lg: 24, md: 24 },
required: true,
},
{
field: 'remark',
label: '描述',
component: 'Input',
colProps: { lg: 24, md: 24 },
required: true,
},
{
field: 'range',
label: '打标范围',
component: 'RadioGroup',
colProps: { lg: 24, md: 24 },
defaultValue: '0',
componentProps: ({ formModel }) => ({
onChange: () => {
tableChange.value = formModel.range === '1';
},
options: [
{ label: '数据源', value: '0' },
{ label: '数据库', value: '1' },
],
}),
required: true,
},
],
disabled: isForm,
showActionButtonGroup: false,
actionColOptions: {
......@@ -156,6 +225,33 @@
},
scroll: { y: 300 },
});
const [registerDataBaseTable] = useTable({
title: '选择数据库',
columns: tagDataBaseColumns,
api: async () => {
const response = {
pageNu: '1',
pageSize: '10',
pages: '1',
total: formData.value.length,
code: '',
message: '',
data: [],
};
var data = [];
data = formData.value.filter((item) => item.businessId !== 100);
return { ...response, data: data };
},
showIndexColumn: false,
pagination: false,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
ifShow: isCopy,
},
scroll: { y: 300 },
});
const [registerTagTable, { reload: reloadTag }] = useTable({
title: '选择标签',
api: async () => {
......@@ -185,11 +281,13 @@
});
async function handleSubmit() {
closeModal();
createMessage.success('提交成功');
await resetFields();
await resetRuleFields();
await reloadTag();
await reload();
if (!isForm.value) {
createMessage.success('提交成功');
}
}
function handDelete() {
createConfirm({
......
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