<#ibizinclude> ./CONTROL-BASE.template.ftl </#ibizinclude> <#assign import_block> <#-- 计数器服务 --> <#if ctrl.getPSAppCounterRefs?? && ctrl.getPSAppCounterRefs()??> <#list ctrl.getPSAppCounterRefs() as singleCounterRef> <#if singleCounterRef.getPSAppCounter()??> <#assign appCounter = singleCounterRef.getPSAppCounter()/> import ${srfclassname('${appCounter.getCodeName()}')}CounterService from '@/app-core/counter/${srffilepath2(appCounter.getCodeName())}/${srffilepath2(appCounter.getCodeName())}-counter'; </#if> </#list> </#if> </#assign> <#ibizinclude> ../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl </#ibizinclude> <#assign counterRefs = ''/> <#if ctrl.getPSAppCounterRefs?? && ctrl.getPSAppCounterRefs()??> <#list ctrl.getPSAppCounterRefs() as singleCounterRef> <#if singleCounterRef.getPSAppCounter()??> <#assign appCounter = singleCounterRef.getPSAppCounter()/> <#assign counterRefs>${counterRefs}this.${srfclassname('${appCounter.getCodeName()}')}counterservice<#if singleCounterRef_has_next>,</#if></#assign> /** * ${srfclassname('${appCounter.getCodeName()}')}CounterService计数器服务对象 * * @type {${srfclassname('${appCounter.getCodeName()}')}CounterService} * @memberof ${srfclassname('${ctrl.codeName}')} */ protected ${srfclassname('${appCounter.getCodeName()}')}counterservice: ${srfclassname('${appCounter.getCodeName()}')}CounterService = new ${srfclassname('${appCounter.getCodeName()}')}CounterService({$store: this.$store,context:this.context,viewparams:this.viewparams}); </#if> </#list> </#if> /** * 计数器服务对象集合 * * @type {Array<*>} * @memberof ${srfclassname('${ctrl.codeName}')} */ protected counterServiceArray:Array<any> = [${counterRefs}]; /** * 加载计数器数据 * * @param {any[]} args * @memberof ProdMobTabExpViewtabexppanel */ public async loadCounterData() { this.$emit("counterInit",this.counterServiceArray[0]); } /** * 销毁计数器服务 * * @memberof ${srfclassname('${view.name}')} */ public counterserviceDestroy(){ this.counterServiceArray.forEach((item:any)=>{ item.destroyCounter(); }); } /** * 获取多项数据 * * @returns {any[]} * @memberof ${srfclassname('${ctrl.codeName}')} */ public getDatas(): any[] { return []; } /** * 获取单项树 * * @returns {*} * @memberof ${srfclassname('${ctrl.codeName}')} */ public getData(): any { return null; } /** * 行为参数 * * @protected * @type {*} * @memberof ${srfclassname('${ctrl.codeName}')} */ protected action:any = ''; /** * 被激活的分页面板 * * @type {string} * @memberof ${srfclassname('${ctrl.codeName}')} */ @Prop({ default: '<#list ctrl.getPSControls() as tabviewpanel><#if tabviewpanel_index==0>${tabviewpanel.name}</#if></#list>' }) protected activiedTabViewPanel?: string; /** * 是否开启点击重新渲染 * * @type {string} * @memberof ${srfclassname('${ctrl.codeName}')} */ @Prop({ default: true }) public isEnableReRender?:boolean; /** * vue 生命周期 * * @returns * @memberof ${srfclassname('${ctrl.codeName}')} */ protected created() { this.afterCreated(); } /** * 执行created后的逻辑 * * @memberof ${srfclassname('${ctrl.codeName}')} */ protected afterCreated(){ if (this.viewState) { this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => { if (!Object.is(tag, this.name)) { return; } this.action = action; if (data.activeItem) { this.tabPanelClick(data.activeItem); } else { this.$nextTick(() => { let panel:any = this.activiedTabViewPanel if(panel){ this.viewState.next({ tag: panel, action: this.action, data: {}}); } }); } }); } } /** * vue 生命周期 * * @returns * @memberof ${srfclassname('${ctrl.codeName}')} */ public mounted() { this.afterMounted(); } /** * 执行mounted后的逻辑 * * @memberof ${srfclassname('${ctrl.codeName}')} */ public afterMounted(){ this.loadCounterData(); } /** * vue 生命周期 * * @memberof ${srfclassname('${ctrl.codeName}')} */ protected destroyed() { this.afterDestroy(); } /** * 执行destroyed后的逻辑 * * @memberof ${srfclassname('${ctrl.codeName}')} */ protected afterDestroy() { this.counterserviceDestroy(); if (this.viewStateEvent) { this.viewStateEvent.unsubscribe(); } <#if destroyed_block??> ${destroyed_block} </#if> } /** * 分页面板选中 * * @param {*} $event * @returns * @memberof ${srfclassname('${ctrl.codeName}')} */ protected tabPanelClick($event: any) { if (!$event) { return; } if (!this.viewState) { return; } this.$emit("changepanel",$event); this.$nextTick(() => { let panel:any = this.activiedTabViewPanel if(panel){ this.viewState.next({ tag: panel, action: this.action, data: {}}); } if (this.isEnableReRender) { if (panel) { let panelarr:any = Object.keys(this.$refs); panelarr.splice(panelarr.findIndex((item:any) => item === panel), 1); panelarr.forEach((item:any,index:number)=>{ let tabviewpanel:any = this.$refs[item]; if (tabviewpanel.isActivied) { tabviewpanel.isActivied = false; } }) } } }); } <#ibizinclude> ../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl </#ibizinclude> <#ibizinclude> ../@MACRO/CONTROL/CONTROL-BASE.style.ftl </#ibizinclude>