<#ibizinclude> ../../../@MACRO/LANG_FUN.ftl </#ibizinclude> <#if item.getPSViewLogic?? && item.getPSViewLogic()??> <#assign viewlogic = item.getPSViewLogic()/> /** * 打开编辑数据视图 * * @param {any[]} args * @param {*} [params] * @param {*} [fullargs] * @param {*} [$event] * @param {*} [xData] * @memberof ${srfclassname('${view.name}')} */ public ${item.name}(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) { <#if viewlogic.getOpenDataPSAppView()??> <#assign dataview = viewlogic.getOpenDataPSAppView()/> const data: any = {}; let curViewParam = JSON.parse(JSON.stringify(this.context)); if(args.length >0){ Object.assign(curViewParam,args[0]); } <#-- BEGIN:准备参数 --> <#if dataview.isRedirectView()> const deResParameters: any[] = []; const parameters: any[] = []; <#else> <#-- BEGIN:是否应用实体视图 --> <#if dataview.isPSDEView()> <#-- 存在关系start --> <#if dataview.getPSAppDERSPathCount() gt 0> <#list 1..dataview.getPSAppDERSPathCount() as count> <#assign condition = ''/> <#list dataview.getPSAppDERSPath(count_index) as deRSPath> <#if deRSPath.getMajorPSAppDataEntity?? && deRSPath.getMajorPSAppDataEntity()??> <#assign _dataEntity = deRSPath.getMajorPSAppDataEntity()/> <#assign condition>${condition}curViewParam.${_dataEntity.getCodeName()?lower_case} && </#assign> </#if> </#list> </#list> let deResParameters: any[] = []; <#-- 如果是主实体需对context判断start --> <#if dataview.getPSAppDataEntity().isMajor()> if(${condition}true){ deResParameters = [ <#list dataview.getPSAppDERSPath(dataview.getPSAppDERSPathCount() - 1) as deRSPath> <#assign majorPSAppDataEntity = deRSPath.getMajorPSAppDataEntity()/> { pathName: '${srfpluralize(majorPSAppDataEntity.codeName)?lower_case}', parameterName: '${majorPSAppDataEntity.getCodeName()?lower_case}' }, </#list> ] } <#else> deResParameters = [ <#list dataview.getPSAppDERSPath(dataview.getPSAppDERSPathCount() - 1) as deRSPath> <#assign majorPSAppDataEntity = deRSPath.getMajorPSAppDataEntity()/> { pathName: '${srfpluralize(majorPSAppDataEntity.codeName)?lower_case}', parameterName: '${majorPSAppDataEntity.getCodeName()?lower_case}' }, </#list> ]; </#if> <#-- 如果是主实体需对context判断end --> <#else> const deResParameters: any[] = []; </#if> <#-- 存在关系end --> <#else> const deResParameters: any[] = []; </#if> <#-- END:是否应用实体视图 --> <#if dataview.getOpenMode() == 'INDEXVIEWTAB' || dataview.getOpenMode() == ''> <#-- BEGIN:是否应用实体视图 --> <#if dataview.isPSDEView()> <#assign appDataEntity = dataview.getPSAppDataEntity()/> const parameters: any[] = [ { pathName: '${srfpluralize(appDataEntity.codeName)?lower_case}', parameterName: '${appDataEntity.getCodeName()?lower_case}' }, { pathName: '${dataview.getPSDEViewCodeName()?lower_case}', parameterName: '${dataview.getPSDEViewCodeName()?lower_case}' }, ]; <#else> const parameters: any[] = [ { pathName: '${dataview.getCodeName()?lower_case}', parameterName: '${dataview.getCodeName()?lower_case}' }, ]; </#if> <#-- END:是否应用实体视图 --> <#else> <#-- BEGIN:是否应用实体视图 --> <#if dataview.isPSDEView()> <#assign appDataEntity = dataview.getPSAppDataEntity()/> const parameters: any[] = [ { pathName: '${srfpluralize(appDataEntity.codeName)?lower_case}', parameterName: '${appDataEntity.getCodeName()?lower_case}' }, ]; <#else> const parameters: any[] = []; </#if> <#-- END:是否应用实体视图 --> </#if> </#if> <#-- END:准备参数 --> <#if dataview.isRedirectView()> <#if dataview.getViewType() == "DEWFDATAREDIRECTVIEW" || dataview.getViewType() == "APPWFREDIRECTVIEW"> <#-- 应用全局流程工作重定向视图and实体全局流程数据重定向视图start --> if(fullargs && fullargs.length >0){ <#noparse>window.open(`${fullargs[0].viewurl}srfworklist=${fullargs[0].wfworklistid}`);</#noparse> window.addEventListener("message",(event:any) =>{ const data:any = event.data; if (Object.is(data.identification,'WF')){ return ; } if(Object.is(data.status,'OK')){ let xData:any = this.$refs.grid; if (xData.refresh && xData.refresh instanceof Function) { setTimeout(() => { xData.refresh(); }, 1000); } } }) }else{ console.error("重定向地址有误"); } <#-- 应用全局流程工作重定向视图and实体全局流程数据重定向视图end --> <#else> <#-- 实体数据重定向视图start --> // todo 实体数据重定向视图 <#-- 实体数据重定向视图end --> </#if> <#elseif dataview.getOpenMode() == 'INDEXVIEWTAB' || dataview.getOpenMode() == ''> <#-- 打开顶级分页视图 --> const _this: any = this; const openIndexViewTab = (data: any) => { const routePath = this.$viewTool.buildUpRoutePath(this.$route, curViewParam, deResParameters, parameters, args, data); <#if dataview.getViewType() == "DEWFDYNAEDITVIEW" > this.$router.push(routePath+'?userTaskId='+this.viewparams.userTaskId); <#else> this.$router.push(routePath); </#if> } openIndexViewTab(data); <#elseif dataview.getOpenMode() == 'POPUPAPP'> <#-- 打开独立程序弹出 --> const _this: any = this; const routePath = this.$viewTool.buildUpRoutePath(this.$route, curViewParam, deResParameters, parameters, args, data); window.open('./#'+routePath, '_blank'); <#elseif dataview.getOpenMode() = 'POPUPMODAL'> <#-- 打开模态 --> const _this: any = this; const openPopupModal = (view: any, data: any) => { let container: Subject<any> = this.$appmodal.openModal(view, curViewParam, data); container.subscribe((result: any) => { if (!result || !Object.is(result.ret, 'OK')) { return; } if (!xData || !(xData.refresh instanceof Function)) { return; } xData.refresh(result.datas); }); } const view: any = { viewname: '${srffilepath2(dataview.getCodeName())}', height: ${dataview.getHeight()?c}, width: ${dataview.getWidth()?c}, title: this.<@getViewLanguageTitle dataview />, }; openPopupModal(view, data); <#elseif dataview.getOpenMode()?index_of('DRAWER') == 0> <#-- 打开抽屉 --> const _this: any = this; const openDrawer = (view: any, data: any) => { let container: Subject<any> = this.$appdrawer.openDrawer(view, curViewParam, data); container.subscribe((result: any) => { if (!result || !Object.is(result.ret, 'OK')) { return; } if (!xData || !(xData.refresh instanceof Function)) { return; } xData.refresh(result.datas); }); } const view: any = { viewname: '${srffilepath2(dataview.getCodeName())}', height: ${dataview.getHeight()?c}, width: ${dataview.getWidth()?c}, title: this.<@getViewLanguageTitle dataview />, placement: '${dataview.getOpenMode()}', }; openDrawer(view, data); <#elseif dataview.getOpenMode() == 'POPOVER'> <#-- 打开气泡卡片 --> const _this: any = this; const openPopOver = (view: any, data: any) => { let container: Subject<any> = this.$apppopover.openPop($event, view, curViewParam, data); container.subscribe((result: any) => { if (!result || !Object.is(result.ret, 'OK')) { return; } if (!xData || !(xData.refresh instanceof Function)) { return; } xData.refresh(result.datas); }); } const view: any = { viewname: '${srffilepath2(dataview.getCodeName())}', height: ${dataview.getHeight()?c}, width: ${dataview.getWidth()?c}, title: this.<@getViewLanguageTitle dataview />, placement: '${dataview.getOpenMode()}', }; openPopOver(view, data); <#else> this.$Notice.warning({ title: '错误', desc: this.<@getViewLanguageTitle dataview />+'不支持该模式打开' }); </#if> <#else> this.$Notice.warning({ title: '错误', desc: '未指定关系视图' }); </#if> } </#if>