bug修复
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
<div class="row justify-between q-mx-sm">
|
<div class="row justify-between q-mx-sm">
|
||||||
<div class="">目標</div>
|
<div class="">目標</div>
|
||||||
<q-btn outline color="primary" size="xs" label="最新のフィールドを取得する"
|
<q-btn outline color="primary" size="xs" label="最新のフィールドを取得する"
|
||||||
@click="() => updateFields(sourceAppId!, undefined)" />
|
@click="() => updateFields(sourceAppId!)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-1 q-pl-md">
|
<div class="col-1 q-pl-md">
|
||||||
@@ -40,13 +40,13 @@
|
|||||||
<!-- <div class="q-my-sm" v-for="(item, index) in mappingProps" :key="item.id"> -->
|
<!-- <div class="q-my-sm" v-for="(item, index) in mappingProps" :key="item.id"> -->
|
||||||
<div class="row q-my-md q-col-gutter-x-md flex-center">
|
<div class="row q-my-md q-col-gutter-x-md flex-center">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<ConditionObject :config="config" v-model="item.from" :disabled="item.disabled" :label="item.disabled ? '「Lookup」によってロックされる': ''"/>
|
<ConditionObject :config="config" v-model="item.from" :disabled="item.disabled"
|
||||||
|
:label="item.disabled ? '「Lookup」によってロックされる' : undefined" />
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="col-1">
|
<!-- <div class="col-1">
|
||||||
</div> -->
|
</div> -->
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<q-field v-model="item.vName" type="text" outlined dense
|
<q-field v-model="item.vName" type="text" outlined dense :disable="item.disabled">
|
||||||
:disable="item.disabled" >
|
|
||||||
<!-- <template v-slot:append>
|
<!-- <template v-slot:append>
|
||||||
<q-icon name="search" class="cursor-pointer"
|
<q-icon name="search" class="cursor-pointer"
|
||||||
@click="() => { mappingProps[index].to.isDialogVisible = true }" />
|
@click="() => { mappingProps[index].to.isDialogVisible = true }" />
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</q-field>
|
</q-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
<q-checkbox size="sm" v-model="item.isKey" :disable="item.disabled"/>
|
<q-checkbox size="sm" v-model="item.isKey" :disable="item.disabled" />
|
||||||
<!-- <q-btn flat round dense icon="delete" size="sm" @click="() => deleteMappingObject(index)" /> -->
|
<!-- <q-btn flat round dense icon="delete" size="sm" @click="() => deleteMappingObject(index)" /> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -184,64 +184,44 @@ export default defineComponent({
|
|||||||
|
|
||||||
const createWithNull = ref(props.modelValue?.createWithNull ?? false)
|
const createWithNull = ref(props.modelValue?.createWithNull ?? false)
|
||||||
|
|
||||||
watch(() => sourceAppId.value, async (newId, oldId) => {
|
watch(() => sourceAppId.value, async (newId, ) => {
|
||||||
if (!newId) return;
|
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 modelValueData = props.modelValue?.data ?? [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ktAppFields = await api.get('api/v1/appfields', {
|
const ktAppFields = await api.get('api/v1/appfields', {
|
||||||
params: {
|
params: {
|
||||||
app: newId
|
app: sourceAppId
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
return Object.values(res.data.properties)
|
return Object.values(res.data.properties)
|
||||||
.filter(f => !blackListLabelName.find(label => f.label === label))
|
.filter(f => !blackListLabelName.find(label => f.label === label))
|
||||||
.map(f => ({ name: f.label, objectType: 'field', ...f }))
|
.map(f => ({ name: f.label, objectType: 'field', ...f }))
|
||||||
.map(f => {
|
.map(f => {
|
||||||
|
const beforeData = modelValueData.find(m => m.to.fields[0].code === f.code)
|
||||||
return {
|
return {
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
from: modelValueData.find(m => m.to.fields[0].code === f.code),
|
from: beforeData?.from ?? {},
|
||||||
to: {
|
to: {
|
||||||
app: sourceApp.value,
|
app: sourceApp.value,
|
||||||
fields: [f],
|
fields: [f],
|
||||||
isDialogVisible: false
|
isDialogVisible: false
|
||||||
},
|
},
|
||||||
isKey: false,
|
isKey: beforeData?.isKey ?? false,
|
||||||
disabled: 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
|
const lookupFixedField = ktAppFields
|
||||||
.filter(field => field.to.fields[0].lookup !== undefined)
|
.filter(field => field.to.fields[0].lookup !== undefined)
|
||||||
.flatMap(field => field.to.fields[0].lookup.fieldMappings.map((m) => m.field))
|
.flatMap(field => field.to.fields[0].lookup.fieldMappings.map((m) => m.field))
|
||||||
|
|
||||||
console.log(lookupFixedField);
|
|
||||||
|
|
||||||
if (lookupFixedField.length > 0) {
|
if (lookupFixedField.length > 0) {
|
||||||
|
ktAppFields.filter(f => lookupFixedField.includes(f.to.fields[0].code)).forEach(f => f.disabled = true)
|
||||||
ktAppFields.filter(f => lookupFixedField.includes( f.to.fields[0].code)).forEach(f => f.disabled = true)
|
|
||||||
// for (const field of ktAppFields) {
|
|
||||||
// field.disabled = true
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit('update:modelValue', { data: ktAppFields, createWithNull: createWithNull });
|
emit('update:modelValue', { data: ktAppFields, createWithNull: createWithNull });
|
||||||
@@ -249,10 +229,6 @@ export default defineComponent({
|
|||||||
|
|
||||||
console.log(createWithNull.value);
|
console.log(createWithNull.value);
|
||||||
|
|
||||||
// const deleteMappingObject = (index: number) => mappingProps.length === 1
|
|
||||||
// ? mappingProps.splice(0, mappingProps.length, defaultMappingProp())
|
|
||||||
// : mappingProps.splice(index, 1);
|
|
||||||
|
|
||||||
const mappingObjectsInputDisplay = computed(() =>
|
const mappingObjectsInputDisplay = computed(() =>
|
||||||
(mappingProps.value && Array.isArray(mappingProps.value)) ?
|
(mappingProps.value && Array.isArray(mappingProps.value)) ?
|
||||||
mappingProps.value
|
mappingProps.value
|
||||||
@@ -263,15 +239,12 @@ export default defineComponent({
|
|||||||
: []
|
: []
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const btnDisable = computed(() => props.onlySourceSelect ? !(source?.props?.modelValue?.app?.id) : false);
|
const btnDisable = computed(() => props.onlySourceSelect ? !(source?.props?.modelValue?.app?.id) : false);
|
||||||
|
|
||||||
//集計処理方法
|
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
emit('update:modelValue', { data: mappingProps.value, createWithNull: createWithNull.value });
|
emit('update:modelValue', { data: mappingProps.value, createWithNull: createWithNull.value });
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uuidv4,
|
uuidv4,
|
||||||
dgIsShow: ref(false),
|
dgIsShow: ref(false),
|
||||||
|
|||||||
Reference in New Issue
Block a user