diff --git a/src/views/materials-inventory/in-out/exportSchema.ts b/src/views/materials-inventory/in-out/exportSchema.ts index 1290e7e..53ea64f 100644 --- a/src/views/materials-inventory/in-out/exportSchema.ts +++ b/src/views/materials-inventory/in-out/exportSchema.ts @@ -3,6 +3,15 @@ import type { FormSchema } from '@/components/core/schema-form/'; import Api from '@/api'; import { debounce } from 'lodash-es'; export const exportSchemas: FormSchema[] = [ + { + label: '时间', + field: 'time', + component: 'MonthPicker', + required: true, + colProps: { + span: 12, + }, + }, { field: 'projectId', component: 'Select', @@ -10,8 +19,7 @@ export const exportSchemas: FormSchema[] = [ colProps: { span: 12, }, - required: true, - helpMessage: '如未找到对应项目,请先去项目管理添加项目。', + helpMessage: '如果不选项目,则导出所选月份所有项目,每个项目一个wooksheet', componentProps: ({ formInstance, schema, formModel }) => ({ showSearch: true, filterOption: false, @@ -50,15 +58,6 @@ export const exportSchemas: FormSchema[] = [ }, 500), }), }, - { - label: '时间', - field: 'time', - component: 'MonthPicker', - required: true, - colProps: { - span: 12, - }, - }, ]; const getProjectOptions = async (keyword?: string): Promise => { diff --git a/src/views/materials-inventory/in-out/index.vue b/src/views/materials-inventory/in-out/index.vue index 6b00906..2258b3a 100644 --- a/src/views/materials-inventory/in-out/index.vue +++ b/src/views/materials-inventory/in-out/index.vue @@ -47,14 +47,13 @@ import AttachmentManage from '@/components/business/attachment-manage/index.vue'; import AttachmentUpload from '@/components/business/attachment-upload/index.vue'; import fileDownload from 'js-file-download'; - import { useGlobalLoading } from '@/hooks'; - import { waitTime } from '@/utils/common'; import dayjs from 'dayjs'; defineOptions({ name: 'MaterialsInOut', }); - const [DynamicTable, dynamicTableInstance] = useTable(); + const [DynamicTable, dynamicTableInstance] = useTable({ formProps: { autoSubmitOnEnter: true } }); const [showModal] = useFormModal(); + const [showExportModal] = useFormModal(); const [fnModal] = useModal(); const isUploadPopupVisiable = ref(false); @@ -113,7 +112,7 @@ dynamicTableInstance?.queryFormRef?.formModel as TableQueryItem, ); - const [formRef] = await showModal({ + const [formRef] = await showExportModal({ modalProps: { title: `导出条件选择`, width: '50%', @@ -121,7 +120,7 @@ onFinish: async (values) => { const response = await Api.materialsInventory.materialsInventoryExport(values); const { time } = values; - fileDownload(response, `${dayjs(time).format('YYYY年MM月')}.xlsx`); + fileDownload(response, `${dayjs(time).format('YYYY年MM月')}.xls`); }, }, formProps: { @@ -130,7 +129,7 @@ }, }); - // auto fill export search fields + // auto fill export time fields if (time) { formRef?.setFieldsValue({ time,