0
0
Fork 0

perf: updates

This commit is contained in:
Javier Segarra 2024-05-02 13:53:40 +02:00
parent 1907301852
commit 6323f165a0
1 changed files with 40 additions and 21 deletions

View File

@ -1,9 +1,9 @@
<script setup>
import FetchData from 'components/FetchData.vue';
import { ref, reactive, computed, watch } from 'vue';
import { ref, reactive, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useDialogPluginComponent } from 'quasar';
// import { useDialogPluginComponent } from 'quasar';
import VnInput from 'src/components/common/VnInput.vue';
import { useArrayData } from 'composables/useArrayData';
@ -18,10 +18,10 @@ const $props = defineProps({
});
const itemsProposal = ref([]);
const showProposalDialog = ref(false);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
watch($props.item, (newX, oldX) => {
showProposalDialog.value = !newX;
});
// const { dialogRef, onDialogHide } = useDialogPluginComponent();
// watch($props.item, (newX, oldX) => {
// showProposalDialog.value = !newX;
// });
const exprBuilder = (param, value) => {
switch (param) {
default:
@ -34,7 +34,7 @@ const arrayData = useArrayData('ItemProposal', {
order: ['itemFk'],
exprBuilder: exprBuilder,
});
const store = arrayData.store;
// const store = arrayData.store;
const defaultColumnAttrs = {
align: 'left',
sortable: true,
@ -55,24 +55,43 @@ const applyColumnFilter = async (col) => {
console.error('Error applying column filter', err);
}
};
const defaultColumnFilter = {
component: VnInput,
type: 'text',
filterValue: null,
event: getColumnInputEvents,
attrs: {
dense: true,
},
// const defaultColumnFilter = {
// component: VnInput,
// type: 'text',
// filterValue: null,
// event: getColumnInputEvents,
// attrs: {
// dense: true,
// },
// };
const statusConditionalValue = (row) => {
const total = [5, 6, 7, 8].reduce((acc, i) => acc + row[`match${i}`], 0);
const STATUS_VALUES = { 2: '$secondary', 3: 'positive', 4: 'warning' };
const status = STATUS_VALUES[total - 2];
if (!status) return 'not-match';
return status;
};
const conditionalValue = (tag) => (tag === 1 ? 'redd' : 'blackd');
const conditionalValue = (tag) => (tag === 1 ? 'match' : 'not-match');
const columns = computed(() => [
{
...defaultColumnAttrs,
label: t('proposal.counter'),
name: 'counter',
field: 'counter',
},
{
...defaultColumnAttrs,
label: t('proposal.itemFk'),
name: 'id',
field: 'id',
},
{
...defaultColumnAttrs,
label: t('proposal.status'),
name: 'status',
field: 'status',
classes: statusConditionalValue,
},
{
...defaultColumnAttrs,
label: t('proposal.longName'),
@ -201,11 +220,11 @@ const columns = computed(() => [
</QDialog>
</template>
<style lang="scss">
.redd {
background-color: red;
.match {
color: $negative;
}
.blackd {
color: black;
.not-match {
color: inherit;
}
</style>