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

View File

@ -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,