提交 7172ae9a 编写于 作者: Mosher's avatar Mosher

update:更新

1、快速分组搜索调整
2、搜索表单按钮位置、按钮样式支持
上级 eea3989e
...@@ -25,7 +25,7 @@ export const AppCodeListConfig:IParam = { ...@@ -25,7 +25,7 @@ export const AppCodeListConfig:IParam = {
'items':[ 'items':[
{{#each appCodeList.psCodeItems as |codeItem|}} {{#each appCodeList.psCodeItems as |codeItem|}}
{{#codeItem}} {{#codeItem}}
{'value': {{#if appCodeList.codeItemValueNumber}}{{value}}{{else}}'{{value}}'{{/if}}, 'text': '{{text}}','codeName': '{{codeName}}','textClass': '{{#if textCls}}{{textCls}}{{else if psSysCss}}{{psSysCss.cssName}}{{/if}}',{{#if psSysImage}}{{#if psSysImage.cssClass}}'cssClass': '{{psSysImage.cssClass}}',{{/if}}{{#if psSysImage.imagePath}}'imagePath': '{{psSysImage.imagePath}}'{{/if}}{{/if}} }{{#unless @last}},{{/unless}} {'value': {{#if appCodeList.codeItemValueNumber}}{{value}}{{else}}'{{value}}'{{/if}}, 'text': '{{text}}','codeName': '{{codeName}}', {{#if data}}'data': `{{data}}`, {{/if}}'textClass': '{{#if textCls}}{{textCls}}{{else if psSysCss}}{{psSysCss.cssName}}{{/if}}',{{#if psSysImage}}{{#if psSysImage.cssClass}}'cssClass': '{{psSysImage.cssClass}}',{{/if}}{{#if psSysImage.imagePath}}'imagePath': '{{psSysImage.imagePath}}'{{/if}}{{/if}} }{{#unless @last}},{{/unless}}
{{/codeItem}} {{/codeItem}}
{{/each}} {{/each}}
] ]
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam } from '@core'; import { IActionParam, IContext, IParam } from '@core';
import { Ref, onBeforeMount } from 'vue'; import { Ref, onBeforeMount } from 'vue';
interface QuickGroupProps { interface QuickGroupProps {
quickGroupModel: IParam; quickGroupModel: IParam;
context: IContext;
viewParams: IParam;
} }
interface FormGroupEmit { interface FormGroupEmit {
(name: 'onQuickGroupEvent', value: IActionParam): void; (name: 'onQuickGroupEvent', value: IActionParam): void;
...@@ -24,11 +26,19 @@ const handleClick = ($event: any) => { ...@@ -24,11 +26,19 @@ const handleClick = ($event: any) => {
}); });
}; };
// 代码表服务
const codeListService = App.getCodeListService();
onBeforeMount(() => { onBeforeMount(() => {
items.value = props.quickGroupModel.codeItems; if (codeListService) {
//todo codeListService.getCodeListItems({ tag: props.quickGroupModel.codeListTag, context: props.context, viewParams: props.viewParams }).then((codeListItems: any[]) => {
// let res: any = await this.codeListService.getDataItems({ tag: this.quickGroupCodeList.codeName, type: this.quickGroupCodeList.codeListType, data: this.quickGroupCodeList, context: this.context }); items.value = codeListItems;
// this.quickGroupModel = this.handleDynamicData(JSON.parse(JSON.stringify(res))); // 默认选中第一项
if (codeListItems.length) {
handleClick(items.value[0]);
}
})
}
}); });
</script> </script>
......
import { deepCopy, IActionParam, IParam, isExistAndNotEmpty, MainView, MDViewState, ViewUtil } from '@core'; import { IActionParam, IParam, MainView, MDViewState, ViewUtil } from '@core';
/** /**
* 多数据视图 * 多数据视图
...@@ -131,13 +131,9 @@ export class MDView extends MainView { ...@@ -131,13 +131,9 @@ export class MDView extends MainView {
* @memberof MDView * @memberof MDView
*/ */
public handleQuickGroupSearch(args: any = {}): void { public handleQuickGroupSearch(args: any = {}): void {
const { viewParams } = this.state; this.state.quickGroupData = JSON.parse(args.data);
const tempViewParams = deepCopy(viewParams);
if (args && isExistAndNotEmpty(args.data) && typeof args.data === 'string') {
Object.assign(tempViewParams, JSON.parse(args.data));
}
const tag = this.getMDCtrl().name; const tag = this.getMDCtrl().name;
this.next({ tag: tag, action: 'load', data: tempViewParams }); this.next({ tag: tag, action: 'load', data: null });
} }
/** /**
...@@ -215,16 +211,15 @@ export class MDView extends MainView { ...@@ -215,16 +211,15 @@ export class MDView extends MainView {
if (searchBar) { if (searchBar) {
Object.assign(args, searchBar.getData()); 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 });
// } // }
// 快速分组和快速搜索栏 // 快速分组
// if (this.view && this.view.quickGroupData) { const { quickGroupData } = this.state;
// Object.assign(args, this.view.quickGroupData); if (quickGroupData && Object.keys(quickGroupData).length) {
// } Object.assign(args, quickGroupData);
// if (this.view && this.view.quickFormData) { }
// Object.assign(args, this.view.quickFormData);
// }
// 自定义查询条件 // 自定义查询条件
// const mdCtrl: any = this.getMDCtrl(); // const mdCtrl: any = this.getMDCtrl();
// if (mdCtrl && mdCtrl.controlInstance && mdCtrl.controlInstance.customCond) { // if (mdCtrl && mdCtrl.controlInstance && mdCtrl.controlInstance.customCond) {
......
...@@ -8,5 +8,10 @@ import { FormControlState, IParam } from '@core'; ...@@ -8,5 +8,10 @@ import { FormControlState, IParam } from '@core';
*/ */
export interface SearchFormControlState extends FormControlState { export interface SearchFormControlState extends FormControlState {
/**
* @description 自动搜索
* @type {boolean}
* @memberof SearchFormControlState
*/
autoSearch: boolean;
} }
...@@ -24,6 +24,17 @@ ...@@ -24,6 +24,17 @@
} }
} }
} }
&.right-button .search-form-footer {
button {
width: 64px;
}
.reset-button {
margin-top: 8px;
}
.filter-save-button {
margin-top: 8px;
}
}
} }
//搜索表单气泡 //搜索表单气泡
.search-form-popover { .search-form-popover {
......
...@@ -60,7 +60,7 @@ const counterData = computed(() => { ...@@ -60,7 +60,7 @@ const counterData = computed(() => {
</template> </template>
{{#if page.enableQuickGroup}} {{#if page.enableQuickGroup}}
<template v-slot:quickGroupSearch> <template v-slot:quickGroupSearch>
<AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" @onQuickGroupEvent="onQuickGroupEvent" /> <AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" :context="state.context" :viewParams="state.viewParams" @onQuickGroupEvent="onQuickGroupEvent" />
</template> </template>
{{/if}} {{/if}}
{{#page.ctrls}} {{#page.ctrls}}
...@@ -93,7 +93,7 @@ const counterData = computed(() => { ...@@ -93,7 +93,7 @@ const counterData = computed(() => {
@ctrlEvent="onCtrlEvent" @ctrlEvent="onCtrlEvent"
></{{codeName}}SearchForm> ></{{codeName}}SearchForm>
</template> </template>
<a-button><filter-outlined /></a-button> <a-button class="app-search-form__filter-button"><filter-outlined /></a-button>
</a-popover> </a-popover>
</div> </div>
</template> </template>
...@@ -155,5 +155,8 @@ const counterData = computed(() => { ...@@ -155,5 +155,8 @@ const counterData = computed(() => {
.app-grid-view { .app-grid-view {
height: 100%; height: 100%;
width: 100%; width: 100%;
.app-search-form__filter-button {
transform: translateX(-2px);
}
} }
</style> </style>
\ No newline at end of file
...@@ -60,7 +60,7 @@ const counterData = computed(() => { ...@@ -60,7 +60,7 @@ const counterData = computed(() => {
</template> </template>
{{#if page.enableQuickGroup}} {{#if page.enableQuickGroup}}
<template v-slot:quickGroupSearch> <template v-slot:quickGroupSearch>
<AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" @onQuickGroupEvent="onQuickGroupEvent" /> <AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" :context="state.context" :viewParams="state.viewParams" @onQuickGroupEvent="onQuickGroupEvent" />
</template> </template>
{{/if}} {{/if}}
{{#page.ctrls}} {{#page.ctrls}}
...@@ -93,7 +93,7 @@ const counterData = computed(() => { ...@@ -93,7 +93,7 @@ const counterData = computed(() => {
@ctrlEvent="onCtrlEvent" @ctrlEvent="onCtrlEvent"
></{{codeName}}SearchForm> ></{{codeName}}SearchForm>
</template> </template>
<a-button><filter-outlined /></a-button> <a-button class="app-search-form__filter-button"><filter-outlined /></a-button>
</a-popover> </a-popover>
</div> </div>
</template> </template>
...@@ -153,5 +153,8 @@ const counterData = computed(() => { ...@@ -153,5 +153,8 @@ const counterData = computed(() => {
.app-list-view { .app-list-view {
height: 100%; height: 100%;
width: 100%; width: 100%;
.app-search-form__filter-button {
transform: translateX(-2px);
}
} }
</style> </style>
\ No newline at end of file
...@@ -49,7 +49,7 @@ const { state, grid, onCtrlEvent, onQuickGroupEvent, onQuickSearchEvent } = pick ...@@ -49,7 +49,7 @@ const { state, grid, onCtrlEvent, onQuickGroupEvent, onQuickSearchEvent } = pick
</template> </template>
{{#if page.enableQuickGroup}} {{#if page.enableQuickGroup}}
<template v-slot:quickGroupSearch> <template v-slot:quickGroupSearch>
<AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" @onQuickGroupEvent="onQuickGroupEvent" /> <AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" :context="state.context" :viewParams="state.viewParams" @onQuickGroupEvent="onQuickGroupEvent" />
</template> </template>
{{/if}} {{/if}}
{{#page.ctrls}} {{#page.ctrls}}
......
...@@ -59,7 +59,7 @@ const counterData = computed(() => { ...@@ -59,7 +59,7 @@ const counterData = computed(() => {
</template> </template>
{{#if page.enableQuickGroup}} {{#if page.enableQuickGroup}}
<template v-slot:quickGroupSearch> <template v-slot:quickGroupSearch>
<AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" @onQuickGroupEvent="onQuickGroupEvent" /> <AppQuickGroup v-if="state.enableQuickGroup" :quickGroupModel="state.quickGroupPSCodeList" :context="state.context" :viewParams="state.viewParams" @onQuickGroupEvent="onQuickGroupEvent" />
</template> </template>
{{/if}} {{/if}}
{{#page.ctrls}} {{#page.ctrls}}
...@@ -92,7 +92,7 @@ const counterData = computed(() => { ...@@ -92,7 +92,7 @@ const counterData = computed(() => {
@ctrlEvent="onCtrlEvent" @ctrlEvent="onCtrlEvent"
></{{codeName}}SearchForm> ></{{codeName}}SearchForm>
</template> </template>
<a-button><filter-outlined /></a-button> <a-button class="app-search-form__filter-button"><filter-outlined /></a-button>
</a-popover> </a-popover>
</div> </div>
</template> </template>
...@@ -146,3 +146,10 @@ const counterData = computed(() => { ...@@ -146,3 +146,10 @@ const counterData = computed(() => {
{{/page.ctrls}} {{/page.ctrls}}
</AppTreeViewLayout> </AppTreeViewLayout>
</template> </template>
<style lang="scss">
.app-tree-view {
.app-search-form__filter-button {
transform: translateX(-2px);
}
}
</style>
\ No newline at end of file
...@@ -49,6 +49,7 @@ export class ControlVO extends ControlVOBase { ...@@ -49,6 +49,7 @@ export class ControlVO extends ControlVOBase {
// 部件配置对象 // 部件配置对象
export const ctrlState = { export const ctrlState = {
autoSearch: {{ctrl.enableAutoSearch}},
controlCodeName: '{{ctrl.codeName}}', controlCodeName: '{{ctrl.codeName}}',
controlName: '{{ctrl.name}}', controlName: '{{ctrl.name}}',
controlService: new EditFormService<ControlVO>(ControlVO, new {{pascalCase ctrl.psAppDataEntity.codeName}}Service() ), controlService: new EditFormService<ControlVO>(ControlVO, new {{pascalCase ctrl.psAppDataEntity.codeName}}Service() ),
......
...@@ -33,7 +33,7 @@ defineExpose({ name, state, getData }); ...@@ -33,7 +33,7 @@ defineExpose({ name, state, getData });
<template> <template>
<a-form <a-form
name="{{ctrl.codeName}}" name="{{ctrl.codeName}}"
class="app-search-form{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}{{#if ctrl.searchButtonPos}} {{ctrl.searchButtonPos}}-button{{/if}}" class="app-search-form{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}{{#if ctrl.searchButtonPos}} {{lowerCase ctrl.searchButtonPos}}-button{{/if}}"
style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}" style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}"
:model="state.data" :model="state.data"
:rules="state.rules"> :rules="state.rules">
...@@ -56,7 +56,8 @@ defineExpose({ name, state, getData }); ...@@ -56,7 +56,8 @@ defineExpose({ name, state, getData });
</a-row> </a-row>
</a-col> </a-col>
<a-col class='search-form-footer'> <a-col class='search-form-footer'>
{{#if (eq ctrl.searchButtonStyle 'DEFAULT')}} {{#if ctrl.enableFilterSave}}
{{#eq ctrl.searchButtonStyle 'DEFAULT'}}
<a-select <a-select
allowClear allowClear
class="search-form-history" class="search-form-history"
...@@ -67,6 +68,7 @@ defineExpose({ name, state, getData }); ...@@ -67,6 +68,7 @@ defineExpose({ name, state, getData });
</a-select> </a-select>
<a-button class='search-button' @click="onSearch" type="primary">搜索</a-button> <a-button class='search-button' @click="onSearch" type="primary">搜索</a-button>
<a-button class='reset-button' @click='loadDraft'>重置</a-button> <a-button class='reset-button' @click='loadDraft'>重置</a-button>
{{#if ctrl.enableFilterSave}}
<a-popover title="存储自定义查询" v-model:visible='state.showPopover' overlayClassName="search-form-popover"> <a-popover title="存储自定义查询" v-model:visible='state.showPopover' overlayClassName="search-form-popover">
<template #content> <template #content>
<a-input /> <a-input />
...@@ -77,8 +79,19 @@ defineExpose({ name, state, getData }); ...@@ -77,8 +79,19 @@ defineExpose({ name, state, getData });
</template> </template>
<a-button><save-outlined /></a-button> <a-button><save-outlined /></a-button>
</a-popover> </a-popover>
{{else if (eq ctrl.searchButtonStyle 'SEARCHONLY')}} {{/if}}
{{/eq}}
{{#eq ctrl.searchButtonStyle 'SEARCHONLY'}}
<a-button class='search-button' type="primary">搜索</a-button>
{{/eq}}
{{else}}
{{#eq ctrl.searchButtonStyle 'DEFAULT'}}
<a-button class='search-button' @click="onSearch" type="primary">搜索</a-button>
<a-button class='reset-button' @click='loadDraft'>重置</a-button>
{{/eq}}
{{#eq ctrl.searchButtonStyle 'SEARCHONLY'}}
<a-button class='search-button' type="primary">搜索</a-button> <a-button class='search-button' type="primary">搜索</a-button>
{{/eq}}
{{/if}} {{/if}}
</a-col> </a-col>
</a-row> </a-row>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册