mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
chore: 简单查询条件在crud中设置,而不是表单项中配置 (#6636)
This commit is contained in:
parent
3c30eb5e55
commit
1b7f76bf6d
@ -115,7 +115,6 @@ export class ButtonGroupControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('multiple'),
|
||||
getSchemaTpl('valueFormula', {
|
||||
rendererSchema: context?.schema,
|
||||
|
@ -106,7 +106,6 @@ export class ChainedSelectControlPlugin extends BasePlugin {
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('valueFormula', {
|
||||
rendererSchema: context?.schema,
|
||||
mode: 'vertical', // 改成上下展示模式
|
||||
|
@ -107,7 +107,6 @@ export class CheckboxControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('option'),
|
||||
{
|
||||
type: 'ae-switch-more',
|
||||
|
@ -126,7 +126,6 @@ export class CheckboxesControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
[
|
||||
getSchemaTpl('switch', {
|
||||
label: '可全选',
|
||||
|
@ -105,7 +105,6 @@ export class CityControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('valueFormula', {
|
||||
rendererSchema: context?.schema,
|
||||
rendererWrapper: true,
|
||||
|
@ -182,7 +182,6 @@ export class ColorControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
{
|
||||
type: 'select',
|
||||
label: '值格式',
|
||||
|
@ -267,10 +267,6 @@ export class DateControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {
|
||||
context,
|
||||
type: 'date'
|
||||
}),
|
||||
getSchemaTpl('selectDateType', {
|
||||
value: this.scaffold.type,
|
||||
onChange: (
|
||||
|
@ -306,7 +306,6 @@ export class DateRangeControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('selectDateRangeType', {
|
||||
value: this.scaffold.type,
|
||||
onChange: (
|
||||
|
@ -146,10 +146,6 @@ export class NumberControlPlugin extends BasePlugin {
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
|
||||
getSchemaTpl('crudFilterOperator', {
|
||||
context,
|
||||
type: 'number'
|
||||
}),
|
||||
{
|
||||
type: 'switch',
|
||||
label: tipedLabel(
|
||||
|
@ -127,8 +127,6 @@ export class RangeControlPlugin extends BasePlugin {
|
||||
label: 'Label'
|
||||
}),
|
||||
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
|
||||
{
|
||||
label: '方式',
|
||||
name: 'multiple',
|
||||
|
@ -105,7 +105,6 @@ export class RateControlPlugin extends BasePlugin {
|
||||
label: 'Label'
|
||||
}),
|
||||
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('valueFormula', {
|
||||
rendererSchema: {
|
||||
...context?.schema,
|
||||
|
@ -142,7 +142,6 @@ export class TagControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('clearable'),
|
||||
getSchemaTpl('optionsTip'),
|
||||
getSchemaTpl('valueFormula', {
|
||||
|
@ -169,7 +169,6 @@ export class TextControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context, type: 'text'}),
|
||||
getSchemaTpl('inputType', {
|
||||
value: this.scaffold.type,
|
||||
onChange: (
|
||||
|
@ -284,7 +284,6 @@ export class TreeControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
{
|
||||
type: 'button-group-select',
|
||||
name: 'type',
|
||||
|
@ -109,7 +109,6 @@ export class ListControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('multiple'),
|
||||
getSchemaTpl('extractValue'),
|
||||
getSchemaTpl('valueFormula', {
|
||||
|
@ -120,7 +120,6 @@ export class MatrixControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('multiple', {
|
||||
value: true
|
||||
}),
|
||||
|
@ -208,7 +208,6 @@ export class NestedSelectControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('clearable'),
|
||||
{
|
||||
type: 'ae-Switch-More',
|
||||
|
@ -112,7 +112,6 @@ export class PickerControlPlugin extends BasePlugin {
|
||||
}),
|
||||
|
||||
getSchemaTpl('switchDefaultValue'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
|
||||
{
|
||||
type: 'input-text',
|
||||
|
@ -121,7 +121,6 @@ export class RadiosControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('valueFormula', {
|
||||
rendererSchema: context?.schema,
|
||||
useSelectMode: true, // 改用 Select 设置模式
|
||||
|
@ -221,7 +221,6 @@ export class SelectControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('clearable'),
|
||||
getSchemaTpl('searchable'),
|
||||
getSchemaTpl('multiple', {
|
||||
|
@ -89,7 +89,6 @@ export class SwitchControlPlugin extends BasePlugin {
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
{
|
||||
name: 'option',
|
||||
type: 'input-text',
|
||||
|
@ -123,7 +123,6 @@ export class TextareaControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
getSchemaTpl('valueFormula', {
|
||||
rendererSchema: context?.schema,
|
||||
mode: 'vertical' // 改成上下展示模式
|
||||
|
@ -268,7 +268,6 @@ export class TreeSelectControlPlugin extends BasePlugin {
|
||||
required: true
|
||||
}),
|
||||
getSchemaTpl('label'),
|
||||
getSchemaTpl('crudFilterOperator', {context}),
|
||||
{
|
||||
type: 'button-group-select',
|
||||
name: 'type',
|
||||
|
@ -1,88 +0,0 @@
|
||||
import {
|
||||
setSchemaTpl,
|
||||
getSchemaTpl,
|
||||
tipedLabel,
|
||||
BaseEventContext,
|
||||
defaultValue
|
||||
} from 'amis-editor-core';
|
||||
|
||||
const filters = {
|
||||
text: [
|
||||
{
|
||||
label: '模糊匹配',
|
||||
value: 'like'
|
||||
},
|
||||
{
|
||||
label: '不匹配',
|
||||
value: 'not_like'
|
||||
},
|
||||
{
|
||||
label: '匹配开头',
|
||||
value: 'starts_with'
|
||||
},
|
||||
{
|
||||
label: '匹配结尾',
|
||||
value: 'ends_with'
|
||||
}
|
||||
],
|
||||
number: [
|
||||
{
|
||||
label: '小于',
|
||||
value: 'less'
|
||||
},
|
||||
{
|
||||
label: '小于或等于',
|
||||
value: 'less_or_equal'
|
||||
},
|
||||
{
|
||||
label: '大于',
|
||||
value: 'greater'
|
||||
},
|
||||
{
|
||||
label: '大于或等于',
|
||||
value: 'greater_or_equal'
|
||||
}
|
||||
]
|
||||
// time: []
|
||||
};
|
||||
|
||||
setSchemaTpl(
|
||||
'crudFilterOperator',
|
||||
(props: {context: BaseEventContext; type: string}) => {
|
||||
const {context, type = 'all'} = props;
|
||||
|
||||
const isInCrudFilter = context?.node?.path?.includes('crud2/filter');
|
||||
|
||||
const addFilters =
|
||||
type === 'all'
|
||||
? [...filters.number, ...filters.text]
|
||||
: filters[type === 'text' ? 'text' : 'number'];
|
||||
|
||||
return {
|
||||
label: '匹配规则',
|
||||
type: 'select',
|
||||
name: 'filterOp',
|
||||
options: [
|
||||
{
|
||||
label: '等于',
|
||||
value: 'equal'
|
||||
},
|
||||
{
|
||||
label: '不等于',
|
||||
value: 'not_equal'
|
||||
},
|
||||
...addFilters,
|
||||
{
|
||||
label: '为空',
|
||||
value: 'is_empty'
|
||||
},
|
||||
{
|
||||
label: '不为空',
|
||||
value: 'is_not_empty'
|
||||
}
|
||||
],
|
||||
pipeIn: defaultValue('equal'),
|
||||
visible: isInCrudFilter
|
||||
};
|
||||
}
|
||||
);
|
@ -6,7 +6,6 @@ import './api';
|
||||
import './options';
|
||||
import './validations';
|
||||
import './style';
|
||||
import './crudFilterOperator';
|
||||
import './layout';
|
||||
|
||||
export * from './style';
|
||||
|
Loading…
Reference in New Issue
Block a user