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

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

上级 7c202bd5
......@@ -2913,7 +2913,7 @@ mock.onGet('v7/main-menuappmenu').reply((config: any) => {
iconcls: '',
icon: '',
textcls: '',
appfunctag: '',
appfunctag: 'AppFunc99',
resourcetag: '',
},
],
......
<template>
<div class="app-view-layout" style="height: '100%'; width: '100%';'display': 'flex'; 'flex-direction': 'column';">
<app-standard-container name="page_container" :layoutModelDetails="layoutModelDetails">
<template #container_grid1>
<app-simpleflex-container name="container_grid1" :layoutModelDetails="layoutModelDetails">
<template #container1>
<app-simpleflex-container name="container1" :layoutModelDetails="layoutModelDetails">
<template #view_pagecaption>
<span>属性项</span>
</template>
</app-simpleflex-container>
</template>
<template #container2>
<app-simpleflex-container name="container2" :layoutModelDetails="layoutModelDetails">
<template #quicksearchbar>
<span>部件占位</span>
</template>
</app-simpleflex-container>
</template>
<template #container_2>
<app-simpleflex-container name="container_2" :layoutModelDetails="layoutModelDetails">
<template #toolbar>
<span>部件占位</span>
</template>
</app-simpleflex-container>
</template>
</app-simpleflex-container>
</template>
<template #container4>
<app-standard-container name="container4" :layoutModelDetails="layoutModelDetails">
<template #tabpanel1>
<span>分组容器</span>
</template>
</app-standard-container>
</template>
</app-standard-container>
</div>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import { Subject,Subscription } from 'rxjs';
import IBIZOrderService from '@/service/ibizorder/ibizorder-service';
import IBIZOrderAuthService from '@/authservice/ibizorder/ibizorder-auth-service';
import GridViewEngine from '@engine/view/grid-view-engine';
import IBIZOrderUIService from '@/uiservice/ibizorder/ibizorder-ui-service';
import { PanelContainerModel, PanelRawitemModel, PanelFieldModel, PanelControlModel, PanelButtonModel, PanelUserControlModel, PanelTabPanelModel, PanelTabPageModel, PanelCtrlPosModel} from '@/model/panel-detail';
import CodeListService from "@/codelist/codelist-service";
@Component({
components: {
},
})
export default class IBIZOrderUsr2GridViewBase extends Vue {
/**
* 实体服务对象
*
* @type {IBIZOrderService}
* @memberof IBIZOrderUsr2GridViewBase
*/
public appEntityService: IBIZOrderService = new IBIZOrderService;
/**
* 实体UI服务对象
*
* @type IBIZOrderUIService
* @memberof IBIZOrderUsr2GridViewBase
*/
public appUIService: IBIZOrderUIService = new IBIZOrderUIService();
/**
* 数据变化
*
* @param {*} val
* @returns {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Emit()
public viewDatasChange(val: any):any {
return val;
}
/**
* 传入视图上下文
*
* @type {string}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Prop() public viewdata!: string;
/**
* 传入视图参数
*
* @type {string}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Prop() public viewparam!: string;
/**
* 视图默认使用
*
* @type {boolean}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Prop({ default: true }) public viewDefaultUsage!: boolean;
/**
* 视图默认使用
*
* @type {string}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Inject({from:'navModel',default: 'tab'})
public navModel!:string;
/**
* 视图标识
*
* @type {string}
* @memberof IBIZOrderUsr2GridViewBase
*/
public viewtag: string = '504c018faa34b2d0fce7c4c56569e02e';
/**
* 自定义视图导航上下文集合
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public customViewNavContexts:any ={
};
/**
* 自定义视图导航参数集合
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public customViewParams:any ={
};
/**
* 视图模型数据
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public model: any = {
srfCaption: 'entities.ibizorder.views.usr2gridview.caption',
srfTitle: 'entities.ibizorder.views.usr2gridview.title',
srfSubTitle: 'entities.ibizorder.views.usr2gridview.subtitle',
dataInfo: ''
}
/**
* 视图参数变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZOrderUsr2GridViewBase
*/
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
}
/**
* 处理应用上下文变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof IBIZOrderUsr2GridViewBase
*/
@Watch('viewdata')
onViewData(newVal: any, oldVal: any) {
const _this: any = this;
if (!Object.is(newVal, oldVal) && _this.engine) {
this.$nextTick(()=>{
_this.parseViewParam();
_this.engine.load();
});
} else if(!Object.is(newVal, oldVal) && _this.refresh && _this.refresh instanceof Function) {
_this.refresh();
}
}
/**
* 容器模型
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public containerModel: any = {
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_searchbar: { name: 'searchbar', type: 'SEARCHBAR' },
wflinks: [],
};
/**
* 视图刷新
*
* @param {*} args
* @memberof IBIZOrderUsr2GridViewBase
*/
public refresh(args?: any): void {
const refs: any = this.$refs;
if (refs && refs.grid) {
refs.grid.refresh();
}
}
/**
* 计数器刷新
*
* @memberof IBIZOrderUsr2GridViewBase
*/
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();
}
})
}
}
/**
* 视图状态订阅对象
*
* @public
* @type {Subject<{action: string, data: any}>}
* @memberof IBIZOrderUsr2GridViewBase
*/
public viewState: Subject<ViewState> = new Subject();
/**
* 工具栏模型
*
* @type {*}
* @memberof IBIZOrderUsr2GridView
*/
public toolBarModels: any = {
};
/**
* 视图布局面板模型对象
*
* @public
* @memberof IBIZOrderUsr2GridViewBase
*/
public layoutModelDetails:any = {
view_pagecaption:new PanelFieldModel({ name: 'view_pagecaption',caption: '页面标题',itemType: 'FIELD',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutWidth:0,widthMode:'FULL',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'LEFT',vAlignSelf:'',
flexGrow:-1,panel: this }),
container1:new PanelContainerModel({ name: 'container1',caption: '面板容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:6,panel: this,
details:['view_pagecaption']}),
quicksearchbar:new PanelCtrlPosModel({ name: 'quicksearchbar',caption: 'QUICKSEARCHBAR',itemType: 'CTRLPOS',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'RIGHT',vAlignSelf:'',
flexGrow:-1,panel: this }),
container2:new PanelContainerModel({ name: 'container2',caption: '面板容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:3,panel: this,
details:['quicksearchbar']}),
toolbar:new PanelCtrlPosModel({ name: 'toolbar',caption: 'TOOLBAR',itemType: 'CTRLPOS',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'RIGHT',vAlignSelf:'',
flexGrow:-1,panel: this }),
container_2:new PanelContainerModel({ name: 'container_2',caption: '容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['toolbar']}),
container_grid1:new PanelContainerModel({ name: 'container_grid1',caption: '栅格容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['container1','container2','container_2']}),
searchform:new PanelCtrlPosModel({ name: 'searchform',caption: 'SEARCHFORM',itemType: 'CTRLPOS',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
search:new PanelTabPageModel({ name: 'search',caption: '搜索',itemType: 'TABPAGE',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
grid:new PanelCtrlPosModel({ name: 'grid',caption: 'GRID',itemType: 'CTRLPOS',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:100,heightMode:'PERCENTAGE',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
content:new PanelTabPageModel({ name: 'content',caption: '内容',itemType: 'TABPAGE',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
tabpanel1:new PanelTabPanelModel({ name: 'tabpanel1',caption: '分页部件',itemType: 'TABPANEL',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['search','content'] }),
container4:new PanelContainerModel({ name: 'container4',caption: '容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:100,heightMode:'PERCENTAGE',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['tabpanel1']}),
page_container:new PanelContainerModel({ name: 'page_container',caption: '',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['container_grid1','container4']})
};
/**
* 视图引擎
*
* @public
* @type {Engine}
* @memberof IBIZOrderUsr2GridViewBase
*/
public engine: GridViewEngine = new GridViewEngine();
/**
* 引擎初始化
*
* @public
* @memberof IBIZOrderUsr2GridViewBase
*/
public engineInit(): void {
this.engine.init({
view: this,
opendata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.opendata(args,fullargs, params, $event, xData);
},
newdata: (args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) => {
this.newdata(args,fullargs, params, $event, xData);
},
grid: this.$refs.grid,
searchform: this.$refs.searchform,
keyPSDEField: 'ibizorder',
majorPSDEField: 'ibizordername',
isLoadDefault: true,
});
}
/**
* 应用导航服务
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public navDataService = NavDataService.getInstance();
/**
* 导航服务事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZOrderUsr2GridViewBase
*/
public serviceStateEvent: Subscription | undefined;
/**
* 门户部件状态对象
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Prop() public portletState?: any;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZOrderUsr2GridViewBase
*/
public portletStateEvent: Subscription | undefined;
/**
* 门户部件状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof IBIZOrderUsr2GridViewBase
*/
public formDruipartEvent: Subscription | undefined;
/**
* 应用上下文
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public context:any = {};
/**
* 视图参数
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public viewparams:any = {};
/**
* 视图缓存数据
*
* @type {*}
* @memberof IBIZOrderUsr2GridViewBase
*/
public viewCacheData:any;
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof IBIZOrderUsr2GridViewBase
*/
public counterServiceArray:Array<any> = [];
/**
* 解析视图参数
*
* @public
* @memberof IBIZOrderUsr2GridViewBase
*/
public parseViewParam(inputvalue:any = null): void {
for(let key in this.context){
delete this.context[key];
}
if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
Object.assign(this.context,this.$store.getters.getAppData().context);
}
if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
if(typeof this.viewdata == 'string') {
Object.assign(this.context, JSON.parse(this.viewdata));
}
if(this.context && this.context.srfparentdename){
Object.assign(this.viewparams,{srfparentdename:this.context.srfparentdename});
}
if(this.context && this.context.srfparentkey){
Object.assign(this.viewparams,{srfparentkey:this.context.srfparentkey});
}
this.handleCustomViewData();
return;
}
const path = (this.$route.matched[this.$route.matched.length - 1]).path;
const keys: Array<any> = [];
const curReg = this.$pathToRegExp.pathToRegexp(path, keys);
const matchArray = curReg.exec(this.$route.path);
let tempValue: Object = {};
keys.forEach((item: any, index: number) => {
if(matchArray[index + 1]){
Object.defineProperty(tempValue, item.name, {
enumerable: true,
value: decodeURIComponent(matchArray[index + 1])
});
}
});
this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
if(inputvalue){
Object.assign(this.context,{'ibizorder':inputvalue});
}
//初始化视图唯一标识
Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
this.handleCustomViewData();
//初始化导航数据
this.initNavDataWithRoute();
}
/**
* 处理自定义视图数据
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public handleCustomViewData(){
if(Object.keys(this.customViewNavContexts).length > 0){
Object.keys(this.customViewNavContexts).forEach((item:any) =>{
let tempContext:any = {};
let curNavContext:any = this.customViewNavContexts[item];
this.handleCustomDataLogic(curNavContext,tempContext,item);
Object.assign(this.context,tempContext);
})
}
if(Object.keys(this.customViewParams).length > 0){
Object.keys(this.customViewParams).forEach((item:any) =>{
let tempParam:any = {};
let curNavParam:any = this.customViewParams[item];
this.handleCustomDataLogic(curNavParam,tempParam,item);
Object.assign(this.viewparams,tempParam);
})
}
}
/**
* 处理自定义视图数据逻辑
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
// 直接值直接赋值
if(curNavData.isRawValue){
if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: curNavData.value,
writable : true,
enumerable : true,
configurable : true
});
}
}else{
// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
if(this.context[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.context[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
if(this.viewparams[(curNavData.value).toLowerCase()] != null){
Object.defineProperty(tempData, item.toLowerCase(), {
value: this.viewparams[(curNavData.value).toLowerCase()],
writable : true,
enumerable : true,
configurable : true
});
}else{
Object.defineProperty(tempData, item.toLowerCase(), {
value: null,
writable : true,
enumerable : true,
configurable : true
});
}
}
}
}
/**
* 初始化导航数据(路由模式)
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public initNavDataWithRoute(data:any = null, isNew:boolean = false, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
this.navDataService.addNavData({id:'ibizorder-usr2-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.ibizorder,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
}
}
/**
* 初始化导航数据(分页模式)
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
this.navDataService.addNavDataByOnly({id:'ibizorder-usr2-grid-view',tag:this.viewtag,srfkey:this.context.ibizorder,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
}
}
/**
* Vue声明周期
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public created() {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public afterCreated(){
let _this:any = this;
const secondtag = _this.$util.createUUID();
_this.$store.commit('viewaction/createdView', { viewtag: _this.viewtag, secondtag: secondtag });
_this.viewtag = secondtag;
_this.parseViewParam();
_this.serviceStateEvent = _this.navDataService.serviceState.subscribe(({ action,name, data }:{ action:string,name:any,data:any }) => {
if(!Object.is(name,'ibizorder-usr2-grid-view')){
return;
}
if (Object.is(action, 'viewrefresh')) {
_this.$nextTick(()=>{
_this.parseViewParam(data);
if(_this.engine){
_this.engine.load();
}
});
}
});
if(_this.portletState){
_this.portletStateEvent = _this.portletState.subscribe((res:any) =>{
if(!Object.is(res.name,'IBIZOrderUsr2GridView')){
return;
}
if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
_this.refresh();
}
})
}
if(this.formDruipart){
this.formDruipartEvent = this.formDruipart.subscribe((res:any) =>{
if(Object.is(res.action,'save')){
this.viewState.next({ tag:'grid', action: 'save', data: this.viewparams });
}
if(Object.is(res.action,'load')){
const _this: any = this;
_this.engine.load(res.data,true);
}
});
}
}
/**
* 销毁之前
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public beforeDestroy() {
this.$store.commit('viewaction/removeView', this.viewtag);
let _this: any = this
if (_this.serviceStateEvent) {
_this.serviceStateEvent.unsubscribe();
}
if (_this.portletStateEvent) {
_this.portletStateEvent.unsubscribe();
}
if (_this.engine) {
_this.engine.destroy();
}
}
/**
* Vue声明周期(组件初始化完毕)
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public mounted() {
this.afterMounted();
}
/**
* 执行mounted后的逻辑
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public afterMounted(){
const _this: any = this;
_this.engineInit();
if (_this.loadModel && _this.loadModel instanceof Function) {
_this.loadModel();
}
}
/**
* grid 部件 rowdblclick 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public grid_rowdblclick($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
}
/**
* grid 部件 selectionchange 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public grid_selectionchange($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'selectionchange', $event);
}
/**
* grid 部件 remove 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public grid_remove($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'remove', $event);
}
/**
* grid 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public grid_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'load', $event);
}
/**
* grid 部件 beforeload 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public grid_beforeload($event: any, $event2?: any) {
this.engine.onCtrlEvent('grid', 'beforeload', $event);
}
/**
* searchform 部件 search 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public searchform_search($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'search', $event);
}
/**
* searchform 部件 load 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public searchform_load($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'load', $event);
}
/**
* searchform 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public searchform_save($event: any, $event2?: any) {
this.engine.onCtrlEvent('searchform', 'save', $event);
}
/**
* 打开新建数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof IBIZOrderUsr2GridView
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
let localContext:any = null;
let localViewParam:any =null;
this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
}
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof IBIZOrderUsr2GridView
*/
public opendata(args: any[],fullargs?:any,params?: any, $event?: any, xData?: any) {
if(!this.viewDefaultUsage){
if(Object.is(this.navModel,"route")){
this.initNavDataWithRoute(this.viewCacheData, false, true);
}else{
this.initNavDataWithTab(this.viewCacheData, false, true);
}
}
let localContext:any = null;
let localViewParam:any =null;
this.$Notice.warning({ title: '错误', desc: '未指定关系视图' });
}
/**
* 关闭视图
*
* @param {any[]} args
* @memberof IBIZOrderUsr2GridViewBase
*/
public closeView(args: any[]): void {
let _view: any = this;
if (_view.viewdata) {
_view.$emit('viewdataschange', Array.isArray(args)?args:[args]);
_view.$emit('close', Array.isArray(args)?args:[args]);
} else if (_view.$tabPageExp) {
_view.$tabPageExp.onClose(_view.$route.fullPath);
}
}
/**
* 销毁视图回调
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBIZOrderUsr2GridViewBase
*/
public afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
if(Object.is(this.navModel,"tab")){
this.navDataService.removeNavDataByTag(this.viewtag);
}
}
if (this.serviceStateEvent) {
this.serviceStateEvent.unsubscribe();
}
// 销毁计数器定时器
if(this.counterServiceArray && this.counterServiceArray.length >0){
this.counterServiceArray.forEach((item:any) =>{
if(item.destroyCounter && item.destroyCounter instanceof Function){
item.destroyCounter();
}
})
}
if(this.portletStateEvent){
this.portletStateEvent.unsubscribe();
}
if (this.formDruipartEvent) {
this.formDruipartEvent.unsubscribe();
}
this.viewState.complete();
}
/**
* 是否单选
*
* @type {boolean}
* @memberof IBIZOrderUsr2GridViewBase
*/
public isSingleSelect: boolean = false;
/**
* 是否嵌入关系界面
*
* @type {boolean}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Prop({default:false}) public isformDruipart?: boolean;
/**
* 界面关系通讯对象
*
* @type {Subject<ViewState>}
* @memberof IBIZOrderUsr2GridViewBase
*/
@Prop() public formDruipart?: Subject<ViewState>;
/**
* 搜索值
*
* @type {string}
* @memberof IBIZOrderUsr2GridViewBase
*/
public query: string = '';
/**
* 是否展开搜索表单
*
* @type {boolean}
* @memberof IBIZOrderUsr2GridViewBase
*/
public isExpandSearchForm: boolean = false;
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof IBIZOrderUsr2GridViewBase
*/
public gridRowActiveMode: number | 0 | 1 | 2 = 2;
/**
* 快速搜索
*
* @param {*} $event
* @memberof IBIZOrderUsr2GridViewBase
*/
public onSearch($event: any): void {
const grid: any = this.$refs.grid;
if (grid) {
grid.load(this.context, true);
}
}
/**
* grid 部件 save 事件
*
* @param {*} [args={}]
* @param {*} $event
* @memberof ENTITYTEST1Usr2GridViewBase
*/
public onSave($event: any) {
this.$emit('drdatasaved', $event);
}
/**
* 刷新数据
*
* @readonly
* @type {(number | null)}
* @memberof IBIZOrderUsr2GridViewBase
*/
get refreshdata(): number | null {
return this.$store.getters['viewaction/getRefreshData'](this.viewtag);
}
/**
* 监控数据变化
*
* @param {*} newVal
* @param {*} oldVal
* @returns
* @memberof IBIZOrderUsr2GridViewBase
*/
@Watch('refreshdata')
onRefreshData(newVal: any, oldVal: any) {
if (newVal === null || newVal === undefined) {
return;
}
if (newVal === 0) {
return;
}
const grid: any = this.$refs.grid;
if (grid) {
grid.load({});
}
}
}
</script>
<style lang='less'>
@import './ibizorder-usr2-grid-view.less';
</style>
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBIZOrderUsr2GridViewBase from './ibizorder-usr2-grid-view-base.vue';
import view_grid from '@widgets/ibizorder/main-grid/main-grid.vue';
import view_searchform from '@widgets/ibizorder/default-searchform/default-searchform.vue';
import view_searchbar from '@widgets/ibizorder/-searchbar/-searchbar.vue';
@Component({
components: {
view_grid,
view_searchform,
view_searchbar,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
if(!Object.is(vm.navModel,"route")){
vm.initNavDataWithTab(vm.viewCacheData);
}
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class IBIZOrderUsr2GridView extends IBIZOrderUsr2GridViewBase {
}
</script>
\ No newline at end of file
......@@ -104,6 +104,7 @@ export const PageComponents = {
Vue.component('ibizbookdata-view-exp-view', () => import('@pages/sample/ibizbookdata-view-exp-view/ibizbookdata-view-exp-view.vue'));
Vue.component('ibizbookusr4-edit-view', () => import('@pages/sample/ibizbookusr4-edit-view/ibizbookusr4-edit-view.vue'));
Vue.component('ibizorder-detail-usr3-edit-view', () => import('@pages/sample/ibizorder-detail-usr3-edit-view/ibizorder-detail-usr3-edit-view.vue'));
Vue.component('ibizorder-usr2-grid-view', () => import('@pages/sample/ibizorder-usr2-grid-view/ibizorder-usr2-grid-view.vue'));
Vue.component('ibizappviewgrid-view', () => import('@pages/sample/ibizappviewgrid-view/ibizappviewgrid-view.vue'));
Vue.component('ibizappviewlist-view', () => import('@pages/sample/ibizappviewlist-view/ibizappviewlist-view.vue'));
Vue.component('ibizappctrlgrid-view', () => import('@pages/sample/ibizappctrlgrid-view/ibizappctrlgrid-view.vue'));
......
......@@ -1609,6 +1609,20 @@ const router = new Router({
},
component: () => import('@pages/sample/ibizorder-detail-usr3-edit-view/ibizorder-detail-usr3-edit-view.vue'),
},
{
path: 'ibizorders/:ibizorder?/usr2gridview/:usr2gridview?',
meta: {
caption: 'entities.ibizorder.views.usr2gridview.caption',
info:'',
parameters: [
{ pathName: 'index', parameterName: 'index' },
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'usr2gridview', parameterName: 'usr2gridview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizorder-usr2-grid-view/ibizorder-usr2-grid-view.vue'),
},
{
path: 'ibizappviews/:ibizappview?/gridview/:gridview?',
meta: {
......@@ -3499,6 +3513,19 @@ const router = new Router({
},
component: () => import('@pages/sample/ibiztaskteamgrid-view9/ibiztaskteamgrid-view9.vue'),
},
{
path: '/ibizorders/:ibizorder?/usr2gridview/:usr2gridview?',
meta: {
caption: 'entities.ibizorder.views.usr2gridview.caption',
info:'',
parameters: [
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'usr2gridview', parameterName: 'usr2gridview' },
],
requireAuth: true,
},
component: () => import('@pages/sample/ibizorder-usr2-grid-view/ibizorder-usr2-grid-view.vue'),
},
{
path: '/ibizbooks/:ibizbook?/wizardiwithstateview/:wizardiwithstateview?',
meta: {
......
......@@ -6,43 +6,39 @@
<app-standard-container name="page_container" :layoutModelDetails="layoutModelDetails">
<template #container1>
<app-standard-container name="container1" :layoutModelDetails="layoutModelDetails">
<template #app_apptitle>
<template #auth_userid>
<span>属性项</span>
</template>
<template #auth_password>
<span>属性项</span>
</template>
<template #container_grid1>
<app-simpleflex-container name="container_grid1" :layoutModelDetails="layoutModelDetails">
<template #container4>
<app-simpleflex-container name="container4" :layoutModelDetails="layoutModelDetails">
<template #auth_orgpick>
<span>属性项</span>
</template>
<template #auth_loginbutton1>
<span>按钮</span>
</template>
</app-simpleflex-container>
<template #auth_registbutton1>
<span>按钮</span>
</template>
<template #container5>
<app-simpleflex-container name="container5" :layoutModelDetails="layoutModelDetails">
<template #auth_resetinput1>
<span>按钮</span>
</template>
</app-simpleflex-container>
</template>
</app-simpleflex-container>
</template>
<template #container3>
<app-standard-container name="container3" :layoutModelDetails="layoutModelDetails">
<template #static_text1>
<span>直接内容</span>
<template #auth_logout1>
<span>按钮</span>
</template>
<template #auth_sso1>
<template #auth_captcha1>
<span>用户自定义控件</span>
</template>
</app-standard-container>
<template #auth_verificationcode>
<span>属性项</span>
</template>
<template #auth_userid>
<template #auth_loginmsg>
<span>属性项</span>
</template>
<template #auth_sso1>
<span>用户自定义控件</span>
</template>
</app-standard-container>
</template>
</app-standard-container>
......@@ -233,71 +229,67 @@ export default class AppLoginViewBase extends Vue {
* @memberof AppLoginViewBase
*/
public layoutModelDetails:any = {
app_apptitle:new PanelFieldModel({ name: 'app_apptitle',caption: '应用标题',itemType: 'FIELD',visible: true,
auth_userid:new PanelFieldModel({ name: 'auth_userid',caption: '用户名',itemType: 'FIELD',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'CENTER',vAlignSelf:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
auth_password:new PanelFieldModel({ name: 'auth_password',caption: '密码',itemType: 'FIELD',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
auth_loginbutton1:new PanelButtonModel({ name: 'auth_loginbutton1',caption: '登陆',itemType: 'BUTTON',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
auth_orgpick:new PanelFieldModel({ name: 'auth_orgpick',caption: '组织',itemType: 'FIELD',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
container4:new PanelContainerModel({ name: 'container4',caption: '面板容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'SIMPLEFLEX',
auth_loginbutton1:new PanelButtonModel({ name: 'auth_loginbutton1',caption: '登陆',itemType: 'BUTTON',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:6,panel: this,
details:['auth_loginbutton1']}),
auth_resetinput1:new PanelButtonModel({ name: 'auth_resetinput1',caption: '重置',itemType: 'BUTTON',visible: true,
disabled: false,layout:'SIMPLEFLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
flexGrow:-1,panel: this }),
auth_registbutton1:new PanelButtonModel({ name: 'auth_registbutton1',caption: '注册',itemType: 'BUTTON',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
container5:new PanelContainerModel({ name: 'container5',caption: '面板容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'SIMPLEFLEX',
auth_resetinput1:new PanelButtonModel({ name: 'auth_resetinput1',caption: '重置',itemType: 'BUTTON',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:6,panel: this,
details:['auth_resetinput1']}),
container_grid1:new PanelContainerModel({ name: 'container_grid1',caption: '栅格容器',itemType: 'CONTAINER',visible: true,
flexGrow:-1,panel: this }),
auth_logout1:new PanelButtonModel({ name: 'auth_logout1',caption: '登出',itemType: 'BUTTON',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['container4','container5']}),
static_text1:new PanelRawitemModel({ name: 'static_text1',caption: '文本',itemType: 'RAWITEM',visible: true,
flexGrow:-1,panel: this }),
auth_captcha1:new PanelUserControlModel({ name: 'auth_captcha1',caption: '人机识别',itemType: 'USERCONTROL',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutWidth:0,widthMode:'FULL',spacingBottom:'',spacingLeft:'',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
auth_sso1:new PanelUserControlModel({ name: 'auth_sso1',caption: '第三方登陆',itemType: 'USERCONTROL',visible: true,
auth_verificationcode:new PanelFieldModel({ name: 'auth_verificationcode',caption: '短信验证码',itemType: 'FIELD',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this }),
container3:new PanelContainerModel({ name: 'container3',caption: '容器',itemType: 'CONTAINER',visible: true,
auth_loginmsg:new PanelFieldModel({ name: 'auth_loginmsg',caption: '登陆校验信息',itemType: 'FIELD',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['static_text1','auth_sso1']}),
auth_userid:new PanelFieldModel({ name: 'auth_userid',caption: '用户名',itemType: 'FIELD',visible: true,
flexGrow:-1,panel: this }),
auth_sso1:new PanelUserControlModel({ name: 'auth_sso1',caption: '第三方登陆',itemType: 'USERCONTROL',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:0,widthMode:'',spacingBottom:'',spacingLeft:'',
......@@ -305,11 +297,11 @@ export default class AppLoginViewBase extends Vue {
flexGrow:-1,panel: this }),
container1:new PanelContainerModel({ name: 'container1',caption: '容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:0,heightMode:'FULL',
layoutWidth:450,widthMode:'PX',spacingBottom:'',spacingLeft:'',
layoutPos:'',layoutHeight:0,heightMode:'',
layoutWidth:600,widthMode:'PX',spacingBottom:'',spacingLeft:'',
spacingRight:'',spacingTop:'',hAlignSelf:'CENTER',vAlignSelf:'',
flexGrow:-1,panel: this,
details:['app_apptitle','auth_password','container_grid1','container3','auth_userid']}),
details:['auth_userid','auth_password','auth_orgpick','auth_loginbutton1','auth_registbutton1','auth_resetinput1','auth_logout1','auth_captcha1','auth_verificationcode','auth_loginmsg','auth_sso1']}),
page_container:new PanelContainerModel({ name: 'page_container',caption: '图片背景容器',itemType: 'CONTAINER',visible: true,
disabled: false,layout:'FLEX',
layoutPos:'',layoutHeight:100,heightMode:'PERCENTAGE',
......
......@@ -559,6 +559,18 @@ export const viewstate: any = {
'd985337c61d3832ea28781561622a1cd',
],
},
{
viewtag: '504c018faa34b2d0fce7c4c56569e02e',
viewmodule: 'Sample',
viewname: 'IBIZOrderUsr2GridView',
viewaction: '',
viewdatachange: false,
refviews: [
'd827fd85e8d9be1bb9348765c09cd465',
'56738595155756fd86c36e20af24f056',
'e6b9fc2b5a23e89827909ccc050eb381',
],
},
{
viewtag: '517580eb2dc02c481b306635c52fb1a3',
viewmodule: 'Sample',
......@@ -759,6 +771,7 @@ export const viewstate: any = {
'bb3b65cf9ba40413db60adce27a94db7',
'f0e584392d060bfef6ad4cec29f73d0d',
'd1e103c50de1fa941638bec77683936c',
'504c018faa34b2d0fce7c4c56569e02e',
],
},
{
......
......@@ -913,6 +913,9 @@ export default class MainMenuBase extends Vue implements ControlInterface {
case 'AppFunc98':
this.clickAppFunc98(item);
return;
case 'AppFunc99':
this.clickAppFunc99(item);
return;
default:
console.warn('未指定应用功能');
}
......@@ -3332,6 +3335,29 @@ export default class MainMenuBase extends Vue implements ControlInterface {
})
}
/**
* 测试表格布局面板
*
* @param {*} [item={}]
* @memberof MainMenu
*/
public clickAppFunc99(item: any = {}) {
const viewparam: any = {};
Object.assign(viewparam, {});
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'usr2gridview', parameterName: 'usr2gridview' },
];
const path: string = this.$viewTool.buildUpRoutePath(this.$route, {}, deResParameters, parameters, [], viewparam);
if(Object.is(this.$route.fullPath,path)){
return;
}
this.$nextTick(function(){
this.$router.push(path);
})
}
/**
* 数据加载
*
......
......@@ -3074,7 +3074,7 @@ export default class MainMenuModel {
iconcls: '',
icon: '',
textcls: '',
appfunctag: '',
appfunctag: 'AppFunc99',
resourcetag: '',
authtag:'Web-MainMenu-menuitem122',
},
......@@ -4344,6 +4344,18 @@ export default class MainMenuModel {
{ pathName: 'usr3editview', parameterName: 'usr3editview' },
],
},
{
appfunctag: 'AppFunc99',
appfuncyype: 'APPVIEW',
openmode: '',
codename: 'ibizorderusr2gridview',
deResParameters: [],
routepath: '/index/:index?/ibizorders/:ibizorder?/usr2gridview/:usr2gridview?',
parameters: [
{ pathName: 'ibizorders', parameterName: 'ibizorder' },
{ pathName: 'usr2gridview', parameterName: 'usr2gridview' },
],
},
];
/**
......
......@@ -663,7 +663,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: 'IBIZBOOKUsr9GridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKGroupByCodelistListView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -699,7 +699,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr9GridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKGroupByCodelistListView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
<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>
</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>
<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 Service from './-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 Base extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Base
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Base
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Base
*/
@Prop() public context!: any;
/**
* 视图参数
*
* @type {*}
* @memberof Base
*/
@Prop() public viewparams!: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof Base
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Base
*/
public getControlType(): string {
return 'SEARCHBAR'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Base
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {Service}
* @memberof Base
*/
public service: Service = new Service({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZOrderService}
* @memberof Base
*/
public appEntityService: IBIZOrderEntityService = new IBIZOrderEntityService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof Base
*/
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 Base
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof Base
*/
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();
}
})
}
}
/**
* 过滤属性集合
*
* @type {*}
* @memberof Base
*/
get filterFields() {
return Object.values(this.detailsModel);
}
/**
* 过滤属性模型集合
*
* @type {*}
* @memberof Base
*/
public detailsModel: any = {
};
/**
* 过滤项集合
*
* @type {*}
* @memberof Base
*/
public filterItems: any[] = [];
/**
* 应用实体名称
*
* @type {string}
* @memberof Base
*/
public appdeName: string = 'IBIZOrder';
/**
* modleId
*
* @type {string}
* @memberof Base
*/
public modelId: string = "searchbar_ibizorder_";
/**
* 功能服务名称
*
* @type {string}
* @memberof Base
*/
public utilServiceName: string = "";
/**
* 历史记录
*
* @type {string}
* @memberof Base
*/
protected historyItems: any[] = [];
/**
* 选中记录
*
* @type {string}
* @memberof Base
*/
protected selectItem: any = null;
/**
* 存储项名称
*
* @type {string}
* @memberof Base
*/
protected saveItemName: string = '';
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Base
*/
public getDatas(): any[] {
return [];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Base
*/
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 Base
*/
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 Base
*/
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 Base
*/
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 Base
*/
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 Base
*/
public created(): void {
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (Object.is('load', action)) {
this.load(data);
}
});
}
}
/**
* 删除过滤项
*
* @return {*}
* @memberof Base
*/
public onRemove(index: number) {
this.filterItems.splice(index, 1);
}
/**
* 搜索
*
* @return {*}
* @memberof Base
*/
public onSearch() {
this.$emit('search', this.getData());
}
/**
* 保存
*
* @return {*}
* @memberof Base
*/
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 Base
*/
public onReset() {
this.filterItems = [];
}
/**
* 加载
*
* @return {*}
* @memberof Base
*/
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 Base
*/
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 Base
*/
public openPoper() {
this.saveItemName = '';
}
/**
* 确定
*
* @return {*}
* @memberof Base
*/
public onOk() {
let propip: any = this.$refs.propip;
propip.handleMouseleave();
this.onSave(this.saveItemName);
}
/**
* 取消设置
*
* @return {*}
* @memberof Base
*/
public onCancel() {
let propip: any = this.$refs.propip;
propip.handleMouseleave();
this.onSave();
}
}
</script>
<style lang='less'>
@import './-searchbar.less';
</style>
\ No newline at end of file
/**
* 部件模型
*
* @export
* @class Model
*/
export default class Model {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof SearchbarMode
*/
public getDataItems(): any[] {
return [
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBIZOrderService from '@/service/ibizorder/ibizorder-service';
import Model from './-searchbar-model';
import UtilService from '@/utilservice/util-service';
/**
* 部件服务对象
*
* @export
* @class Service
*/
export default class Service extends ControlService {
/**
* 订单服务对象
*
* @type {IBIZOrderService}
* @memberof Service
*/
public appEntityService: IBIZOrderService = new IBIZOrderService();
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof Service
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of Service.
*
* @param {*} [opts={}]
* @memberof Service
*/
constructor(opts: any = {}) {
super(opts);
this.model = new Model();
}
/**
* 工具服务对象
*
* @protected
* @type {UtilService}
* @memberof Service
*/
protected utilService: UtilService = new UtilService();
/**
* 加载数据模型
*
* @param {string} serviceName
* @param {*} context
* @param {*} viewparams
* @memberof Service
*/
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 Service
*/
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
.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 less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import Base from './-searchbar-base.vue';
@Component({
components: {
}
})
export default class extends Base {
}
</script>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册