feat: 导出盘点表初步完成

This commit is contained in:
louis 2024-03-07 16:27:48 +08:00
parent 963ad25032
commit cae070985c
2 changed files with 15 additions and 17 deletions

View File

@ -3,6 +3,15 @@ import type { FormSchema } from '@/components/core/schema-form/';
import Api from '@/api'; import Api from '@/api';
import { debounce } from 'lodash-es'; import { debounce } from 'lodash-es';
export const exportSchemas: FormSchema<API.MaterialsInventoryExportParams>[] = [ export const exportSchemas: FormSchema<API.MaterialsInventoryExportParams>[] = [
{
label: '时间',
field: 'time',
component: 'MonthPicker',
required: true,
colProps: {
span: 12,
},
},
{ {
field: 'projectId', field: 'projectId',
component: 'Select', component: 'Select',
@ -10,8 +19,7 @@ export const exportSchemas: FormSchema<API.MaterialsInventoryExportParams>[] = [
colProps: { colProps: {
span: 12, span: 12,
}, },
required: true, helpMessage: '如果不选项目则导出所选月份所有项目每个项目一个wooksheet',
helpMessage: '如未找到对应项目,请先去项目管理添加项目。',
componentProps: ({ formInstance, schema, formModel }) => ({ componentProps: ({ formInstance, schema, formModel }) => ({
showSearch: true, showSearch: true,
filterOption: false, filterOption: false,
@ -50,15 +58,6 @@ export const exportSchemas: FormSchema<API.MaterialsInventoryExportParams>[] = [
}, 500), }, 500),
}), }),
}, },
{
label: '时间',
field: 'time',
component: 'MonthPicker',
required: true,
colProps: {
span: 12,
},
},
]; ];
const getProjectOptions = async (keyword?: string): Promise<LabelValueOptions> => { const getProjectOptions = async (keyword?: string): Promise<LabelValueOptions> => {

View File

@ -47,14 +47,13 @@
import AttachmentManage from '@/components/business/attachment-manage/index.vue'; import AttachmentManage from '@/components/business/attachment-manage/index.vue';
import AttachmentUpload from '@/components/business/attachment-upload/index.vue'; import AttachmentUpload from '@/components/business/attachment-upload/index.vue';
import fileDownload from 'js-file-download'; import fileDownload from 'js-file-download';
import { useGlobalLoading } from '@/hooks';
import { waitTime } from '@/utils/common';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
defineOptions({ defineOptions({
name: 'MaterialsInOut', name: 'MaterialsInOut',
}); });
const [DynamicTable, dynamicTableInstance] = useTable(); const [DynamicTable, dynamicTableInstance] = useTable({ formProps: { autoSubmitOnEnter: true } });
const [showModal] = useFormModal(); const [showModal] = useFormModal();
const [showExportModal] = useFormModal();
const [fnModal] = useModal(); const [fnModal] = useModal();
const isUploadPopupVisiable = ref(false); const isUploadPopupVisiable = ref(false);
@ -113,7 +112,7 @@
dynamicTableInstance?.queryFormRef?.formModel as TableQueryItem, dynamicTableInstance?.queryFormRef?.formModel as TableQueryItem,
); );
const [formRef] = await showModal({ const [formRef] = await showExportModal({
modalProps: { modalProps: {
title: `导出条件选择`, title: `导出条件选择`,
width: '50%', width: '50%',
@ -121,7 +120,7 @@
onFinish: async (values) => { onFinish: async (values) => {
const response = await Api.materialsInventory.materialsInventoryExport(values); const response = await Api.materialsInventory.materialsInventoryExport(values);
const { time } = values; const { time } = values;
fileDownload(response, `${dayjs(time).format('YYYY年MM月')}.xlsx`); fileDownload(response, `${dayjs(time).format('YYYY年MM月')}.xls`);
}, },
}, },
formProps: { formProps: {
@ -130,7 +129,7 @@
}, },
}); });
// auto fill export search fields // auto fill export time fields
if (time) { if (time) {
formRef?.setFieldsValue({ formRef?.setFieldsValue({
time, time,