datasource.vue
1.05 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
<script lang="ts" setup>
  // import { computed } from 'vue';
  import { commonDataSourceSchemas } from '../../../config/common.config';
  import { BasicForm, useForm } from '/@/components/Form';
  import { PublicFormInstaceType } from '/@/views/visual/dataSourceBindPanel/index.type';
  // const props = defineProps<{
  //   values: PublicComponentDataSourceProps;
  // }>();
  const [register, { getFieldsValue, setFieldsValue, validate, resetFields }] = useForm({
    labelWidth: 0,
    showActionButtonGroup: false,
    layout: 'horizontal',
    labelCol: { span: 0 },
    schemas: commonDataSourceSchemas(),
  });
  // const getBindValues = computed(() => {
  //   return props.values.bindValue;
  // });
  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>