VIEW_CONTENT-BASE.vue.ftl 5.2 KB
Newer Older
1 2 3 4 5 6 7 8 9
<#ibizinclude>
./WF_VIEW_CONTENT.vue.ftl
</#ibizinclude>

    <#if view.getPSAppViewEngines()??>
    <#list view.getPSAppViewEngines() as engine>
    /**
     * 视图引擎
     *
tony001's avatar
tony001 committed
10
     * @public
11 12 13
     * @type {Engine}
     * @memberof ${srfclassname('${view.name}')}Base
     */
tony001's avatar
tony001 committed
14
    public ${engine.getName()?lower_case}: ${engine.getEngineType()}Engine = new ${engine.getEngineType()}Engine();
15 16
    </#list>
    </#if>
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
	
    <#if view.getPSDER1N?? && view.getPSDER1N()??>
    /**
     * 处理指定视图控制关系将父键转为父实体上下文
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
    public handleviewRes(){
    <#assign viewRes = view.getPSDER1N()/>
    <#if viewRes.getMajorPSDataEntity()??>
    <#assign majorAppDataEntity = viewRes.getMajorPSDataEntity() />
    if(this.context.srfparentkey){
        Object.assign(this.context,{'${majorAppDataEntity.getCodeName()?lower_case}':this.context.srfparentkey});
    }
    </#if>
    }
    </#if>
34 35 36 37

    /**
     * 引擎初始化
     *
tony001's avatar
tony001 committed
38
     * @public
39 40
     * @memberof ${srfclassname('${view.name}')}Base
     */
tony001's avatar
tony001 committed
41
    public engineInit(): void {
42 43 44 45 46 47 48
    <#if view.getPSAppViewEngines()??>
    <#list view.getPSAppViewEngines() as engine>
        this.${engine.getName()?lower_case}.init({
            view: this,
        <#if engine.getPSAppViewEngineParams()??>
            <#list engine.getPSAppViewEngineParams() as param>
            <#if param.getParamType() == "LOGIC" && param.getPSAppViewLogic()??>
49 50
            ${param.getName()?lower_case}: (args: any[], params?: any, $event?: any, xData?: any) => {
                this.${param.getPSAppViewLogic().getName()}(args, params, $event, xData);
51 52 53 54 55 56 57 58 59 60
            },
            </#if>
            <#if param.getParamType() == "CTRL" && param.getPSControl()??>
            ${param.getName()?lower_case}: this.$refs.${param.getPSControl().getName()},
            </#if>
            <#if param.getParamType() == "VALUE" && param.getValue()??>
            ${param.getName()?lower_case}: '${param.getValue()?c}',
            </#if>
            </#list>
        </#if>
61
        <#if appde??>
62 63 64 65 66 67 68 69 70 71 72
            keyPSDEField: '${appde.getCodeName()?lower_case}',
            <#if appde.getMajorPSAppDEField()??>
            majorPSDEField: '${appde.getMajorPSAppDEField().getCodeName()?lower_case}',
            </#if>
        </#if>
            isLoadDefault: <#if view.isLoadDefault?? && !view.isLoadDefault()>false<#else>true</#if>,
        });
    </#list>
    </#if>
    }

tony001's avatar
tony001 committed
73
    
74 75 76 77 78 79 80 81 82 83 84 85 86
    <#if view.getPSControls()??>
    <#list view.getPSControls() as ctrl>
    <#if ctrl.getControlType()??>
    <#if ctrl.getHookEventNames()??>
    <#list ctrl.getHookEventNames() as eventName>

    /**
     * ${ctrl.name} 部件 ${eventName?lower_case} 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof ${srfclassname('${view.name}')}Base
     */
87
    public ${ctrl.name}_${eventName?lower_case}($event: any, $event2?: any) {
88 89 90 91 92 93 94
    <#if ctrl.getPSControlLogics(eventName)??>
    <#list ctrl.getPSControlLogics(eventName) as ctrlLogic>
    <#if ctrlLogic.getLogicType() == "APPVIEWENGINE" && ctrlLogic.getPSAppViewEngine()??>
        this.${ctrlLogic.getPSAppViewEngine().getName()}.onCtrlEvent('${ctrl.name}', '${eventName?lower_case}', $event);
    <#else>
        <#if ctrlLogic.getEventArg()?? && ctrlLogic.getEventArg()?length gt 0>
        if (Object.is($event.tag, '${ctrlLogic.getEventArg()}')) {
tony001's avatar
tony001 committed
95
            this.${ctrlLogic.name}(null, '', $event2);
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
        }
        <#else>
        this.${ctrlLogic.name}($event, '', $event2);
        </#if>
    </#if>
    </#list>
    </#if>
    }

    </#list>
    </#if>
    </#if>
    </#list>
    </#if>

<#if view.getPSAppViewLogics()??>
<#list view.getPSAppViewLogics() as logic>
<#if logic.getLogicTrigger() == "CUSTOM" || logic.getLogicTrigger() == "CTRLEVENT">

${P.getLogicCode(logic, "LOGIC.vue").code}
</#if>
</#list>
</#if>

120 121
<#if view.getPSUIActions()??>
<#list view.getPSUIActions() as uiAction>
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
<#-- 系统预置界面行为输入start -->
<#if !(uiAction.getPSAppDataEntity?? && uiAction.getPSAppDataEntity()??)>
${P.getLogicCode(uiAction, "LOGIC.vue").code}
</#if>
<#-- 系统预置界面行为输入end -->
</#list>
</#if>

    <#if view.isPSDEView()>
    <#if view.getPSAppDataEntity()??>
    <#assign appDataEntity = view.getPSAppDataEntity() />
    <#if appDataEntity.isMajor()>

    /**
     * 销毁视图回调
     *
     * @memberof ${srfclassname('${view.name}')}Base
     */
140 141
    public destroyed(){
        <#if view_base_name??>
142 143 144 145 146 147 148 149 150
        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);
                }
                })
            }
tony001's avatar
tony001 committed
151 152 153 154 155 156
            <#--  if(Object.is(this.navModel,"tab")){
                this.navDataService.removeNavDataByTag(this.viewtag);
            }
            if (this.serviceStateEvent) {
                this.serviceStateEvent.unsubscribe();
            }  -->
157
        }
158
        </#if>
159 160 161 162 163 164 165 166 167
    }
    </#if>
    </#if>
    </#if>
    <#--  视图独立定义的内容start  -->
    <#if self_content??>
    ${self_content}
    </#if>
    <#--  视图独立定义的内容end  -->