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
import { SearchFormModel } from '@ibiz-template/model';
import { useNamespace, useSearchFormController } from '@ibiz-template/vue-util';
import { defineComponent, getCurrentInstance, PropType } from 'vue';
import '@ibiz-template/theme/style/components/widgets/search-form/search-form.scss';
export const SearchFormControl = defineComponent({
name: 'SearchFormControl',
props: {
modelData: {
type: SearchFormModel,
required: true,
},
context: { type: Object as PropType<IContext>, required: true },
params: { type: Object as PropType<IParams>, default: () => ({}) },
},
setup(props) {
const { proxy } = getCurrentInstance()!;
const c = useSearchFormController(
proxy,
props.modelData,
props.context,
props.params,
);
const ns = useNamespace('search-form');
return { c, ns };
},
render() {
if (!this.c.complete) {
return;
}
return (
<div class={this.ns.b()}>
<form-control
model-data={this.modelData}
context={this.context}
controller={this.c}
nativeOnkeyup={(e: KeyboardEvent) => this.c.onKeyUp(e)}
></form-control>
{this.c.model.source.searchButtonStyle === 'NONE' ? null : (
<div class={this.ns.b('buttons')}>
<i-button
class={this.ns.be('buttons', 'search')}
on-click={() => this.c.onSearchButtonClick()}
>
查询
</i-button>
<i-button
class={this.ns.be('buttons', 'reset')}
on-click={() => this.c.reset()}
>
重置
</i-button>
</div>
)}
</div>
);
},
});
export default SearchFormControl;