Are you an LLM? You can read better optimized documentation at /front/component/ma-pro-table/examples/advanced-search.md for this page in Markdown format
Advanced Search β
Demonstrates various search component types and complex search logic, including date ranges, numeric ranges, multi-select functionality, and more.
Features β
- Rich Search Components: Supports input, select, date-range, slider, checkbox, etc.
- Multi-Condition Combination: Allows complex search condition combinations.
- Search Events: Listen for search submission and reset events.
- Default Expansion: Configurable number of search items to display by default.
- Responsive Layout: Search forms support responsive layouts.
Search Component Types β
Basic Input Component β
javascript
{
label: 'Name',
prop: 'name',
render: 'input',
renderProps: {
placeholder: 'Please enter name',
clearable: true
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Selector Component β
javascript
// Single select
{
label: 'Department',
prop: 'department',
render: 'select',
options: [
{ label: 'Tech', value: 'Tech' },
{ label: 'Product', value: 'Product' }
],
renderProps: {
placeholder: 'Please select department'
}
}
// Multi-select
{
label: 'Departments',
prop: 'departments',
render: 'select',
options: [
{ label: 'Tech', value: 'Tech' },
{ label: 'Product', value: 'Product' },
{ label: 'Design', value: 'Design' }
],
renderProps: {
multiple: true,
placeholder: 'Please select departments'
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Numeric Range Component β
javascript
{
label: 'Salary Range',
prop: 'salaryRange',
render: () => (
<div style="display: flex; gap: 8px; align-items: center;">
<el-input-number
v-model={formData.salaryMin}
placeholder="Min salary"
min={0}
max={100000}
controls-position="right"
style="width: 140px;"
/>
<span>-</span>
<el-input-number
v-model={formData.salaryMax}
placeholder="Max salary"
min={0}
max={100000}
controls-position="right"
style="width: 140px;"
/>
</div>
),
span: 2
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Date Range Component β
javascript
{
label: 'Join Date Range',
prop: 'joinDateRange',
render: 'date-picker',
renderProps: {
type: 'daterange',
startPlaceholder: 'Start date',
endPlaceholder: 'End date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD'
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Slider Component β
javascript
{
label: 'Experience',
prop: 'experience',
render: 'slider',
renderProps: {
min: 0,
max: 15,
range: true,
marks: {
0: '0 years',
5: '5 years',
10: '10 years',
15: '15+ years'
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Checkbox Group Component β
javascript
{
label: 'Level',
prop: 'level',
render: 'checkbox-group',
options: [
{ label: 'P4', value: 'P4' },
{ label: 'P5', value: 'P5' },
{ label: 'P6', value: 'P6' },
{ label: 'P7', value: 'P7' },
{ label: 'P8', value: 'P8' },
{ label: 'P9', value: 'P9' }
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Radio Group Component β
javascript
{
label: 'Employment Status',
prop: 'status',
render: 'radio-group',
options: [
{ label: 'All', value: '' },
{ label: 'Active', value: 1 },
{ label: 'Inactive', value: 0 }
]
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Custom Rendering Components β
JSX Custom Rendering β
For complex input components, use JSX for custom rendering:
javascript
// Need to add reactive data in script setup
const formData = reactive({
salaryMin: undefined,
salaryMax: undefined
})
// Search item configuration
{
label: 'Salary Range',
prop: 'salaryRange',
render: () => (
<div style="display: flex; gap: 8px; align-items: center;">
<el-input-number
v-model={formData.salaryMin}
placeholder="Min salary"
min={0}
max={100000}
controls-position="right"
style="width: 140px;"
/>
<span>-</span>
<el-input-number
v-model={formData.salaryMax}
placeholder="Max salary"
min={0}
max={100000}
controls-position="right"
style="width: 140px;"
/>
</div>
),
span: 2 // Occupies two column widths
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Component Configuration Points β
options
array is configured directly in the search item, no need to nest inrenderProps
renderProps
is used to configure other component properties (like placeholder, multiple, etc.)- Custom JSX rendering requires reactive data
- Use
span
property to control the number of columns a form item occupies
Search Configuration β
Display Control β
javascript
const options = {
searchOptions: {
showNumber: 3, // Show 3 search items by default
layout: 'auto' // Layout mode: auto/inline/vertical
}
}
1
2
3
4
5
6
2
3
4
5
6
Search Events β
javascript
const options = {
onSearchSubmit: (form) => {
console.log('Search conditions:', form)
// Preprocess search conditions if needed
return form
},
onSearchReset: (form) => {
console.log('Reset search')
return form
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Advanced Table Columns β
Progress Bar Display β
javascript
{
label: 'Performance Score',
prop: 'performance',
width: 120,
cellRender: ({ row }) => (
<el-progress
percentage={row.performance}
color={row.performance >= 90 ? '#67c23a' : '#e6a23c'}
stroke-width={8}
text-inside
/>
)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Multi-Tag Display β
javascript
{
label: 'Skill Tags',
prop: 'skills',
width: 200,
cellRender: ({ row }) => (
<div>
{row.skills.map((skill, index) => (
<el-tag key={index} size="small" style="margin-right: 4px;">
{skill}
</el-tag>
))}
</div>
)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
Conditional Operations β
javascript
{
type: 'operation',
operationConfigure: {
type: 'auto',
fold: 2, // Collapse when more than 2 actions
actions: [
{
name: 'promote',
text: 'Promote',
show: (data) => data.row.performance >= 85, // Conditional display
onClick: (data) => {
console.log('Promote employee:', data.row.name)
}
}
]
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Advanced search functionality allows you to build complex query interfaces to meet various business scenario search requirements.