Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
icon="refresh"
|
||||
label="Yenile"
|
||||
:loading="loading"
|
||||
@click="loadRows"
|
||||
@click="refreshRows"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { computed, onActivated, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { Notify } from 'quasar'
|
||||
import api, { download } from 'src/services/api'
|
||||
import { usePermissionStore } from 'stores/permissionStore'
|
||||
@@ -809,7 +809,11 @@ function parseCsvRows (text) {
|
||||
}
|
||||
|
||||
function normalizeImportText (value) {
|
||||
return String(value ?? '').trim().toLocaleUpperCase('tr')
|
||||
let text = String(value ?? '').trim()
|
||||
if (text.startsWith("'")) text = text.slice(1).trim()
|
||||
const formulaMatch = text.match(/^=\s*"([\s\S]*)"$/)
|
||||
if (formulaMatch) text = formulaMatch[1]
|
||||
return text.toLocaleUpperCase('tr')
|
||||
}
|
||||
|
||||
function buildImportRowKeyFromObject (row) {
|
||||
@@ -880,7 +884,7 @@ async function onImportFileChange (event) {
|
||||
const csvRow = matrix[i]
|
||||
const identity = {}
|
||||
for (const [field, label] of importKeyFieldLabels) {
|
||||
identity[field] = csvRow[keyHeaderIndexes[label]] ?? ''
|
||||
identity[field] = String(csvRow[keyHeaderIndexes[label]] ?? '').trim().replace(/^'/, '').replace(/^=\s*"([\s\S]*)"$/, '$1')
|
||||
}
|
||||
|
||||
const item = {
|
||||
@@ -920,7 +924,7 @@ async function onImportFileChange (event) {
|
||||
const stats = response?.data || {}
|
||||
Notify.create({
|
||||
type: 'positive',
|
||||
message: `CSV yuklendi. Islenen: ${stats.processed ?? importItems.length}, kaydedilen: ${stats.updated ?? importItems.length}, yeni aktiflestirilen: ${stats.activated_scope_count ?? 0}, hata: ${stats.error_count ?? 0}`
|
||||
message: `CSV yuklendi. Islenen: ${stats.processed ?? importItems.length}, eslesen: ${stats.matched ?? stats.updated ?? importItems.length}, kaydedilen: ${stats.updated ?? importItems.length}, atlanan: ${stats.skipped ?? 0}, hata: ${stats.error_count ?? 0}`
|
||||
})
|
||||
} catch (err) {
|
||||
Notify.create({ type: 'negative', message: err?.message || 'CSV okunamadi' })
|
||||
@@ -946,6 +950,7 @@ function copySelectedToSelected () {
|
||||
markDirty(target)
|
||||
}
|
||||
|
||||
copySelectedKeys.value = []
|
||||
Notify.create({ type: 'positive', message: 'Kopyalama tamamlandi' })
|
||||
}
|
||||
|
||||
@@ -1025,6 +1030,13 @@ function clearAllFilters () {
|
||||
numberRangeFilters.value = Object.fromEntries([...numericFields].map(field => [field, { min: '', max: '' }]))
|
||||
}
|
||||
|
||||
async function refreshRows () {
|
||||
clearAllFilters()
|
||||
selectedKeyMap.value = {}
|
||||
copySelectedKeys.value = []
|
||||
await loadRows()
|
||||
}
|
||||
|
||||
async function loadRows () {
|
||||
if (emptyRetryTimer) {
|
||||
clearTimeout(emptyRetryTimer)
|
||||
@@ -1081,9 +1093,17 @@ async function saveSelected () {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadRows)
|
||||
function resetTransientState () {
|
||||
rows.value = []
|
||||
selectedKeyMap.value = {}
|
||||
copySelectedKeys.value = []
|
||||
}
|
||||
|
||||
onMounted(refreshRows)
|
||||
onActivated(refreshRows)
|
||||
onBeforeUnmount(() => {
|
||||
if (emptyRetryTimer) clearTimeout(emptyRetryTimer)
|
||||
resetTransientState()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user