From c7c774f801e162831a4398dc27e72a20fb8f2958 Mon Sep 17 00:00:00 2001 From: louis <869322496@qq.com> Date: Mon, 4 Mar 2024 11:29:26 +0800 Subject: [PATCH] fix: build --- Dockerfile | 12 +- src/api/backend/api/index.ts | 3 + ...als_inventory.ts => materialsInventory.ts} | 54 +++++---- src/api/backend/api/systemDictType.ts | 4 +- src/api/backend/api/typings.d.ts | 107 +++++++++++++++++- src/store/modules/dict.ts | 7 +- src/views/meterials-inventory/index.vue | 4 +- 7 files changed, 151 insertions(+), 40 deletions(-) rename src/api/backend/api/{materials_inventory.ts => materialsInventory.ts} (55%) diff --git a/Dockerfile b/Dockerfile index 33c4815..2096743 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,4 @@ -FROM nginx:alpine as production -EXPOSE 80 - FROM node:20-slim as base ENV PROJECT_DIR=/huaxin-front \ PNPM_HOME="/pnpm" \ @@ -28,7 +25,10 @@ RUN pnpm run build FROM base AS result COPY --from=prod-deps $PROJECT_DIR/node_modules $PROJECT_DIR/node_modules COPY --from=builder $PROJECT_DIR/dist $PROJECT_DIR/dist -COPY --from=builder $PROJECT_DIR/dist/ /usr/share/nginx/html -COPY --from=builder $PROJECT_DIR/nginx.conf /etc/nginx/nginx.conf -# 构建nginx,并且在result之后拷贝dist到nginx中,其中包含了自定义nginx.conf +# 构建nginx,并且在result之后拷贝dist到nginx中,其中包含了自定义nginx.conf, +FROM nginx:alpine as production +ENV PROJECT_DIR=/huaxin-front +COPY --from=result $PROJECT_DIR/dist/ /usr/share/nginx/html +COPY --from=result $PROJECT_DIR/nginx.conf /etc/nginx/nginx.conf +EXPOSE 80 \ No newline at end of file diff --git a/src/api/backend/api/index.ts b/src/api/backend/api/index.ts index 6bb58f3..e4a049a 100644 --- a/src/api/backend/api/index.ts +++ b/src/api/backend/api/index.ts @@ -26,6 +26,8 @@ import * as netDiskManage from './netDiskManage'; import * as netDiskOverview from './netDiskOverview'; import * as businessTodo from './businessTodo'; import * as contract from './contract'; +import * as materialsInventory from './materialsInventory'; + export default { auth, account, @@ -51,4 +53,5 @@ export default { netDiskOverview, businessTodo, contract, + materialsInventory }; diff --git a/src/api/backend/api/materials_inventory.ts b/src/api/backend/api/materialsInventory.ts similarity index 55% rename from src/api/backend/api/materials_inventory.ts rename to src/api/backend/api/materialsInventory.ts index 5f378b9..8bf4c82 100644 --- a/src/api/backend/api/materials_inventory.ts +++ b/src/api/backend/api/materialsInventory.ts @@ -1,9 +1,12 @@ import { request, type RequestOptions } from '@/utils/request'; -/** 获取原材料盘点列表 GET /api/contract */ -export async function materialsInventoryList(params: API.MaterialsInventoryListParams, options?: RequestOptions) { +/** 获取原材料盘点列表 GET /api/materials-inventory */ +export async function materialsInventoryList( + params: API.MaterialsInventoryListParams, + options?: RequestOptions, +) { return request<{ - items?: API.ContractEntity[]; + items?: API.MaterialsInventoryEntity[]; meta?: { itemCount?: number; totalItems?: number; @@ -11,7 +14,7 @@ export async function materialsInventoryList(params: API.MaterialsInventoryListP totalPages?: number; currentPage?: number; }; - }>('/api/contract', { + }>('/api/materials-inventory', { method: 'GET', params: { // page has a default value: 1 @@ -25,9 +28,12 @@ export async function materialsInventoryList(params: API.MaterialsInventoryListP }); } -/** 新增原材料盘点 POST /api/contract */ -export async function contractCreate(body: API.ContractDto, options?: RequestOptions) { - return request('/api/contract', { +/** 新增原材料盘点 POST /api/materials-inventory */ +export async function materialsInventoryCreate( + body: API.MaterialsInventoryDto, + options?: RequestOptions, +) { + return request('/api/materials-inventory', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -37,29 +43,29 @@ export async function contractCreate(body: API.ContractDto, options?: RequestOpt }); } -/** 获取原材料盘点信息 GET /api/contract/${param0} */ -export async function contractInfo( +/** 获取原材料盘点信息 GET /api/materials-inventory/${param0} */ +export async function materialsInventoryInfo( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.ContractInfoParams, + params: API.MaterialsInventoryInfoParams, options?: RequestOptions, ) { const { id: param0, ...queryParams } = params; - return request(`/api/contract/${param0}`, { + return request(`/api/contract/${param0}`, { method: 'GET', params: { ...queryParams }, ...(options || {}), }); } -/** 解除原材料盘点和附件关联 PUT /api/contract/unlink-attachments/${param0} */ +/** 解除原材料盘点和附件关联 PUT /api/materials-inventory/unlink-attachments/${param0} */ export async function unlinkAttachments( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.ContractUpdateParams, - body: API.ContractUpdateDto, + params: API.MaterialsInventoryUpdateParams, + body: API.MaterialsInventoryDto, options?: RequestOptions, ) { const { id: param0, ...queryParams } = params; - return request(`/api/contract/unlink-attachments/${param0}`, { + return request(`/api/materials-inventory/unlink-attachments/${param0}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', @@ -70,15 +76,15 @@ export async function unlinkAttachments( }); } -/** 更新原材料盘点 PUT /api/contract/${param0} */ -export async function contractUpdate( +/** 更新原材料盘点 PUT /api/materials-inventory/${param0} */ +export async function MaterialsInventoryUpdate( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.ContractUpdateParams, - body: API.ContractUpdateDto, + params: API.MaterialsInventoryUpdateParams, + body: API.MaterialsInventoryUpdateDto, options?: RequestOptions, ) { const { id: param0, ...queryParams } = params; - return request(`/api/contract/${param0}`, { + return request(`/api/materials-inventory/${param0}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', @@ -89,14 +95,14 @@ export async function contractUpdate( }); } -/** 删除原材料盘点 DELETE /api/contract/${param0} */ -export async function contractDelete( +/** 删除原材料盘点 DELETE /api/materials-inventory/${param0} */ +export async function materialsInventoryDelete( // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.ContractDeleteParams, + params: API.MaterialsInventoryDeleteParams, options?: RequestOptions, ) { const { id: param0, ...queryParams } = params; - return request(`/api/contract/${param0}`, { + return request(`/api/materials-inventory/${param0}`, { method: 'DELETE', params: { ...queryParams }, ...(options || { successMsg: '删除成功' }), diff --git a/src/api/backend/api/systemDictType.ts b/src/api/backend/api/systemDictType.ts index 47c22bd..36a7652 100644 --- a/src/api/backend/api/systemDictType.ts +++ b/src/api/backend/api/systemDictType.ts @@ -90,9 +90,9 @@ export async function dictTypeDelete( }); } -/** 一次性获取所有的字典类型(不分页) GET /api/system/dict-type/select-options */ +/** 一次性获取所有的字典类型(不分页) GET /api/system/dict-type/all*/ export async function dictTypeGetAll(options?: RequestOptions) { - return request('/api/system/dict-type/select-options', { + return request('/api/system/dict-type/all', { method: 'GET', ...(options || {}), }); diff --git a/src/api/backend/api/typings.d.ts b/src/api/backend/api/typings.d.ts index bd5297b..6f33b90 100644 --- a/src/api/backend/api/typings.d.ts +++ b/src/api/backend/api/typings.d.ts @@ -1353,6 +1353,14 @@ declare namespace API { id: number; }; + type MaterialsInventoryUpdateParams = { + id: number; + }; + + type MaterialsInventoryInfoParams = { + id: number; + }; + type MaterialsInventoryListParams = { page?: number; pageSize?: number; @@ -1361,7 +1369,7 @@ declare namespace API { _t?: number; }; - type ContractEntity = { + type MaterialsInventoryEntity = { /** 公司名称 */ companyName: string; /** 产品名称(字典) */ @@ -1398,10 +1406,105 @@ declare namespace API { currentAmount: number; /** 经办人 */ agent: string; + /** 领料单号 */ + issuanceNumber?: number; + /** 备注 */ + remark: string; /** 附件 */ - files?: any[]; + files: number[]; id: number; createdAt: string; updatedAt: string; }; + type MaterialsInventoryDto = { + /** 公司名称 */ + companyName: string; + /** 产品名称(字典) */ + product: number; + /** 单位(字典) */ + unit: number; + /** 之前的库存数量 */ + previousInventoryQuantity: number; + /** 之前的单价 */ + previousUnitPrice: number; + /** 之前的金额 */ + previousAmount: number; + /** 入库时间 */ + inventoryTime: Date; + /** 入库数量 */ + inventoryQuantity: number; + /** 入库单价*/ + inventoryUnitPrice: number; + /** 入库金额 */ + inventoryAmount: number; + /** 出库时间 */ + outime: Date; + /** 出库数量 */ + outQuantity: number; + /** 出库单价 */ + outUnitPrice: number; + /** 出库金额 */ + outAmount: number; + /** 现在的结存数量 */ + currentInventoryQuantity: number; + /** 现在的单价 */ + currentUnitPrice: number; + /** 现在的金额 */ + currentAmount: number; + /** 经办人 */ + agent: string; + /** 领料单号 */ + issuanceNumber?: number; + /** 备注 */ + remark: string; + /** 附件 */ + files: number[]; + }; + type MaterialsInventoryUpdateDto = { + /** 公司名称 */ + companyName: string; + /** 产品名称(字典) */ + product: number; + /** 单位(字典) */ + unit: number; + /** 之前的库存数量 */ + previousInventoryQuantity: number; + /** 之前的单价 */ + previousUnitPrice: number; + /** 之前的金额 */ + previousAmount: number; + /** 入库时间 */ + inventoryTime: Date; + /** 入库数量 */ + inventoryQuantity: number; + /** 入库单价*/ + inventoryUnitPrice: number; + /** 入库金额 */ + inventoryAmount: number; + /** 出库时间 */ + outime: Date; + /** 出库数量 */ + outQuantity: number; + /** 出库单价 */ + outUnitPrice: number; + /** 出库金额 */ + outAmount: number; + /** 现在的结存数量 */ + currentInventoryQuantity: number; + /** 现在的单价 */ + currentUnitPrice: number; + /** 现在的金额 */ + currentAmount: number; + /** 经办人 */ + agent: string; + /** 领料单号 */ + issuanceNumber?: number; + /** 备注 */ + remark: string; + /** 附件 */ + files: number[]; + }; + type MaterialsInventoryDeleteParams = { + id: number; + }; } diff --git a/src/store/modules/dict.ts b/src/store/modules/dict.ts index e31a1f7..4a3aa10 100644 --- a/src/store/modules/dict.ts +++ b/src/store/modules/dict.ts @@ -2,10 +2,9 @@ import { ref } from 'vue'; import { defineStore } from 'pinia'; import Api from '@/api'; import { store } from '@/store'; -// interface DictState { -// /** 需要缓存的路由组件名称列表 */ -// list: API.DictItemDto[]; -// } +const needCachedKey = [ + 'contract_type', // 合同类型 +]; export const useDictStore = defineStore('dict', () => { const dictTypes = ref([]); diff --git a/src/views/meterials-inventory/index.vue b/src/views/meterials-inventory/index.vue index 8088863..68f167c 100644 --- a/src/views/meterials-inventory/index.vue +++ b/src/views/meterials-inventory/index.vue @@ -3,9 +3,9 @@