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

update:更新实体行为发布逻辑,支持脚本、实体处理逻辑类型

上级 c1ca690c
/**
* {{singleAppMethod.codeName}}
*
* @param {IContext} [context={}]
* @param {IParam} [data = {}]
* @returns {Promise<any>}
* @memberof {{pascalCase appEntity.codeName}}ServiceBase
*/
public async {{singleAppMethod.codeName}}(context: IContext = {}, data: IParam = {}): Promise<any> {
try {
// data = await this.executeAppDELogic('{{singleAppMethod.psDEAction.psDELogic.codeName}}', context, data);
const res = {
ok: true,
status: 200,
data: data
};
return res;
} catch (error: any) {
const res = {
ok: false,
status: 500,
message: error?.message
}
return res;
}
}
/**
/**
* {{singleAppMethod.codeName}}
*
* @param {IContext} [context={}]
......@@ -6,7 +6,7 @@
* @returns {Promise<any>}
* @memberof {{pascalCase appEntity.codeName}}ServiceBase
*/
public async {{singleAppMethod.codeName}}(context: IContext = {}, data: IParam = {}): Promise<any> {
public async {{singleAppMethod.codeName}}(context: IContext = {}, data: IParam = {}): Promise<any> {
{{! 方法路径是否带资源主键 }}
const deResPath = this.buildDeResPath(context, {{singleAppMethod.psDEServiceAPIMethod.needResourceKey}});
{{#if (eq singleAppMethod.methodType "SELECT")}}
......@@ -45,4 +45,4 @@
this.afterExecuteAction(context,data,'{{singleAppMethod.codeName}}');
{{/if}}
return res;
}
\ No newline at end of file
}
/**
* {{singleAppMethod.codeName}}
*
* @param {IContext} [context={}]
* @param {IParam} [data = {}]
* @returns {Promise<any>}
* @memberof {{pascalCase appEntity.codeName}}ServiceBase
*/
public async {{singleAppMethod.codeName}}(context: IContext = {}, data: IParam = {}): Promise<any> {
{{#if singleAppMethod.psDEAction.scriptCode}}
eval(`{{singleAppMethod.psDEAction.scriptCode}}`);
{{/if}}
const res = {
ok: true,
status: 200,
data: data
}
return res;
}
......@@ -43,13 +43,25 @@ export class {{pascalCase appEntity.codeName}}ServiceBase extends EntityService
}
{{#each appEntity.allPSAppDEMethods as |singleAppMethod| }}
{{! 非内置行为才输出 }}
{{#if (eq isBuiltinMethod false)}}
{{! 存在接口方法才输出 }}
{{#if singleAppMethod.psDEServiceAPIMethod}}
{{! 远端接口 }}
{{! 非内置行为和非临时数据方法才输出 }}
{{#if (and (eq builtinMethod false) (eq tempDataMode 0))}}
{{#if (eq appEntity.psDEServiceAPI.nested true)}}
{{!-- todo嵌套行为补充 --}}
{{else}}
{{!-- todo 插件 --}}
{{#if (and (eq methodType 'DEACTION') psDEAction (eq psDEAction.actionType 'DELOGIC'))}}
{{!-- 实体处理逻辑 --}}
{{> @macro/front-end/entity/service-delogic-method.hbs singleAppMethod=singleAppMethod}}
{{else if (and (eq methodType 'DEACTION') psDEAction (eq psDEAction.actionType 'SCRIPT'))}}
{{!-- 脚本代码 --}}
{{> @macro/front-end/entity/service-script-method.hbs singleAppMethod=singleAppMethod}}
{{else if (and singleAppMethod.psDEServiceAPIMethod appEntity.major)}}
{{!-- 远程接口 --}}
{{> @macro/front-end/entity/service-remote-method.hbs singleAppMethod=singleAppMethod}}
{{/if}}
{{/if}}
{{/if}}
{{/each}}
......
......@@ -204,7 +204,7 @@ export class AppSysAction {
public static newRow(params: IUIActionParams) {
const { actionEnvironment } = params;
// 视图里获取多数据部件
if (hasFunction(actionEnvironment.xDataControl, "newRow")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "newRow")) {
actionEnvironment.xDataControl.newRow();
} else if (isExist(actionEnvironment.newRow)) {
actionEnvironment.newRow();
......@@ -220,7 +220,7 @@ export class AppSysAction {
public static save(params: IUIActionParams) {
const { actionEnvironment } = params;
// 视图里获取多数据部件
if (hasFunction(actionEnvironment.xDataControl, "save")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "save")) {
actionEnvironment.xDataControl.save();
} else if (isExist(actionEnvironment.save)) {
actionEnvironment.save();
......@@ -236,7 +236,7 @@ export class AppSysAction {
public static saveRow(params: IUIActionParams) {
const { actionEnvironment } = params;
// 视图里获取多数据部件
if (hasFunction(actionEnvironment.xDataControl, "save")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "save")) {
actionEnvironment.xDataControl.save();
} else if (isExist(actionEnvironment.save)) {
actionEnvironment.save();
......@@ -252,10 +252,10 @@ export class AppSysAction {
public static remove(params: IUIActionParams) {
const { actionEnvironment, data } = params;
// 视图里获取多数据部件
if (hasFunction(actionEnvironment.xDataControl, "remove")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "remove")) {
actionEnvironment.xDataControl.remove(data);
} else if (isExist(actionEnvironment.remove)) {
actionEnvironment.remove();
actionEnvironment.remove(data);
}
}
......@@ -268,7 +268,7 @@ export class AppSysAction {
public static refresh(params: IUIActionParams) {
const { actionEnvironment } = params;
// 视图里获取多数据部件
if (hasFunction(actionEnvironment.xDataControl, "refresh")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "refresh")) {
actionEnvironment.xDataControl.refresh();
} else if (isExist(actionEnvironment.refresh)) {
actionEnvironment.refresh();
......@@ -296,7 +296,7 @@ export class AppSysAction {
*/
public static async saveAndExit(params: IUIActionParams) {
const { actionEnvironment } = params;
if (hasFunction(actionEnvironment.xDataControl, "save")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "save")) {
await actionEnvironment.xDataControl.save();
} else if (isExist(actionEnvironment.save)) {
await actionEnvironment.save();
......@@ -314,7 +314,7 @@ export class AppSysAction {
*/
public static async saveAndNew(params: IUIActionParams) {
const { actionEnvironment } = params;
if (hasFunction(actionEnvironment.xDataControl, "save")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "save")) {
await actionEnvironment.xDataControl.save();
} else if (isExist(actionEnvironment.save)) {
await actionEnvironment.save();
......@@ -338,7 +338,7 @@ export class AppSysAction {
public static async removeAndExit(params: IUIActionParams) {
const { actionEnvironment } = params;
// 视图里获取多数据部件
if (hasFunction(actionEnvironment.xDataControl, "remove")) {
if (actionEnvironment.xDataControl && hasFunction(actionEnvironment.xDataControl, "remove")) {
await actionEnvironment.xDataControl.remove();
} else if (isExist(actionEnvironment.remove)) {
await actionEnvironment.remove();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册