BUG527:エラーの共通処理追加
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
import { actionAddins } from ".";
|
||||
import { IAction,IActionResult, IActionNode, IActionProperty, IField } from "../types/ActionTypes";
|
||||
import { IAction,IActionResult, IActionNode, IActionProperty, IField, IContext } from "../types/ActionTypes";
|
||||
|
||||
interface IMustInputProps{
|
||||
field:IField;
|
||||
@@ -22,25 +22,33 @@ export class MustInputAction implements IAction{
|
||||
this.register();
|
||||
}
|
||||
|
||||
async process(actionNode:IActionNode,event:any):Promise<IActionResult> {
|
||||
async process(actionNode:IActionNode,event:any,context:IContext):Promise<IActionResult> {
|
||||
let result={
|
||||
canNext:true,
|
||||
result:false
|
||||
};
|
||||
this.actionProps=actionNode.actionProps;
|
||||
if (!('field' in actionNode.ActionValue) && !('message' in actionNode.ActionValue)) {
|
||||
return result
|
||||
}
|
||||
this.props = actionNode.ActionValue as IMustInputProps;
|
||||
const record = event.record;
|
||||
const value = record[this.props.field.code]?.value;
|
||||
if(value===undefined || value===''){
|
||||
record[this.props.field.code].error=this.props.message;
|
||||
return result;
|
||||
}
|
||||
result= {
|
||||
canNext:true,
|
||||
result:true
|
||||
try{
|
||||
this.actionProps=actionNode.actionProps;
|
||||
if (!('field' in actionNode.ActionValue) && !('message' in actionNode.ActionValue)) {
|
||||
return result
|
||||
}
|
||||
this.props = actionNode.ActionValue as IMustInputProps;
|
||||
const record = event.record;
|
||||
if(!(this.props.field.code in record)){
|
||||
throw new Error(`フィールド[${this.props.field.code}]が見つかりませんでした。`);
|
||||
}
|
||||
const value = record[this.props.field.code].value;
|
||||
if(value===undefined || value===''){
|
||||
record[this.props.field.code].error=this.props.message;
|
||||
return result;
|
||||
}
|
||||
result= {
|
||||
canNext:true,
|
||||
result:true
|
||||
}
|
||||
}catch(error){
|
||||
context.errors.handleError(error,actionNode);
|
||||
result.canNext=false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user