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

update:搜索表单调整

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