ErrorShowNewVer
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
import { actionAddins } from ".";
|
||||
import { IAction, IActionProperty, IActionNode, IContext, IActionResult } from "../types/ActionTypes";
|
||||
import { ConditionTree } from '../types/Conditions';
|
||||
|
||||
/**
|
||||
* アクションの属性定義
|
||||
*/
|
||||
interface IErrorShowProps {
|
||||
message: string;
|
||||
condition: string;
|
||||
@@ -10,16 +12,16 @@ interface IErrorShowProps {
|
||||
|
||||
export class ErrorShowAction implements IAction {
|
||||
name: string;
|
||||
actionProps: IActionProperty[];
|
||||
props: IErrorShowProps;
|
||||
constructor() {
|
||||
actionProps: IActionProperty[]; //调用从import导入关于显示类的定义
|
||||
props: IErrorShowProps;//从上方的interface 定义这个props所需要接受的属性
|
||||
constructor() { //解构函数定义需要的类名
|
||||
this.name = "エラー表示";
|
||||
this.actionProps = [];
|
||||
this.props = {
|
||||
message: '',
|
||||
condition: ''
|
||||
}
|
||||
this.register();
|
||||
this.register(); //重置以上注册表
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,17 +30,17 @@ export class ErrorShowAction implements IAction {
|
||||
* @param event
|
||||
* @returns
|
||||
*/
|
||||
async process(actionNode: IActionNode, event: any, context: IContext): Promise<IActionResult> {
|
||||
let result = {
|
||||
async process(actionNode: IActionNode, event: any, context: IContext): Promise<IActionResult> { //异步处理某函数下的:xx属性
|
||||
let result = { //定义一个能否继续往下实行的开关
|
||||
canNext: true,
|
||||
result: false
|
||||
};
|
||||
try {
|
||||
try { //尝试执行以下代码部分
|
||||
this.actionProps = actionNode.actionProps;
|
||||
if (!('message' in actionNode.ActionValue) && !('condition' in actionNode.ActionValue)) {
|
||||
if (!('message' in actionNode.ActionValue) && !('condition' in actionNode.ActionValue)) { //如果message以及condition两者都不存在的情况下return
|
||||
return result
|
||||
}
|
||||
this.props = actionNode.ActionValue as IErrorShowProps;
|
||||
this.props = actionNode.ActionValue as IErrorShowProps; //将TS的action.actionvalue as转换为interface需要且定义的js部分
|
||||
const conditionResult = this.getConditionResult(context);
|
||||
if (conditionResult) {
|
||||
event.error = this.props.message
|
||||
|
||||
@@ -3,6 +3,7 @@ import { actionAddins } from "../actions";
|
||||
import '../actions/must-input';
|
||||
import '../actions/auto-numbering';
|
||||
import '../actions/field-shown';
|
||||
import '../actions/error-show';
|
||||
import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes";
|
||||
|
||||
export class ActionProcess{
|
||||
|
||||
Reference in New Issue
Block a user