feat(后台): 日期筛选统一默认当天(7 页 + 告警铃铛),并带上看板列改造的在途改动
- utils/datetime 新增 todayDateInput()/todayDateTimeRange(),8 处日期筛选的初值与「重置」都锁当天; 撞款监控按口径排除(该页日期是 ASIN 上架时间,默认当天会让首屏几乎为空)。 - NotificationBell 的 hasFilter 不再把日期计入:日期恒有值是默认视图,计入会让 「无筛选才记录已提醒 id」那条分支永久失效。 - 新增护栏 tests/date-filter-default-today.test.ts(6 例,变异自证 3/3 转红): 凡带日期控件的页面没接入当天默认就红,不等人工发现首屏是空的。 - 同批带上另一路会话的看板在途改动(task-center-model 的 tabCount/完成数口径、 TaskCenterBoardPage 列改造与对应用例):它与本页的日期默认改动落在同一文件, 拆开会让单次提交编译不过,故按现状一起上。
This commit is contained in:
@@ -135,17 +135,37 @@ export function shopDisplayName(shopName: string | null | undefined, shopCount:
|
||||
return count > 1 ? `${name} 等${count}个` : name
|
||||
}
|
||||
|
||||
export function progressText(row: { progressSuccess: number; progressTotal: number }): string {
|
||||
const total = Number(row.progressTotal || 0)
|
||||
if (total <= 0) return '—'
|
||||
return `成功 ${Number(row.progressSuccess || 0)} / 总 ${total}`
|
||||
/** 页签徽章用的条数:只有接口真的回了非负数才算一个数,否则回 null 画「—」。
|
||||
* 麦象在结果表未注册时把 total 回成 -1 哨兵,`Number(x || 0)` 会把它读成 0 条。 */
|
||||
export function tabCount(total: unknown): number | null {
|
||||
if (total === null || total === undefined || total === '') return null
|
||||
const value = Number(total)
|
||||
return Number.isFinite(value) && value >= 0 ? value : null
|
||||
}
|
||||
|
||||
export function progressPercent(row: { progressSuccess: number; progressTotal: number }): number {
|
||||
/** 进度行:已完成数 = 成功 + 失败,与客户端一致(跑完一步就计入,不论成败)。
|
||||
* 见 frontend-vue `BrandBrandTab.vue`「完成数 = 已处理品牌行(成功或查询失败都计入)」;
|
||||
* 旧口径只数成功,会把「1 步全失败」的终态任务显示成 0 / 1。 */
|
||||
export interface TaskCenterProgress {
|
||||
progressSuccess: number
|
||||
progressFailed: number
|
||||
progressTotal: number
|
||||
}
|
||||
|
||||
function progressDone(row: TaskCenterProgress): number {
|
||||
return Math.max(0, Number(row.progressSuccess || 0)) + Math.max(0, Number(row.progressFailed || 0))
|
||||
}
|
||||
|
||||
export function progressText(row: TaskCenterProgress): string {
|
||||
const total = Number(row.progressTotal || 0)
|
||||
if (total <= 0) return '—'
|
||||
return `已完成 ${progressDone(row)} / 总 ${total}`
|
||||
}
|
||||
|
||||
export function progressPercent(row: TaskCenterProgress): number {
|
||||
const total = Number(row.progressTotal || 0)
|
||||
if (total <= 0) return 0
|
||||
const percent = Math.round((Number(row.progressSuccess || 0) / total) * 100)
|
||||
return Math.min(100, Math.max(0, percent))
|
||||
return Math.min(100, Math.max(0, Math.round((progressDone(row) / total) * 100)))
|
||||
}
|
||||
|
||||
/** datetime-local 原生值(YYYY-MM-DDTHH:mm) → 后端 LocalDateTime 兼容的秒级格式。 */
|
||||
|
||||
Reference in New Issue
Block a user