|
|
@@ -1,125 +0,0 @@
|
|
|
-<script lang="ts">
|
|
|
- // 在 setup 中使用
|
|
|
- import { h, defineComponent } from 'vue';
|
|
|
- import BasicForm from './BasicForm.vue'; // 假设 BasicForm 组件的路径
|
|
|
- import { FormItem, InputGroup, InputNumber, Input } from 'ant-design-vue';
|
|
|
-
|
|
|
- export default defineComponent({
|
|
|
- name: 'MyFormComponent',
|
|
|
-
|
|
|
- setup() {
|
|
|
- return () =>
|
|
|
- h(
|
|
|
- BasicForm,
|
|
|
- {
|
|
|
- register: 'registerForm',
|
|
|
- },
|
|
|
- {
|
|
|
- // 使用 slots 而不是 scopedSlots(Vue 3)
|
|
|
- InputRangeNumber: ({ model, field, schema }) => {
|
|
|
- return h(FormItem, null, {
|
|
|
- default: () =>
|
|
|
- h(InputGroup, null, {
|
|
|
- default: () => [
|
|
|
- h(InputNumber, {
|
|
|
- modelValue: model[`${field}Start`],
|
|
|
- 'onUpdate:modelValue': (val) => (model[`${field}Start`] = val),
|
|
|
- style: { width: 'calc(50% - 100px)' },
|
|
|
- placeholder: '-',
|
|
|
- }),
|
|
|
- h(Input, {
|
|
|
- value: schema.groupName,
|
|
|
- style: {
|
|
|
- width: '200px',
|
|
|
- borderLeft: '0',
|
|
|
- pointerEvents: 'none',
|
|
|
- color: 'inherit',
|
|
|
- },
|
|
|
- disabled: true,
|
|
|
- }),
|
|
|
- h(InputNumber, {
|
|
|
- modelValue: model[`${field}End`],
|
|
|
- 'onUpdate:modelValue': (val) => (model[`${field}End`] = val),
|
|
|
- style: {
|
|
|
- width: 'calc(50% - 100px)',
|
|
|
- borderLeft: '0',
|
|
|
- },
|
|
|
- placeholder: '-',
|
|
|
- }),
|
|
|
- ],
|
|
|
- }),
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- InputGreaterNumber: ({ model, field, schema }) => {
|
|
|
- return h(FormItem, null, {
|
|
|
- default: () =>
|
|
|
- h(InputGroup, null, {
|
|
|
- default: () => [
|
|
|
- h(InputNumber, {
|
|
|
- style: { width: 'calc(50% - 100px)' },
|
|
|
- placeholder: '-',
|
|
|
- disabled: true,
|
|
|
- }),
|
|
|
- h(Input, {
|
|
|
- value: schema.groupName,
|
|
|
- style: {
|
|
|
- width: '200px',
|
|
|
- borderLeft: '0',
|
|
|
- pointerEvents: 'none',
|
|
|
- color: 'inherit',
|
|
|
- },
|
|
|
- disabled: true,
|
|
|
- }),
|
|
|
- h(InputNumber, {
|
|
|
- modelValue: model[field],
|
|
|
- 'onUpdate:modelValue': (val) => (model[field] = val),
|
|
|
- style: {
|
|
|
- width: 'calc(50% - 100px)',
|
|
|
- borderLeft: '0',
|
|
|
- },
|
|
|
- placeholder: '-',
|
|
|
- }),
|
|
|
- ],
|
|
|
- }),
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- InputLowerNumber: ({ model, field, schema }) => {
|
|
|
- return h(FormItem, null, {
|
|
|
- default: () =>
|
|
|
- h(InputGroup, null, {
|
|
|
- default: () => [
|
|
|
- h(InputNumber, {
|
|
|
- modelValue: model[field],
|
|
|
- 'onUpdate:modelValue': (val) => (model[field] = val),
|
|
|
- style: { width: 'calc(50% - 100px)' },
|
|
|
- placeholder: '-',
|
|
|
- }),
|
|
|
- h(Input, {
|
|
|
- value: schema.groupName,
|
|
|
- style: {
|
|
|
- width: '200px',
|
|
|
- borderLeft: '0',
|
|
|
- pointerEvents: 'none',
|
|
|
- color: 'inherit',
|
|
|
- },
|
|
|
- disabled: true,
|
|
|
- }),
|
|
|
- h(InputNumber, {
|
|
|
- style: {
|
|
|
- width: 'calc(50% - 100px)',
|
|
|
- borderLeft: '0',
|
|
|
- },
|
|
|
- placeholder: '-',
|
|
|
- disabled: true,
|
|
|
- }),
|
|
|
- ],
|
|
|
- }),
|
|
|
- });
|
|
|
- },
|
|
|
- }
|
|
|
- );
|
|
|
- },
|
|
|
- });
|
|
|
-</script>
|