| | |
| | | </BasicDrawer> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, ref, computed, unref } from 'vue'; |
| | | import { BasicForm, useForm } from '/@/components/Form/index'; |
| | | import { formSchema } from './region.data'; |
| | | import { defineComponent, ref, computed, unref, onMounted } from 'vue'; |
| | | import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; |
| | | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| | | |
| | | import { useGlobSetting } from '/@/hooks/setting'; |
| | | import { SaveRegion } from '/@/api/tigerapi/wms/region'; |
| | | import { fetchJson } from '/@/api/tigerapi/system'; |
| | | |
| | | export default defineComponent({ |
| | | name: 'RegionDrawer', |
| | | components: { BasicDrawer, BasicForm }, |
| | | emits: ['success', 'register'], |
| | | setup(_, { emit }) { |
| | | const globSetting = useGlobSetting(); |
| | | const isUpdate = ref(true); |
| | | |
| | | const formSchema = ref([]); |
| | | const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ |
| | | labelWidth: 120, |
| | | schemas: formSchema, |
| | | schemas: formSchema as unknown as FormSchema[], |
| | | actionColOptions: { |
| | | span: 24, |
| | | }, |
| | |
| | | |
| | | const getTitle = computed(() => (!unref(isUpdate) ? '新增储区' : '编辑储区')); |
| | | |
| | | onMounted(async () => { |
| | | formSchema.value = await fetchJson(`${globSetting.downloadUrl}/LowCode/addEditform.json`); |
| | | }); |
| | | async function handleSubmit() { |
| | | try { |
| | | const values = await validate(); |
| | |
| | | registerForm, |
| | | getTitle, |
| | | handleSubmit, |
| | | formSchema, |
| | | }; |
| | | }, |
| | | }); |