LOGIC.vue.ftl 3.7 KB
Newer Older
1 2 3 4 5 6 7 8 9
    <#--  逻辑事件  -->
    /**
     * 逻辑事件
     *
     * @param {*} [params={}]
     * @param {*} [tag]
     * @param {*} [$event]
     * @memberof 
     */
10
    public ${item.name}(params: any = {}, tag?: any, $event?: any) {
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
<#--  事件参数(未支持)  -->
<#if item.getEventArg()?? && item.getEventArg()?length gt 0>
        // 参数
</#if>
<#--  触发逻辑类型为APPVIEWUIACTION且存在视图界面行为  -->
<#if item.getLogicType() == 'APPVIEWUIACTION' && item.getPSAppViewUIAction()??>
  <#assign uiAction = item.getPSAppViewUIAction().getPSUIAction() />
        // 取数
        let datas: any[] = [];
        let xData: any = null;
        // _this 指向容器对象
        const _this: any = this;
        let paramJO:any = <#if uiAction.getUIActionParamJO()??>${uiAction.getUIActionParamJO().toString()}<#else>{}</#if>;
        <#if uiAction.getParamJOString?? && uiAction.getParamJOString()??>Object.assign(paramJO,${uiAction.getParamJOString()});</#if>
        let contextJO:any = <#if uiAction.getContextJOString?? && uiAction.getContextJOString()??>${uiAction.getContextJOString()}<#else>{}</#if>;
  <#--  是否存在界面行为数据部件  -->
  <#if item.getPSAppViewUIAction().getXDataPSControl?? && item.getPSAppViewUIAction().getXDataPSControl()??>
    <#assign xData = item.getPSAppViewUIAction().getXDataPSControl()/>
      <#--  界面行为数据部件与控件容器不同时,即逻辑事件在视图里时  -->
      <#if xData != item.getPSAppViewUIAction().getPSControlContainer()>
        xData = this.$refs.${xData.name?lower_case};
        if (xData.getDatas && xData.getDatas instanceof Function) {
            datas = [...xData.getDatas()];
        }
      <#--  逻辑事件在数据部件里时  -->
      <#else>
        xData = this;
        if (_this.getDatas && _this.getDatas instanceof Function) {
            datas = [..._this.getDatas()];
        }
      </#if>
  <#else>
        if (_this.getDatas && _this.getDatas instanceof Function) {
            datas = [..._this.getDatas()];
        }
        </#if>
        // 界面行为
        <#if item.getPSAppViewUIAction().getPSUIAction()??>
        <#assign uiaction = item.getPSAppViewUIAction().getPSUIAction()/>
        <#-- 属于应用实体的界面行为走UI服务start -->
        <#if uiaction.getPSAppDataEntity?? && uiaction.getPSAppDataEntity()??>
        <#assign curAppEntity = uiaction.getPSAppDataEntity() />
        <#if uiaction.getPSAppWFVer?? && uiaction.getPSAppWFVer()??>
        const curUIService:${srfclassname('${uiaction.getPSAppWFVer().getCodeName()}')}WFUIService = new ${srfclassname('${uiaction.getPSAppWFVer().getCodeName()}')}WFUIService();
        <#else>
        const curUIService:${srfclassname('${curAppEntity.getCodeName()}')}UIService  = new ${srfclassname('${curAppEntity.getCodeName()}')}UIService();
        </#if>
        <#if item.getPSControlContainer()?? && item.getPSControlContainer().getPSAppDataEntity()??>
        <#assign appDataEntity = item.getPSControlContainer().getPSAppDataEntity()/>
        curUIService.${uiaction.getFullCodeName()}(datas,contextJO, paramJO,  $event, xData,this,<#if appDataEntity??>"${appDataEntity.getCodeName()}"<#else>null</#if>);
        </#if>
        <#else>
        <#if item.getPSControlContainer()?? && item.getPSControlContainer().getPSAppDataEntity()??>
        <#assign appDataEntity = item.getPSControlContainer().getPSAppDataEntity()/>
        this.${uiaction.getFullCodeName()}(datas, contextJO,paramJO,  $event, xData,this,<#if appDataEntity??>"${appDataEntity.getCodeName()}"<#else>null</#if>);
        </#if>
        </#if>
        <#-- 属于应用实体的界面行为走UI服务end -->
        </#if>
        </#if>
    }