update: 表格组件新增表头插槽

This commit is contained in:
JiangQiming 2023-03-02 14:05:06 +08:00
parent 80e2b02364
commit deac9539c1
2 changed files with 19 additions and 0 deletions

View File

@ -337,6 +337,14 @@ const JTable = defineComponent<JTableProps>({
rowSelection={props.rowSelection} rowSelection={props.rowSelection}
scroll={props.scroll} scroll={props.scroll}
v-slots={{ v-slots={{
headerCell: (dt: Record<string, any>) => {
const { column, title } = dt;
if (column?.headerCell) {
return slots?.[column?.headerCell]!(column.title)
} else {
return title || ''
}
},
bodyCell: (dt: Record<string, any>) => { bodyCell: (dt: Record<string, any>) => {
const { column, record } = dt; const { column, record } = dt;
if ((column?.key || column?.dataIndex) && column?.scopedSlots && (slots?.[column?.dataIndex] || slots?.[column?.key])) { if ((column?.key || column?.dataIndex) && column?.scopedSlots && (slots?.[column?.dataIndex] || slots?.[column?.key])) {

View File

@ -40,6 +40,16 @@
</a-popconfirm> </a-popconfirm>
</a-space> </a-space>
</template> </template>
<template #gbChannelIdHeader="title">
<a-tooltip
title="国标级联有16位、20位两种格式。在当前页面修改不会修改视频设备-通道页面中的国标ID"
>
<a-space>
<span>{{ title }}</span>
<AIcon type="InfoCircleOutlined" />
</a-space>
</a-tooltip>
</template>
<template #gbChannelId="slotProps"> <template #gbChannelId="slotProps">
<a-space> <a-space>
<Ellipsis> <Ellipsis>
@ -172,6 +182,7 @@ const columns = [
dataIndex: 'gbChannelId', dataIndex: 'gbChannelId',
key: 'gbChannelId', key: 'gbChannelId',
scopedSlots: true, scopedSlots: true,
headerCell: 'gbChannelIdHeader', //
search: { search: {
type: 'string', type: 'string',
}, },