<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER.tsx.ftl
</#ibizinclude>


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

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

    /**
     * vue 生命周期
     *
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
    public created() {
        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 生命周期
     *
     * @memberof ${srfclassname('${ctrl.codeName}')}
     */
    public destroyed() {
        if (this.viewStateEvent) {
            this.viewStateEvent.unsubscribe();
        }
        <#if destroyed_block??>
        ${destroyed_block}
        </#if>
    }

    /**
     * 内容绘制
     *
     * @returns
     * @memberof Pickupviewpanel
     */
    public render() {
        return (
            <div class='porlet'>
            <#if ctrl.getPortletType?? && ctrl.getPortletType()??>
            <#--  视图  -->
            <#if ctrl.getPortletType() == 'VIEW' && ctrl.getPortletPSAppView?? && ctrl.getPortletPSAppView()??>
            <#assign refview = ctrl.getPortletPSAppView()>
            <${srffilepath2(refview.getCodeName())}></${srffilepath2(refview.getCodeName())}>
            <#--  菜单  -->
            <#elseif  ctrl.getPortletType() == 'APPMENU'>
            <#assign appmenu = ctrl.getPSAppMenu()>
            ${P.getCtrlCode(appmenu, 'CONTROL.html').code}
            <#--  自定义  -->
            <#elseif  ctrl.getPortletType() == 'CUSTOM'>
            <#if ctrl.render??>
            ${ctrl.render.code}
            <#else>
            <div>无扩展插件</div>
            </#if>
            <#--  HTML  -->
            <#elseif  ctrl.getPortletType() == 'HTML'>
            <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>
            <#--  容器  -->
            <#elseif  ctrl.getPortletType() == 'CONTAINER'>
            <#list ctrl.getPSPortlets() as portlet>
            <#if portlet.getPortletType?? && portlet.getPortletType()??>

                <#assign layout='TABLE_24COL'><#if portlet.getPSLayoutPos()??><#if portlet.getPSLayoutPos().getParentPSLayout()??><#assign layout='${portlet.getPSLayoutPos().getParentPSLayout().getLayout()}'></#if></#if>
                <#assign LayoutPos = portlet.getPSLayoutPos()>
                <#if layout == 'TABLE_24COL' && LayoutPos??>
                <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>>
                    <card  bordered={false} dis-hover={true} padding={0}>
                        <#if portlet.isShowTitleBar()>
                        <p slot='title'>
                            ${portlet.getTitle()}
                        </p>
                        <a slot='extra'>
                        </a>
                        </#if> 
                        <span>
                            ${P.getCtrlCode(portlet, 'CONTROL.html').code}
                        </span>
                    </card>
                </i-col>
                <#else>
                <card bordered={false} dis-hover={true} padding={0}>
                    <#if portlet.isShowTitleBar()>
                    <p slot='title'>
                        ${portlet.getTitle()}
                    </p>
                    <a slot='extra'>
                    </a>
                    </#if> 
                    <span>
                        ${P.getCtrlCode(portlet, 'CONTROL.html').code}
                    </span>
                </card>
                </#if>
                <#if layout == 'FLEX'>
                    <card bordered={false} dis-hover={true} padding={0}>
                        <#if portlet.isShowTitleBar()>
                        <p slot='title'>
                            ${portlet.getTitle()}
                        </p>
                        <a slot='extra'>
                        </a>
                        </#if> 
                        <span>
                            ${P.getCtrlCode(portlet, 'CONTROL.html').code}
                        </span>
                    </card>
                </#if>
            </#if>
            </#list>
            <#--  其他部件  -->
            <#elseif ctrl.getContentPSControl()??>
            <#assign control = ctrl.getContentPSControl()>
            ${P.getCtrlCode(control, 'CONTROL.html').code}
            </#if>
            </#if>
            </div>
        );
    }

}