update: 表格组件新增表头插槽
This commit is contained in:
parent
80e2b02364
commit
deac9539c1
|
@ -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])) {
|
||||||
|
|
|
@ -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',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue