From 452e16ce2f8ebf7b95604e3f5fa5b486f6942b86 Mon Sep 17 00:00:00 2001 From: fyy <2717885210@qq.com> Date: Wed, 27 Aug 2025 23:47:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=9A=E8=A1=8C=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E3=80=81=E8=BD=A6=E8=BE=86=E9=80=9A=E8=A1=8C=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resident/carPassRecordManagement/data.ts | 164 ++++++----- .../carPassRecordManagement/index.vue | 201 ++++++++++---- .../record-detail-modal.vue | 256 ++++++++++++++++++ .../views/property/resident/person/index.vue | 12 +- .../personPassRecordManagement/data.ts | 40 +-- .../personPassRecordManagement/index.vue | 13 +- .../record-detail-modal.vue | 18 +- 7 files changed, 542 insertions(+), 162 deletions(-) diff --git a/apps/web-antd/src/views/property/resident/carPassRecordManagement/data.ts b/apps/web-antd/src/views/property/resident/carPassRecordManagement/data.ts index 96da3f8d..11573ef1 100644 --- a/apps/web-antd/src/views/property/resident/carPassRecordManagement/data.ts +++ b/apps/web-antd/src/views/property/resident/carPassRecordManagement/data.ts @@ -1,41 +1,12 @@ import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; -import { getDictOptions } from '#/utils/dict'; -import { renderDict } from '#/utils/render'; +import dayjs from 'dayjs'; export const querySchema: FormSchemaGetter = () => [ { component: 'Input', - fieldName: 'actionTime', - label: '通行时间', - }, - { - component: 'Input', - fieldName: 'customerName', - label: '人员姓名', - }, - { - component: 'Input', - fieldName: 'organFullPath', - label: '组织机构', - }, - { - component: 'Input', - fieldName: 'doorName', - label: '门/电梯名称', - }, - { - component: 'Input', - fieldName: 'deviceName', - label: '设备名称', - }, - { - component: 'Select', - componentProps: { - options: getDictOptions('wy_txjllx'), - }, - fieldName: 'recordType', - label: '记录类型', + fieldName: 'orderId', + label: '订单编号', }, ]; @@ -54,22 +25,31 @@ export const columns: VxeGridProps['columns'] = [ { title: '订单编号', field: 'orderId', - width: 100, + minWidth: 200, }, { title: '车场名称', field: 'plName', - width: 100, + width: 'auto', }, { title: '停车类型', field: 'carBusiType', - slots: { - default: ({ row }) => { - return renderDict(row.deviceType, 'wy_txjlsblb'); - }, - }, width: 100, + formatter: ({ cellValue }) => { + // 停车类型转换 + // 10:临时车,11, 12, 13:月租车,其他:未知 + switch (cellValue) { + case 10: + return '临时车'; + case 11: + case 12: + case 13: + return '月租车'; + default: + return '未知'; + } + }, }, { title: '车牌号', @@ -80,6 +60,18 @@ export const columns: VxeGridProps['columns'] = [ title: '车辆类型', field: 'carType', width: 100, + formatter: ({ cellValue }) => { + switch (cellValue) { + case 1: + return '大型车'; + case 2: + return '小型车'; + case 3: + return '新能源车'; + default: + return '未知'; + } + }, }, { title: '应收', @@ -89,55 +81,99 @@ export const columns: VxeGridProps['columns'] = [ { title: '实收', field: 'orderActFee', - slots: { - default: ({ row }) => { - return renderDict(row.cardType, 'wy_txjlmklb'); - }, - }, width: 100, }, { title: '停车时长', field: 'parkingDuration', - slots: { - default: ({ row }) => { - return renderDict(row.gatewayType, 'wy_txjlcrlx'); - }, + width: 150, + formatter: ({ cellValue }) => { + // 将秒数转换为友好的时间格式 + if (!cellValue && cellValue !== 0) return ''; + + const totalSeconds = Number(cellValue); + if (isNaN(totalSeconds)) return cellValue; + + // 计算天、小时、分钟和秒 + const days = Math.floor(totalSeconds / 86400); + const hours = Math.floor((totalSeconds % 86400) / 3600); + const minutes = Math.floor((totalSeconds % 3600) / 60); + const seconds = Math.floor(totalSeconds % 60); + + // 格式化显示 + let result = ''; + if (days > 0) result += `${days}天`; + if (hours > 0) result += `${hours}小时`; + if (minutes > 0) result += `${minutes}分钟`; + if (seconds > 0 || result === '') result += `${seconds}秒`; + + return result; }, - width: 100, }, { title: '进场时间', field: 'parkInTime', - width: 100, + width: 150, + formatter: ({ cellValue }) => { + // 如果没有值,直接返回空字符串 + if (!cellValue) return ''; + + // 使用 dayjs 格式化时间戳 + // 如果是时间戳(数字或数字字符串) + if (typeof cellValue === 'number' || /^\d+$/.test(cellValue.toString())) { + return dayjs(Number(cellValue)).format('YYYY-MM-DD HH:mm:ss'); + } + + // 如果已经是日期字符串,尝试解析后格式化 + const date = dayjs(cellValue); + if (date.isValid()) { + return date.format('YYYY-MM-DD HH:mm:ss'); + } + + // 如果无法解析,返回原始值 + return cellValue; + }, }, { title: '出场时间', field: 'parkOutTime', - slots: { - default: ({ row }) => { - return renderDict(row.recordType, 'wy_txjllx'); - }, - }, width: 100, + formatter: ({ cellValue }) => { + // 如果没有值,直接返回空字符串 + if (!cellValue) return ''; + + // 使用 dayjs 格式化时间戳 + // 如果是时间戳(数字或数字字符串) + if (typeof cellValue === 'number' || /^\d+$/.test(cellValue.toString())) { + return dayjs(Number(cellValue)).format('YYYY-MM-DD HH:mm:ss'); + } + + // 如果已经是日期字符串,尝试解析后格式化 + const date = dayjs(cellValue); + if (date.isValid()) { + return date.format('YYYY-MM-DD HH:mm:ss'); + } + + // 如果无法解析,返回原始值 + return cellValue; + }, }, { title: '备注', field: 'remark', - slots: { - default: ({ row }) => { - return renderDict(row.recordType, 'wy_txjllx'); - }, - }, + width: 100, }, { title: '状态', field: 'parkState', - slots: { - default: ({ row }) => { - return renderDict(row.recordType, 'wy_txjllx'); - }, + formatter: ({ cellValue }) => { + switch (cellValue) { + case 10: + return '在场'; + case 20: + return '离场'; + } }, width: 100, }, diff --git a/apps/web-antd/src/views/property/resident/carPassRecordManagement/index.vue b/apps/web-antd/src/views/property/resident/carPassRecordManagement/index.vue index 6ef5c95b..427a0b32 100644 --- a/apps/web-antd/src/views/property/resident/carPassRecordManagement/index.vue +++ b/apps/web-antd/src/views/property/resident/carPassRecordManagement/index.vue @@ -1,21 +1,72 @@