提交 b9088c57 编写于 作者: ibizdev's avatar ibizdev

tony001 发布系统代码 [后台服务,演示应用]

上级 a310d6fd
......@@ -2281,6 +2281,10 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("拷贝",null),
tip: commonLogic.appcommonhandle("拷贝",null),
},
deuiaction3: {
caption: commonLogic.appcommonhandle("过滤",null),
tip: commonLogic.appcommonhandle("过滤",null),
},
tbitem7: {
caption: commonLogic.appcommonhandle("-",null),
tip: commonLogic.appcommonhandle("",null),
......
......@@ -2281,6 +2281,10 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("Copy",null),
tip: commonLogic.appcommonhandle("Copy {0}",null),
},
deuiaction3: {
caption: commonLogic.appcommonhandle("Filter",null),
tip: commonLogic.appcommonhandle("Filter",null),
},
tbitem7: {
caption: commonLogic.appcommonhandle("-",null),
tip: commonLogic.appcommonhandle("",null),
......
......@@ -2281,6 +2281,10 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("拷贝",null),
tip: commonLogic.appcommonhandle("拷贝",null),
},
deuiaction3: {
caption: commonLogic.appcommonhandle("过滤",null),
tip: commonLogic.appcommonhandle("过滤",null),
},
tbitem7: {
caption: commonLogic.appcommonhandle("-",null),
tip: commonLogic.appcommonhandle("",null),
......
......@@ -30,6 +30,13 @@
</i-button>
<div slot='content'>{{$t('entities.ibizorder.sgridviewtoolbar_toolbar.tbitem6.tip')}}</div>
</tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.deuiaction3.visabled" :disabled="toolBarModels.deuiaction3.disabled" class=' srfactionlevel100' v-button-loading:i-button @click="toolbar_click({ tag: 'deuiaction3' }, $event)">
<i class='fa fa-filter'></i>
<span class='caption'>{{$t('entities.ibizorder.sgridviewtoolbar_toolbar.deuiaction3.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ibizorder.sgridviewtoolbar_toolbar.deuiaction3.tip')}}</div>
</tooltip>
<span class='seperator'>|</span>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem8.visabled" :disabled="toolBarModels.tbitem8.disabled" class=' srfactionlevel100' v-button-loading:i-button @click="toolbar_click({ tag: 'tbitem8' }, $event)">
......@@ -99,6 +106,17 @@
<app-quick-group :items="quickGroupModel" @valuechange="quickGroupValueChange"></app-quick-group>
<i-input v-model="query" class='quick-search-input' @on-enter="onSearch($event)" placeholder="订单名称" />
</template>
<view_searchbar
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:pViewCtx="viewCtx"
v-show="isExpandSearchForm"
@search="onSearch($event)"
name="searchbar"
ref='searchbar'
@closeview="closeView($event)">
</view_searchbar>
<template #default>
<view_grid
:viewState="viewState"
......@@ -313,6 +331,7 @@ export default class IBIZOrderSGridViewBase extends Vue {
* @memberof IBIZOrderSGridViewBase
*/
public containerModel: any = {
view_searchbar: { name: 'searchbar', type: 'SEARCHBAR' },
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_grid: { name: 'grid', type: 'GRID' },
wflinks: [],
......@@ -378,6 +397,8 @@ export default class IBIZOrderSGridViewBase extends Vue {
tbitem6: { name: 'tbitem6', actiontarget: 'NONE', caption: '拷贝', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Copy', target: 'SINGLEKEY' } },
deuiaction3: { name: 'deuiaction3', actiontarget: 'NONE', caption: '过滤', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'ToggleFilter', target: '' } },
tbitem7: { name: 'tbitem7', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem8: { name: 'tbitem8', actiontarget: 'NONE', caption: '删除', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Remove', target: 'MULTIKEY' } },
......
......@@ -2,11 +2,13 @@
import { Component } from 'vue-property-decorator';
import IBIZOrderSGridViewBase from './ibizorder-sgrid-view-base.vue';
import view_searchbar from '@widgets/ibizorder/searchbar-searchbar/searchbar-searchbar.vue';
import view_grid from '@widgets/ibizorder/main-grid/main-grid.vue';
// 基于 @VIEW/实体表格视图/VIEW.vue.ftl 生成
@Component({
components: {
view_searchbar,
view_grid,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
......
......@@ -639,7 +639,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -675,7 +675,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public async loadDraft(opt: any = {},mode?:string): Promise<any> {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
......@@ -712,7 +712,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKCustomView_layout' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4ListView_layout' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -748,7 +748,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public async loadDraft(opt: any = {},mode?:string): Promise<any> {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKCustomView_layout' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4ListView_layout' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
......@@ -828,5 +828,4 @@ export default class QUICKSEARCHFORMBase extends Vue implements ControlInterface
<style lang='scss'>
@import './quicksearchform-searchform.scss';
</style>;
</style>
\ No newline at end of file
......@@ -698,7 +698,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
*/
public async load(opt: any = {}, isReset: boolean = false): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.list.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
}
const arg: any = {...opt};
......@@ -792,7 +792,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.gridpage.notConfig.removeAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.gridpage.notConfig.removeAction') as string) });
return;
}
let _datas:any[] = [];
......@@ -908,7 +908,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.list.notConfig.createAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.list.notConfig.createAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
......@@ -916,7 +916,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.list.notConfig.updateAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.list.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizbook){
......
......@@ -70,11 +70,6 @@ export default class Usr4Model {
prop: 'n_ibizbookname_like',
dataType: 'QUERYPARAM'
},
{
name: 'n_price_gtandeq',
prop: 'n_price_gtandeq',
dataType: 'QUERYPARAM'
},
{
......
......@@ -1314,7 +1314,7 @@ export default class AddDataFormBase extends Vue implements ControlInterface {
*/
public async load(opt: any = {}): Promise<any> {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerUsr3EditView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerMediaTestEditView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1366,7 +1366,7 @@ export default class AddDataFormBase extends Vue implements ControlInterface {
*/
public async loadDraft(opt: any = {}): Promise<any> {
if (!this.loaddraftAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerUsr3EditView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerMediaTestEditView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1436,7 +1436,7 @@ export default class AddDataFormBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerUsr3EditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerMediaTestEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1544,7 +1544,7 @@ export default class AddDataFormBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerUsr3EditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerMediaTestEditView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg, { viewparams: this.viewparams });
......@@ -1742,7 +1742,7 @@ export default class AddDataFormBase extends Vue implements ControlInterface {
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerUsr3EditView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZCustomerMediaTestEditView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -933,7 +933,7 @@ export default class MainBase extends Vue implements ControlInterface {
if (!this.fetchAction) {
this.$Notice.error({
title: this.$t("app.commonWords.wrong") as string,
desc: "IBIZOrderDetailSGridView9" + (this.$t("app.gridpage.notConfig.fetchAction") as string),
desc: "IBIZOrderDetailSGridView" + (this.$t("app.gridpage.notConfig.fetchAction") as string),
});
return;
}
......@@ -1073,7 +1073,7 @@ export default class MainBase extends Vue implements ControlInterface {
if (!this.removeAction) {
this.$Notice.error({
title: (this.$t('app.commonWords.wrong') as string),
desc: 'IBIZOrderDetailSGridView9' + (this.$t('app.gridpage.notConfig.removeAction') as string)
desc: 'IBIZOrderDetailSGridView' + (this.$t('app.gridpage.notConfig.removeAction') as string)
});
return;
}
......@@ -1187,7 +1187,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailSGridView9'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailSGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
return;
}
if(!arg){
......@@ -2082,7 +2082,7 @@ export default class MainBase extends Vue implements ControlInterface {
try {
if (Object.is(item.rowDataState, 'create')) {
if (!this.createAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailSGridView9'+(this.$t('app.gridpage.notConfig.createAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailSGridView'+(this.$t('app.gridpage.notConfig.createAction') as string) });
} else {
Object.assign(item, { viewparams: this.viewparams });
const tempContext = Util.deepCopy(this.context);
......@@ -2091,7 +2091,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}else if (Object.is(item.rowDataState, 'update')){
if (!this.updateAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailSGridView9'+(this.$t('app.gridpage.notConfig.updateAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderDetailSGridView'+(this.$t('app.gridpage.notConfig.updateAction') as string) });
} else {
Object.assign(item, { viewparams: this.viewparams });
const tempContext = Util.deepCopy(this.context);
......@@ -2167,7 +2167,7 @@ export default class MainBase extends Vue implements ControlInterface {
if(!this.loaddraftAction){
this.$Notice.error({
title: (this.$t('app.commonWords.wrong') as string),
desc: 'IBIZOrderDetailSGridView9' + (this.$t('app.gridpage.notConfig.loaddraftAction') as string)
desc: 'IBIZOrderDetailSGridView' + (this.$t('app.gridpage.notConfig.loaddraftAction') as string)
});
return;
}
......
<template>
<div class="app-searchbar">
<div v-if="filterFields.length > 0" class="filter-group">
<filter-tree :datas="filterItems" :fields="filterFields">
<template slot-scope="{ data }">
<template v-if="Object.is(data.editor, 'filter')">
<input-box
v-model="data.filter"
@enter="onEnter($event)"
:disabled="detailsModel.filter.disabled"
type='text'
style="">
</input-box>
</template>
<template v-if="Object.is(data.editor, 'filter2')">
<input-box
v-model="data.filter2"
@enter="onEnter($event)"
:disabled="detailsModel.filter2.disabled"
type='text'
style="">
</input-box>
</template>
<template v-if="Object.is(data.editor, 'filter3')">
<input-box
v-model="data.filter3"
@enter="onEnter($event)"
:disabled="detailsModel.filter3.disabled"
type='text'
style="">
</input-box>
</template>
</template>
</filter-tree>
</div>
<div class="search-bar-footer">
<div class="search-bar-action">
<el-select size="small" v-if="historyItems.length > 0" v-model="selectItem" @change="onFilterChange">
<el-option v-for="item in historyItems" :key="item.value" :label="item.name" :value="item.value"></el-option>
</el-select>
<i-button type="primary" @click="onSearch">{{ $t('app.searchButton.search') }}</i-button>
<i-button @click="onReset">{{ $t('app.searchButton.reset') }}</i-button>
<Poptip ref="propip" trigger="hover" placement="top-end" :title="$t('app.searchForm.custom')" :width="250" @on-popper-show="openPoper">
<i-button><i class="fa fa-floppy-o" aria-hidden="true"></i></i-button>
<template slot="content">
<div>
<i-input v-model="saveItemName" :placeholder="$t('app.searchForm.title')"></i-input>
<div class="save-action">
<i-button @click="onCancel">{{ $t('app.commonWords.cancel') }}</i-button>
<i-button type="primary" @click="onOk">{{ $t('app.commonWords.save') }}</i-button>
</div>
</div>
</template>
</Poptip>
</div>
</div>
</div>
</template>
// 基于 @CONTROL/搜索栏/CONTROL-BASE.vue.ftl 生成
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model,Inject } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util,ViewTool } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import IBIZOrderEntityService from '@/service/ibizorder/ibizorder-service';
import SearchbarService from './searchbar-searchbar-service';
import IBIZOrderUIService from '@/uiservice/ibizorder/ibizorder-ui-service';
import FilterTree from '@components/filter-tree/filter-tree.vue';
import moment from 'moment';
@Component({
components: {
FilterTree,
}
})
export default class SearchbarBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof SearchbarBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof SearchbarBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof SearchbarBase
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof SearchbarBase
*/
@Prop() public viewparams!: any;
/**
* 视图操作参数(父级)
*
* @type {*}
* @memberof SearchbarBase
*/
@Prop() public pViewCtx!: any;
/**
* 视图操作参数
*
* @type {*}
* @memberof SearchbarBase
*/
public viewCtx: any = {};
/**
* 监听视图操作参数变化
*
* @type {*}
* @memberof SearchbarBase
*/
@Watch('pViewCtx', { immediate: true })
public onViewCtxChange(newVal: any, oldVal: any) {
Object.assign(this.viewCtx, newVal, { xData: this, ctrl: this });
}
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof SearchbarBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof SearchbarBase
*/
public getControlType(): string {
return 'SEARCHBAR'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof SearchbarBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {SearchbarService}
* @memberof SearchbarBase
*/
public service: SearchbarService = new SearchbarService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZOrderService}
* @memberof SearchbarBase
*/
public appEntityService: IBIZOrderEntityService = new IBIZOrderEntityService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof SearchbarBase
*/
public transformData(args: any) {
let _this: any = this;
if(_this.service && _this.service.handleRequestData instanceof Function && _this.service.handleRequestData('transform',_this.context,args)){
return _this.service.handleRequestData('transform',_this.context,args)['data'];
}
}
/**
* 关闭视图
*
* @param {any} args
* @memberof SearchbarBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof SearchbarBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 处理部件事件
*
* @memberof SearchbarBase
*/
public async handleCtrlEvents(eventName: string, args: any = {}): Promise<boolean> {
const actionData = {
data: this.getData() || {},
context: Util.deepCopy(this.context),
viewparams: Util.deepCopy(this.viewparams),
xData: this
}
let result: boolean = true;
Object.assign(actionData, args);
if (!result) {
return false;
}
this.$emit(eventName, actionData);
return true;
}
/**
* 过滤属性集合
*
* @type {*}
* @memberof SearchbarBase
*/
get filterFields() {
return Object.values(this.detailsModel);
}
/**
* 过滤属性模型集合
*
* @type {*}
* @memberof SearchbarBase
*/
public detailsModel: any = {
'filter': {
label: '订单编号',
name: 'filter',
prop: 'orderuid',
disabled: false
},
'filter2': {
label: '订单名称',
name: 'filter2',
prop: 'ibizordername',
disabled: false
},
'filter3': {
label: '订单时间',
name: 'filter3',
prop: 'ordertime',
disabled: false
},
};
/**
* 过滤项集合
*
* @type {*}
* @memberof SearchbarBase
*/
public filterItems: any[] = [];
/**
* 应用实体名称
*
* @type {string}
* @memberof SearchbarBase
*/
public appdeName: string = 'IBIZOrder';
/**
* modleId
*
* @type {string}
* @memberof SearchbarBase
*/
public modelId: string = "searchbar_ibizorder_searchbar";
/**
* 功能服务名称
*
* @type {string}
* @memberof SearchbarBase
*/
public utilServiceName: string = "";
/**
* 历史记录
*
* @type {string}
* @memberof SearchbarBase
*/
protected historyItems: any[] = [];
/**
* 选中记录
*
* @type {string}
* @memberof SearchbarBase
*/
protected selectItem: any = null;
/**
* 存储项名称
*
* @type {string}
* @memberof SearchbarBase
*/
protected saveItemName: string = '';
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof SearchbarBase
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof SearchbarBase
*/
public getData(): any {
let data: any = {};
if(this.filterFields.length > 0) {
let filter: any = this.getFilter();
Object.assign(data, { filter: filter ? JSON.stringify(filter) : null })
}
return data;
}
/**
* 获取filter
*
* @return {*}
* @memberof SearchbarBase
*/
public getFilter(): any {
if(this.filterItems.length === 0) {
return null;
}
let ands: any[] = this.transformAnd(this.filterItems);
this.transformResult(ands, '$and');
if(ands.length === 0) {
return null;
}
return { '$and': ands };
}
/**
* 处理结果集
*
* @return {*}
* @memberof SearchbarBase
*/
public transformResult(datas: any[], pName: string) {
let items: any[] = [];
for(let i = datas.length - 1; i >= 0; i--) {
let data: any = datas[i];
let field: string = Object.is(pName, '$and') ? '$or' : '$and';
if(data.hasOwnProperty(field)) {
items.push(data);
datas.splice(i, 1);
this.transformResult(data[field], field);
}
}
if(items.length > 0) {
let item: any = {};
item[pName] = items;
datas.push(item);
}
}
/**
* 处理并且逻辑
*
* @return {*}
* @memberof SearchbarBase
*/
public transformAnd(datas: any[]): any {
let result: any[] = [];
datas.forEach((data: any) => {
let item: any = {};
if(data.field && data.mode) {
item[data.field] = {};
let valField: string = data.editor ? data.editor : data.field;
item[data.field][data.mode] = (data[valField] == null ? '' : data[valField]);
result.push(item)
} else if(Object.is(data.label, '$and')) {
let items: any[] = this.transformAnd(data.children);
result = [...result, ...items];
} else if(Object.is(data.label, '$or')) {
item[data.label] = this.transformOr(data.children);
result.push(item)
}
})
return result;
}
/**
* 处理或逻辑
*
* @return {*}
* @memberof SearchbarBase
*/
public transformOr(datas: any[]) {
let result: any[] = [];
datas.forEach((data: any) => {
let item: any = {};
if(data.field && data.mode) {
item[data.field] = {};
let valField: string = data.editor ? data.editor : data.field;
item[data.field][data.mode] = (data[valField] == null ? '' : data[valField]);
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;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof SearchbarBase
*/
public created(): void {
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (Object.is('load', action)) {
this.load(data);
}
});
}
}
/**
* 删除过滤项
*
* @return {*}
* @memberof SearchbarBase
*/
public onRemove(index: number) {
this.filterItems.splice(index, 1);
}
/**
* 搜索
*
* @return {*}
* @memberof SearchbarBase
*/
public onSearch() {
this.$emit('search', this.getData());
}
/**
* 保存
*
* @return {*}
* @memberof SearchbarBase
*/
public onSave(name?: string) {
let time = moment();
this.historyItems.push({
name: (name ? name : time.format('YYYY-MM-DD HH:mm:ss')),
value: time.unix().toString(),
data: JSON.parse(JSON.stringify(this.filterItems))
})
this.selectItem = time.unix().toString();
let param: any = {};
Object.assign(param, {
model: JSON.parse(JSON.stringify(this.historyItems)),
appdeName: this.appdeName,
modelid: this.modelId,
utilServiceName: this.utilServiceName,
...this.viewparams
});
let post = this.service.saveModel(this.utilServiceName, this.context, param);
post.then((response: any) => {
this.$emit("save", response.data);
}).catch((response: any) => {
console.log(response);
});
}
/**
* 重置
*
* @return {*}
* @memberof SearchbarBase
*/
public onReset() {
this.filterItems = [];
}
/**
* 加载
*
* @return {*}
* @memberof SearchbarBase
*/
public load(data: any) {
let param: any = {};
Object.assign(param, {
appdeName: this.appdeName,
modelid: this.modelId,
utilServiceName: this.utilServiceName,
...this.viewparams
});
let post = this.service.loadModel(this.utilServiceName, this.context, param);
post.then((response: any) => {
if(response.status == 200) {
this.historyItems = response.data;
}
}).catch((response: any) => {
console.log(response);
});
}
/**
* 改变过滤条件
*
* @return {*}
* @memberof SearchbarBase
*/
public onFilterChange(evt: any) {
let item: any = this.historyItems.find((item: any) => Object.is(evt, item.value));
if(item) {
this.filterItems = JSON.parse(JSON.stringify(item.data));
}
}
/**
* 打开弹框
*
* @return {*}
* @memberof SearchbarBase
*/
public openPoper() {
this.saveItemName = '';
}
/**
* 确定
*
* @return {*}
* @memberof SearchbarBase
*/
public onOk() {
let propip: any = this.$refs.propip;
propip.handleMouseleave();
this.onSave(this.saveItemName);
}
/**
* 取消设置
*
* @return {*}
* @memberof SearchbarBase
*/
public onCancel() {
let propip: any = this.$refs.propip;
propip.handleMouseleave();
this.onSave();
}
}
</script>
<style lang='scss'>
@import './searchbar-searchbar.scss';
</style>
\ No newline at end of file
// 基于 @CONTROL/搜索栏/MODEL.ts.ftl 生成
/**
* Searchbar 部件模型
*
* @export
* @class SearchbarModel
*/
export default class SearchbarModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof SearchbarSearchbarMode
*/
public getDataItems(): any[] {
return [
]
}
}
\ No newline at end of file
// 基于 @CONTROL/搜索栏/SERVICE.ts.ftl 生成
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBIZOrderService from '@/service/ibizorder/ibizorder-service';
import SearchbarModel from './searchbar-searchbar-model';
import UtilService from '@/utilservice/util-service';
/**
* Searchbar 部件服务对象
*
* @export
* @class SearchbarService
*/
export default class SearchbarService extends ControlService {
/**
* 订单服务对象
*
* @type {IBIZOrderService}
* @memberof SearchbarService
*/
public appEntityService: IBIZOrderService = new IBIZOrderService();
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof SearchbarService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of SearchbarService.
*
* @param {*} [opts={}]
* @memberof SearchbarService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new SearchbarModel();
}
/**
* 工具服务对象
*
* @protected
* @type {UtilService}
* @memberof SearchbarService
*/
protected utilService: UtilService = new UtilService();
/**
* 加载数据模型
*
* @param {string} serviceName
* @param {*} context
* @param {*} viewparams
* @memberof SearchbarService
*/
public loadModel(serviceName: string, context: any, viewparams: any) {
return new Promise((resolve: any, reject: any) => {
this.utilService.getService(serviceName).then((service: any) => {
service.loadModelData(JSON.stringify(context), viewparams).then((response: any) => {
resolve(response);
}).catch((response: any) => {
reject(response);
});
}).catch((response: any) => {
reject(response);
});
});
}
/**
* 保存模型
*
* @param {string} serviceName
* @param {*} context
* @param {*} viewparams
* @returns
* @memberof SearchbarService
*/
public saveModel(serviceName: string, context: any, viewparams: any) {
return new Promise((resolve: any, reject: any) => {
this.utilService.getService(serviceName).then((service: any) => {
service.saveModelData(JSON.stringify(context), '', viewparams).then((response: any) => {
resolve(response);
}).catch((response: any) => {
reject(response);
});
}).catch((response: any) => {
reject(response);
});
});
}
}
\ No newline at end of file
// 基于 @CONTROL/搜索栏/CONTROL.scss.ftl 生成
.search-bar-footer {
height: 32px;
margin-bottom: 6px;
.search-bar-action {
float: right;
display: flex;
align-items: center;
> * {
margin-left: 5px;
.save-action {
text-align: right;
margin-top: 10px;
> * {
margin-left: 5px;
}
}
}
}
}
// this is scss
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import SearchbarBase from './searchbar-searchbar-base.vue';
// 基于 @CONTROL/搜索栏/CONTROL.vue.ftl 生成
@Component({
components: {
}
})
export default class Searchbar extends SearchbarBase {
}
</script>
\ No newline at end of file
{
"codeName" : "searchbar",
"controlType" : "SEARCHBAR",
"dynaModelFilePath" : "PSSYSAPPS/Web/PSAPPDATAENTITIES/IBIZOrder/PSSEARCHBARS/searchbar.json",
"logicName" : "常规搜索栏",
"mOSFilePath" : "psmodules/Sample/psdataentities/IBIZORDER/pssyssearchbars/searchbar",
"getPSAppDataEntity" : {
"modelref" : true,
"path" : "PSSYSAPPS/Web/PSAPPDATAENTITIES/IBIZOrder.json"
},
"getPSSearchBarFilters" : [ {
"dataType" : 25,
"itemType" : "FILTER",
"labelPos" : "NONE",
"labelWidth" : 0,
"name" : "filter",
"getPSAppDEField" : {
"name" : "ORDERUID",
"codeName" : "OrderUID"
},
"getPSEditor" : {
"editorType" : "TEXTBOX",
"name" : "filter"
},
"addSeparator" : true,
"allowEmpty" : true,
"emptyCaption" : false,
"hidden" : false,
"showCaption" : false
}, {
"dataType" : 25,
"itemType" : "FILTER",
"labelPos" : "NONE",
"labelWidth" : 0,
"name" : "filter2",
"getPSAppDEField" : {
"name" : "IBIZORDERNAME",
"codeName" : "IBIZOrderName"
},
"getPSEditor" : {
"editorType" : "TEXTBOX",
"name" : "filter2"
},
"allowEmpty" : true,
"emptyCaption" : false,
"hidden" : false,
"showCaption" : false
}, {
"dataType" : 5,
"itemType" : "FILTER",
"labelPos" : "NONE",
"labelWidth" : 0,
"name" : "filter3",
"getPSAppDEField" : {
"name" : "ORDERTIME",
"codeName" : "OrderTime"
},
"getPSEditor" : {
"editorType" : "TEXTBOX",
"name" : "filter3"
},
"allowEmpty" : true,
"emptyCaption" : false,
"hidden" : false,
"showCaption" : false
} ],
"quickGroupCount" : -1,
"quickSearchMode" : 1,
"quickSearchWidth" : 0,
"rTMOSFilePath" : "pssysapps/Web/psappdeviews/IBIZOrderSGridView/psappviewctrls/searchbar",
"enableFilter" : true,
"enableGroup" : false,
"enableQuickSearch" : true,
"mobileSearchBar" : false,
"modelid" : "C200F1B8-4D4A-4FC7-AE5E-86FDD1C703C7",
"modeltype" : "PSSYSSEARCHBAR"
}
\ No newline at end of file
......@@ -460,6 +460,86 @@
"xDataControlName" : "grid"
} ],
"getPSControls" : [ {
"codeName" : "searchbar",
"controlType" : "SEARCHBAR",
"dynaModelFilePath" : "PSSYSAPPS/Web/PSAPPDATAENTITIES/IBIZOrder/PSSEARCHBARS/searchbar.json",
"logicName" : "常规搜索栏",
"mOSFilePath" : "psmodules/Sample/psdataentities/IBIZORDER/pssyssearchbars/searchbar",
"getPSAppDataEntity" : {
"modelref" : true,
"path" : "PSSYSAPPS/Web/PSAPPDATAENTITIES/IBIZOrder.json"
},
"getPSControlParam" : {
"id" : "SEARCHBAR"
},
"getPSSearchBarFilters" : [ {
"dataType" : 25,
"itemType" : "FILTER",
"labelPos" : "NONE",
"labelWidth" : 0,
"name" : "filter",
"getPSAppDEField" : {
"name" : "ORDERUID",
"codeName" : "OrderUID"
},
"getPSEditor" : {
"editorType" : "TEXTBOX",
"name" : "filter"
},
"addSeparator" : true,
"allowEmpty" : true,
"emptyCaption" : false,
"hidden" : false,
"showCaption" : false
}, {
"dataType" : 25,
"itemType" : "FILTER",
"labelPos" : "NONE",
"labelWidth" : 0,
"name" : "filter2",
"getPSAppDEField" : {
"name" : "IBIZORDERNAME",
"codeName" : "IBIZOrderName"
},
"getPSEditor" : {
"editorType" : "TEXTBOX",
"name" : "filter2"
},
"allowEmpty" : true,
"emptyCaption" : false,
"hidden" : false,
"showCaption" : false
}, {
"dataType" : 5,
"itemType" : "FILTER",
"labelPos" : "NONE",
"labelWidth" : 0,
"name" : "filter3",
"getPSAppDEField" : {
"name" : "ORDERTIME",
"codeName" : "OrderTime"
},
"getPSEditor" : {
"editorType" : "TEXTBOX",
"name" : "filter3"
},
"allowEmpty" : true,
"emptyCaption" : false,
"hidden" : false,
"showCaption" : false
} ],
"quickGroupCount" : -1,
"quickSearchMode" : 1,
"quickSearchWidth" : 0,
"rTMOSFilePath" : "pssysapps/Web/psappdeviews/IBIZOrderSGridView/psappviewctrls/searchbar",
"enableFilter" : true,
"enableGroup" : false,
"enableQuickSearch" : true,
"mobileSearchBar" : false,
"name" : "searchbar",
"modelid" : "C200F1B8-4D4A-4FC7-AE5E-86FDD1C703C7",
"modeltype" : "PSSYSSEARCHBAR"
}, {
"codeName" : "SGridViewtoolbar",
"controlType" : "TOOLBAR",
"hookEventNames" : [ "CLICK" ],
......@@ -824,6 +904,62 @@
},
"showCaption" : true,
"showIcon" : false
}, {
"getCapPSLanguageRes" : {
"lanResTag" : "TBB.TEXT.*.FILTER",
"mOSFilePath" : "pslanguageres/Auto1437",
"rTMOSFilePath" : "pslanguageres/Auto1437"
},
"caption" : "过滤",
"groupExtractMode" : "ITEM",
"itemType" : "DEUIACTION",
"name" : "deuiaction3",
"noPrivDisplayMode" : 2,
"getPSAppViewUIAction" : {
"modelref" : true,
"id" : "toolbar_deuiaction3"
},
"getPSSysImage" : {
"glyph" : "xf0b0@FontAwesome",
"cssClass" : "fa fa-filter"
},
"getPSUIAction" : {
"getCapPSLanguageRes" : {
"lanResTag" : "TBB.TEXT.*.FILTER",
"mOSFilePath" : "pslanguageres/Auto1437",
"rTMOSFilePath" : "pslanguageres/Auto1437"
},
"caption" : "过滤",
"codeName" : "ToggleFilter",
"fullCodeName" : "ToggleFilter",
"mOSFilePath" : "pssysapps/Web/pssysappdeuiactions/ToggleFilter",
"name" : "表格界面_搜索栏",
"getPSSysImage" : {
"glyph" : "xf0b0@FontAwesome",
"cssClass" : "fa fa-filter"
},
"predefinedType" : "GRIDVIEW_SEARCHBAR",
"rTMOSFilePath" : "pssysapps/Web/pssysappdeuiactions/ToggleFilter",
"timeout" : 60000,
"getTooltipPSLanguageRes" : {
"lanResTag" : "TBB.TOOLTIP.*.FILTER",
"mOSFilePath" : "pslanguageres/Auto796",
"rTMOSFilePath" : "pslanguageres/Auto796"
},
"uIActionMode" : "SYS",
"uIActionTag" : "ToggleFilter",
"uIActionType" : "DEUIACTION",
"enableToggleMode" : true
},
"tooltip" : "过滤",
"getTooltipPSLanguageRes" : {
"lanResTag" : "TBB.TOOLTIP.*.FILTER",
"mOSFilePath" : "pslanguageres/Auto796",
"rTMOSFilePath" : "pslanguageres/Auto796"
},
"enableToggleMode" : true,
"showCaption" : true,
"showIcon" : true
}, {
"itemType" : "SEPERATOR",
"name" : "tbitem7",
......@@ -1665,11 +1801,12 @@
"xDataControlName" : "grid",
"enableDP" : true,
"enableExport" : true,
"enableFilter" : false,
"enableFilter" : true,
"enableImport" : true,
"enableQuickGroup" : true,
"enableQuickSearch" : true,
"enableRowEdit" : false,
"enableSearch" : true,
"rowEditDefault" : false,
"showCaptionBar" : false,
"modelid" : "1a7578c0b5f8a1107d0fe9c2dc51f314",
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册