This commit is contained in:
yin 2026-10-01 18:02:21 +08:00
parent 52810f991f
commit d6314aa7a1
2 changed files with 14 additions and 3 deletions

View File

@ -215,10 +215,16 @@ export function readNumberText(value: unknown): string {
return `${sign}${grouped}${decimal}`
}
/** 统计区间文案:只到**日期**(`2026-09-01 ~ 2026-09-30`),移动端一行放得下 */
/**
* 统计区间文案:只到**日期**(`2026-09-01 ~ 2026-09-30`),移动端一行放得下
*
* 与 new3 表格里的「区间开始 / 区间结束」两列是同一对字段(`start_time` / `end_time`),
* 这里合成一行。⚠️ 接口文档未展开响应字段,无法保证后端一定下发;
* **没下发时返回 `''`**(页面据此整行不显示,而不是摆一个没意义的「—」)
*/
export function readPeriodText(item: ReportItem | undefined | null): string {
const start = item?.start_time ? String(item.start_time).slice(0, 10) : ''
const end = item?.end_time ? String(item.end_time).slice(0, 10) : ''
if (start && end) return `${start} ~ ${end}`
return start || end || '—'
return start || end || ''
}

View File

@ -99,7 +99,7 @@
</view>
</view>
<view class="rpt__period">统计区间 {{ periodTextOf(item) }}</view>
<view v-if="periodTextOf(item)" class="rpt__period">统计区间 {{ periodTextOf(item) }}</view>
</view>
</template>
@ -211,6 +211,11 @@ const hasFilter = computed(
)
const numTextOf = (value: unknown): string => readNumberText(value)
/**
* 统计区间文案(`item.start_time` / `item.end_time`,即 new3 表格的「区间开始 / 区间结束」)
*
* 返回空字符串 = 后端没下发 → 模板里整行不显示(避免每张卡都挂个「统计区间 —」)
*/
const periodTextOf = (item: ReportItem): string => readPeriodText(item)
/** 总页数(按固定每页条数算;总数 0 时也算 1 页,避免出现「第 1/0 页」) */