Compare commits
4 Commits
171f0dfa89
...
c24a3e5695
| Author | SHA1 | Date | |
|---|---|---|---|
| c24a3e5695 | |||
| 2a290c3142 | |||
| de717f25a5 | |||
| 9c4adc48ba |
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ref, PropType } from 'vue';
|
import { ref, PropType, watchEffect } from 'vue';
|
||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
import DetailFieldTable from './dialog/DetailFieldTable.vue';
|
import DetailFieldTable from './dialog/DetailFieldTable.vue';
|
||||||
|
|
||||||
@@ -33,6 +33,9 @@ export default {
|
|||||||
filter: String,
|
filter: String,
|
||||||
filterInitRowsFunc: {
|
filterInitRowsFunc: {
|
||||||
type: Function as PropType<(app: IAppDisplay) => boolean>,
|
type: Function as PropType<(app: IAppDisplay) => boolean>,
|
||||||
|
},
|
||||||
|
updateSelectApp: {
|
||||||
|
type: Function
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
@@ -44,6 +47,12 @@ export default {
|
|||||||
{ name: 'createdate', label: '作成日時', field: 'createdate', align: 'left' }
|
{ name: 'createdate', label: '作成日時', field: 'createdate', align: 'left' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
watchEffect(()=>{
|
||||||
|
if (selected.value && selected.value[0] && props.updateSelectApp) {
|
||||||
|
props.updateSelectApp(selected.value[0])
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const fetchApps = async () => {
|
const fetchApps = async () => {
|
||||||
const res = await api.get('api/v1/allapps');
|
const res = await api.get('api/v1/allapps');
|
||||||
return res.data.apps.map((item: any) => ({
|
return res.data.apps.map((item: any) => ({
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -645,7 +645,7 @@ export class InsertValueAction implements IAction{
|
|||||||
|
|
||||||
const conditionResult = this.getConditionResult(context);
|
const conditionResult = this.getConditionResult(context);
|
||||||
//保存成功イベントの場合、kintone async/await による非同期処理でフィールドに値を挿入する
|
//保存成功イベントの場合、kintone async/await による非同期処理でフィールドに値を挿入する
|
||||||
if(!event.type.includes('success')){
|
if(!event.type?.includes('success')){
|
||||||
|
|
||||||
//条件式の結果がtrueかつ挿入する値が変換できた場合、フィールド(ラジオボタン・ドロップダウン・チェックボックス・複数選択・文字列一行・文字列複数行・リッチエディタ・数値・日付・日時・時刻)にセット
|
//条件式の結果がtrueかつ挿入する値が変換できた場合、フィールド(ラジオボタン・ドロップダウン・チェックボックス・複数選択・文字列一行・文字列複数行・リッチエディタ・数値・日付・日時・時刻)にセット
|
||||||
if(conditionResult){
|
if(conditionResult){
|
||||||
|
|||||||
Reference in New Issue
Block a user