Refact: Move back filtering in store

This commit is contained in:
2018-12-01 14:49:02 +01:00
parent df4c1af893
commit 967557f397
3 changed files with 79 additions and 71 deletions

View File

@@ -31,29 +31,16 @@ export default {
...mapGetters('config', [
'postes'
]),
...mapGetters('datas', [
'libelle_filter_rows'
]),
poste () {
return this.postes[this.postename]
}
},
methods: {
filter_rows () {
if (this.poste.words) {
if (this.poste.invert) {
return this.rows.filter(x => {
return this.poste.words.every(v => {
return x.Libellé.indexOf(v) < 0
})
})
} else {
return this.rows.filter(x => {
return this.poste.words.some(v => {
return x.Libellé.indexOf(v) >= 0
})
})
}
} else {
return this.rows
}
return this.libelle_filter_rows(this.poste.words, this.poste.invert)
},
total () {
return Math.round(
@@ -78,6 +65,7 @@ export default {
}
.icon {
flex: 40%;
align-self: center;
}
.amount {
flex: 50%;