提交 32ac057c 编写于 作者: Mosher's avatar Mosher

update:更新

上级 432aedee
......@@ -23,18 +23,18 @@
</#if>
<#else>
<#if item.getUILogicAttachMode?? && item.getUILogicAttachMode()?? && item.getUILogicAttachMode() == 'AFTER' && item.getPSAppDEUILogic?? && item.getPSAppDEUILogic()??>
const _context: any = Object.assign(context, actionContext.context);
const _params: any = Object.assign(params, actionContext.viewparams);
const _context: any = Object.assign(context, actionContext.context);
const _params: any = Object.assign(params, actionContext.viewparams);
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()?? && item.getPSAppDEUILogic().getPSAppDataEntity?? && item.getPSAppDEUILogic().getPSAppDataEntity()?? && item.getPSAppDataEntity().codeName == item.getPSAppDEUILogic().getPSAppDataEntity().codeName>
return this.executeUILogic('${item.getPSAppDEUILogic().codeName}', args, _context, _params, $event, xData, actionContext, srfParentDeName);
return this.executeUILogic('${item.getPSAppDEUILogic().codeName}', args, _context, _params, $event, xData, actionContext, srfParentDeName);
<#elseif item.getPSAppDEUILogic().getPSAppDataEntity?? && item.getPSAppDEUILogic().getPSAppDataEntity()??>
const uiService = await window.uiServiceRegister.getService('${item.getPSAppDEUILogic().getPSAppDataEntity().codeName?lower_case}');
if (uiService) {
return uiService.executeUILogic('${item.getPSAppDEUILogic().codeName}', args, _context, _params, $event, xData, actionContext, srfParentDeName);
}
const uiService = await window.uiServiceRegister.getService('${item.getPSAppDEUILogic().getPSAppDataEntity().codeName?lower_case}');
if (uiService) {
return uiService.executeUILogic('${item.getPSAppDEUILogic().codeName}', args, _context, _params, $event, xData, actionContext, srfParentDeName);
}
</#if>
<#else>
return { ok: true, result: ${resultData} };
return { ok: true, result: ${resultData} };
</#if>
</#if>
</#macro>
......@@ -79,8 +79,6 @@ ${front_block}
let tempData: any = {};
let tempContext: any = {};
let tempViewParam: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
<#-- 是否先保存目标数据start -->
<#if item.isSaveTargetFirst()>
......@@ -425,7 +423,7 @@ ${front_block}
openPopupApp(result.url);
} else if (Object.is(result.openmode, 'INDEXVIEWTAB') || Object.is(result.openmode, '')) {
const viewpath = ${r'`${result.viewmodule}_${result.viewname}`.toLowerCase()'};
openIndexViewTab(viewpath, data);
return openIndexViewTab(viewpath, data);
} else if (Object.is(result.openmode, 'POPUPMODAL')) {
const viewname = actionContext.$util.srfFilePath2(result.viewname);
const view: any = {
......@@ -434,7 +432,7 @@ ${front_block}
width: result.width,
height: result.height,
}
openPopupModal(view,context,data);
return openPopupModal(view,context,data);
} else if (result.openmode.startsWith('DRAWER')) {
const viewname = actionContext.$util.srfFilePath2(result.viewname);
const view: any = {
......@@ -444,7 +442,7 @@ ${front_block}
height: result.height,
placement: result.openmode,
}
openDrawer(view,context,data);
return openDrawer(view,context,data);
} else if (Object.is(result.openmode, 'POPOVER')) {
const viewname = actionContext.$util.srfFilePath2(result.viewname);
const view: any = {
......@@ -454,7 +452,7 @@ ${front_block}
height: result.height,
placement: result.openmode,
}
openPopOver(view,context,data);
return openPopOver(view,context,data);
}
}).catch((response: any) => {
if (!response || !response.status || !response.data) {
......@@ -475,7 +473,7 @@ ${front_block}
// 后续界面行为
<@nextUIActionLogic 'args' />
}
openIndexViewTab(data);
return openIndexViewTab(data);
<#-- END: 打开顶级分页视图 -->
<#-- BEGIN: 打开模态 -->
<#elseif dataview.getOpenMode() = 'POPUPMODAL'>
......@@ -496,7 +494,7 @@ ${front_block}
width: ${dataview.getWidth()?c},
title: actionContext.<@getViewLanguageTitle dataview />,
};
openPopupModal(view, data);
return openPopupModal(view, data);
<#-- END: 打开模态 -->
<#-- BEGIN: 打开抽屉 -->
<#elseif dataview.getOpenMode()?index_of('DRAWER') == 0>
......@@ -517,7 +515,7 @@ ${front_block}
title: actionContext.<@getViewLanguageTitle dataview />,
placement: '${dataview.getOpenMode()}',
};
openDrawer(view, data);
return openDrawer(view, data);
<#-- END: 打开抽屉 -->
<#-- BEGIN: 打开气泡卡片 -->
<#elseif dataview.getOpenMode() == 'POPOVER'>
......@@ -539,7 +537,7 @@ ${front_block}
title: actionContext.<@getViewLanguageTitle dataview />,
placement: '${dataview.getOpenMode()}',
};
openPopOver(view, data);
return openPopOver(view, data);
<#-- END: 打开气泡卡片 -->
<#-- BEGIN: 其他打开模式 -->
<#else>
......
......@@ -34,8 +34,8 @@ ${backend_block}
return uiService.executeUILogic('${item.getPSAppDEUILogic().codeName}', args, _context, _params, $event, xData, actionContext, srfParentDeName);
</#if>
<#else>
<#-- BEGIN: 自定义确认 -->
<#if item.getConfirmMsg?? && item.getConfirmMsg()??>
<#-- BEGIN: 自定义确认 -->
<#if item.getEnableConfirm?? && item.getEnableConfirm() && item.getConfirmMsg?? && item.getConfirmMsg()??>
let confirmResult:boolean = await new Promise((resolve: any, reject: any) => {
actionContext.$Modal.confirm({
title: '警告',
......@@ -47,131 +47,198 @@ ${backend_block}
if(!confirmResult){
return;
}
</#if>
<#-- BEGIN: 自定义确认 -->
<#if item.getActionTarget() == 'SINGLEDATA'>
actionContext.$Notice.error({ title: '错误', desc: '不支持单项数据' });
<#elseif item.getActionTarget() == 'MULTIDATA'>
</#if>
<#-- END: 自定义确认 -->
<#if item.getActionTarget() == 'MULTIDATA'>
actionContext.$Notice.error({ title: '错误', desc: '不支持多项数据' });
<#else>
<#else>
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
let tempData: any = {};
let tempContext: any = {};
let tempViewParam: 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()>
<#if item.isSaveTargetFirst()>
const result:any = await xData.save(args,false);
<#if item.getActionTarget() == 'SINGLEDATA'>
Object.assign(args[0], result.data);
<#else>
args = [result.data];
</#if>
</#if>
</#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;
<#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>
if (_args && args[0] && args[0]['${valueItem}']) {
Object.assign(tempContext, { ${appDataEntity.codeName?lower_case}: '%${valueItem}%' });
} else {
Object.assign(tempContext, { ${appDataEntity.codeName?lower_case}: '%${paramItem}%' });
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
Object.assign(tempViewParam, { ${valueItem}: '%${paramItem}%' });
Object.assign(tempViewParam, { ${textItem}: '%${textItem}%' });
</#if>
</#if>
<#if item.getPSNavigateContexts?? && item.getPSNavigateContexts()??>
Object.assign(tempContext, <@getNavigateContext item />);
</#if>
<#if item.getPSNavigateParams?? && item.getPSNavigateParams()??>
Object.assign(tempViewParam, <@getNavigateParams item />);
</#if>
tempContext = UIActionTool.handleContextParam(actionTarget, _args, context, params, tempContext);
<#if item.getActionTarget() == 'SINGLEDATA'>
tempData = UIActionTool.handleActionParam(actionTarget, _args, context, params, tempViewParam);
Object.assign(data, tempData);
<#else>
tempViewParam = UIActionTool.handleActionParam(actionTarget, _args, context, params, tempViewParam);
</#if>
<#-- 多项数据主键转换数据 start -->
if(Object.is(actionTarget,"MULTIKEY")){
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 = {};
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]});
Object.assign(tempObject,{ [key]: data[key].split(',')[i] });
})
tempDataArray.push(tempObject);
}
}else{
} else {
tempDataArray.push(data);
}
data = tempDataArray;
}
<#-- 多项数据主键转换数据 end -->
context = Object.assign({},actionContext.context,context);
Object.assign(context, tempContext);
<#-- 构建srfparentdename和srfparentkey start -->
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
let parentObj: any = {
srfparentdename: srfParentDeName ? srfParentDeName : null,
srfparentkey: srfParentDeName ? context[srfParentDeName.toLowerCase()] : null
};
<#-- 多项数据主键转换数据 start -->
if(!Object.is(actionTarget,"MULTIKEY")){
Object.assign(data,parentObj);
Object.assign(data, parentObj);
}
<#-- 多项数据主键转换数据 end -->
Object.assign(context,parentObj);
Object.assign(context, parentObj);
<#-- 构建srfparentdename和srfparentkey end -->
// 直接调实体服务需要转换的数据
if(context && context.srfsessionid){
context.srfsessionkey = 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) {
if (xData && xData.formValidateStatus instanceof Function) {
if (!xData.formValidateStatus()) {
actionContext.$Notice.error({ title: '错误', actionContext.$t('app.searchform.globalerrortip') as string });
return;
}
}
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()?? && item.getPSAppDEMethod?? && item.getPSAppDEMethod()??>
const curService: ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service = new ${srfclassname('${item.getPSAppDataEntity().getCodeName()}')}Service();
<#if item.getActionTarget() == 'MULTIKEY'>
const promiseArray = [];
if (data && data.length > 0) {
const srfkeys = context['${item.getPSAppDataEntity().codeName?lower_case}'] ? context['${item.getPSAppDataEntity().codeName?lower_case}'].split(',') : [];
data.forEach((ele: any, index: number) => {
const tempContext = Util.deepCopy(context);
Object.assign(tempContext, { [key]: srfkeys[index] });
promiseArray.push(curService['${item.getPSAppDEMethod().getCodeName()}'](tempContext, ele));
})
}
let promise: any = Promise.all(promiseArray);
<#else>
let promise: any = curService['${item.getPSAppDEMethod().getCodeName()'](context, data);
</#if>
promise.then(async (response: any) => {
<#if item.getActionTarget() == 'SINGLEDATA'>
Util.clearAdditionalData(tempData, args[0]);
</#if>
if ((!response || response.status !== 200) && !Array.isArray(response)) {
actionContext.$Notice.error({ title: '错误', desc: response.message });
return;
}
<#if item.isShowBusyIndicator()>
<#if item.getSuccessMsg?? && item.getSuccessMsg()??>
let { data } = response;
if (Array.isArray(response) && response.length > 0) {
data = [];
response.forEach((item: any) => {
data.push(item.data);
})
}
<#-- 合并参数 -->
<#if item.getPSAppDEMethod().isCustomCode?? && item.getPSAppDEMethod().isCustomCode() && !(item.getPSAppDEMethod().getPSDEServiceAPIMethod?? && item.getPSAppDEMethod().getPSDEServiceAPIMethod()??)>
if (args && args.length > 0 && Object.prototype.toString.call(data) === '[Object Object]') {
Object.assign(args[0], data);
actionContext.$forceUpdate();
}
</#if>
<#if item.isShowBusyIndicator()>
<#if item.getSuccessMsg?? && item.getSuccessMsg()??>
actionContext.$Notice.success({ title: '成功', desc: '${item.getSuccessMsg()}' });
<#else>
<#else>
actionContext.$Notice.success({ title: '成功', desc: '${item.getCaption()}成功!' });
</#if>
</#if>
const _this: any = actionContext;
</#if>
</#if>
<#-- 是否重新加载数据 -->
<#if item.isReloadData?? && item.isReloadData()>
<#if item.isReloadData?? && item.isReloadData()>
if (xData && xData.refresh && xData.refresh instanceof Function) {
xData.refresh(args);
}
</#if>
<#-- 关闭编辑视图 -->
<#if item.isCloseEditView()>
</#if>
<#-- 关闭编辑视图 -->
<#if item.isCloseEditView()>
actionContext.closeView(null);
</#if>
<#-- 后续界面行为 -->
<#if item.getNextPSUIAction?? && item.getNextPSUIAction()??>
<#assign nextPSUIAction = item.getNextPSUIAction()/>
const { data: result } = response;
</#if>
<#if item.isReloadData?? && item.isReloadData() && item.getRefreshMode?? && item.getRefreshMode()?? == 1>
if (xData && xData.getControlType instanceof Function && xData.getControlType() == 'FORM') {
AppCenterService.notifyMessage({ name:"${item.getPSAppDataEntity().getCodeName()}", action: 'appRefresh', data: args });
}
</#if>
<#-- 后续界面行为 -->
<#if item.getNextPSUIAction?? && item.getNextPSUIAction()??>
let { data: result } = response;
if (response && Array.isArray(response) && response.length > 0) {
result = [];
response.forEach((item: any) => {
result.push(item.data);
})
}
let _args: any[] = [];
if (Object.is(actionContext.$util.typeOf(result), 'array')) {
_args = [...result];
} else if (Object.is(actionContext.$util.typeOf(result), 'object')) {
_args = [{...result}];
_args = result && Object.keys(result).length > 0 ? [{ ...result }] : Util.deepCopy(args);
} else {
_args = [...args];
_args = Util.deepCopy(args);
}
<#if !(nextPSUIAction.getPSAppDataEntity?? && nextPSUIAction.getPSAppDataEntity()??)>
<#if !(nextPSUIAction.getPSAppDataEntity?? && nextPSUIAction.getPSAppDataEntity()??)>
if (_this.${nextPSUIAction.getFullCodeName()} && _this.${nextPSUIAction.getFullCodeName()} instanceof Function) {
_this.${nextPSUIAction.getFullCodeName()}(_args,context, params, $event, xData,actionContext);
_this.${nextPSUIAction.getFullCodeName()}(_args, context, params, $event, xData, actionContext);
}
<#else>
<#else>
if (this.${nextPSUIAction.getFullCodeName()} && this.${nextPSUIAction.getFullCodeName()} instanceof Function) {
this.${nextPSUIAction.getFullCodeName()}(_args,context, params, $event, xData,actionContext);
this.${nextPSUIAction.getFullCodeName()}(_args, context, params, $event, xData, actionContext);
}
</#if>
</#if>
return response;
</#if>
<#else>
<#if item.getUILogicAttachMode?? && item.getUILogicAttachMode()?? && item.getUILogicAttachMode() == 'AFTER' && item.getPSAppDEUILogic?? && item.getPSAppDEUILogic()??>
const _context: any = Object.assign(context, actionContext.context);
const _params: any = Object.assign(params, actionContext.viewparams);
<#if item.getPSAppDataEntity?? && item.getPSAppDataEntity()?? && item.getPSAppDEUILogic().getPSAppDataEntity?? && item.getPSAppDEUILogic().getPSAppDataEntity()?? && item.getPSAppDataEntity().codeName == item.getPSAppDEUILogic().getPSAppDataEntity().codeName>
return this.executeUILogic('${item.getPSAppDEUILogic().codeName}', args, _context, _params, $event, xData, actionContext, srfParentDeName);
<#elseif item.getPSAppDEUILogic().getPSAppDataEntity?? && item.getPSAppDEUILogic().getPSAppDataEntity()??>
const uiService = await window.uiServiceRegister.getService('${item.getPSAppDEUILogic().getPSAppDataEntity().codeName?lower_case}');
if (uiService) {
return uiService.executeUILogic('${item.getPSAppDEUILogic().codeName}', args, _context, _params, $event, xData, actionContext, srfParentDeName);
}
</#if>
</#if>
</#if>
}).catch((response: any) => {
if (response && response.status && response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: response.data.message });
......@@ -183,14 +250,14 @@ ${backend_block}
}
return response;
});
<#else>
<#else>
actionContext.$Notice.error({ title: '错误', desc: '模型异常,应用实体方法不存在' });
</#if>
</#if>
};
<#if item.getFrontPSAppView()??>
<#assign frontview = item.getFrontPSAppView()>
<#-- 抽屉打开 -->
<#if frontview.getOpenMode()?index_of('DRAWER') == 0>
<#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 />,
......@@ -201,12 +268,18 @@ ${backend_block}
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 });
if(data && data instanceof Array && data.length > 0){
data.forEach((item:any) => {
Object.assign(item, { srfactionparam: result.datas });
})
} else {
Object.assign(data, { srfactionparam: result.datas });
}
backend();
}
});
<#-- 模态打开 -->
<#else>
<#else>
const view = {
viewname: '${srffilepath2(frontview.getCodeName())}',
title: actionContext.<@getViewLanguageTitle frontview />,
......@@ -216,16 +289,22 @@ ${backend_block}
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 });
if(data && data instanceof Array && data.length > 0){
data.forEach((item:any) =>{
Object.assign(item, { srfactionparam: result.datas });
})
} else {
Object.assign(data, { srfactionparam: result.datas });
}
backend();
}
});
</#if>
<#else>
</#if>
<#else>
backend();
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
}
</#if>
\ No newline at end of file
......@@ -7,6 +7,7 @@
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch,Inject } from 'vue-property-decorator';
import { UIActionTool, Util } from '@/utils';
import axios from 'axios';
import { AppMessageBox } from '@/utils/app-message-box/app-message-box';
import NavDataService from '@/service/app/navdata-service';
<#if view.getPSAppCounterRefs()??>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册