Commit b372c688 authored by hzl's avatar hzl

feat: 增加修改时间字段

parent d49a952c
......@@ -58,6 +58,11 @@
<el-table-column prop="actId" label="账户ID" align="center" />
<el-table-column prop="name" label="账户名称" align="center" />
<el-table-column prop="pkg" label="应用包名" align="center" />
<el-table-column label="更新时间" align="center" width="180">
<template slot-scope="scope">
<span>{{ formatDateTime(scope.row.updatedAt) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="授权状态" align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">-->
......@@ -364,6 +369,36 @@ export default {
default:
return '未知'
}
},
// 格式化日期时间
formatDateTime(dateTime) {
if (!dateTime) {
return '-'
}
try {
// 解析ISO 8601格式的时间字符串
const date = new Date(dateTime)
// 检查日期是否有效
if (isNaN(date.getTime())) {
return '-'
}
// 格式化为 YYYY-MM-DD HH:mm:ss
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
} catch (error) {
console.error('格式化时间失败:', error)
return '-'
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment