根据对接实施方案文档修改

This commit is contained in:
2026-03-20 18:11:49 +08:00
parent ed5665cb85
commit 5d8a0564b4
14 changed files with 1320 additions and 16 deletions

View File

@@ -0,0 +1,45 @@
<template>
<div>{{ formattedValue }}</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { TableColumnCtx } from 'element-plus'
import { getCellValue } from '/@/components/table/index'
interface Props {
row: TableRow
field: TableColumn
column: TableColumnCtx<TableRow>
index: number
}
const props = defineProps<Props>()
const cellValue = getCellValue(props.row, props.field, props.column, props.index)
const formattedValue = computed(() => {
if (cellValue === null || cellValue === undefined || cellValue === '') return '-'
// PlayX “业务日期”在后端为 YYYY-MM-DD或 YYYY-MM-DDTHH:mm:ssZ
// 这里尽量“按字符串原样”处理,避免 new Date('YYYY-MM-DD') 的时区差导致日期偏移 1 天。
const s = typeof cellValue === 'string' ? cellValue : String(cellValue)
// 常见 ISO/日期字符串截取
const m = s.match(/^(\d{4}-\d{2}-\d{2})/)
if (m) return m[1]
// 如果后端返回的是秒级时间戳,做兜底:用本地日期组件拼出 YYYY-MM-DD
const n = Number(cellValue)
if (Number.isFinite(n) && s.length === 10) {
const d = new Date(n * 1000)
const y = d.getFullYear()
const mm = String(d.getMonth() + 1).padStart(2, '0')
const dd = String(d.getDate()).padStart(2, '0')
return `${y}-${mm}-${dd}`
}
return s
})
</script>