fix: incorrect value display for "Enable index column" (#6724)

This commit is contained in:
Katherine 2025-04-21 09:47:15 +08:00 committed by GitHub
parent 31a0189e2e
commit 374c569dc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 3 deletions

View File

@ -37,7 +37,7 @@ const enabledIndexColumn: SchemaSettingsItemType = {
const { dn } = useDesignable();
return {
title: t('Enable index column'),
checked: field.decoratorProps.enableSelectColumn !== false,
checked: field.decoratorProps.enableIndexÏColumn !== false,
onChange: async (enableIndexÏColumn) => {
field.decoratorProps = field.decoratorProps || {};
field.decoratorProps.enableIndexÏColumn = enableIndexÏColumn;

View File

@ -35,9 +35,34 @@ export const useValues = (options) => {
const option = (dataIndex && findOption(dataIndex, options)) || {};
const operators = option?.operators || [];
field.data.operators = operators?.filter((v) => {
if (dataIndex.length > 1) {
return v.value !== 'value';
const isOptionField = ['select', 'radioGroup', 'multipleSelect', 'checkboxGroup'].includes(
option?.interface || '',
);
const isDateField = [
'date',
'datetime',
'dateOnly',
'datetimeNoTz',
'unixTimestamp',
'createdAt',
'updatedAt',
].includes(option?.interface || '');
// 如果 多个字段,则排除 Value、DateScope、Options
if (dataIndex.length > 1 && [ActionType.Value, ActionType.DateScope, ActionType.Options].includes(v.value)) {
return false;
}
// 非选项字段,去掉 Options
if (!isOptionField && v.value === ActionType.Options) {
return false;
}
// 非时间字段,去掉 DateScope
if (!isDateField && v.value === ActionType.DateScope) {
return false;
}
return true;
});
field.data.schema = option?.schema;