feat(订单): 添加机柜和格口信息显示及参数过滤功能
在借还记录页面添加机柜名称和格口号显示,并新增工具函数过滤请求参数中的undefined和null值
This commit is contained in:
parent
7296994b51
commit
44d315a953
|
|
@ -184,6 +184,14 @@ export interface BorrowReturnRecordDTO {
|
||||||
status: number;
|
status: number;
|
||||||
/** 状态描述 */
|
/** 状态描述 */
|
||||||
statusStr: string;
|
statusStr: string;
|
||||||
|
/** 格口ID */
|
||||||
|
cellId?: number;
|
||||||
|
/** 格口号 */
|
||||||
|
cellNo?: number;
|
||||||
|
/** 柜机ID */
|
||||||
|
cabinetId?: number;
|
||||||
|
/** 柜机名称 */
|
||||||
|
cabinetName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取借还记录分页列表 */
|
/** 获取借还记录分页列表 */
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import { ElMessageBox } from "element-plus";
|
||||||
import { router } from "@/router";
|
import { router } from "@/router";
|
||||||
import { removeToken } from "@/utils/auth";
|
import { removeToken } from "@/utils/auth";
|
||||||
import { downloadByData } from "@pureadmin/utils";
|
import { downloadByData } from "@pureadmin/utils";
|
||||||
|
import { filterUndefinedAndNull } from "../tools/object";
|
||||||
// console.log("Utils:" + router);
|
// console.log("Utils:" + router);
|
||||||
|
|
||||||
const { VITE_APP_BASE_API } = import.meta.env;
|
const { VITE_APP_BASE_API } = import.meta.env;
|
||||||
|
|
@ -201,10 +202,13 @@ class PureHttp {
|
||||||
param?: AxiosRequestConfig,
|
param?: AxiosRequestConfig,
|
||||||
axiosConfig?: PureHttpRequestConfig
|
axiosConfig?: PureHttpRequestConfig
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
|
// 过滤param中的undefined和null值
|
||||||
|
const filteredParam = param ? filterUndefinedAndNull(param) : param;
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
...param,
|
...filteredParam,
|
||||||
...axiosConfig
|
...axiosConfig
|
||||||
} as PureHttpRequestConfig;
|
} as PureHttpRequestConfig;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -82,9 +82,6 @@ onMounted(() => {
|
||||||
<el-option label="已驳回" :value="3" />
|
<el-option label="已驳回" :value="3" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-form :inline="true" class="search-form bg-bg_color flex w-[99/100] pl-[22px] pt-0">
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" :icon="useRenderIcon(Search)" @click="onSearch" style="margin-right: 10px;">
|
<el-button type="primary" :icon="useRenderIcon(Search)" @click="onSearch" style="margin-right: 10px;">
|
||||||
搜索
|
搜索
|
||||||
|
|
@ -103,6 +100,16 @@ onMounted(() => {
|
||||||
{{ row.orderTime ? new Date(row.orderTime).toLocaleString() : '-' }}
|
{{ row.orderTime ? new Date(row.orderTime).toLocaleString() : '-' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="机柜名称" prop="cabinetName" width="150">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.cabinetName || '-' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="格口号" prop="cellNo" width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
{{ row.cellNo || '-' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="商品价格" prop="goodsPrice" width="120">
|
<el-table-column label="商品价格" prop="goodsPrice" width="120">
|
||||||
<template #default="{ row }">{{ row.goodsPrice }}元</template>
|
<template #default="{ row }">{{ row.goodsPrice }}元</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue