feat(workbench): show progress update time first

This commit is contained in:
caoxiaozhu
2026-06-03 12:28:21 +08:00
parent 27dd2f0a0d
commit 6fc5e66ea1
4 changed files with 70 additions and 6 deletions

View File

@@ -205,6 +205,11 @@
class="progress-row"
@click="openWorkbenchTarget(item)"
>
<span class="progress-time">
<time :datetime="item.updatedAt || ''">{{ item.displayTime }}</time>
<small>更新</small>
</span>
<span class="progress-identity">
<strong>{{ item.id }}</strong>
<small>{{ item.title }}</small>
@@ -459,9 +464,26 @@ const visibleProgressItems = computed(() => {
const rows = Array.isArray(props.workbenchSummary.progressItems)
? props.workbenchSummary.progressItems
: []
return rows.slice(0, 5)
return rows.slice(0, 5).map((item) => ({
...item,
displayTime: formatProgressTime(item?.updatedAt)
}))
})
function formatProgressTime(value) {
const text = String(value || '').trim()
if (!text) {
return '最近更新'
}
const match = /^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2}))?/.exec(text)
if (match) {
return match[4] ? `${match[2]}-${match[3]} ${match[4]}:${match[5]}` : `${match[2]}-${match[3]}`
}
return text
}
function buildSelectedFileKey(file) {
return [file?.name, file?.size, file?.lastModified, file?.type].join('__')
}