Bug510保存成功後イベントで文字結合複数設定できるように非同期処理修正

This commit is contained in:
王玉
2024-07-17 21:34:47 +09:00
parent 6ba1e0d958
commit ee362a6a93

View File

@@ -159,32 +159,32 @@ export class StringJoinAction implements IAction{
if (!event.type.includes('success')){ if (!event.type.includes('success')){
//保存先フィールドに値セット: //保存先フィールドに値セット:
record[this.props.saveField.code].value=saveValue; record[this.props.saveField.code].value=saveValue;
window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。"); //window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。");
}else{ }else{
const params={ //kintone async/await による非同期処理(成功イベントREST API処理時)
"app":event.appId, async function updateRecord(fieldCode:string,event:any) {
"id":event.recordId, return new Promise((resolve, reject) => {
"record":{[this.props.saveField.code]:{"value":saveValue}} var updatedRecord = {
app: event.appId,
id: event.recordId,
record: {[fieldCode]:{"value":saveValue}}
}; };
return await kintone.api(kintone.api.url('/k/v1/record',true),'PUT',params).then((resp) => { kintone.api(kintone.api.url('/k/v1/record', true), 'PUT', updatedRecord, (resp) => {
resolve(resp);
}, (error) => {
reject(error);
});
});
}
//kintone保存先フィールド存在確認 //kintone保存先フィールド存在確認
record[this.props.saveField.code].value=saveValue; record[this.props.saveField.code].value=saveValue;
//kintone async/await による非同期処理:
await updateRecord(this.props.saveField.code,event);
//一覧画面更新成功後手動リロードください:
if (event.type.includes('index')){ if (event.type.includes('index')){
window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。"); //window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。");
}else{ window.alert("文字結合には、一覧画面更新成功後自動リロードしません。必要に応じて手動リロードください。");
window.alert("文字結合行いました。"+this.props.joinField1.name+":"+joinValue1+","+this.props.joinField2.name+":"+joinValue2+"。");
} }
//一覧画面更新成功後リロード:
// if (event.type.includes('index')){
// event.url = location.href.endsWith('/') || location.href.endsWith('&') ?
// location.href.slice(0, -1) :
// location.href + (location.href.includes('?') ? '&' : '/');
// }
}).catch((error) => {
event.error = 'エラーが発生しました。結合しません。システム管理者へお問合せください';
window.alert(event.error+"error message"+error);
return event;
});
} }
////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////
result= { result= {