Skip to content

Commit d4fee8c

Browse files
akfdwjxwangjinpeng1235
authored andcommitted
TableProps add Primary key column show name
1 parent 7a4b229 commit d4fee8c

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/components/conf.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as eb from './eventbus'
1010
export interface TableConf extends CommonFunctionProps {
1111
id: string
1212
pkColumnName: string
13+
pkColumnShowName?: string
1314
parentPkColumnName?: string
1415
columns: TableColumnProps[]
1516
styles: TableStyleProps
@@ -44,6 +45,7 @@ export function init(props: SimpleTableProps): {
4445
id: tableProps.id,
4546
pkColumnName: tableProps.pkColumnName,
4647
parentPkColumnName: tableProps.parentPkColumnName,
48+
pkColumnShowName: tableProps.pkColumnShowName,
4749
columns: tableProps.columns,
4850
styles: tableProps.styles,
4951
quickSearch: tableProps.quickSearch,

src/components/layout/list/List.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ onMounted(() => {
105105
<RowsComp
106106
:records="props.layoutConf.data.records"
107107
:pk-column-name="props.tableConf.pkColumnName"
108+
:pk-column-show-name="props.tableConf.pkColumnShowName"
108109
:parent-pk-column-name="props.tableConf.parentPkColumnName"
109110
:sub-data-show-kind="props.layoutConf.subDataShowKind"
110111
:pk-kind-is-number="pkKindIsNumber"

src/components/layout/list/ListRows.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ const props = defineProps<{
1414
// 主键列名
1515
// Primary key column name
1616
pkColumnName: string
17+
// 主键列显示名
18+
// Primary key column show name
19+
pkColumnShowName?: string
1720
// 父主键列名
1821
// Parent primary key column name
1922
parentPkColumnName?: string
@@ -78,7 +81,7 @@ const props = defineProps<{
7881
>
7982
<div v-if="props.subDataShowKind === SubDataShowKind.FOLD_SUB_DATA && props.parentPkColumnName" class="flex justify-end" :style="{ width: `${15 * (row[NODE_DEPTH_FLAG] + 1)}px` }" v-html="renderTreeToggleHandler(props.records[idx + 1] && row[props.pkColumnName] === props.records[idx + 1][props.parentPkColumnName])" />
8083
<i v-else-if="props.subDataShowKind === SubDataShowKind.TILE_ALL_DATA && props.parentPkColumnName && row[props.parentPkColumnName]" :class="`${iconSvg.SUB}`" />
81-
{{ row[props.pkColumnName] }}
84+
{{ row[props.pkColumnShowName || props.pkColumnName] }}
8285
</div>
8386
<!-- 常规数据列 -->
8487
<!-- Normal data column -->
@@ -91,7 +94,7 @@ const props = defineProps<{
9194
<!-- 优先使用自定义渲染 -->
9295
<!-- Prefer custom rendering -->
9396
<div v-if="column.name === 'name'" style="display: none;" class="hover-edit invisible group-hover/item:visible cursor-pointer bg-white h-full flex items-center absolute right-0 top-0 pr-1">
94-
<i class="octicon-pencil-24"></i>
97+
<i class="octicon-pencil-24" />
9598
</div>
9699
<div v-if="column.render" v-html="column.render(row, props.layoutKind)" />
97100
<template v-else-if="column.dataKind === DataKind.DATE || column.dataKind === DataKind.TIME || column.dataKind === DataKind.DATETIME">

src/props/kernelProps.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ export interface TableProps extends CommonFunctionProps {
344344
* After enabling, only the first layout will be displayed, and functions such as filter, group, sort, and table configuration will not be displayed.
345345
*/
346346
mini: boolean
347+
/**
348+
* 主键列显示名
349+
*
350+
* Primary key column show name
351+
*/
352+
pkColumnShowName?: string
347353
}
348354
/**
349355
* 简单表格属性
@@ -545,6 +551,12 @@ export interface SimpleTableProps extends SimpleCommonFunctionProps {
545551
* After enabling, only the first layout will be displayed, and functions such as filter, group, sort, and table configuration will not be displayed.
546552
*/
547553
mini?: boolean
554+
/**
555+
* 主键列显示名
556+
*
557+
* Primary key column show name
558+
*/
559+
pkColumnShowName?: string
548560
}
549561
/**
550562
* 生成表格属性
@@ -572,6 +584,7 @@ export function generateTableProps(simple: SimpleTableProps): TableProps {
572584
})),
573585
styles: generateTableStyleProps(simple.styles ?? {}),
574586
mini: simple.mini ?? false,
587+
pkColumnShowName: simple.pkColumnShowName,
575588
}
576589
}
577590

0 commit comments

Comments
 (0)