CONTROL-BASE.vue.ftl 11.0 KB
Newer Older
1 2 3 4 5 6 7 8 9
<#if ctrl.getPortletType() == 'CONTAINER'>
  <#assign portletClass = "portlet-container">
  <#assign portletHeight = "100%">
  <#assign portletWidth = "100%">
<#else>
  <#assign portletHeight = "clac(100% - 16px)">
  <#assign portletWidth = "clac(100% - 16px)">
  <#assign portletClass = "portlet">
</#if>
10
<template>
11
    <div class='${portletClass} ${srffilepath2(ctrl.getCodeName())} <#if ctrl.getPSSysCss()??> ${ctrl.getPSSysCss().getCssName()}</#if>' :style="{<#if (ctrl.getHeight?? && ctrl.getHeight() gt 0)>'height': isAdaptiveSize ? '${portletHeight}' : <#if ctrl.getHeight() == 1>'auto'<#else>'${ctrl.getHeight()?c}px'</#if>,</#if><#if (ctrl.getWidth?? && ctrl.getWidth() gt 0)>'width': isAdaptiveSize ? '${portletWidth}' : '${ctrl.getWidth()?c}px '</#if>}">
12 13 14
    <#if ctrl.getPortletType?? && ctrl.getPortletType()??><#t>
        <#--  视图  -->
        <#if ctrl.getPortletType() == 'VIEW' && ctrl.getPortletPSAppView?? && ctrl.getPortletPSAppView()??><#t>
15 16
        <#if ctrl.isShowTitleBar() && ctrl.getTitle()??>
        <p class='portlet-title'>
17
            <i class='<#if ctrl.getPSSysImage()??><#assign img=ctrl.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)>${img.getCssClass()}</#if></#if>'></i>
18 19 20
            ${ctrl.getTitle()}
        </p>
        </#if>
21
        <div class="<#if ctrl.isShowTitleBar()>portlet-with-title<#else>portlet-without-title</#if>">
22 23 24 25 26
        <#assign refview = ctrl.getPortletPSAppView()><#t>
        <${srffilepath2(refview.getCodeName())} :viewdata="JSON.stringify(context)" :viewDefaultUsage="false" ></${srffilepath2(refview.getCodeName())}>
        </div>
        <#--  菜单  -->
        <#elseif  ctrl.getPortletType() == 'APPMENU'><#t>
27 28
        <#if ctrl.isShowTitleBar() && ctrl.getTitle()??>
        <p class='portlet-title'>
29
            <i class='<#if ctrl.getPSSysImage()??><#assign img=ctrl.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)>${img.getCssClass()}</#if></#if>'></i>
30 31 32
            ${ctrl.getTitle()}
        </p>
        </#if>
33
        <div class="<#if ctrl.isShowTitleBar()>portlet-with-title<#else>portlet-without-title</#if>">
34 35 36 37 38 39 40
        <#assign appmenu = ctrl.getPSAppMenu()><#t>
        <@ibizindent blank=6>
        ${P.getCtrlCode(appmenu, 'CONTROL.html').code}
        </@ibizindent>
        </div>
        <#--  自定义  -->
        <#elseif  ctrl.getPortletType() == 'CUSTOM'>
41 42
        <#if ctrl.isShowTitleBar() && ctrl.getTitle()??>
        <p class='portlet-title'>
43
            <i class='<#if ctrl.getPSSysImage()??><#assign img=ctrl.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)>${img.getCssClass()}</#if></#if>'></i>
44 45 46
            ${ctrl.getTitle()}
        </p>
        </#if>
47
        <div class="<#if ctrl.isShowTitleBar()>portlet-with-title<#else>portlet-without-title</#if>">
48 49 50 51 52 53 54 55
        <#if ctrl.render??>
        ${ctrl.render.code}
        <#else>
        <div>无扩展插件</div>
        </#if>
        </div>
        <#--  操作栏  -->
        <#elseif  ctrl.getPortletType() == 'ACTIONBAR'>
56 57
        <#if ctrl.isShowTitleBar() && ctrl.getTitle()??>
        <p class='portlet-title'>
58
            <i class='<#if ctrl.getPSSysImage()??><#assign img=ctrl.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)>${img.getCssClass()}</#if></#if>'></i>
59 60 61
            ${ctrl.getTitle()}
        </p>
        </#if>
62
        <div class="<#if ctrl.isShowTitleBar()>portlet-with-title<#else>portlet-without-title</#if>">
63 64 65 66 67 68 69 70
        <#if ctrl.render??>
            ${ctrl.render.code}
        <#else>
            <app-actionbar :items="actionBarModelData" @itemClick="handleItemClick"></app-actionbar>
        </#if>
        </div>
        <#--  HTML  -->
        <#elseif  ctrl.getPortletType() == 'HTML'>
71 72
        <#if ctrl.isShowTitleBar() && ctrl.getTitle()??>
        <p class='portlet-title'>
73
            <i class='<#if ctrl.getPSSysImage()??><#assign img=ctrl.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)>${img.getCssClass()}</#if></#if>'></i>
74 75 76
            ${ctrl.getTitle()}
        </p>
        </#if>
77
        <div class="<#if ctrl.isShowTitleBar()>portlet-with-title<#else>portlet-without-title</#if>">
78 79 80 81 82 83 84 85 86 87 88 89 90
        <iframe src="<#if ctrl.getPageUrl()??>${ctrl.getPageUrl()}</#if>" style="height: <#if ctrl.getHeight() gt 0>${ctrl.getHeight()?c}<#else>400</#if>px;width: 100%;border-width: 1px;"></iframe>
        </div>         
        <#--  容器  -->
        <#elseif  ctrl.getPortletType() == 'CONTAINER'><#t>
        <#list ctrl.getPSPortlets() as portlet><#t>
            <#if portlet.getPortletType?? && portlet.getPortletType()??><#t>
            <#assign layout='TABLE_24COL'><#if portlet.getPSLayoutPos()??><#if portlet.getPSLayoutPos().getParentPSLayout()??><#assign layout='${portlet.getPSLayoutPos().getParentPSLayout().getLayout()}'></#if></#if><#t>
            <#assign LayoutPos = portlet.getPSLayoutPos()><#t>
            <#if layout == 'FLEX' >
            <div style = '<#if layout == 'FLEX' > display : flex; <#if ctrl.getFlexAlign()??> justify-content :${ctrl.getFlexAlign()};</#if> <#if ctrl.getFlexDir()??> flex-direction:${ctrl.getFlexDir()};</#if> <#if ctrl.getFlexVAlign()??>align-items:${ctrl.getFlexVAlign()};</#if></#if> '>
            </#if>
            <#if layout == 'TABLE_24COL' && LayoutPos??><#t>
            <i-col<#if LayoutPos.getColXS() != -1> :xs="{ span: ${LayoutPos.getColXS()}, offset: <#if LayoutPos.getColXSOffset() != -1>${LayoutPos.getColXSOffset()}<#else>0</#if> }"</#if><#if LayoutPos.getColSM() != -1> :sm="{ span: ${LayoutPos.getColSM()}, offset: <#if LayoutPos.getColSMOffset() != -1>${LayoutPos.getColSMOffset()}<#else>0</#if> }"</#if><#if LayoutPos.getColMD() != -1> :md="{ span: ${LayoutPos.getColMD()}, offset: <#if LayoutPos.getColMDOffset() != -1>${LayoutPos.getColMDOffset()}<#else>0</#if> }"</#if><#if LayoutPos.getColLG() != -1> :lg="{ span: ${LayoutPos.getColLG()}, offset: <#if LayoutPos.getColLGOffset() != -1>${LayoutPos.getColLGOffset()}<#else>0</#if> }"</#if>>
91
                <div class="portlet-without-title">
92 93 94 95 96 97
                <@ibizindent blank=18>
                ${P.getCtrlCode(portlet, 'CONTROL.html').code}
                </@ibizindent>
                </div>
            </i-col>
            <#else>
98
            <div class="portlet-without-title">
99 100 101 102 103 104 105 106 107 108 109 110
            <@ibizindent blank=18>
            ${P.getCtrlCode(portlet, 'CONTROL.html').code}
            </@ibizindent>
            </div>
            </#if>
            <#if layout == 'FLEX' >
            </div>
            </#if>
            </#if>
        </#list>
        <#--  其他部件  -->
        <#elseif ctrl.getContentPSControl()??><#t>
111 112
        <#if ctrl.isShowTitleBar() && ctrl.getTitle()??>
        <p class='portlet-title'>
113
            <i class='<#if ctrl.getPSSysImage()??><#assign img=ctrl.getPSSysImage()><#if img.getCssClass()?? && (img.getCssClass()?length gt 0)>${img.getCssClass()}</#if></#if>'></i>
114 115 116
            ${ctrl.getTitle()}
        </p>
        </#if>
117
        <div class="<#if ctrl.isShowTitleBar()>portlet-with-title<#else>portlet-without-title</#if>">
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
        <#assign control = ctrl.getContentPSControl()><#t>
        <!-- 测试 -->
        <@ibizindent blank=6>
        ${P.getCtrlCode(control, 'CONTROL.html').code}
        </@ibizindent>
        </div>
        </#if>
    </#if>
    </div>
</template>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_PORTLET-HEADER-BASE.vue.ftl
</#ibizinclude>

    <#if ctrl.getPortletType() == 'ACTIONBAR'>
    /**
     * 操作栏模型数据
     *
     * @returns {any[]}
tony001's avatar
tony001 committed
137
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
138
     */
139
    public actionBarModelData:any[] =[
140 141 142 143 144 145 146
        <#if  ctrl.getPSAppViewLogics?? && ctrl.getPSAppViewLogics()??>
        <#list ctrl.getPSAppViewLogics() as appViewLogic>
        { viewlogicname:"${appViewLogic.name}",
        <#if appViewLogic.getPSAppViewUIAction?? && appViewLogic.getPSAppViewUIAction()??>
        <#assign viewUIAction = appViewLogic.getPSAppViewUIAction()/>
        <#if viewUIAction.getPSUIAction?? && viewUIAction.getPSUIAction()??>
        <#assign uiaction = viewUIAction.getPSUIAction() />
147
        actionName:"${uiaction.getCaption()}",
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
        <#if uiaction.getPSAppCounter?? && uiaction.getPSAppCounter()??>
        <#assign counter = uiaction.getPSAppCounter() />
        counterService:this.${srfclassname('${counter.getCodeName()}')}counterservice,
        <#if uiaction.getCounterId()??>counterId:"${uiaction.getCounterId()}",</#if>
        </#if>
        </#if>
        </#if>
        }<#if appViewLogic_has_next>,</#if>
        </#list>
        </#if>
    ];

    /**
     * 触发界面行为
     *
tony001's avatar
tony001 committed
163
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
164
     */
165
    public handleItemClick($event:any){
166 167 168 169 170 171 172 173 174 175
    <#if  ctrl.getPSAppViewLogics?? && ctrl.getPSAppViewLogics()??>
    <#list ctrl.getPSAppViewLogics() as appViewLogic>
        if(Object.is($event,'${appViewLogic.name}')){
            this.${appViewLogic.name}(null);
        }
    </#list>
    </#if>
    }
    </#if>

176 177 178 179 180
    <#if ctrl.getPortletType?? && ctrl.getPortletType()?? && ctrl.getPortletType() == "TOOLBAR" >
    <#assign toolbar = ctrl.getContentPSControl()/>
    ${P.getCtrlCode(toolbar, 'CONTROL.vue').code}
    </#if>

181 182 183 184
    /**
     * 是否自适应大小
     *
     * @returns {boolean}
tony001's avatar
tony001 committed
185
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
186 187 188 189 190 191 192
     */
    @Prop({default: false})public isAdaptiveSize!: boolean;

    /**
     * 获取多项数据
     *
     * @returns {any[]}
tony001's avatar
tony001 committed
193
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
194 195 196 197 198 199 200 201 202
     */
    public getDatas(): any[] {
        return [];
    }

    /**
     * 获取单项树
     *
     * @returns {*}
tony001's avatar
tony001 committed
203
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
204 205 206 207 208 209 210 211
     */
    public getData(): any {
        return {};
    }

    /**
     * vue 生命周期
     *
tony001's avatar
tony001 committed
212
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
213
     */
214
    public created() {
215 216 217 218 219 220
        this.afterCreated();
    }

    /**
     * 执行created后的逻辑
     *
tony001's avatar
tony001 committed
221
     *  @memberof ${srfclassname('${ctrl.codeName}')}Base
222
     */    
223
    public afterCreated(){
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
        if (this.viewState) {
            this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
                if (!Object.is(tag, this.name)) {
                    return;
                }
                const refs: any = this.$refs;
                Object.keys(refs).forEach((_name: string) => {
                    this.viewState.next({ tag: _name, action: action, data: data });
                });
            });
        }
    }

    /**
     * vue 生命周期
     *
tony001's avatar
tony001 committed
240
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
241
     */
242
    public destroyed() {
243 244 245 246 247 248
        this.afterDestroy();
    }

    /**
     * 执行destroyed后的逻辑
     *
tony001's avatar
tony001 committed
249
     * @memberof ${srfclassname('${ctrl.codeName}')}Base
250
     */
251
    public afterDestroy() {
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
        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>