diff --git a/yunkes/src/components/YkStaffDetailModal.vue b/yunkes/src/components/YkStaffDetailModal.vue index 9b1d26d..bbd1615 100644 --- a/yunkes/src/components/YkStaffDetailModal.vue +++ b/yunkes/src/components/YkStaffDetailModal.vue @@ -12,6 +12,8 @@ interface Col { width?: number | string minWidth?: number | string 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<{ modelValue: boolean @@ -68,6 +70,7 @@ watch( :width="c.width" :min-width="c.minWidth" :align="c.align" + :formatter="c.formatter" show-overflow-tooltip /> diff --git a/yunkes/src/views/StaffList.vue b/yunkes/src/views/StaffList.vue index 29c9aac..43e6427 100644 --- a/yunkes/src/views/StaffList.vue +++ b/yunkes/src/views/StaffList.vue @@ -199,11 +199,14 @@ const detailFetcher = ref<(p: number, s: number) => Promise>( ) const detailCols = ref([]) +const fmtTime = (_r: any, _c: any, v: any): string => + typeof v === 'number' && v > 0 ? formatTime(v) : v ? String(v) : '--' + const baseCustomerCols = [ { prop: 'friend_nickname', label: '客户', minWidth: 140 }, { prop: 'phone', label: '客户号码', width: 130 }, - { prop: 'last_chat_time', label: '最后沟通', width: 150 }, - { prop: 'add_time', label: '添加时间', width: 150 }, + { prop: 'last_chat_time', label: '最后沟通', width: 150, formatter: fmtTime }, + { prop: 'add_time', label: '添加时间', width: 150, formatter: fmtTime }, ] function openAddedModal(row: Account) {