This commit is contained in:
zlwu committed 2026-06-30 23:44:22 +08:00
1 parent d84f4b944c
commit 7c838cfb2d
249 files changed
+50600 -18556

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
import { fetchCategoryList } from '@/api/admin'
import { fetchCategoryList } from '@/api/demo'
import { fetchAllPagedRecords } from '@/utils/fetch-paged-list'
import { buildTreePathLabelFromFlat } from '@/utils/tree-path'
+19
View File
@@ -25,6 +25,25 @@ export function pickBxData<T>(res: unknown): T {
return res as T
}
/** 解析分页列表响应 */
export function pickBxPageResult<T>(res: unknown): { list: T[]; total: number } {
const payload = pickBxData<{ list?: T[]; rows?: T[]; total?: number } | T[]>(res)
if (Array.isArray(payload)) {
return { list: payload, total: payload.length }
}
if (payload && typeof payload === 'object') {
const record = payload as { list?: T[]; rows?: T[]; total?: number }
const list = Array.isArray(record.list)
? record.list
: Array.isArray(record.rows)
? record.rows
: []
const total = typeof record.total === 'number' ? record.total : list.length
return { list, total }
}
return { list: [], total: 0 }
}
/** 解析列表类响应,保证始终返回数组 */
export function pickBxList<T>(res: unknown): T[] {
const payload = pickBxData<T[] | { list?: T[]; rows?: T[] }>(res)
@@ -0,0 +1,64 @@
import type { CertRead, VehicleDetail } from '@/api/pl'
import type { VehiclePersonnelViewRow } from '@/components/business/pl-vehicle-personnel-view-list/index.vue'
import type { VehicleViewBundle } from '@/composables/usePlVehicleViewDetail'
export interface TransportResourceSnapshotCert extends CertRead {}
export interface TransportResourceSnapshotPersonnel {
personnelId?: string
personnelName: string
phoneNo?: string
age?: number | null
idCardNo?: string
role: string
isDefault?: number
remark?: string
certList?: TransportResourceSnapshotCert[]
}
export interface TransportResourceSnapshot {
snapshottedAt?: string
vehicleId: string
vehicleType: string
carrierId?: string
carrierName?: string
licensePlate: string
trailerNo?: string
loadCapacity?: number | string | null
vehicleStatus: string
certList?: TransportResourceSnapshotCert[]
personnelList?: TransportResourceSnapshotPersonnel[]
personnelSummary?: string
selectedDriverId?: string
}
/** 将计划/运输单上的资源快照转为车辆查看组件可消费的 bundle */
export function snapshotToVehicleViewBundle(
snapshot: TransportResourceSnapshot
): VehicleViewBundle {
const detail: VehicleDetail = {
id: snapshot.vehicleId,
vehicleType: snapshot.vehicleType,
carrierId: snapshot.carrierId,
carrierName: snapshot.carrierName,
licensePlate: snapshot.licensePlate,
trailerNo: snapshot.trailerNo,
loadCapacity: snapshot.loadCapacity != null ? Number(snapshot.loadCapacity) : undefined,
vehicleStatus: snapshot.vehicleStatus,
certList: (snapshot.certList || []) as CertRead[],
createTime: snapshot.snapshottedAt || ''
}
const personnelList: VehiclePersonnelViewRow[] = (snapshot.personnelList || []).map(person => ({
personnelId: person.personnelId,
personnelName: person.personnelName,
phoneNo: person.phoneNo,
age: person.age,
role: person.role,
isDefault: person.isDefault,
remark: person.remark,
certList: person.certList || []
}))
return { detail, personnelList }
}
+8 -1
View File
@@ -33,6 +33,10 @@
* @module utils/table/tableConfig
* @author Art Design Pro Team
*/
/** 列表分页默认每页条数 */
export const DEFAULT_LIST_PAGE_SIZE = 20
export const tableConfig = {
// 响应数据字段映射配置,系统会从接口返回数据中按顺序查找这些字段
// 列表数据
@@ -51,5 +55,8 @@ export const tableConfig = {
current: 'current',
// 每页大小
size: 'size'
}
},
/** 列表分页默认每页条数 */
defaultPageSize: DEFAULT_LIST_PAGE_SIZE
}