birleşik kriter

This commit is contained in:
ctengiz
2024-04-19 10:57:57 +03:00
parent 945b479309
commit 06f834e8c9
2 changed files with 169 additions and 31 deletions

View File

@@ -89,7 +89,41 @@
<q-markup-table flat bordered>
<thead>
<tr>
<th>Kolon No</th>
<th>
<q-btn flat
color="positive"
dense
icon="add"
>
<q-tooltip>Yeni birleşik alan ekle</q-tooltip>
</q-btn>
<q-popup-edit
v-model="ld.combinedFields"
buttons
v-slot="scope"
@update:modelValue="addCombinedField()"
anchor="top start"
style="min-width: 350px; !important;"
persistent
>
<q-select
multiple
use-chips
v-model="scope.value"
:options="fieldOptions"
dense
autofocus
counter
@keyup.enter="scope.set"
style="min-width: 300px; !important;"
map-options
option-label="fieldName"
option-value="colNro"
/>
</q-popup-edit>
Kolon No
</th>
<th>Alan</th>
<th>Kontrol</th>
<th>Fişte Göster</th>
@@ -98,8 +132,21 @@
</tr>
</thead>
<tbody>
<tr v-for="r in tmpl.alanlar" :key="r.fieldName">
<td class="text-center" style="width: 70px;">{{ r.colNro }}</td>
<tr v-for="(r, rndx) in tmpl.alanlar" :key="r.fieldName">
<td class="text-center" style="width: 70px;">
{{ r.colNro }}
<q-btn
v-if="r.colNro < 0"
icon="delete"
color="negative"
flat
size="sm"
dense
@click="delCombinedField(rndx)"
/>
</td>
<td>{{ r.fieldName }}</td>
<td class="text-center" style="width: 70px;">
<q-radio
@@ -255,6 +302,8 @@ const ld = reactive({
alreadySelectedValFields: {},
showFields: false,
combinedFields: [],
})
const tmpl = reactive({
@@ -371,13 +420,6 @@ const load = function () {
const loadFile = function () {
const reader = new FileReader()
/*
reader.addEventListener('load', (event) => {
console.log(event.target.result)
});
reader.readAsDataURL(ld.xlsFile);
*/
reader.onload = function (e) {
const uin = new Uint8Array(e.target.result)
@@ -413,6 +455,9 @@ const processXLS = function () {
colType: '',
ba: 'B',
showInSlip: false,
combinedFields: [],
combinedFieldsNro: [],
formula: '',
})
}
}
@@ -429,10 +474,13 @@ const processXLS = function () {
tmpl.alanlar.push({
colNro: ndx,
fieldName: name,
showInSlip: false,
fieldName: name.trim(),
colType: '',
ba: 'B',
showInSlip: false,
combinedFields: [],
combinedFieldsNro: [],
formula: '',
})
lastCol = ndx
@@ -455,6 +503,9 @@ const fillCriteria = function () {
tmpl.kriterler[f.fieldName] = {
colNro: f.colNro,
combinedFields: [...(f.combinedFields || [])],
combinedFieldsNro: [...(f.combinedFieldsNro || [])],
valFields: [],
/*
[
@@ -478,10 +529,29 @@ const fillCriteria = function () {
const kval = row[tmpl.kontrolKolonu]
if ((kval !== null) && (kval !== undefined) && (kval !== '')) {
Object.keys(tmpl.kriterler).forEach(k => {
const kriterVal = row[tmpl.kriterler[k].colNro]
let kriterVal = ''
if (tmpl.kriterler[k].colNro >= 0) {
// sabit kriter alanı
kriterVal = row[tmpl.kriterler[k].colNro]
} else {
// birleştirilmiş / combine kriter alanı
const tmpValues = []
tmpl.kriterler[k].combinedFieldsNro.forEach(cf => {
let tmpKriterVal = row[cf]
if ((tmpKriterVal === null ) || (tmpKriterVal === undefined)) {
tmpKriterVal = ''
}
tmpValues.push(tmpKriterVal)
})
kriterVal = tmpValues.join(' ').trim()
}
if ((kriterVal !== null) && (kriterVal !== undefined) && (kriterVal !== '')) {
tmpl.kriterler[k].mappings[kriterVal] = {}
}
})
}
}
@@ -512,6 +582,46 @@ const delMapping = function (k, valField) {
})
}
const fieldOptions = computed(() => {
const ls = tmpl.alanlar.filter(f => {return f.colNro >= 0})
const opts = []
ls.forEach(f => {
opts.push({ colNro: f.colNro, fieldName: f.fieldName })
})
return opts
})
const addCombinedField = function () {
ld.isDirty = true
const combinedFields = []
const combinedFieldsNro = []
ld.combinedFields.forEach(f => {
combinedFields.push(f.fieldName)
combinedFieldsNro.push(f.colNro)
})
const fName = combinedFields.join(' : ')
tmpl.alanlar.push({
colNro: -1,
fieldName: fName,
colType: '',
ba: 'B',
showInSlip: false,
combinedFields: [...combinedFields],
combinedFieldsNro: [...combinedFieldsNro],
formula: '',
})
ld.combinedFields.splice(0)
}
const delCombinedField = function (ndx) {
ld.isDirty = true
tmpl.alanlar.splice(ndx, 1)
}
</script>