提交 2450369b 编写于 作者: ibizdev's avatar ibizdev

Mosher 发布系统代码 [后台服务,演示应用]

上级 c026e326
import { ILogicNode } from "@/interface/logic";
import {
UIActionContext,
UILogicAppendParamNode,
UILogicBeginNode,
UILogicBindParamNode,
UILogicCopyParamNode,
UILogicDataSetNode,
UILogicDeActionNode,
UILogicDebugParamNode,
UILogicDeLogicNode,
UILogicDeUIActionNode,
UILogicEndNode,
UILogicMsgboxNode,
UILogicPrepareParamNode,
UILogicRawCodeNode,
UILogicReNewParamNode,
UILogicResetParamNode,
UILogicSortParamNode,
UILogicThrowExceptionNode,
UILogicViewctrlFireEventNode,
UILogicViewctrlInvokeNode
} from "@/logic/ui-logic";
/**
* 打开语雀文档
*
......@@ -79,19 +55,6 @@ export default class OpenYuQueUILogicBase {
},
];
/**
* 逻辑节点
*
* @protected
* @type {ILogicNode[]}
* @memberof OpenYuQueUILogicBase
*/
protected logicNodes: ILogicNode[] = [
{ codeName: 'Begin', name: '开始', logicNodeType: 'BEGIN', logicLinks: [ { name: '连接名称', dstLogicNode: 'DEUIACTION1', } ] },
{ codeName: 'END1', name: '结束', logicNodeType: 'END', returnType: 'NONEVALUE', returnRawValue: '', },
{ codeName: 'DEUIACTION1', name: '界面行为', logicNodeType: 'DEUIACTION', dstParam: 'Default', logicLinks: [ { name: '连接名称', dstLogicNode: 'END1', } ] },
];
/**
* 执行前
*
......@@ -125,10 +88,7 @@ export default class OpenYuQueUILogicBase {
async execute(args: any[], context:any = {} ,params: any = {}, $event?: any, xData?: any, actioncontext?: any, srfParentDeName?: string) {
try {
const actionContext = this.beforeExecute(args, context, params, $event, xData, actioncontext, srfParentDeName);
if (!this.startLogicNode) {
throw new Error('没有开始节点');
}
await this.executeNode(this.startLogicNode, actionContext);
await this.execute_Begin_node(actionContext);
return actionContext.getResult();
} catch (error: any) {
throw new Error(`${error && error.message ? error.message : '发生未知错误!'}`);
......@@ -136,122 +96,36 @@ export default class OpenYuQueUILogicBase {
}
/**
* 执行节点
* 处理参数
*
* @param {ILogicNode} logicNode
* @param {UIActionContext} actionContext
* @memberof OpenYuQueUILogicBase
* @param {UIActionContext} actionContext 界面逻辑上下文
*/
async executeNode(logicNodeName: string, actionContext: UIActionContext) {
const logicNode = this.logicNodes.find((node: ILogicNode) => node.codeName === logicNodeName) as ILogicNode;
if (!logicNode) {
console.log(`未找到 ${logicNodeName} 节点`);
}
let result: any = { actionContext };
try {
switch (logicNode.logicNodeType) {
// 开始节点
case 'BEGIN':
result = await new UILogicBeginNode().executeNode(logicNode, actionContext);
break;
// 准备参数节点
case 'PREPAREJSPARAM':
result = await new UILogicPrepareParamNode().executeNode(logicNode, actionContext);
break;
// 重置参数节点
case 'RESETPARAM':
result = await new UILogicResetParamNode().executeNode(logicNode, actionContext);
break;
// 拷贝参数
case 'COPYPARAM':
result = await new UILogicCopyParamNode().executeNode(logicNode, actionContext);
break;
// 绑定参数
case 'BINDPARAM':
result = await new UILogicBindParamNode().executeNode(logicNode, actionContext);
break;
// 重新建立参数
case 'RENEWPARAM':
result = await new UILogicReNewParamNode().executeNode(logicNode, actionContext);
break;
// 调用实体界面行为
case 'DEUIACTION':
result = await new UILogicDeUIActionNode().executeNode(logicNode, actionContext);
break;
// 行为处理节点
case 'DEACTION':
result = await new UILogicDeActionNode().executeNode(logicNode, actionContext);
break;
// 实体处理逻辑
case 'DELOGIC':
result = await new UILogicDeLogicNode().executeNode(logicNode, actionContext);
break;
// 实体数据集
case 'DEDATASET':
result = await new UILogicDataSetNode().executeNode(logicNode, actionContext);
break;
// 附加到数组参数
case 'APPENDPARAM':
result = await new UILogicAppendParamNode().executeNode(logicNode, actionContext);
break;
// 排序数组参数
case 'SORTPARAM':
result = await new UILogicSortParamNode().executeNode(logicNode, actionContext);
break;
// 视图部件调用
case 'VIEWCTRLINVOKE':
result = await new UILogicViewctrlInvokeNode().executeNode(logicNode, actionContext);
break;
// 视图部件事件触发
case 'VIEWCTRLFIREEVENT':
result = await new UILogicViewctrlFireEventNode().executeNode(logicNode, actionContext);
break;
// 调试逻辑参数
case 'DEBUGPARAM':
result = await new UILogicDebugParamNode().executeNode(logicNode, actionContext);
break;
// 消息弹窗
case 'MSGBOX':
result = await new UILogicMsgboxNode().executeNode(logicNode, actionContext);
break;
// 前端代码
case 'RAWJSCODE':
result = await new UILogicRawCodeNode().executeNode(logicNode, actionContext);
break;
// 异常处理
case 'THROWEXCEPTION':
result = await new UILogicThrowExceptionNode().executeNode(logicNode, actionContext);
break;
// 结束
case 'END':
result = await new UILogicEndNode().executeNode(logicNode, actionContext);
break;
default:
console.log(`${logicNode.logicNodeType}暂未支持`);
}
// 有后续节点时继续递归,反之返回,抛异常无返回值
if (result && result.nextNodes && result.nextNodes.length > 0) {
await this.executeNextNodes(result.nextNodes, actionContext);
}
} catch (error: any) {
throw new Error(`${error && error.message ? error.message : '发生未知错误!'}`);
}
}
protected async execute_begin_node(actionContext: UIActionContext) {
// 打开语雀文档
actionContext.setResult(actionContext.defaultParam.getReal());
console.log('已完成执行 开始 节点');
await this.execute_deuiaction1_node(actionContext);
}
/**
* 执行后续节点集合
* 处理参数
*
* @param {any[]} nextNodes
* @param {UIActionContext} actionContext
* @memberof OpenYuQueUILogicBase
* @param {UIActionContext} actionContext 界面逻辑上下文
*/
public async executeNextNodes(nextNodes: any[], actionContext: UIActionContext) {
if (nextNodes && (nextNodes.length > 0)) {
for (let nextNode of nextNodes) {
await this.executeNode(nextNode, actionContext);
}
}
}
protected async execute_end1_node(actionContext: UIActionContext) {
// 打开语雀文档
// TODO 等待补充
console.log('已完成执行 结束 节点');
}
/**
* 处理参数
*
* @param {UIActionContext} actionContext 界面逻辑上下文
*/
protected async execute_deuiaction1_node(actionContext: UIActionContext) {
// 打开语雀文档
// TODO 等待补充
console.log('已完成执行 界面行为 节点');
await this.execute_end1_node(actionContext);
}
}
\ No newline at end of file
......@@ -590,7 +590,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -626,7 +626,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZAPPEDITORListView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
......@@ -663,7 +663,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr3GridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr5DataView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -699,7 +699,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr3GridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr5DataView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
......@@ -1800,7 +1800,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView_layout' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1835,7 +1835,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {}): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView_layout' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1897,7 +1897,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -2005,7 +2005,7 @@ export default class MainBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -2082,7 +2082,7 @@ export default class MainBase extends Vue implements ControlInterface {
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView_layout' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKOptionView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -522,7 +522,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView_layout' + (this.$t('app.list.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
}
const arg: any = {...opt};
......@@ -638,7 +638,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView_layout' + (this.$t('app.list.notConfig.removeAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView' + (this.$t('app.list.notConfig.removeAction') as string) });
return;
}
if (datas.length === 0) {
......@@ -733,7 +733,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView_layout' + (this.$t('app.list.notConfig.createAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZOrderListExpView' + (this.$t('app.list.notConfig.createAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
......@@ -741,7 +741,7 @@ export default class ListExpBase extends Vue implements ControlInterface {
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: (this.$t('app.commonWords.warning') as string), desc: 'IBIZOrderListExpView_layout' + (this.$t('app.list.notConfig.updateAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.warning') as string), desc: 'IBIZOrderListExpView' + (this.$t('app.list.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizorder){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册