From a614d754f4420024763bb803172563a31bdf48d6 Mon Sep 17 00:00:00 2001 From: wtl Date: Tue, 6 Feb 2024 15:33:47 +0900 Subject: [PATCH] ErrorShowNewVer --- .../kintone-addins/src/actions/error-show.ts | 28 ++++++++++--------- .../src/types/action-process.ts | 1 + 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/plugin/kintone-addins/src/actions/error-show.ts b/plugin/kintone-addins/src/actions/error-show.ts index 03b7dca..2feeba5 100644 --- a/plugin/kintone-addins/src/actions/error-show.ts +++ b/plugin/kintone-addins/src/actions/error-show.ts @@ -2,24 +2,26 @@ import { actionAddins } from "."; import { IAction, IActionProperty, IActionNode, IContext, IActionResult } from "../types/ActionTypes"; import { ConditionTree } from '../types/Conditions'; - +/** + * アクションの属性定義 + */ interface IErrorShowProps { message: string; condition: string; -} +} export class ErrorShowAction implements IAction { - name: string; - actionProps: IActionProperty[]; - props: IErrorShowProps; - constructor() { + name: string; + actionProps: IActionProperty[]; //调用从import导入关于显示类的定义 + props: IErrorShowProps;//从上方的interface 定义这个props所需要接受的属性 + constructor() { //解构函数定义需要的类名 this.name = "エラー表示"; this.actionProps = []; this.props = { message: '', condition: '' } - this.register(); + this.register(); //重置以上注册表 } /** @@ -28,18 +30,18 @@ export class ErrorShowAction implements IAction { * @param event * @returns */ - async process(actionNode: IActionNode, event: any, context: IContext): Promise { - let result = { + async process(actionNode: IActionNode, event: any, context: IContext): Promise { //异步处理某函数下的: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; - const conditionResult = this.getConditionResult(context); + this.props = actionNode.ActionValue as IErrorShowProps; //将TS的action.actionvalue as转换为interface需要且定义的js部分 + const conditionResult = this.getConditionResult(context); if (conditionResult) { event.error = this.props.message } else { diff --git a/plugin/kintone-addins/src/types/action-process.ts b/plugin/kintone-addins/src/types/action-process.ts index a8e0b1d..5c02792 100644 --- a/plugin/kintone-addins/src/types/action-process.ts +++ b/plugin/kintone-addins/src/types/action-process.ts @@ -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{