Updated value-getter.ts

This commit is contained in:
tenraku ou
2024-06-03 07:40:41 +00:00
parent c1cad3d7a9
commit 5bde55e5fc

View File

@@ -1,10 +1,11 @@
import { actionAddins } from "."; import { actionAddins } from ".";
import { IAction,IActionResult, IActionNode, IActionProperty, IField} from "../types/ActionTypes"; import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext} from "../types/ActionTypes";
/** /**
* アクションの属性定義 * アクションの属性定義
*/ */
interface IGetValueProps{ interface IGetValueProps{
field:IField;//チェックするフィールドの対象 field:IField;//チェックするフィールドの対象
verName:string;
} }
/** /**
* 正規表現チェックアクション * 正規表現チェックアクション
@@ -18,6 +19,7 @@ export class GetValueAciton implements IAction{
this.actionProps=[]; this.actionProps=[];
this.props={ this.props={
field:{code:''}, field:{code:''},
verName:''
} }
//アクションを登録する //アクションを登録する
this.register(); this.register();
@@ -28,7 +30,7 @@ export class GetValueAciton implements IAction{
* @param event * @param event
* @returns * @returns
*/ */
async process(actionNode:IActionNode,event:any):Promise<IActionResult> { async process(actionNode:IActionNode,event:any,context:IContext):Promise<IActionResult> {
let result={ let result={
canNext:true, canNext:true,
result:false result:false
@@ -36,7 +38,7 @@ export class GetValueAciton implements IAction{
try{ try{
//属性設定を取得する //属性設定を取得する
this.actionProps=actionNode.actionProps; this.actionProps=actionNode.actionProps;
if (!('field' in actionNode.ActionValue)) { if (!('field' in actionNode.ActionValue) && !('verName' in actionNode.ActionValue)) {
return result return result
} }
@@ -44,7 +46,7 @@ export class GetValueAciton implements IAction{
//条件式の計算結果を取得 //条件式の計算結果を取得
const record = event.record; const record = event.record;
const value = record[this.props.field.code].value; const value = record[this.props.field.code].value;
console.log(value) context.variables[this.props.verName] = value;
result = { result = {
canNext:true, canNext:true,
result:true result:true