|
|
@ -128,9 +128,16 @@ const isValid = computed(() => { |
|
|
|
return true |
|
|
|
return true |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const prevEditableTn = ref<string[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
parseAndLoadTemplate() |
|
|
|
parseAndLoadTemplate() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// used to record the previous EditableTn values |
|
|
|
|
|
|
|
// for checking the table duplication in current import |
|
|
|
|
|
|
|
// and updating the key in importData |
|
|
|
|
|
|
|
prevEditableTn.value = data.tables.map((t) => t.ref_table_name) |
|
|
|
|
|
|
|
|
|
|
|
nextTick(() => { |
|
|
|
nextTick(() => { |
|
|
|
inputRefs.value[0]?.focus() |
|
|
|
inputRefs.value[0]?.focus() |
|
|
|
}) |
|
|
|
}) |
|
|
@ -508,6 +515,22 @@ onMounted(() => { |
|
|
|
mapDefaultColumns() |
|
|
|
mapDefaultColumns() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleEditableTnChange(idx: number) { |
|
|
|
|
|
|
|
const oldValue = prevEditableTn.value[idx] |
|
|
|
|
|
|
|
const newValue = data.tables[idx].ref_table_name |
|
|
|
|
|
|
|
if (data.tables.filter((t) => t.ref_table_name === newValue).length > 1) { |
|
|
|
|
|
|
|
message.warn('Duplicate Table Name') |
|
|
|
|
|
|
|
data.tables[idx].ref_table_name = oldValue |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
prevEditableTn.value[idx] = newValue |
|
|
|
|
|
|
|
if (oldValue !== newValue) { |
|
|
|
|
|
|
|
// update the key name of importData |
|
|
|
|
|
|
|
delete Object.assign(importData, { [newValue]: importData[oldValue] })[oldValue] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setEditableTn(idx, false) |
|
|
|
|
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -589,8 +612,8 @@ onMounted(() => { |
|
|
|
size="large" |
|
|
|
size="large" |
|
|
|
hide-details |
|
|
|
hide-details |
|
|
|
@click="$event.stopPropagation()" |
|
|
|
@click="$event.stopPropagation()" |
|
|
|
@blur="setEditableTn(tableIdx, false)" |
|
|
|
@blur="handleEditableTnChange(tableIdx)" |
|
|
|
@keydown.enter="setEditableTn(tableIdx, false)" |
|
|
|
@keydown.enter="handleEditableTnChange(tableIdx)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</a-form-item> |
|
|
|
</a-form-item> |
|
|
|
|
|
|
|
|
|
|
|