提交 a48cbd5f 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新

上级 fa45dc9c
<#-- 后台界面行为 -->
<#macro backend item>
<#if backend_block??>
${backend_block}
<#else>
/**
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
<#if item.getgetPSAppDataEntity?? && item.getPSAppDataEntity()??>
* @memberof ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}UIService
</#if>
*/
public async ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string){
<#if item.render??>
${item.render.code}
<#else>
<#-- BEGIN: 自定义确认 -->
<#if item.getConfirmMsg?? && item.getConfirmMsg()??>
let confirmResult:boolean = await new Promise((resolve: any, reject: any) => {
actionContext.$Modal.confirm({
title: '警告',
content: '${item.getConfirmMsg()}',
onOk: () => {resolve(true);},
onCancel: () => {resolve(false);}
});
});
if(!confirmResult){
return;
}
</#if>
<#-- BEGIN: 自定义确认 -->
<#if item.getActionTarget() == 'SINGLEDATA'>
actionContext.$Notice.error({ title: '错误', desc: '不支持单项数据' });
<#elseif item.getActionTarget() == 'MULTIDATA'>
actionContext.$Notice.error({ title: '错误', desc: '不支持多项数据' });
<#else>
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
<#if item.getPSNavigateContexts?? && item.getPSNavigateContexts()??>
Object.assign(context,<@getNavigateContext item />);
</#if>
<#if item.getPSNavigateParams?? && item.getPSNavigateParams()??>
Object.assign(params,<@getNavigateParams item />);
</#if>
<#-- 是否先保存目标数据start -->
<#if item.isSaveTargetFirst()>
const result:any = await xData.save(args,false);
args = [result.data];
</#if>
<#-- 是否先保存目标数据end -->
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = <#if item.getActionTarget()??>'${item.getActionTarget()}'<#else>null</#if>;
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
<#assign appDataEntity = item.getPSAppDataEntity() />
<#if item.getActionTarget() == 'SINGLEKEY' || item.getActionTarget() == 'MULTIKEY'>
<#assign valueItem><#if item.getValueItem?? && item.getValueItem() != ''>${item.getValueItem()}<#else>${appDataEntity.getKeyPSAppDEField().getCodeName()?lower_case}</#if></#assign>
<#assign paramItem><#if item.getParamItem?? && item.getParamItem() != ''>${item.getParamItem()}<#else>${appDataEntity.getCodeName()?lower_case}</#if></#assign>
<#assign textItem><#if item.getTextItem?? && item.getTextItem() != ''>${item.getTextItem()}<#else>${appDataEntity.getMajorPSAppDEField().getCodeName()?lower_case}</#if></#assign>
Object.assign(context, { ${appDataEntity.getCodeName()?lower_case}: '%${paramItem}%' });
Object.assign(params, { ${valueItem}: '%${paramItem}%' });
Object.assign(params, { ${textItem}: '%${textItem}%' });
</#if>
</#if>
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
<#-- 多项数据主键转换数据 start -->
if(Object.is(actionTarget,"MULTIKEY")){
let tempDataArray:Array<any> = [];
if((_args.length >1) && (Object.keys(data).length >0)){
for(let i =0;i<_args.length;i++){
let tempObject:any = {};
Object.keys(data).forEach((key:string) =>{
Object.assign(tempObject,{[key]:data[key].split(',')[i]});
})
tempDataArray.push(tempObject);
}
}else{
tempDataArray.push(data);
}
data = tempDataArray;
}
<#-- 多项数据主键转换数据 end -->
context = Object.assign({},actionContext.context,context);
<#-- 构建srfparentdename和srfparentkey start -->
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
<#-- 多项数据主键转换数据 start -->
if(!Object.is(actionTarget,"MULTIKEY")){
Object.assign(data,parentObj);
}
<#-- 多项数据主键转换数据 end -->
Object.assign(context,parentObj);
<#-- 构建srfparentdename和srfparentkey end -->
// 直接调实体服务需要转换的数据
if(context && context.srfsessionid){
context.srfsessionkey = context.srfsessionid;
delete context.srfsessionid;
}
const backend = () => {
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()?? && item.getPSAppDEMethod?? && item.getPSAppDEMethod()??>
const curService:${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service = new ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service();
curService.${item.getPSAppDEMethod().getCodeName()}<#if item.getActionTarget() == 'MULTIKEY' && item.getPSDEAction?? && item.getPSDEAction()?? && item.getPSDEAction().getActionType?? && item.getPSDEAction().getActionType()?? && item.getPSDEAction().getActionType() =="USERCUSTOM">Batch</#if>(context,data, ${item.isShowBusyIndicator()?c}).then((response: any) => {
if (!response || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: response.message });
return;
}
<#if item.isShowBusyIndicator()>
<#if item.getSuccessMsg?? && item.getSuccessMsg()??>
actionContext.$Notice.success({ title: '成功', desc: '${item.getSuccessMsg()}' });
<#else>
actionContext.$Notice.success({ title: '成功', desc: '${item.getCaption()}成功!' });
</#if>
</#if>
const _this: any = actionContext;
<#-- 是否重新加载数据 -->
<#if item.isReloadData?? && item.isReloadData()>
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
</#if>
<#-- 关闭编辑视图 -->
<#if item.isCloseEditView()>
actionContext.closeView(null);
</#if>
<#-- 后续界面行为 -->
<#if item.getNextPSUIAction?? && item.getNextPSUIAction()??>
<#assign nextPSUIAction = item.getNextPSUIAction()/>
const { data: result } = response;
let _args: any[] = [];
if (Object.is(actionContext.$util.typeOf(result), 'array')) {
_args = [...result];
} else if (Object.is(actionContext.$util.typeOf(result), 'object')) {
_args = [{...result}];
} else {
_args = [...args];
}
<#if !(nextPSUIAction.getPSAppDataEntity?? && nextPSUIAction.getPSAppDataEntity()??)>
if (_this.${nextPSUIAction.getFullCodeName()} && _this.${nextPSUIAction.getFullCodeName()} instanceof Function) {
_this.${nextPSUIAction.getFullCodeName()}(_args,context, params, $event, xData,actionContext);
}
<#else>
if (this.${nextPSUIAction.getFullCodeName()} && this.${nextPSUIAction.getFullCodeName()} instanceof Function) {
this.${nextPSUIAction.getFullCodeName()}(_args,context, params, $event, xData,actionContext);
}
</#if>
</#if>
return response;
}).catch((response: any) => {
if (response && response.status && response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: (actionContext.$t('app.commonWords.sysException') as string) });
return;
}
return response;
});
<#else>
actionContext.$Notice.error({ title: '错误', desc: '模型异常,应用实体方法不存在' });
</#if>
};
<#if item.getFrontPSAppView()??>
<#assign frontview = item.getFrontPSAppView()>
<#-- 抽屉打开 -->
<#if frontview.getOpenMode()?index_of('DRAWER') == 0>
const view: any = {
viewname: '${srffilepath2(frontview.getCodeName())}',
title: actionContext.<@getViewLanguageTitle frontview />,
height: ${frontview.getHeight()?c},
width: ${frontview.getWidth()?c},
placement: '${frontview.getOpenMode()}'
};
const appdrawer = actionContext.$appdrawer.openDrawer(view,context,data);
appdrawer.subscribe((result: any) => {
if (result && Object.is(result.ret, 'OK')) {
Object.assign(data, { srfactionparam: result.datas });
backend();
}
});
<#-- 模态打开 -->
<#else>
const view = {
viewname: '${srffilepath2(frontview.getCodeName())}',
title: actionContext.<@getViewLanguageTitle frontview />,
height: ${frontview.getHeight()?c},
width: ${frontview.getWidth()?c},
};
const appmodal = actionContext.$appmodal.openModal(view,context,data);
appmodal.subscribe((result:any) => {
if (result && Object.is(result.ret, 'OK')) {
Object.assign(data, { srfactionparam: result.datas });
backend();
}
});
</#if>
<#else>
backend();
</#if>
</#if>
</#if>
}
</#if>
</#macro>
\ No newline at end of file
<#-- 自定义行为 -->
<#macro custom item>
/**
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
<#if item.getScriptCode?? && item.getScriptCode()??>
const data = args;
eval('${item.getScriptCode()}');
<#else>
this.$Notice.error({ title: '错误', desc: '自定义行为未实现' });
</#if>
}
</#macro>
\ No newline at end of file
......@@ -18,7 +18,7 @@ ${front_block}
* @memberof ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}UIService
</#if>
*/
public async ${item.getFullCodeName()}(args: any[], context:any = {} ,params: any={}, $event?: any, xData?: any,actionContext?:any,srfParentDeName?:string) {
public async ${item.getFullCodeName()}(args: any[], context: any = {}, params: any={}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
<#if item.render??>
${item.render.code}
......
......@@ -4,23 +4,14 @@
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], contextJO?:any, params?: any, $event?: any, xData?: any, actionContext?:any, srfParentDeName?:string) {
if (xData && xData.create instanceof Function) {
xData.create().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
this.$emit('viewdataschange', [{ ...response.data }]);
});
} else {
this.$Notice.error({ title: '错误', desc: '建立数据未支持' });
}
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 建立数据
}
</#macro>
\ No newline at end of file
......@@ -4,23 +4,14 @@
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], contextJO?:any, params?: any, $event?: any, xData?: any, actionContext?:any, srfParentDeName?:string) {
if (xData && xData.remove instanceof Function) {
xData.remove().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
this.$emit('viewdataschange', [{ ...response.data }]);
});
} else {
this.$Notice.error({ title: '错误', desc: '删除数据未支持' });
}
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 删除数据
}
</#macro>
\ No newline at end of file
<#-- 保存数据 -->
<#-- 保存变更 -->
<#macro dataSaveChanges item>
/**
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], contextJO?:any, params?: any, $event?: any, xData?: any, actionContext?:any, srfParentDeName?:string) {
if (xData && xData.save instanceof Function) {
xData.save().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
this.$emit('viewdataschange', [{ ...response.data }]);
});
} else {
this.$Notice.error({ title: '错误', desc: '保存数据未支持' });
}
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 保存变更
}
</#macro>
\ No newline at end of file
......@@ -4,23 +4,14 @@
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} contextJO 行为附加上下文
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
*/
public ${item.getFullCodeName()}(args: any[], contextJO?:any, params?: any, $event?: any, xData?: any, actionContext?:any, srfParentDeName?:string) {
if (xData && xData.synchronize instanceof Function) {
xData.synchronize().then((response: any) => {
if (!response || response.status !== 200) {
return;
}
this.$emit('viewdataschange', [{ ...response.data }]);
});
} else {
this.$Notice.error({ title: '错误', desc: '同步数据未支持' });
}
public ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
// TODO 同步数据
}
</#macro>
\ No newline at end of file
......@@ -5,22 +5,34 @@
./FRONT.ftl
</#ibizinclude>
<#ibizinclude>
./BACKEND.ftl
</#ibizinclude>
<#ibizinclude>
./WFFRONT.ftl
</#ibizinclude>
<#ibizinclude>
./WFBACKEND.ftl
</#ibizinclude>
<#ibizinclude>
./SYS/SYS.ftl
</#ibizinclude>
<#ibizinclude>
./CUSTOM.ftl
</#ibizinclude>
<#macro viewLayoutPanelUIAction item>
<#if item.getUIActionMode?? && item.getUIActionMode()??>
<#if item.getUIActionMode() == 'FRONT'>
<@front item />
<#elseif item.getUIActionMode() == 'BACKEND'>
// 后台调用
<@backend item />
<#elseif item.getUIActionMode() == 'WFFRONT'>
// 工作流前台调用
<@wfFront item />
<#elseif item.getUIActionMode() == 'WFBACKEND'>
// 工作流后台调用
<@wfBackend item />
<#elseif item.getUIActionMode() == 'SYS'>
<@sys item />
<#elseif item.getUIActionMode() == 'CUSTOM'>
// 自定义
<@custom item />
</#if>
</#if>
</#macro>
\ No newline at end of file
<#macro wfBackend item>
/**
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
<#if item.getPSWFVersion?? && item.getPSWFVersion()??>
* @memberof ${srfclassname('${item.getPSWFVersion().getCodeName()}')}WFUIService<#t>
<#elseif item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
* @memberof ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}UIService<#t>
</#if>
*/
public async ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string) {
<#if item.render??>
${item.render.code}
<#else>
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
<#if item.getActionTarget() == 'SINGLEDATA'>
actionContext.$Notice.error({ title: '错误', desc: '不支持单项数据' });
<#elseif item.getActionTarget() == 'MULTIDATA'>
actionContext.$Notice.error({ title: '错误', desc: '不支持多项数据' });
<#else>
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
if(!args || args.length <1){
console.error("错误,无数据传入");
}
let tempsrfmome:any = {srfwfmemo:args[0].srfwfmemo};
<#-- 是否先保存目标数据start -->
<#if item.isSaveTargetFirst()>
const result:any = await xData.save(args,false);
args = [result.data];
</#if>
<#-- 是否先保存目标数据end -->
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = <#if item.getActionTarget()??>'${item.getActionTarget()}'<#else>null</#if>;
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
<#assign appDataEntity = item.getPSAppDataEntity() />
<#if item.getActionTarget() == 'SINGLEKEY' || item.getActionTarget() == 'MULTIKEY'>
<#assign valueItem><#if item.getValueItem?? && item.getValueItem() != ''>${item.getValueItem()}<#else>${appDataEntity.getKeyPSAppDEField().getCodeName()?lower_case}</#if></#assign>
<#assign paramItem><#if item.getParamItem?? && item.getParamItem() != ''>${item.getParamItem()}<#else>${appDataEntity.getKeyPSAppDEField().getCodeName()?lower_case}</#if></#assign>
<#assign textItem><#if item.getTextItem?? && item.getTextItem() != ''>${item.getTextItem()}<#else>${appDataEntity.getMajorPSAppDEField().getCodeName()?lower_case}</#if></#assign>
<#if valueItem == paramItem>
Object.assign(context, { ${appDataEntity.getCodeName()?lower_case}: '%${valueItem}%' });
Object.assign(params, { ${valueItem}: '%${valueItem}%' });
Object.assign(params, { ${textItem}: '%${textItem}%' })
<#else>
Object.assign(context, { ${appDataEntity.getCodeName()?lower_case}: '%${paramItem}%' });
Object.assign(params, { ${valueItem}: '%${paramItem}%' });
Object.assign(params, { ${textItem}: '%${textItem}%' });
</#if>
</#if>
</#if>
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
//转化表单界面数据
const resultData:any = xData.service.handleRequestData('',actionContext.context,_args[0]);
Object.assign(context,resultData.context,context);
Object.assign(data,resultData.data,{viewparams:actionContext.viewparams});
Object.assign(data,tempsrfmome);
<#-- 构建srfparentdename和srfparentkey start -->
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
<#-- 构建srfparentdename和srfparentkey end -->
const backend = () => {
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
const curService:${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service = new ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service();
curService.WFSubmit(context,data, ${item.isShowBusyIndicator()?c}).then((response: any) => {
if (!response || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: response.message });
return;
}
<#if item.getSuccessMsg?? && item.getSuccessMsg()??>
actionContext.$Notice.success({ title: '成功', desc: '${item.getSuccessMsg()}' });
<#else>
actionContext.$Notice.success({ title: '成功', desc: '${item.getCaption()}成功!' });
</#if>
<#-- if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
} -->
return response;
}).catch((response: any) => {
if (!response || !response.status || !response.data) {
actionContext.$Notice.error({ title: '错误', desc: '系统异常!' });
return;
}
if (response.status === 401) {
return;
}
return null;
});
</#if>
};
<#if item.getFrontPSAppView()??>
<#assign frontview = item.getFrontPSAppView()>
<#if frontview.getOpenMode()?index_of('DRAWER') == 0>
const view: any = {
viewname: '${srffilepath2(frontview.getCodeName())}',
title: actionContext.<@getViewLanguageTitle frontview />,
height: ${frontview.getHeight()?c},
width: ${frontview.getWidth()?c},
placement: '${frontview.getOpenMode()}'
};
const appdrawer = actionContext.$appdrawer.openDrawer(view,context,data);
appdrawer.subscribe((result: any) => {
if (result && Object.is(result.ret, 'OK')) {
Object.assign(data, { srfactionparam: result.datas });
backend();
}
});
<#else>
const view = {
viewname: '${srffilepath2(frontview.getCodeName())}',
title: actionContext.<@getViewLanguageTitle frontview />,
height: ${frontview.getHeight()?c},
width: ${frontview.getWidth()?c},
};
const appmodal = actionContext.$appmodal.openModal(view,context,data);
appmodal.subscribe((result:any) => {
if (result && Object.is(result.ret, 'OK')) {
Object.assign(data, { srfactionparam: result.datas });
backend();
}
});
</#if>
<#elseif item.getConfirmMsg?? && item.getConfirmMsg()??>
actionContext.$Modal.confirm({
title: '警告',
content: '${item.getConfirmMsg()}',
onOk: () => {
backend();
},
onCancel: () => { }
});
<#else>
backend();
</#if>
</#if>
</#if>
</#if>
}
</#macro>
\ No newline at end of file
<#-- 工作流前台调用 -->
<#macro wfFront item>
/**
* ${item.getCaption()}
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
<#if item.getPSWFVersion?? && item.getPSWFVersion()??>
* @memberof ${srfclassname('${item.getPSWFVersion().getCodeName()}')}WFUIService<#t>
<#elseif item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
* @memberof ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}UIService<#t>
</#if>
*/
public async ${item.getFullCodeName()}(args: any[], context: any = {}, params: any = {}, $event?: any, xData?: any, actionContext?: any, srfParentDeName?: string){
<#if item.render??>
${item.render.code}
<#else>
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()??>
<#if item.getFrontPSAppView()??>
<#assign dataview = item.getFrontPSAppView()>
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
<#if item.getPSNavigateContexts?? && item.getPSNavigateContexts()??>
Object.assign(context,<@getNavigateContext item />);
</#if>
<#if item.getPSNavigateParams?? && item.getPSNavigateParams()??>
Object.assign(params,<@getNavigateParams item />);
</#if>
<#-- 是否先保存目标数据start -->
<#if item.isSaveTargetFirst()>
const result:any = await xData.save(args,false);
args = [result.data];
</#if>
<#-- 是否先保存目标数据end -->
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = <#if item.getActionTarget()??>'${item.getActionTarget()}'<#else>null</#if>;
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
//转化表单界面数据
const resultData:any = xData.service.handleRequestData('',actionContext.context,_args[0]);
Object.assign(context,resultData.context,context);
Object.assign(data,resultData.data,{viewparams:actionContext.viewparams});
<#-- 构建srfparentdename和srfparentkey start -->
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
Object.assign(data,parentObj);
Object.assign(context,parentObj);
<#-- 构建srfparentdename和srfparentkey end -->
<#-- 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}context.${_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>
let deResParameters: any[] = [];
</#if>
<#-- 存在关系end -->
<#else>
const deResParameters: any[] = [];
</#if>
<#-- END:是否应用实体视图 -->
<#-- 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 dataview.getOpenMode() =='INDEXVIEWTAB' || dataview.getOpenMode() == '' >
const openIndexViewTab = (data: any) => {
const routePath = actionContext.$viewTool.buildUpRoutePath(actionContext.$route, context, deResParameters, parameters, _args, data);
actionContext.$router.push(routePath);
<#-- BEGIN 是否重新加载数据 -->
<#if item.isReloadData?? && item.isReloadData()>
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
} else if (_this.refresh && _this.refresh instanceof Function) {
_this.refresh(args);
}
</#if>
<#-- END 是否重新加载数据 -->
<#-- BEGIN 后续界面行为 -->
<#if item.getNextPSUIAction?? && item.getNextPSUIAction()??>
<#assign nextPSUIAction = item.getNextPSUIAction()/>
if (this.${nextPSUIAction.getFullCodeName()} && this.${nextPSUIAction.getFullCodeName()} instanceof Function) {
this.${nextPSUIAction.getFullCodeName()}([data],context,params, $event, xData,actionContext);
}
</#if>
<#-- END 后续界面行为 -->
return null;
}
openIndexViewTab(data);
<#elseif dataview.getOpenMode() = 'POPUPMODAL'>
<#-- 打开模态 -->
const openPopupModal = (view: any, data: any) => {
let container: Subject<any> = actionContext.$appmodal.openModal(view, context, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
<#-- 是否重新加载数据 -->
actionContext.closeView();
<#-- if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
} -->
});
}
const view: any = {
viewname: '${srffilepath2(dataview.getCodeName())}',
height: ${dataview.getHeight()?c},
width: ${dataview.getWidth()?c},
title: actionContext.<@getViewLanguageTitle dataview />,
};
openPopupModal(view, data);
<#elseif dataview.getOpenMode()?index_of('DRAWER') == 0>
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = actionContext.$appdrawer.openDrawer(view, context,data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
<#-- 是否重新加载数据 -->
actionContext.closeView();
<#-- if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
} -->
});
}
const view: any = {
viewname: '${srffilepath2(dataview.getCodeName())}',
height: ${dataview.getHeight()?c},
width: ${dataview.getWidth()?c},
title: actionContext.<@getViewLanguageTitle dataview />,
placement: '${dataview.getOpenMode()}',
};
openDrawer(view, data);
<#elseif dataview.getOpenMode() == 'POPOVER'>
const openPopOver = (view: any, data: any) => {
let container: Subject<any> = actionContext.$apppopover.openPop($event, view, context, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
<#-- 是否重新加载数据 -->
actionContext.closeView();
<#-- if(window.opener){
window.opener.postMessage({status:'OK',identification:'WF'},Environment.uniteAddress);
window.close();
} -->
});
}
const view: any = {
viewname: '${srffilepath2(dataview.getCodeName())}',
height: ${dataview.getHeight()?c},
width: ${dataview.getWidth()?c},
title: actionContext.<@getViewLanguageTitle dataview />,
placement: '${dataview.getOpenMode()}',
};
openPopOver(view, data);
<#else>
actionContext.$Notice.warning({ title: '错误', desc: actionContext.<@getViewLanguageTitle dataview />+'不支持该模式打开' });
</#if>
</#if>
</#if>
</#if>
}
</#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册