diff --git a/src/api/shop/order.ts b/src/api/shop/order.ts index 28134f7..d175e60 100644 --- a/src/api/shop/order.ts +++ b/src/api/shop/order.ts @@ -184,6 +184,14 @@ export interface BorrowReturnRecordDTO { status: number; /** 状态描述 */ statusStr: string; + /** 格口ID */ + cellId?: number; + /** 格口号 */ + cellNo?: number; + /** 柜机ID */ + cabinetId?: number; + /** 柜机名称 */ + cabinetName?: string; } /** 获取借还记录分页列表 */ diff --git a/src/utils/http/index.ts b/src/utils/http/index.ts index 6382eac..b5db671 100644 --- a/src/utils/http/index.ts +++ b/src/utils/http/index.ts @@ -17,6 +17,7 @@ import { ElMessageBox } from "element-plus"; import { router } from "@/router"; import { removeToken } from "@/utils/auth"; import { downloadByData } from "@pureadmin/utils"; +import { filterUndefinedAndNull } from "../tools/object"; // console.log("Utils:" + router); const { VITE_APP_BASE_API } = import.meta.env; @@ -201,10 +202,13 @@ class PureHttp { param?: AxiosRequestConfig, axiosConfig?: PureHttpRequestConfig ): Promise { + // 过滤param中的undefined和null值 + const filteredParam = param ? filterUndefinedAndNull(param) : param; + const config = { method, url, - ...param, + ...filteredParam, ...axiosConfig } as PureHttpRequestConfig; diff --git a/src/utils/tools/object.ts b/src/utils/tools/object.ts new file mode 100644 index 0000000..e1be05c --- /dev/null +++ b/src/utils/tools/object.ts @@ -0,0 +1,23 @@ + +/** 过滤掉值为undefined和null的字段 */ +export const filterUndefinedAndNull = (obj: any): any => { + if (obj === null || obj === undefined) { + return obj; + } + + if (Array.isArray(obj)) { + return obj.map(item => filterUndefinedAndNull(item)); + } + + if (typeof obj === 'object') { + const filteredObj: any = {}; + for (const [key, value] of Object.entries(obj)) { + if (value !== undefined && value !== null) { + filteredObj[key] = filterUndefinedAndNull(value); + } + } + return filteredObj; + } + + return obj; +} \ No newline at end of file diff --git a/src/views/shop/goods/borrow-return-record.vue b/src/views/shop/goods/borrow-return-record.vue index d658e5a..79d6131 100644 --- a/src/views/shop/goods/borrow-return-record.vue +++ b/src/views/shop/goods/borrow-return-record.vue @@ -82,9 +82,6 @@ onMounted(() => { - - - 搜索 @@ -103,6 +100,16 @@ onMounted(() => { {{ row.orderTime ? new Date(row.orderTime).toLocaleString() : '-' }} + + + + + +