wfuser-pickup-grid-view-base.vue 21.3 KB
Newer Older
ibizdev's avatar
ibizdev committed
1
<template>
ibizdev's avatar
ibizdev committed
2
<div class='view-container depickupgridview wfuser-pickup-grid-view'>
3
    <app-studioaction :viewTitle="$t(model.srfCaption)" viewName="wfuserpickupgridview"></app-studioaction>
ibizdev's avatar
ibizdev committed
4
    <card class='view-card view-no-caption  view-no-toolbar' :dis-hover="true" :bordered="false">
5 6
        <div class='view-top-messages'>
        </div>
ibizdev's avatar
ibizdev committed
7
        <div class='content-container pickup-grid-view'>
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
            <view_searchform 
                :viewState="viewState"  
                :viewparams="viewparams" 
                :context="context" 
                :showBusyIndicator="true"
                v-show="isExpandSearchForm"
                loaddraftAction="FilterGetDraft"
                loadAction="FilterGet"
            
                name="searchform"  
                ref='searchform' 
                @save="searchform_save($event)"  
                @search="searchform_search($event)"  
                @load="searchform_load($event)"  
                @closeview="closeView($event)">
            </view_searchform>
24
                    <div class='view-body-messages'>                    </div>            <view_grid 
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
                :viewState="viewState"  
                :viewparams="viewparams" 
                :context="context" 
                :isSingleSelect="isSingleSelect"
                :selectedData="selectedData"
                :showBusyIndicator="true"
                updateAction=""
                removeAction="Remove"
                loaddraftAction=""
                loadAction=""
                createAction=""
                fetchAction="FetchDefault"
                name="grid"  
                ref='grid' 
                @selectionchange="grid_selectionchange($event)"  
                @beforeload="grid_beforeload($event)"  
                @rowdblclick="grid_rowdblclick($event)"  
                @load="grid_load($event)"  
                @closeview="closeView($event)">
            </view_grid>
ibizdev's avatar
ibizdev committed
45
        </div>
46 47
        <div class='view-bottom-messages'>
        </div>
ibizdev's avatar
ibizdev committed
48 49 50 51 52
    </card>
</div>
</template>

<script lang='tsx'>
53
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
ibizdev's avatar
ibizdev committed
54
import { UIActionTool,Util } from '@/utils';
55
import NavDataService from '@/service/app/navdata-service';
56
import { Subject,Subscription } from 'rxjs';
ibizdev's avatar
ibizdev committed
57
import WFUserService from '@/service/wfuser/wfuser-service';
58
import WFUserAuthService from '@/authservice/wfuser/wfuser-auth-service';
ibizdev's avatar
ibizdev committed
59 60 61 62

import PickupGridViewEngine from '@engine/view/pickup-grid-view-engine';


63
import WFUserUIService from '@/uiservice/wfuser/wfuser-ui-service';
ibizdev's avatar
ibizdev committed
64 65 66 67 68 69 70 71 72 73 74 75 76

@Component({
    components: {
    },
})
export default class WFUserPickupGridViewBase extends Vue {

    /**
     * 实体服务对象
     *
     * @type {WFUserService}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
77
    public appEntityService: WFUserService = new WFUserService;
ibizdev's avatar
ibizdev committed
78

79
    /**
80
     * 实体UI服务对象
81
     *
82
     * @type WFUserUIService
83 84
     * @memberof WFUserPickupGridViewBase
     */
85
    public appUIService: WFUserUIService = new WFUserUIService(this.$store);
ibizdev's avatar
ibizdev committed
86 87 88 89 90 91 92 93 94
    
    /**
     * 数据变化
     *
     * @param {*} val
     * @returns {*}
     * @memberof WFUserPickupGridViewBase
     */
    @Emit() 
ibizdev's avatar
ibizdev committed
95
    public viewDatasChange(val: any):any {
ibizdev's avatar
ibizdev committed
96 97 98 99 100 101 102 103 104
        return val;
    }

    /**
     * 传入视图上下文
     *
     * @type {string}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
105
    @Prop() public viewdata!: string;
ibizdev's avatar
ibizdev committed
106 107 108 109 110 111 112

    /**
     * 传入视图参数
     *
     * @type {string}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
113
    @Prop() public viewparam!: string;
ibizdev's avatar
ibizdev committed
114 115 116 117 118 119 120

    /**
     * 视图默认使用
     *
     * @type {boolean}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
121
    @Prop({ default: true }) public viewDefaultUsage!: boolean;
ibizdev's avatar
ibizdev committed
122

123 124 125 126 127 128
    /**
     * 视图默认使用
     *
     * @type {string}
     * @memberof WFUserPickupGridViewBase
     */
129
    @Inject({from:'navModel',default: 'tab'})
130 131
    public navModel!:string;

ibizdev's avatar
ibizdev committed
132 133 134 135 136 137
	/**
	 * 视图标识
	 *
	 * @type {string}
	 * @memberof WFUserPickupGridViewBase
	 */
138
	public viewtag: string = 'c9c73c8d2e61bd29a304622f3d39b522';
ibizdev's avatar
ibizdev committed
139 140 141 142 143 144 145

	/**
	 * 自定义视图导航上下文集合
	 *
	 * @type {*}
	 * @memberof WFUserPickupGridViewBase
	 */
ibizdev's avatar
ibizdev committed
146
    public customViewNavContexts:any ={
ibizdev's avatar
ibizdev committed
147 148 149 150 151 152 153 154
    };

	/**
	 * 自定义视图导航参数集合
	 *
	 * @type {*}
	 * @memberof WFUserPickupGridViewBase
	 */
ibizdev's avatar
ibizdev committed
155
    public customViewParams:any ={
ibizdev's avatar
ibizdev committed
156 157 158 159 160 161 162 163
    };

    /**
     * 视图模型数据
     *
     * @type {*}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
164
    public model: any = {
ibizdev's avatar
ibizdev committed
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
        srfCaption: 'entities.wfuser.views.pickupgridview.caption',
        srfTitle: 'entities.wfuser.views.pickupgridview.title',
        srfSubTitle: 'entities.wfuser.views.pickupgridview.subtitle',
        dataInfo: ''
    }

    /**
     * 视图参数变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof WFUserPickupGridViewBase
     */
    @Watch('viewparam',{immediate: true, deep: true})
    onParamData(newVal: any, oldVal: any) {
        if(newVal){
            for(let key in this.viewparams){
                delete this.viewparams[key];
            }
184 185 186
            if(typeof this.viewparams == 'string') {
                Object.assign(this.viewparams, JSON.parse(this.viewparam));
            }
ibizdev's avatar
ibizdev committed
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
            
        } 
    }

    /**
     * 处理应用上下文变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof WFUserPickupGridViewBase
     */
    @Watch('viewdata')
    onViewData(newVal: any, oldVal: any) {
        const _this: any = this;
        if (!Object.is(newVal, oldVal) && _this.engine) {
202 203 204 205 206
            this.$nextTick(()=>{
              _this.parseViewParam();
              _this.engine.load();
              
            });
207
        } else if(!Object.is(newVal, oldVal) && _this.refresh && _this.refresh instanceof Function) {
208
            _this.refresh();
ibizdev's avatar
ibizdev committed
209 210 211 212 213 214 215 216 217
        }
    }

    /**
     * 容器模型
     *
     * @type {*}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
218
    public containerModel: any = {
ibizdev's avatar
ibizdev committed
219 220 221 222
        view_grid: { name: 'grid', type: 'GRID' },
        view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
    };

223 224 225 226 227 228 229 230 231 232 233 234
    /**
     * 视图刷新
     *
     * @param {*} args
     * @memberof WFUserPickupGridViewBase
     */
    public refresh(args?: any): void {
        const refs: any = this.$refs;
        if (refs && refs.grid) {
            refs.grid.refresh();
        }
    }
ibizdev's avatar
ibizdev committed
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
    /**
     *  计数器刷新
     *
     * @memberof WFUserPickupGridViewBase
     */
    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();
                }
            })
        }
    }

    /**
     * 视图状态订阅对象
     *
ibizdev's avatar
ibizdev committed
254
     * @public
ibizdev's avatar
ibizdev committed
255 256 257
     * @type {Subject<{action: string, data: any}>}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
258
    public viewState: Subject<ViewState> = new Subject();
ibizdev's avatar
ibizdev committed
259 260 261 262 263


    /**
     * 视图引擎
     *
ibizdev's avatar
ibizdev committed
264
     * @public
ibizdev's avatar
ibizdev committed
265 266 267
     * @type {Engine}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
268
    public engine: PickupGridViewEngine = new PickupGridViewEngine();
ibizdev's avatar
ibizdev committed
269 270 271 272

    /**
     * 引擎初始化
     *
ibizdev's avatar
ibizdev committed
273
     * @public
ibizdev's avatar
ibizdev committed
274 275
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
276
    public engineInit(): void {
ibizdev's avatar
ibizdev committed
277 278 279 280 281 282 283 284 285 286
        this.engine.init({
            view: this,
            grid: this.$refs.grid,
            searchform: this.$refs.searchform,
            keyPSDEField: 'wfuser',
            majorPSDEField: 'displayname',
            isLoadDefault: true,
        });
    }

287 288 289 290 291 292
    /**
     * 应用导航服务
     *
     * @type {*}
     * @memberof WFUserPickupGridViewBase
     */
293 294 295 296 297 298 299 300 301 302
    public  navDataService = NavDataService.getInstance(this.$store);

    /**
    * 导航服务事件
    *
    * @public
    * @type {(Subscription | undefined)}
    * @memberof WFUserPickupGridViewBase
    */
    public serviceStateEvent: Subscription | undefined;
303

304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
    /**
     * 门户部件状态对象
     *
     * @type {*}
     * @memberof WFUserPickupGridViewBase
     */
    @Prop() public portletState?: any;

   /**
   * 门户部件状态事件
   *
   * @public
   * @type {(Subscription | undefined)}
   * @memberof WFUserPickupGridViewBase
   */
    public portletStateEvent: Subscription | undefined;

ibizdev's avatar
ibizdev committed
321 322 323 324 325 326
    /**
     * 应用上下文
     *
     * @type {*}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
327
    public context:any = {};
ibizdev's avatar
ibizdev committed
328 329 330 331 332 333 334

    /**
     * 视图参数
     *
     * @type {*}
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
335
    public viewparams:any = {};
ibizdev's avatar
ibizdev committed
336

337 338 339 340 341 342 343 344
    /**
     * 视图缓存数据
     *
     * @type {*}
     * @memberof WFUserPickupGridViewBase
     */
    public viewCacheData:any;

345 346 347 348 349 350 351 352 353

    /**
     * 计数器服务对象集合
     *
     * @type {Array<*>}
     * @memberof WFUserPickupGridViewBase
     */    
    public counterServiceArray:Array<any> = [];

ibizdev's avatar
ibizdev committed
354 355 356
    /**
     * 解析视图参数
     *
ibizdev's avatar
ibizdev committed
357
     * @public
ibizdev's avatar
ibizdev committed
358 359
     * @memberof WFUserPickupGridViewBase
     */
360
    public parseViewParam(inputvalue:any = null): void {
ibizdev's avatar
ibizdev committed
361 362 363
        for(let key in this.context){
            delete this.context[key];
        }
364 365 366
        if(this.$store.getters.getAppData() && this.$store.getters.getAppData().context){
            Object.assign(this.context,this.$store.getters.getAppData().context);
        }
ibizdev's avatar
ibizdev committed
367
        if (!this.viewDefaultUsage && this.viewdata && !Object.is(this.viewdata, '')) {
368 369 370
            if(typeof this.viewdata == 'string') {
                Object.assign(this.context, JSON.parse(this.viewdata));
            }
ibizdev's avatar
ibizdev committed
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
            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) => {
            Object.defineProperty(tempValue, item.name, {
                enumerable: true,
                value: matchArray[index + 1]
            });
        });
        this.$viewTool.formatRouteParams(tempValue,this.$route,this.context,this.viewparams);
392 393 394
        if(inputvalue){
            Object.assign(this.context,{'wfuser':inputvalue});
        }
ibizdev's avatar
ibizdev committed
395 396 397
        //初始化视图唯一标识
        Object.assign(this.context,{srfsessionid:this.$util.createUUID()});
        this.handleCustomViewData();
398
        //初始化导航数据
399
        this.initNavDataWithRoute();
ibizdev's avatar
ibizdev committed
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
    }

    /**
     * 处理自定义视图数据
     *
     * @memberof WFUserPickupGridViewBase
     */
	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 WFUserPickupGridViewBase
     */
	public handleCustomDataLogic(curNavData:any,tempData:any,item:string){
		// 直接值直接赋值
		if(curNavData.isRawValue){
			if(Object.is(curNavData.value,"null") || Object.is(curNavData.value,"")){
ibizdev's avatar
ibizdev committed
435
                Object.defineProperty(tempData, item.toLowerCase(), {
ibizdev's avatar
ibizdev committed
436 437 438 439 440 441
                    value: null,
                    writable : true,
                    enumerable : true,
                    configurable : true
                });
            }else{
ibizdev's avatar
ibizdev committed
442
                Object.defineProperty(tempData, item.toLowerCase(), {
ibizdev's avatar
ibizdev committed
443 444 445 446 447 448 449 450
                    value: curNavData.value,
                    writable : true,
                    enumerable : true,
                    configurable : true
                });
            }
		}else{
			// 先从导航上下文取数,没有再从导航参数(URL)取数,如果导航上下文和导航参数都没有则为null
451
			if(this.context[(curNavData.value).toLowerCase()] != null){
ibizdev's avatar
ibizdev committed
452
				Object.defineProperty(tempData, item.toLowerCase(), {
ibizdev's avatar
ibizdev committed
453
					value: this.context[(curNavData.value).toLowerCase()],
ibizdev's avatar
ibizdev committed
454 455 456 457 458
					writable : true,
					enumerable : true,
					configurable : true
				});
			}else{
459
				if(this.viewparams[(curNavData.value).toLowerCase()] != null){
ibizdev's avatar
ibizdev committed
460
					Object.defineProperty(tempData, item.toLowerCase(), {
ibizdev's avatar
ibizdev committed
461
						value: this.viewparams[(curNavData.value).toLowerCase()],
ibizdev's avatar
ibizdev committed
462 463 464 465 466
						writable : true,
						enumerable : true,
						configurable : true
					});
				}else{
ibizdev's avatar
ibizdev committed
467
					Object.defineProperty(tempData, item.toLowerCase(), {
ibizdev's avatar
ibizdev committed
468 469 470 471 472 473 474 475 476
						value: null,
						writable : true,
						enumerable : true,
						configurable : true
					});
				}
			}
		}
	}
477 478

    /**
479
     * 初始化导航数据(路由模式)
480 481 482
     *
     * @memberof WFUserPickupGridViewBase
     */
483 484
    public initNavDataWithRoute(data:any = null, isNew:boolean = false,  isAlways:boolean = false){
        if( isAlways || (this.viewDefaultUsage && Object.is(this.navModel,"route")) ){
485
            this.navDataService.addNavData({id:'wfuser-pickup-grid-view',tag:this.viewtag,srfkey:isNew ? null : this.context.wfuser,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath});
486 487 488 489 490 491 492 493
        }
    }

    /**
     * 初始化导航数据(分页模式)
     *
     * @memberof WFUserPickupGridViewBase
     */
494 495
    public initNavDataWithTab(data:any = null,isOnlyAdd:boolean = true, isAlways:boolean = false){
        if( isAlways || (this.viewDefaultUsage && !Object.is(this.navModel,"route")) ){
496
            this.navDataService.addNavDataByOnly({id:'wfuser-pickup-grid-view',tag:this.viewtag,srfkey:this.context.wfuser,title:this.$t(this.model.srfCaption),data:data,context:this.context,viewparams:this.viewparams,path:this.$route.fullPath},isOnlyAdd);
497 498
        }
    }
ibizdev's avatar
ibizdev committed
499 500 501 502 503 504 505
	

    /**
     * Vue声明周期
     *
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
506
    public created() {
ibizdev's avatar
ibizdev committed
507 508 509 510 511 512 513 514
        this.afterCreated();
    }

    /**
     * 执行created后的逻辑
     *
     * @memberof WFUserPickupGridViewBase
     */    
ibizdev's avatar
ibizdev committed
515
    public afterCreated(){
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
        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,'wfuser-pickup-grid-view')){
                return;
            }
            if (Object.is(action, 'viewrefresh')) {
                _this.$nextTick(()=>{
                    _this.parseViewParam(data);
                    if(_this.engine){
                        _this.engine.load();
                    }
                }); 
            }
        });
534 535 536 537 538 539 540 541 542 543
        if(_this.portletState){
            _this.portletStateEvent = _this.portletState.subscribe((res:any) =>{
                if(!Object.is(res.name,'calendar-view9')){
                    return;
                }
                if(Object.is(res.action,'refresh') && _this.refresh && _this.refresh instanceof Function){
                    _this.refresh();
                }
            })
        }
ibizdev's avatar
ibizdev committed
544 545 546 547 548 549 550 551
        
    }

    /**
     * 销毁之前
     *
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
552
    public beforeDestroy() {
ibizdev's avatar
ibizdev committed
553 554 555 556 557 558 559 560
        this.$store.commit('viewaction/removeView', this.viewtag);
    }

    /**
     * Vue声明周期(组件初始化完毕)
     *
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
561
    public mounted() {
ibizdev's avatar
ibizdev committed
562 563 564 565 566 567 568 569
        this.afterMounted();
    }

    /**
     * 执行mounted后的逻辑
     * 
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
570
    public afterMounted(){
ibizdev's avatar
ibizdev committed
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
        const _this: any = this;
        _this.engineInit();
        if (_this.loadModel && _this.loadModel instanceof Function) {
            _this.loadModel();
        }
        
    }


    /**
     * grid 部件 selectionchange 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
587
    public grid_selectionchange($event: any, $event2?: any) {
ibizdev's avatar
ibizdev committed
588 589 590 591 592 593 594 595 596 597 598
        this.engine.onCtrlEvent('grid', 'selectionchange', $event);
    }


    /**
     * grid 部件 beforeload 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
599
    public grid_beforeload($event: any, $event2?: any) {
ibizdev's avatar
ibizdev committed
600 601 602 603 604 605 606 607 608 609 610
        this.engine.onCtrlEvent('grid', 'beforeload', $event);
    }


    /**
     * grid 部件 rowdblclick 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
611
    public grid_rowdblclick($event: any, $event2?: any) {
ibizdev's avatar
ibizdev committed
612 613 614 615 616 617 618 619 620 621 622
        this.engine.onCtrlEvent('grid', 'rowdblclick', $event);
    }


    /**
     * grid 部件 load 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
623
    public grid_load($event: any, $event2?: any) {
ibizdev's avatar
ibizdev committed
624 625 626 627 628 629 630 631 632 633 634
        this.engine.onCtrlEvent('grid', 'load', $event);
    }


    /**
     * searchform 部件 save 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
635
    public searchform_save($event: any, $event2?: any) {
ibizdev's avatar
ibizdev committed
636 637 638 639 640 641 642 643 644 645 646
        this.engine.onCtrlEvent('searchform', 'save', $event);
    }


    /**
     * searchform 部件 search 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
647
    public searchform_search($event: any, $event2?: any) {
ibizdev's avatar
ibizdev committed
648 649 650 651 652 653 654 655 656 657 658
        this.engine.onCtrlEvent('searchform', 'search', $event);
    }


    /**
     * searchform 部件 load 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
659
    public searchform_load($event: any, $event2?: any) {
ibizdev's avatar
ibizdev committed
660 661 662 663 664 665 666 667 668 669 670 671
        this.engine.onCtrlEvent('searchform', 'load', $event);
    }




    /**
     * 关闭视图
     *
     * @param {any[]} args
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
672
    public closeView(args: any[]): void {
ibizdev's avatar
ibizdev committed
673 674 675 676 677 678 679 680 681 682 683 684 685 686
        let _view: any = this;
        if (_view.viewdata) {
            _view.$emit('viewdataschange', [args]);
            _view.$emit('close', [args]);
        } else if (_view.$tabPageExp) {
            _view.$tabPageExp.onClose(_view.$route.fullPath);
        }
    }

    /**
     * 销毁视图回调
     *
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
687
    public destroyed(){
ibizdev's avatar
ibizdev committed
688 689 690 691 692 693 694 695
        this.afterDestroyed();
    }

    /**
     * 执行destroyed后的逻辑
     * 
     * @memberof WFUserPickupGridViewBase
     */
ibizdev's avatar
ibizdev committed
696
    public afterDestroyed(){
ibizdev's avatar
ibizdev committed
697 698 699 700 701 702 703 704 705
        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);
                }
                })
            }
706 707 708
            if(Object.is(this.navModel,"tab")){
                this.navDataService.removeNavDataByTag(this.viewtag);
            }
709 710 711
            if (this.serviceStateEvent) {
                this.serviceStateEvent.unsubscribe();
            }
ibizdev's avatar
ibizdev committed
712
        }
713 714 715 716 717 718 719 720
        // 销毁计数器定时器
        if(this.counterServiceArray && this.counterServiceArray.length >0){
            this.counterServiceArray.forEach((item:any) =>{
                if(item.destroyCounter && item.destroyCounter instanceof Function){
                    item.destroyCounter();
                }
            })
        }
721 722 723
        if(this.portletStateEvent){
            this.portletStateEvent.unsubscribe();
        }
ibizdev's avatar
ibizdev committed
724 725 726 727 728
    }
    /**
     * 选中数据字符串
     *
     * @type {string}
729
     * @memberof WFUserPickupGridViewBase
ibizdev's avatar
ibizdev committed
730
     */
ibizdev's avatar
ibizdev committed
731
    @Prop() public selectedData?: string;
ibizdev's avatar
ibizdev committed
732 733 734 735 736

    /**
     * 是否单选
     *
     * @type {boolean}
737
     * @memberof WFUserPickupGridViewBase
ibizdev's avatar
ibizdev committed
738
     */
ibizdev's avatar
ibizdev committed
739
    @Prop() public isSingleSelect?: boolean;
ibizdev's avatar
ibizdev committed
740 741 742 743 744

    /**
     * 搜索值
     *
     * @type {string}
745
     * @memberof WFUserPickupGridViewBase
ibizdev's avatar
ibizdev committed
746
     */
ibizdev's avatar
ibizdev committed
747
    public query: string = '';
ibizdev's avatar
ibizdev committed
748 749 750 751 752

    /**
     * 是否展开搜索表单
     *
     * @type {boolean}
753
     * @memberof WFUserPickupGridViewBase
ibizdev's avatar
ibizdev committed
754
     */
ibizdev's avatar
ibizdev committed
755
    public isExpandSearchForm: boolean = true;
ibizdev's avatar
ibizdev committed
756 757 758 759 760 761 762 763

    /**
     * 表格行数据默认激活模式
     * 0 不激活
     * 1 单击激活
     * 2 双击激活
     *
     * @type {(number | 0 | 1 | 2)}
764
     * @memberof WFUserPickupGridViewBase
ibizdev's avatar
ibizdev committed
765
     */
ibizdev's avatar
ibizdev committed
766
    public gridRowActiveMode: number | 0 | 1 | 2 = 2;
ibizdev's avatar
ibizdev committed
767 768 769 770 771

    /**
     * 快速搜索
     *
     * @param {*} $event
772
     * @memberof WFUserPickupGridViewBase
ibizdev's avatar
ibizdev committed
773
     */
ibizdev's avatar
ibizdev committed
774
    public onSearch($event: any): void {
ibizdev's avatar
ibizdev committed
775 776 777 778 779 780 781 782 783 784 785 786
        const refs: any = this.$refs;
        if (refs.grid) {
            refs.grid.load({});
        }
    }

}
</script>

<style lang='less'>
@import './wfuser-pickup-grid-view.less';
</style>