bugfix for auto-lookup
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -103,7 +103,7 @@ export class AutoLookUpAction implements IAction {
|
|||||||
this.actionProps = actionNode.actionProps;
|
this.actionProps = actionNode.actionProps;
|
||||||
this.props = {
|
this.props = {
|
||||||
...actionNode.ActionValue,
|
...actionNode.ActionValue,
|
||||||
condition: JSON.parse((actionNode.ActionValue as any).condition),
|
condition: JSON.parse((actionNode.ActionValue as any).condition || '{}'),
|
||||||
} as IAutoLookUpProps;
|
} as IAutoLookUpProps;
|
||||||
// console.log(context);
|
// console.log(context);
|
||||||
|
|
||||||
@@ -111,16 +111,17 @@ export class AutoLookUpAction implements IAction {
|
|||||||
canNext: true,
|
canNext: true,
|
||||||
result: "",
|
result: "",
|
||||||
} as IActionResult;
|
} as IActionResult;
|
||||||
try {
|
const lookUpFields = this.props.lookupField.fields.filter(
|
||||||
const lookUpFields = this.props.lookupField.fields.filter(
|
(f) => f.lookup && f.lookup.relatedApp.app === String(kintone.app.getId())
|
||||||
(f) => f.lookup && f.lookup.relatedApp.app === String(kintone.app.getId())
|
);
|
||||||
|
if (!lookUpFields || lookUpFields.length===0) {
|
||||||
|
throw new Error(
|
||||||
|
`ルックアップの設定は不正です。${this.props.lookupField.fields[0].label} `
|
||||||
);
|
);
|
||||||
if (!lookUpFields || lookUpFields.length===0) {
|
}
|
||||||
throw new Error(
|
try {
|
||||||
`ルックアップの設定は不正です。${this.props.lookupField.fields[0].label} `
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const lookUpField = this.props.lookupField.fields[0];
|
const lookUpField = this.props.lookupField.fields[0];
|
||||||
|
this.showSpinnerModel(this.props.lookupField.app, lookUpField);
|
||||||
const key = event.record[lookUpField.lookup.relatedKeyField].value;
|
const key = event.record[lookUpField.lookup.relatedKeyField].value;
|
||||||
const targetRecords = await this.getUpdateRecords(lookUpField, key);
|
const targetRecords = await this.getUpdateRecords(lookUpField, key);
|
||||||
//更新対象がない時にスキップ
|
//更新対象がない時にスキップ
|
||||||
@@ -129,7 +130,6 @@ export class AutoLookUpAction implements IAction {
|
|||||||
}
|
}
|
||||||
const updateRecords = this.convertForLookup(targetRecords,lookUpField,key);
|
const updateRecords = this.convertForLookup(targetRecords,lookUpField,key);
|
||||||
console.log("updateRecords", updateRecords);
|
console.log("updateRecords", updateRecords);
|
||||||
this.showSpinnerModel(this.props.lookupField.app,lookUpField);
|
|
||||||
const updateResult = await this.updateLookupTarget(updateRecords);
|
const updateResult = await this.updateLookupTarget(updateRecords);
|
||||||
if(updateResult){
|
if(updateResult){
|
||||||
this.showResult(this.props.lookupField.app,lookUpField,updateRecords.length);
|
this.showResult(this.props.lookupField.app,lookUpField,updateRecords.length);
|
||||||
@@ -157,7 +157,7 @@ export class AutoLookUpAction implements IAction {
|
|||||||
if(typeof key==='string'){
|
if(typeof key==='string'){
|
||||||
query = `${lookUpField.code} = "${key}"`
|
query = `${lookUpField.code} = "${key}"`
|
||||||
}
|
}
|
||||||
if(this.props.condition.queryString!==''){
|
if(!!this.props.condition.queryString){
|
||||||
query = `${query} and (${this.props.condition.queryString})`
|
query = `${query} and (${this.props.condition.queryString})`
|
||||||
}
|
}
|
||||||
return query;
|
return query;
|
||||||
|
|||||||
Reference in New Issue
Block a user