提交 806232a3 编写于 作者: Mosher's avatar Mosher

update:搜索表单调整

上级 a0661022
......@@ -15,6 +15,14 @@ export class MainView extends ViewBase {
*/
public declare state: MainViewState;
/**
* 视图实体UI服务
*
* @type {*}
* @memberof MainView
*/
public appUIService: any;
/**
* 设置工具栏项状态
*
......@@ -23,11 +31,13 @@ export class MainView extends ViewBase {
* @return {*}
* @memberof MainView
*/
public async setToolbarItemState(state: boolean, data?: IParam) {
public setToolbarItemState(state: boolean, data?: IParam) {
if (!this.state.toolbar) {
return;
}
const appUIService = await this.getUIService();
if (!this.appUIService) {
await this.useUIService();
}
for (const key in this.state.toolbar) {
// 设置初始化状态
if (!this.state.toolbar.hasOwnProperty(key)) {
......@@ -47,18 +57,18 @@ export class MainView extends ViewBase {
const { actionTarget, uIActionTag, dataAccessAction } = item.uIAction;
// 不需要数据的界面行为
if (item.uIAction && (Object.is(actionTarget, "NONE") || !actionTarget)) {
if (!actionTarget && Object.is(uIActionTag, "Save") && appUIService.isEnableDEMainState) {
if (!actionTarget && Object.is(uIActionTag, "Save") && this.appUIService.isEnableDEMainState) {
if (data && Object.keys(data).length > 0) {
dataActionResult = appUIService.getAllOPPrivs(data, dataAccessAction);
dataActionResult = this.appUIService.getAllOPPrivs(data, dataAccessAction);
}
} else {
dataActionResult = appUIService.getAllOPPrivs(undefined, dataAccessAction);
dataActionResult = this.appUIService.getAllOPPrivs(undefined, dataAccessAction);
}
} else {
if (data && Object.keys(data).length > 0 && appUIService?.isEnableDEMainState) {
dataActionResult = appUIService.getAllOPPrivs(data, dataAccessAction);
if (data && Object.keys(data).length > 0 && this.appUIService.isEnableDEMainState) {
dataActionResult = this.appUIService.getAllOPPrivs(data, dataAccessAction);
} else {
dataActionResult = appUIService.getAllOPPrivs(undefined, dataAccessAction);
dataActionResult = this.appUIService.getAllOPPrivs(undefined, dataAccessAction);
}
}
// 无权限:0;有权限:1
......@@ -110,6 +120,20 @@ export class MainView extends ViewBase {
App.getAppActionService().execute(uIAction, inputParam);
}
/**
* @description 注册UI服务
*
* @private
* @memberof MainView
*/
private useUIService() {
const { context, appEntityCodeName } = this.state;
App.getUIService(appEntityCodeName.toLowerCase(), context).then((service: IParam) => {
this.appUIService = service;
this.state.UIService = this.appUIService;
});
}
/**
* @description 安装视图所有功能模块的方法
*
......
......@@ -24,6 +24,14 @@ export class MDView extends MainView {
*/
public declare searchForm: IParam;
/**
* 当前视图快速搜索表单部件
*
* @type {IParam}
* @memberof MDView
*/
public declare quickSearchForm: IParam;
/**
* 当前视图搜索栏部件
*
......@@ -41,6 +49,8 @@ export class MDView extends MainView {
super.useViewInit();
// 初始化搜索表单引用
this.searchForm = ref(null);
// 初始化快速搜索表单引用
this.quickSearchForm = ref(null);
// 初始化搜索栏引用
this.searchBar = ref(null);
onMounted(() => {
......@@ -68,7 +78,7 @@ export class MDView extends MainView {
public onCtrlEvent(actionParam: IActionParam) {
super.onCtrlEvent(actionParam);
const { tag, action, data } = actionParam;
if (Object.is(tag, 'searchform')) {
if (Object.is(tag, 'searchform') || Object.is(tag, 'quicksearchform')) {
this.handleSearchFormEvent(action, data);
}
}
......@@ -85,7 +95,7 @@ export class MDView extends MainView {
this.onSearchFormLoad(args);
}
if (Object.is(eventName, 'search')) {
this.onSearchFormLoad(args);
this.onSearchFormSearch(args);
}
}
......@@ -176,11 +186,20 @@ export class MDView extends MainView {
* @memberof MDView
*/
public MDCtrlBeforeLoad(args: any = {}) {
if (this.getSearchForm()) {
Object.assign(args, this.getSearchForm().getData());
// 搜索表单
const searchForm = this.getSearchForm();
if (searchForm) {
Object.assign(args, searchForm.getData());
}
// 快速搜索表单
const quickSearchForm = this.getQuickSearchForm();
if (quickSearchForm) {
Object.assign(args, quickSearchForm.getData());
}
if (this.getSearchBar()) {
Object.assign(args, this.getSearchBar().getData());
// 搜索栏
const searchBar = this.getSearchBar();
if (searchBar) {
Object.assign(args, searchBar.getData());
}
// if (this.view && !this.view.isExpandSearchForm) {
// Object.assign(args, { query: this.view.query });
......@@ -289,6 +308,7 @@ export class MDView extends MainView {
...superParams,
xDataControl: this.xDataControl,
searchForm: this.searchForm,
quickSearchForm: this.quickSearchForm,
searchBar: this.searchBar,
onQuickGroupEvent: this.onQuickGroupEvent.bind(this),
onQuickSearchEvent: this.onQuickSearchEvent.bind(this),
......@@ -305,6 +325,16 @@ export class MDView extends MainView {
return unref(this.searchForm);
}
/**
* @description 获取快速搜索表单部件
*
* @return {*} {*}
* @memberof MDView
*/
public getQuickSearchForm(): any {
return unref(this.quickSearchForm);
}
/**
* 获取搜索栏部件
*
......
......@@ -23,7 +23,7 @@ export class QuickSearchFormControl extends FormControl {
super.onEditorEvent(actionParam);
this.emit("ctrlEvent", {
tag: this.props.name,
action: "selectionChange",
action: "search",
data: this.state.data,
});
}
......
......@@ -21,7 +21,7 @@ export class SearchFormControl extends FormControl {
public onSearch() {
this.emit("ctrlEvent", {
tag: this.props.name,
action: "selectionChange",
action: "search",
data: this.state.data,
});
}
......
......@@ -40,7 +40,7 @@ const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const gridView = new GridView(viewState, props, emit).moduleInstall();
const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSearchEvent } = gridView;
const { state, grid, searchForm, quickSearchForm, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSearchEvent } = gridView;
</script>
......@@ -72,6 +72,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSear
<a-popover v-if="state.expandSearchForm" trigger="click" :overlayStyle="{width: '50%'}" placement="bottom">
<template #content>
<{{codeName}}SearchForm
ref="searchForm"
name="{{name}}"
:context="state.context"
:viewParams="state.viewParams"
......@@ -88,6 +89,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSear
<template v-slot:searchForm>
<{{codeName}}SearchForm
v-if="state.expandSearchForm"
ref="searchForm"
name="{{name}}"
:context="state.context"
:viewParams="state.viewParams"
......@@ -101,6 +103,7 @@ const { state, grid, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSear
{{#if (and (eq controlType "SEARCHFORM") (eq name 'quicksearchform'))}}
<template v-slot:quickSearchForm>
<{{codeName}}QuickSearchForm
ref="quickSearchForm"
name="{{name}}"
:context="state.context"
:viewParams="state.viewParams"
......
......@@ -60,7 +60,7 @@ export const ctrlState = {
detailsModel: {
{{#if ctrl.psDEFormPages}}
{{#each ctrl.psDEFormPages as | FormPage | }}
{{>(lookup 'FORMDETAILSMODEL') formDetail=FormPage}}
{{> @macro/front-end/widgets/form-detail/include-form.hbs type='FORMDETAILSMODEL' item=FormPage}}
{{/each}}
{{/if}}
},
......
......@@ -27,7 +27,8 @@ interface CtrlEmit {
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力方法
const { name, state, onEditorEvent } = new QuickSearchFormControl(ctrlState, props, emit).moduleInstall();
const { name, state, getData, onEditorEvent } = new QuickSearchFormControl(ctrlState, props, emit).moduleInstall();
defineExpose({ name, state, getData });
</script>
<template>
......@@ -41,13 +42,13 @@ const { name, state, onEditorEvent } = new QuickSearchFormControl(ctrlState, pro
{{#if ctrl.noTabHeader}}
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{#each ctrlPage.psDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{> @macro/front-end/widgets/form-detail/include-form.hbs type=formDetail.detailType item=formDetail}}
{{/each }}
{{/each}}
{{else}}
<a-tabs class="app-form-page">
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{>(lookup . 'ctrlPage.detailType') item=ctrlPage }}
{{> @macro/front-end/widgets/form-detail/include-form.hbs type=ctrlPage.detailType item=ctrlPage}}
{{/each}}
</a-tabs>
{{/if}}
......
......@@ -27,8 +27,8 @@ interface CtrlEmit {
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力方法
const { state, onEditorEvent, onComponentEvent, onSearch, loadDraft, onSaveHistoryItem, onCancel, onRemoveHistoryItem } = new SearchFormControl(ctrlState, props, emit).moduleInstall();
const { name, state, getData, onEditorEvent, onComponentEvent, onSearch, loadDraft, onSaveHistoryItem, onCancel, onRemoveHistoryItem } = new SearchFormControl(ctrlState, props, emit).moduleInstall();
defineExpose({ name, state, getData });
</script>
<template>
<a-form
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册