提交 2d6ab5f1 编写于 作者: zhujiamin's avatar zhujiamin

update:表格视图支持快速搜索

上级 d3d7309d
......@@ -116,6 +116,19 @@ export class MDView extends MainView {
this.next({ tag: tag, action: 'load', data: viewParams });
}
/**
* @description 快速搜索查询
* @param {*} [args={}]
* @memberof MDView
*/
public handleQuickSearch(args: any = {}): void {
const { viewParams } = this.state;
const query = args?.target?._value || '';
Object.assign(viewParams,{query: query});
const tag = this.getMDCtrl().name;
this.next({ tag: tag, action: 'load', data: viewParams });
}
/**
* 搜索表单搜索
*
......@@ -228,6 +241,17 @@ export class MDView extends MainView {
}
}
/**
* @description 处理快速搜索事件
* @param {any} $event
* @memberof MDView
*/
public onQuickSearchEvent($event: any) {
if ($event) {
this.handleQuickSearch($event);
}
}
/**
* @description 安装视图所有功能模块的方法
*
......@@ -240,7 +264,8 @@ export class MDView extends MainView {
xDataControl: this.xDataControl,
searchForm: this.searchForm,
searchBar: this.searchBar,
onQuickGroupEvent: this.onQuickGroupEvent.bind(this)
onQuickGroupEvent: this.onQuickGroupEvent.bind(this),
onQuickSearchEvent: this.onQuickSearchEvent.bind(this)
};
}
......
......@@ -41,9 +41,10 @@ export class GridService<T extends ControlVOBase> extends ControlServiceBase<T>
const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(_entityService, opts.action) ? opts.action : 'GET';
const response = await _entityService[action](Context, Data, opts.isLoading);
response.data?.forEach((item: IParam) => {
item = this.newControlVO(item);
})
let resData:any[] = response.data;
for (let index = 0; index < resData.length; index++) {
resData[index] = this.newControlVO(resData[index]);
}
return this.handleResponse(response, opts);
}
......
......@@ -39,7 +39,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent } = new GridView(viewState, props, emit).moduleInstall();
const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSearchEvent } = new GridView(viewState, props, emit).moduleInstall();
</script>
......@@ -67,7 +67,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent } = new Grid
{{#if page.enableFilter}}
<template v-slot:quickSearch>
<div class='app-quick-search'>
<a-input/>
<a-input @pressEnter="onQuickSearchEvent($event)" allowClear/>
<a-popover trigger="click" :overlayStyle="{width: '50%'}">
<template #content>
<{{codeName}}SearchForm
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册