Merged PR 28: 追加 フィールドの値を取得する

追加 フィールドの値を取得する

Related work items: #287
This commit is contained in:
tenraku ou
2024-06-03 09:46:32 +00:00
committed by Takuto Yoshida(タクト)
3 changed files with 77 additions and 1 deletions

View File

@@ -0,0 +1,68 @@
import { actionAddins } from ".";
import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext} from "../types/ActionTypes";
/**
* アクションの属性定義
*/
interface IGetValueProps{
field:IField;//チェックするフィールドの対象
verName:string;
}
/**
* 正規表現チェックアクション
*/
export class GetValueAciton implements IAction{
name: string;
actionProps: IActionProperty[];
props:IGetValueProps;
constructor(){
this.name="値を取得する";
this.actionProps=[];
this.props={
field:{code:''},
verName:''
}
//アクションを登録する
this.register();
}
/**
* アクションの実行を呼び出す
* @param actionNode
* @param event
* @returns
*/
async process(actionNode:IActionNode,event:any,context:IContext):Promise<IActionResult> {
let result={
canNext:true,
result:false
};
try{
//属性設定を取得する
this.actionProps=actionNode.actionProps;
if (!('field' in actionNode.ActionValue) && !('verName' in actionNode.ActionValue)) {
return result
}
this.props = actionNode.ActionValue as IGetValueProps;
//条件式の計算結果を取得
const record = event.record;
const value = record[this.props.field.code].value;
context.variables[this.props.verName] = value;
result = {
canNext:true,
result:true
}
return result;
}catch(error){
event.error=error;
console.error(error);
result.canNext=false;
return result;
}
};
register(): void {
actionAddins[this.name]=this;
}
}
new GetValueAciton();

View File

@@ -11,6 +11,8 @@ import '../actions/mail-check';
import '../actions/counter-check';
import '../actions/datetime-getter';
import '../actions/insert-value';
import '../actions/value-getter';
import { ActionFlow,IActionFlow, IActionResult,IContext } from "./ActionTypes";
export class ActionProcess{
@@ -44,7 +46,7 @@ export class ActionProcess{
result = await action.process(nextAction,this.event,this.context);
}
let nextInput = '';
//outputPoints一以上の場合、次のInputPoint戻り値を設定
//outputPoints一以上㝮場坈〝次㝮InputPoint戻り値を設定
if(nextAction.outputPoints && nextAction.outputPoints.length>1){
nextInput = result.result||'';
}