From 0dd3b77f2d7b65f77dd1c38bbaa415cb11d132f9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 10 Mar 2023 09:45:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86=E7=9A=84=20date=20?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/formatTime.ts | 17 +++++++++++++++++ src/views/infra/config/index.vue | 21 +++++++++++---------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/utils/formatTime.ts b/src/utils/formatTime.ts index 9b0e4465..39671279 100644 --- a/src/utils/formatTime.ts +++ b/src/utils/formatTime.ts @@ -1,3 +1,5 @@ +import dayjs from 'dayjs' + /** * 时间日期转换 * @param date 当前时间,new Date() 格式 @@ -174,3 +176,18 @@ export function formatPast2(ms) { return 0 + '秒' } } + +/** + * element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式 + * + * @param row 行数据 + * @param column 字段 + * @param cellValue 字段值 + */ +// @ts-ignore +export const dateFormatter = (row, column, cellValue) => { + if (!cellValue) { + return + } + return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss') +} diff --git a/src/views/infra/config/index.vue b/src/views/infra/config/index.vue index dd15ff8c..68bb5896 100644 --- a/src/views/infra/config/index.vue +++ b/src/views/infra/config/index.vue @@ -88,7 +88,7 @@ - + @@ -105,13 +105,13 @@ - - - - +