From cae070985c8e7b413f8baae303d4ca15f6910c31 Mon Sep 17 00:00:00 2001 From: louis <869322496@qq.com> Date: Thu, 7 Mar 2024 16:27:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=87=BA=E7=9B=98=E7=82=B9?= =?UTF-8?q?=E8=A1=A8=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../in-out/exportSchema.ts | 21 +++++++++---------- .../materials-inventory/in-out/index.vue | 11 +++++----- 2 files changed, 15 insertions(+), 17 deletions(-) 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,