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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| <template>
| <ArtSearchBar
| ref="searchBarRef"
| v-model="formData"
| :items="formItems"
| :showExpand="false"
| @reset="handleReset"
| @search="handleSearch"
| />
| </template>
|
| <script setup>
| import { create@{ENTITYNAME}SearchState, get@{ENTITYNAME}FieldOptions } from '../@{SIMPLEENTITYNAME}Page.helpers'
|
| const props = defineProps({
| modelValue: { required: true }
| })
|
| const emit = defineEmits(['update:modelValue', 'search', 'reset'])
| const searchBarRef = ref()
|
| const formData = computed({
| get: () => props.modelValue,
| set: (val) => emit('update:modelValue', val)
| })
|
| function createInputSearchItem(label, key, placeholder) {
| return {
| label,
| key,
| type: 'input',
| props: {
| placeholder,
| clearable: true
| }
| }
| }
|
| function createSelectSearchItem(label, key, placeholder, options) {
| return {
| label,
| key,
| type: 'select',
| props: {
| placeholder,
| clearable: true,
| options
| }
| }
| }
|
| const formItems = computed(() => [
| createInputSearchItem('关键字', 'condition', '请输入@{TABLEDESC}关键字'),
| @{SEARCHITEMSCONTENT}
| ])
|
| function handleReset() {
| emit('update:modelValue', create@{ENTITYNAME}SearchState())
| emit('reset')
| }
|
| async function handleSearch(params) {
| await searchBarRef.value.validate()
| emit('search', params)
| }
| </script>
|
|