From 89d1aeedf08adfba85e002c16528b8e0e61ed55c Mon Sep 17 00:00:00 2001
From: louis <869322496@qq.com>
Date: Wed, 17 Apr 2024 09:59:31 +0800
Subject: [PATCH] feat: develop export and domain
---
src/api/backend/api/domain.ts | 26 +
src/api/backend/api/index.ts | 5 +-
src/api/backend/api/materialsInOut.ts | 16 +-
src/api/backend/api/typings.d.ts | 29 +-
.../basic/excel/src/ExportExcelModal.tsx | 6 +-
src/enums/cacheEnum.ts | 5 +
.../header/components/domianPicker/index.vue | 51 ++
src/layout/header/components/index.ts | 1 +
src/layout/header/index.vue | 302 ++++++-----
src/store/modules/user.ts | 26 +-
src/utils/request.ts | 3 +
.../materials-inventory/in-out/index.vue | 511 +++++++++---------
.../inventory-check/index.vue | 271 +++++-----
13 files changed, 714 insertions(+), 538 deletions(-)
create mode 100644 src/api/backend/api/domain.ts
create mode 100644 src/layout/header/components/domianPicker/index.vue
diff --git a/src/api/backend/api/domain.ts b/src/api/backend/api/domain.ts
new file mode 100644
index 0000000..c6009ba
--- /dev/null
+++ b/src/api/backend/api/domain.ts
@@ -0,0 +1,26 @@
+import { request, type RequestOptions } from '@/utils/request';
+
+/** 获取公司列表 GET /api/domain */
+export async function domainList(params: API.DomainParams, options?: RequestOptions) {
+ return request<{
+ items?: API.DomainEntity[];
+ meta?: {
+ itemCount?: number;
+ totalItems?: number;
+ itemsPerPage?: number;
+ totalPages?: number;
+ currentPage?: number;
+ };
+ }>('/api/domain', {
+ method: 'GET',
+ params: {
+ // page has a default value: 1
+ page: '1',
+ // pageSize has a default value: 10
+ pageSize: '10',
+
+ ...params,
+ },
+ ...(options || {}),
+ });
+}
diff --git a/src/api/backend/api/index.ts b/src/api/backend/api/index.ts
index 74fd81b..39c65f3 100644
--- a/src/api/backend/api/index.ts
+++ b/src/api/backend/api/index.ts
@@ -36,9 +36,10 @@ import * as saleQuotationGroup from './saleQuotationGroup';
import * as saleQuotationComponent from './saleQuotationComponent';
import * as saleQuotationTemplate from './saleQuotationTemplate';
import * as saleQuotation from './saleQuotation';
-
+import * as domain from './domain';
export default {
auth,
+ domain,
account,
captcha,
authEmail,
@@ -71,5 +72,5 @@ export default {
saleQuotationGroup,
saleQuotationComponent,
saleQuotationTemplate,
- saleQuotation
+ saleQuotation,
};
diff --git a/src/api/backend/api/materialsInOut.ts b/src/api/backend/api/materialsInOut.ts
index bf7bfbd..13433c4 100644
--- a/src/api/backend/api/materialsInOut.ts
+++ b/src/api/backend/api/materialsInOut.ts
@@ -1,5 +1,19 @@
import { request, type RequestOptions } from '@/utils/request';
+/** 导出出入库记录 GET /api/materials-inventory/export*/
+export async function materialsInoutExport(
+ // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
+ params: API.MaterialsInoutExportParams,
+ options?: RequestOptions,
+) {
+ const { ...queryParams } = params;
+ return request(`/api/materials-in-out/export`, {
+ method: 'GET',
+ params: { ...queryParams },
+ ...(options || { responseType: 'blob', isReturnResult: false }),
+ });
+}
+
/** 获取原材料出入库记录列表 GET /api/materials-in-out */
export async function materialsInOutList(
params: API.MaterialsInOutListParams,
@@ -60,7 +74,7 @@ export async function materialsInOutInfo(
/** 解除原材料出入库记录和附件关联 PUT /api/materials-in-out/unlink-attachments/${param0} */
export async function unlinkAttachments(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
- params: API.MaterialsInOutUpdateParams,
+ params: API.MaterialsInOutUpdateParams,
body: API.MaterialsInOutUpdateDto,
options?: RequestOptions,
) {
diff --git a/src/api/backend/api/typings.d.ts b/src/api/backend/api/typings.d.ts
index 2723f0e..90d5ce1 100644
--- a/src/api/backend/api/typings.d.ts
+++ b/src/api/backend/api/typings.d.ts
@@ -21,6 +21,8 @@ declare namespace API {
remark: string;
/** 头像 */
avatar: string;
+ /** 所属域 */
+ domain: DomainType;
};
type AccountMenus = {
@@ -1213,12 +1215,13 @@ declare namespace API {
status: number;
roles: RoleEntity[];
dept: DeptEntity;
+ domain: DomainType;
accessTokens: AccessTokenEntity[];
id: number;
createdAt: string;
updatedAt: string;
};
-
+ type DomainType = number;
type UserListParams = {
page?: number;
pageSize?: number;
@@ -1379,8 +1382,9 @@ declare namespace API {
};
type MaterialsInventoryExportParams = {
- time: string;
- projectId: number;
+ time: string[];
+ filename:string;
+ projectId?: number;
};
type MaterialsInventoryInfoParams = {
@@ -1808,6 +1812,11 @@ declare namespace API {
};
// Materials In out history
+ type MaterialsInoutExportParams = {
+ time: string[];
+ filename:string;
+ };
+
type MaterialsInOutUpdateParams = {
id: number;
fileIds?: number[];
@@ -2015,4 +2024,18 @@ declare namespace API {
type SaleQuotationTemplateDeleteParams = {
id: number;
};
+
+ type DomainEntity = {
+ title: string;
+ id: number;
+ };
+
+ type DomainParams = {
+ page?: number;
+ pageSize?: number;
+ title?: string;
+ field?: string;
+ order?: 'ASC' | 'DESC';
+ _t?: number;
+ };
}
diff --git a/src/components/basic/excel/src/ExportExcelModal.tsx b/src/components/basic/excel/src/ExportExcelModal.tsx
index b453a23..257e098 100644
--- a/src/components/basic/excel/src/ExportExcelModal.tsx
+++ b/src/components/basic/excel/src/ExportExcelModal.tsx
@@ -58,11 +58,11 @@ export const useExportExcelModal = () => {
modalProps: {
title: t('component.excel.exportModalTitle'),
onFinish: async (values) => {
- const { filename, bookType } = values;
-
+ const { filename, bookType, time } = values;
onOk({
- filename: `${filename.split('.').shift()}.${bookType}`,
+ filename: bookType ? `${filename.split('.').shift()}.${bookType}` : filename,
bookType,
+ time,
});
},
},
diff --git a/src/enums/cacheEnum.ts b/src/enums/cacheEnum.ts
index bfce2a5..ad1b060 100644
--- a/src/enums/cacheEnum.ts
+++ b/src/enums/cacheEnum.ts
@@ -12,7 +12,12 @@ export const USER_INFO_KEY = 'USER__INFO__';
// role info key
export const ROLES_KEY = 'ROLES__KEY__';
+
/** 是否锁屏 */
export const IS_LOCKSCREEN = 'IS_LOCKSCREEN';
+
/** 标签页 */
export const TABS_ROUTES = 'TABS_ROUTES';
+
+/** 域 */
+export const DOMAIN_KEY = 'DOMAIN__';
\ No newline at end of file
diff --git a/src/layout/header/components/domianPicker/index.vue b/src/layout/header/components/domianPicker/index.vue
new file mode 100644
index 0000000..010ca5f
--- /dev/null
+++ b/src/layout/header/components/domianPicker/index.vue
@@ -0,0 +1,51 @@
+
+
+ 公司:
+ {{ item.label }}
+
+
+
+
+
+
+
diff --git a/src/layout/header/components/index.ts b/src/layout/header/components/index.ts
index 940e35d..0ca8e22 100644
--- a/src/layout/header/components/index.ts
+++ b/src/layout/header/components/index.ts
@@ -1,3 +1,4 @@
export { default as Search } from './search/index.vue';
export { default as FullScreen } from './fullscreen/index.vue';
export { default as ProjectSetting } from './setting/index.vue';
+export { default as DomianPicker } from './domianPicker/index.vue';
diff --git a/src/layout/header/index.vue b/src/layout/header/index.vue
index b5dc23b..7689460 100644
--- a/src/layout/header/index.vue
+++ b/src/layout/header/index.vue
@@ -1,23 +1,26 @@
-
-
-
+
diff --git a/src/views/materials-inventory/inventory-check/index.vue b/src/views/materials-inventory/inventory-check/index.vue
index 7f86136..03b5711 100644
--- a/src/views/materials-inventory/inventory-check/index.vue
+++ b/src/views/materials-inventory/inventory-check/index.vue
@@ -18,139 +18,154 @@
-
-
+
import dayjs from 'dayjs'; import fileDownload from 'js-file-download'; import type { TableQueryItem
} from '../in-out/columns'; import { exportSchemas } from '../in-out/exportSchema'; import dayjs
from 'dayjs'; import fileDownload from 'js-file-download'; import type { TableQueryItem } from