CONTROL-BASE.vue.ftl 3.4 KB
Newer Older
1 2 3 4 5 6
<template>
  <div class='tabviewpanel' style="height:100%;" v-if = 'isActivied' >
    <#if ctrl.getEmbeddedPSAppDEView()??><#assign embedddevedview = ctrl.getEmbeddedPSAppDEView()>
    <${srffilepath2(embedddevedview.getCodeName())} 
      class='viewcontainer2' 
      :viewdata="JSON.stringify(context)" 
7
      :viewparam="JSON.stringify(getNavViewParams())"
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
      @viewload="viewDatasChange($event)" 
      :viewDefaultUsage="false" >
    </${srffilepath2(embedddevedview.getCodeName())}></#if>
  </div>
</template>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>

 /**
     * 获取多项数据
     *
     * @returns {any[]}
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
    public getDatas(): any[] {
        return [];
    }

    /**
     * 获取单项树
     *
     * @returns {*}
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
    public getData(): any {
        return null;
    }

    /**
     * 是否被激活
     *
     * @type {boolean}
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
43
    public isActivied: boolean = true;
44 45 46 47 48 49 50 51

    /**
     * 视图面板过滤项
     *
     * @type {string}
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
    public navfilter: string = "<#if ctrl.getNavFilter?? && ctrl.getNavFilter()??>${ctrl.getNavFilter()}</#if>";
52 53 54 55 56 57 58
             
    /**
     * vue 生命周期
     *
     * @returns
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
59
    public created() {
60 61 62 63 64 65 66 67
        this.afterCreated();
    }

    /**
     * 执行created后的逻辑
     *
     *  @memberof ${srfclassname('${ctrl.codeName}')}
     */    
68
    public afterCreated(){
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
        if (this.viewState) {
            this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
                if (!Object.is(tag, this.name)) {
                    return;
                }
<#if view.getPSAppViewEngines()??>
                this.$forceUpdate();
<#else>
                this.isActivied = false;
                this.$nextTick(() => {
                    this.isActivied = true;
                });
</#if>

            });
        }
    }

87 88 89 90 91 92 93 94 95 96
    /**
     * 传入导航视图参数
     *
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
    public getNavViewParams(){
        if(Object.is(this.navfilter,"")){
            return this.viewparams;
        }else{
            let tempViewParams:any = JSON.parse(JSON.stringify(this.viewparams));
97
            Object.assign(tempViewParams,{[this.navfilter]:this.context['${ctrl.getPSAppDataEntity().getCodeName()?lower_case}']});
98 99 100 101
            return tempViewParams;
        }
    }

102 103 104 105 106
    /**
     * 视图数据变化
     *
     * @memberof  ${srfclassname('${ctrl.codeName}')}
     */
107
    public viewDatasChange($event:any){
108 109 110 111 112 113 114 115
        this.$emit('viewpanelDatasChange',$event);
    }

    /**
     * vue 生命周期
     *
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
116
    public destroyed() {
117 118 119 120 121 122 123 124
        this.afterDestroy();
    }

    /**
     * 执行destroyed后的逻辑
     *
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
125
    public afterDestroy() {
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
        if (this.viewStateEvent) {
            this.viewStateEvent.unsubscribe();
        }
        <#if destroyed_block??>
        ${destroyed_block}
        </#if>       
    }



<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>

<#ibizinclude>
../@MACRO/CONTROL/CONTROL-BASE.style.ftl
</#ibizinclude>