From 18b97c249a9bc3ca781d317f917f3888b017dbb8 Mon Sep 17 00:00:00 2001 From: Mouriya Date: Thu, 11 Jul 2024 20:34:32 +0900 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/right/DataMapping.vue | 55 +++++-------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/frontend/src/components/right/DataMapping.vue b/frontend/src/components/right/DataMapping.vue index 7e6e745..2629b78 100644 --- a/frontend/src/components/right/DataMapping.vue +++ b/frontend/src/components/right/DataMapping.vue @@ -29,7 +29,7 @@
目標
+ @click="() => updateFields(sourceAppId!)" />
@@ -40,13 +40,13 @@
- +
- +
@@ -184,64 +184,44 @@ export default defineComponent({ const createWithNull = ref(props.modelValue?.createWithNull ?? false) - watch(() => sourceAppId.value, async (newId, oldId) => { + watch(() => sourceAppId.value, async (newId, ) => { if (!newId) return; - updateFields(newId, oldId) + updateFields(newId) }) - const updateFields = async (newId: string, oldId: string | undefined) => { + const updateFields = async (sourceAppId: string) => { const modelValueData = props.modelValue?.data ?? []; - - const ktAppFields = await api.get('api/v1/appfields', { params: { - app: newId + app: sourceAppId } }).then(res => { return Object.values(res.data.properties) .filter(f => !blackListLabelName.find(label => f.label === label)) .map(f => ({ name: f.label, objectType: 'field', ...f })) .map(f => { + const beforeData = modelValueData.find(m => m.to.fields[0].code === f.code) return { id: uuidv4(), - from: modelValueData.find(m => m.to.fields[0].code === f.code), + from: beforeData?.from ?? {}, to: { app: sourceApp.value, fields: [f], isDialogVisible: false }, - isKey: false, + isKey: beforeData?.isKey ?? false, disabled: false } }) }) - - - // const createWithNull = props.modelValue?.createWithNull ?? false - - // if (modelValueData.length === 0 || newId !== oldId) { - // emit('update:modelValue', { data: ktAppFields, createWithNull: createWithNull }); - // return; - // } - // const modelValueFieldNames = modelValueData.map(item => item.to.fields[0].name); - - // const newFields = ktAppFields.filter(field => !modelValueFieldNames.includes(field.to.fields[0].name)); - - // const updatedModelValueData = [...modelValueData, ...newFields]; const lookupFixedField = ktAppFields .filter(field => field.to.fields[0].lookup !== undefined) .flatMap(field => field.to.fields[0].lookup.fieldMappings.map((m) => m.field)) - console.log(lookupFixedField); - if (lookupFixedField.length > 0) { - - ktAppFields.filter(f => lookupFixedField.includes( f.to.fields[0].code)).forEach(f => f.disabled = true) - // for (const field of ktAppFields) { - // field.disabled = true - // } + ktAppFields.filter(f => lookupFixedField.includes(f.to.fields[0].code)).forEach(f => f.disabled = true) } emit('update:modelValue', { data: ktAppFields, createWithNull: createWithNull }); @@ -249,10 +229,6 @@ export default defineComponent({ console.log(createWithNull.value); - // const deleteMappingObject = (index: number) => mappingProps.length === 1 - // ? mappingProps.splice(0, mappingProps.length, defaultMappingProp()) - // : mappingProps.splice(index, 1); - const mappingObjectsInputDisplay = computed(() => (mappingProps.value && Array.isArray(mappingProps.value)) ? mappingProps.value @@ -263,15 +239,12 @@ export default defineComponent({ : [] ); - - const btnDisable = computed(() => props.onlySourceSelect ? !(source?.props?.modelValue?.app?.id) : false); - //集計処理方法 - watchEffect(() => { emit('update:modelValue', { data: mappingProps.value, createWithNull: createWithNull.value }); }); + return { uuidv4, dgIsShow: ref(false),