Ben Lin
2024-12-07 547c91649da47f4dd8c6706e632797dbd9d79d87
src/views/tigerprojects/wms/region/regionDrawer.vue
@@ -11,23 +11,24 @@
  </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,
        },
@@ -48,6 +49,9 @@
      const getTitle = computed(() => (!unref(isUpdate) ? '新增储区' : '编辑储区'));
      onMounted(async () => {
        formSchema.value = await fetchJson(`${globSetting.downloadUrl}/LowCode/addEditform.json`);
      });
      async function handleSubmit() {
        try {
          const values = await validate();
@@ -71,6 +75,7 @@
        registerForm,
        getTitle,
        handleSubmit,
        formSchema,
      };
    },
  });