bug修复
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<div class="row justify-between q-mx-sm">
|
||||
<div class="">目標</div>
|
||||
<q-btn outline color="primary" size="xs" label="最新のフィールドを取得する"
|
||||
@click="() => updateFields(sourceAppId!, undefined)" />
|
||||
@click="() => updateFields(sourceAppId!)" />
|
||||
</div>
|
||||
</div>
|
||||
<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="row q-my-md q-col-gutter-x-md flex-center">
|
||||
<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 class="col-1">
|
||||
</div> -->
|
||||
<div class="col-5">
|
||||
<q-field v-model="item.vName" type="text" outlined dense
|
||||
:disable="item.disabled" >
|
||||
<q-field v-model="item.vName" type="text" outlined dense :disable="item.disabled">
|
||||
<!-- <template v-slot:append>
|
||||
<q-icon name="search" class="cursor-pointer"
|
||||
@click="() => { mappingProps[index].to.isDialogVisible = true }" />
|
||||
@@ -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
|
||||
// }
|
||||
}
|
||||
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user