fix(staff): format time columns in detail modal
YkStaffDetailModal Col gains optional formatter; baseCustomerCols time cols render via formatTime instead of raw epoch. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ interface Col {
|
|||||||
width?: number | string
|
width?: number | string
|
||||||
minWidth?: number | string
|
minWidth?: number | string
|
||||||
align?: 'left' | 'center' | 'right'
|
align?: 'left' | 'center' | 'right'
|
||||||
|
/** el-table-column formatter (row, column, cellValue, index) → display string. */
|
||||||
|
formatter?: (row: any, column: any, cellValue: any, index: number) => string
|
||||||
}
|
}
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: boolean
|
modelValue: boolean
|
||||||
@@ -68,6 +70,7 @@ watch(
|
|||||||
:width="c.width"
|
:width="c.width"
|
||||||
:min-width="c.minWidth"
|
:min-width="c.minWidth"
|
||||||
:align="c.align"
|
:align="c.align"
|
||||||
|
:formatter="c.formatter"
|
||||||
show-overflow-tooltip
|
show-overflow-tooltip
|
||||||
/>
|
/>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|||||||
@@ -199,11 +199,14 @@ const detailFetcher = ref<(p: number, s: number) => Promise<any>>(
|
|||||||
)
|
)
|
||||||
const detailCols = ref<any[]>([])
|
const detailCols = ref<any[]>([])
|
||||||
|
|
||||||
|
const fmtTime = (_r: any, _c: any, v: any): string =>
|
||||||
|
typeof v === 'number' && v > 0 ? formatTime(v) : v ? String(v) : '--'
|
||||||
|
|
||||||
const baseCustomerCols = [
|
const baseCustomerCols = [
|
||||||
{ prop: 'friend_nickname', label: '客户', minWidth: 140 },
|
{ prop: 'friend_nickname', label: '客户', minWidth: 140 },
|
||||||
{ prop: 'phone', label: '客户号码', width: 130 },
|
{ prop: 'phone', label: '客户号码', width: 130 },
|
||||||
{ prop: 'last_chat_time', label: '最后沟通', width: 150 },
|
{ prop: 'last_chat_time', label: '最后沟通', width: 150, formatter: fmtTime },
|
||||||
{ prop: 'add_time', label: '添加时间', width: 150 },
|
{ prop: 'add_time', label: '添加时间', width: 150, formatter: fmtTime },
|
||||||
]
|
]
|
||||||
|
|
||||||
function openAddedModal(row: Account) {
|
function openAddedModal(row: Account) {
|
||||||
|
|||||||
Reference in New Issue
Block a user