Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
<div class="text-caption text-grey-7">Seri kodu ve beden seri basliklari burada yonetilir.</div>
|
<div class="text-caption text-grey-7">Seri kodu ve beden seri basliklari burada yonetilir.</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row q-gutter-sm">
|
<div class="row q-gutter-sm">
|
||||||
|
<q-btn color="primary" outline icon="grid_on" label="Excel" :disable="!rows.length" @click="exportExcel" />
|
||||||
<q-btn color="secondary" outline icon="refresh" label="Yenile" :loading="loading" @click="reload" />
|
<q-btn color="secondary" outline icon="refresh" label="Yenile" :loading="loading" @click="reload" />
|
||||||
<q-btn color="primary" icon="add" label="Yeni Seri" :disable="!canUpdate" @click="newRow" />
|
<q-btn color="primary" icon="add" label="Yeni Seri" :disable="!canUpdate" @click="newRow" />
|
||||||
</div>
|
</div>
|
||||||
@@ -191,5 +192,65 @@ function removeRow (row) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeHtml (value) {
|
||||||
|
return String(value ?? '')
|
||||||
|
.replaceAll('&', '&')
|
||||||
|
.replaceAll('<', '<')
|
||||||
|
.replaceAll('>', '>')
|
||||||
|
.replaceAll('"', '"')
|
||||||
|
.replaceAll("'", ''')
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportExcel () {
|
||||||
|
const headers = [
|
||||||
|
'ID',
|
||||||
|
'Seri Kodu',
|
||||||
|
'Seri Basligi',
|
||||||
|
'Aktif',
|
||||||
|
'Parent Filter',
|
||||||
|
'Sira',
|
||||||
|
'Not'
|
||||||
|
]
|
||||||
|
const headerHtml = headers.map(h => `<th>${escapeHtml(h)}</th>`).join('')
|
||||||
|
const rowsHtml = rows.value.map(row => `
|
||||||
|
<tr>
|
||||||
|
<td>${escapeHtml(row.id)}</td>
|
||||||
|
<td>${escapeHtml(row.code)}</td>
|
||||||
|
<td>${escapeHtml(row.title)}</td>
|
||||||
|
<td>${escapeHtml(row.is_active ? 'Evet' : 'Hayir')}</td>
|
||||||
|
<td>${escapeHtml(row.parent_filter)}</td>
|
||||||
|
<td>${escapeHtml(row.sort_order)}</td>
|
||||||
|
<td>${escapeHtml(row.notes)}</td>
|
||||||
|
</tr>
|
||||||
|
`).join('')
|
||||||
|
const html = `<!doctype html>
|
||||||
|
<html xmlns:x="urn:schemas-microsoft-com:office:excel">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
table { border-collapse: collapse; font-family: Arial, sans-serif; font-size: 12px; }
|
||||||
|
th { background: #fff4bf; font-weight: 700; text-align: center; }
|
||||||
|
td, th { border: 1px solid #999; padding: 5px 7px; mso-number-format: '\\@'; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table border="1">
|
||||||
|
<thead><tr>${headerHtml}</tr></thead>
|
||||||
|
<tbody>${rowsHtml}</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>`
|
||||||
|
const blob = new Blob([html], { type: 'application/vnd.ms-excel;charset=utf-8' })
|
||||||
|
const url = URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
const stamp = new Date().toISOString().slice(0, 10).replaceAll('-', '')
|
||||||
|
link.href = url
|
||||||
|
link.download = `urun_seri_tanimlari_${stamp}.xls`
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
link.remove()
|
||||||
|
URL.revokeObjectURL(url)
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(reload)
|
onMounted(reload)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user