提交 bc9d0b55 编写于 作者: JunZai's avatar JunZai

update

上级 10b52131
<template>
<div>
<div class="search-bar-header">
<#if !view.isEnableQuickSearch() && ctrl.getQuickSearchMode() gt 0>
<i-input v-model="query" placeholder="<#if ctrl.getPSSearchBarQuickSearchs()??><#list ctrl.getPSSearchBarQuickSearchs() as search><#if search_index gt 0>,</#if><#if search.getPSDEField()??>${search.getPSDEField().getLogicName()}</#if></#list></#if>" style="<#if ctrl.getQuickSearchWidth() gt 0>width: ${ctrl.getQuickSearchWidth()?c}px;</#if>"></i-input>
</#if>
<div class="search-bar-action">
<i-button title="搜索" @click="onSearch"><i class="fa fa-search" aria-hidden="true"></i></i-button>
<i-button title="保存" @click="onSave"><i class="fa fa-floppy-o" aria-hidden="true"></i></i-button>
<i-button title="重置" @click="onReset"><i class="fa fa-repeat" aria-hidden="true"></i></i-button>
</div>
</div>
<div v-if="filterFields.length > 0" class="filter-group">
<filter-tree :datas="filterItems" :fields="filterFields">
<template slot-scope="{ data }">
......@@ -23,6 +13,16 @@
</template>
</filter-tree>
</div>
<div class="search-bar-footer">
<#-- <#if !view.isEnableQuickSearch() && ctrl.getQuickSearchMode() gt 0>
<i-input v-model="query" placeholder="<#if ctrl.getPSSearchBarQuickSearchs()??><#list ctrl.getPSSearchBarQuickSearchs() as search><#if search_index gt 0>,</#if><#if search.getPSDEField()??>${search.getPSDEField().getLogicName()}</#if></#list></#if>" style="<#if ctrl.getQuickSearchWidth() gt 0>width: ${ctrl.getQuickSearchWidth()?c}px;</#if>"></i-input>
</#if> -->
<div class="search-bar-action">
<i-button title="搜索" @click="onSearch"><i class="fa fa-search" aria-hidden="true"></i></i-button>
<i-button title="保存" @click="onSave"><i class="fa fa-floppy-o" aria-hidden="true"></i></i-button>
<i-button title="重置" @click="onReset"><i class="fa fa-repeat" aria-hidden="true"></i></i-button>
</div>
</div>
</div>
</template>
<#assign import_block>
......@@ -37,13 +37,13 @@ FilterTree,
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>
/**
<#-- /**
* 快速搜索值
*
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public query: string = '';
public query: string = ''; -->
/**
* 过滤属性集合
......@@ -100,10 +100,10 @@ FilterTree,
*/
public getData(): any {
let data: any = {};
if(!Object.is(this.query, '')) {
<#-- if(!Object.is(this.query, '')) {
Object.assign(data, { query: this.query })
}
if(this.filterFields.length > 0 && this.filterItems.length > 0) {
} -->
if(this.filterFields.length > 0) {
Object.assign(data, { filter: this.getFilter() })
}
return data;
......@@ -116,7 +116,62 @@ FilterTree,
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public getFilter(): any {
if(this.filterItems.length === 0) {
return null;
}
return { ...this.transformAnd(this.filterItems) };
}
/**
* 处理并且逻辑
*
* @return {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public transformAnd(datas: any[]): any {
let result: any[] = [];
datas.forEach((data: any) => {
let item: any = {};
if(data.field && data.mode) {
let field: any = this.detailsModel[data.field];
item[field.prop] = {};
item[field.prop][data.mode] = (data[data.field] == null ? '' : data[data.field]);
result.push(item)
} else if(Object.is(data.label, '$and')) {
item[data.label] = this.transformAnd(data.children);
result.push(item)
} else if(Object.is(data.label, '$or')) {
item[data.label] = this.transformOr(data.children);
result.push(item)
}
})
return result;
}
/**
* 处理或逻辑
*
* @return {*}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public transformOr(datas: any[]) {
let result: any[] = [];
datas.forEach((data: any) => {
let item: any = {};
if(data.field && data.mode) {
let field: any = this.detailsModel[data.field];
item[field.prop] = {};
item[field.prop][data.mode] = (data[data.field] == null ? '' : data[data.field]);
result.push(item);
} else if(Object.is(data.label, '$and')) {
item[data.label] = this.transformAnd(data.children);
result.push(item);
} else if(Object.is(data.label, '$or')) {
item[data.label] = this.transformOr(data.children);
result.push(item);
}
})
return result;
}
/**
......
.search-bar-header {
.search-bar-footer {
height: 32px;
.search-bar-action {
float: right;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册