datasource.vue
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script lang="ts" setup>
// import { commonDataSourceSchemas } from '../../../config/common.config';
import { CreateComponentType } from '../../../index.type';
import { BasicForm, useForm } from '/@/components/Form';
import {
PublicComponentValueType,
PublicFormInstaceType,
} from '/@/views/visual/dataSourceBindPanel/index.type';
import { formSchemas } from './datasource.config';
defineProps<{
values: PublicComponentValueType;
componentConfig: CreateComponentType;
}>();
const [register, { getFieldsValue, setFieldsValue, validate, resetFields }] = useForm({
labelWidth: 0,
showActionButtonGroup: false,
layout: 'horizontal',
labelCol: { span: 0 },
schemas: formSchemas(),
});
const getFormValues = () => {
return getFieldsValue();
};
const setFormValues = (record: Recordable) => {
return setFieldsValue(record);
};
defineExpose({
getFormValues,
setFormValues,
validate,
resetFormValues: resetFields,
} as PublicFormInstaceType);
</script>
<template>
<BasicForm @register="register" />
</template>