修复pagetype列表页不按In List View属性显示字段的问题
This commit is contained in:
parent
fc7e166bc9
commit
33f0b6f049
@ -487,11 +487,13 @@ function onFilterChange() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const displayColumns = computed(() => {
|
const displayColumns = computed(() => {
|
||||||
// 生成列表列:优先 in_list_view,并排除分隔类
|
// 生成列表列:严格使用 in_list_view 属性,排除分隔类
|
||||||
const isDisplayable = (f: any) => !['Section Break', 'Column Break', 'Tab Break'].includes(f.fieldtype)
|
const isDisplayable = (f: any) => !['Section Break', 'Column Break', 'Tab Break'].includes(f.fieldtype)
|
||||||
const display = metaFields.value.filter((f: any) => f.in_list_view && isDisplayable(f))
|
const display = metaFields.value.filter((f: any) => f.in_list_view && isDisplayable(f))
|
||||||
const base = (display.length ? display : metaFields.value.filter(isDisplayable)).slice(0, 8)
|
|
||||||
const cols: any[] = base.map((f: any) => ({ title: f.label || f.fieldname, key: f.fieldname }))
|
// 不再回退到显示所有字段,如果没有设置 in_list_view,则只显示 name
|
||||||
|
const cols: any[] = display.slice(0, 30).map((f: any) => ({ title: f.label || f.fieldname, key: f.fieldname }))
|
||||||
|
|
||||||
// 确保有 name 列
|
// 确保有 name 列
|
||||||
if (!cols.find(c => c.key === 'name')) cols.unshift({ title: 'ID', key: 'name' })
|
if (!cols.find(c => c.key === 'name')) cols.unshift({ title: 'ID', key: 'name' })
|
||||||
return cols
|
return cols
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user