0
0
Fork 0

perf: minor comments

This commit is contained in:
Javier Segarra 2024-09-05 20:51:33 +02:00
parent 31abd8b4c5
commit b3391ab522
8 changed files with 271 additions and 338 deletions

View File

@ -346,10 +346,9 @@ defineExpose({
</QScrollArea>
</QDrawer>
<!-- class in div to fix warn-->
<div class="q-px-md">
<CrudModel
v-bind="$attrs"
:class="$attrs['class'] ?? 'q-px-md'"
:class="$attrs['class']"
:limit="$attrs['limit'] ?? 20"
ref="CrudModelRef"
@on-fetch="(...args) => emit('onFetch', ...args)"
@ -361,11 +360,7 @@ defineExpose({
:has-sub-toolbar="$props.hasSubToolbar ?? isEditable"
:auto-load="hasParams || $attrs['auto-load']"
>
<template
v-for="(_, slotName) in $slots"
#[slotName]="slotData"
:key="slotName"
>
<template v-for="(_, slotName) in $slots" #[slotName]="slotData" :key="slotName">
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template>
<template #body="{ rows }">
@ -421,13 +416,8 @@ defineExpose({
:class="`text-${col?.align ?? 'left'}`"
:style="$props.columnSearch ? 'height: 75px' : ''"
>
<div
class="row items-center no-wrap"
style="height: 30px"
>
<QTooltip v-if="col.toolTip">{{
col.toolTip
}}</QTooltip>
<div class="row items-center no-wrap" style="height: 30px">
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
<VnTableOrder
v-model="orders[col.orderBy ?? col.name]"
:name="col.orderBy ?? col.name"
@ -453,10 +443,7 @@ defineExpose({
</template>
<template #body-cell-tableStatus="{ col, row }">
<QTd auto-width :class="getColAlign(col)">
<VnTableChip
:columns="splittedColumns.columnChips"
:row="row"
>
<VnTableChip :columns="splittedColumns.columnChips" :row="row">
<template #afterChip>
<slot name="afterChip" :row="row"></slot>
</template>
@ -472,8 +459,7 @@ defineExpose({
v-if="col.visible ?? true"
@click.ctrl="
($event) =>
rowCtrlClickFunction &&
rowCtrlClickFunction($event, row)
rowCtrlClickFunction && rowCtrlClickFunction($event, row)
"
>
<slot
@ -507,14 +493,10 @@ defineExpose({
class="q-px-sm"
flat
:class="
btn.isPrimary
? 'text-primary-light'
: 'color-vn-text '
btn.isPrimary ? 'text-primary-light' : 'color-vn-text '
"
:style="`visibility: ${
(btn.show && btn.show(row)) ?? true
? 'visible'
: 'hidden'
(btn.show && btn.show(row)) ?? true ? 'visible' : 'hidden'
}`"
@click="btn.action(row)"
/>
@ -588,9 +570,7 @@ defineExpose({
>
<template #value>
<span
@click="
stopEventPropagation($event)
"
@click="stopEventPropagation($event)"
>
<slot
:name="`column-${col.name}`"
@ -641,7 +621,6 @@ defineExpose({
</QTable>
</template>
</CrudModel>
</div>
<QPageSticky v-if="create" :offset="[20, 20]" style="z-index: 2">
<QBtn @click="showForm = !showForm" color="primary" fab icon="add" shortcut="+" />
<QTooltip>

View File

@ -86,13 +86,13 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
Object.assign(filter, store.userFilter, exprFilter);
let where;
// ARRAY DATA FALLA AL JUNTAR WHERE'S
console.log(
'userParams?.filter?.where: ',
userParams?.filter?.where,
filter?.where,
store.filter?.where
);
//FIXME: ARRAY DATA FALLA AL JUNTAR WHERE'S
// console.log(
// 'userParams?.filter?.where: ',
// userParams?.filter?.where,
// filter?.where,
// store.filter?.where
// );
if ((userParams?.filter?.where, filter?.where || store.filter?.where))
where = Object.assign(
userParams?.filter?.where ?? {},
@ -101,9 +101,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
);
Object.assign(filter, store.filter);
filter.where = where;
console.log('where: ', where);
// console.log('where: ', where);
const params = { filter };
console.log('params: ', params);
// console.log('params: ', params);
delete userParams?.filter;
Object.assign(params, userParams);

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, computed, onBeforeMount, onMounted } from 'vue';
import { ref, computed, onBeforeMount } from 'vue';
import axios from 'axios';
import { useI18n } from 'vue-i18n';
import { toDate } from 'src/filters/index';
@ -90,9 +90,6 @@ const columns = computed(() => [
onBeforeMount(async () => {
campaignList.value = (await axios('Campaigns/latest')).data;
});
// onMounted(() => {
// showActionBtns.value = handleQueryParams();
// });
function getQueryParams() {
return JSON.parse(route.query.consumption ?? '{}');

View File

@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import VnTable from 'src/components/VnTable/VnTable.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import ModalCloseContract from 'src/pages/Customer/components/ModalCloseContract.vue';
@ -73,28 +72,6 @@ const updateData = () => {
</script>
<template>
<!-- <VnTable
ref="tableRef"
data-key="Greuges"
url="Greuges"
search-url="greuges"
:filter="filter"
:order="['shipped DESC', 'amount']"
:columns="columns"
:right-search="false"
:is-editable="false"
:use-model="true"
:column-search="false"
@on-fetch="(data) => setRows(data)"
:disable-option="{ card: true }"
:create="{
urlCreate: `Greuges`,
title: t('New greuge'),
onDataSaved: () => tableRef.reload(),
formInitialData: { shipped: new Date(), clientFk: route.params.id },
}"
auto-load
></VnTable> -->
<div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg">
<VnPaginate

View File

@ -1,22 +1,17 @@
<script setup>
import { computed, ref, watch } from 'vue';
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { toCurrency, toDateHourMin } from 'src/filters';
import VnTable from 'src/components/VnTable/VnTable.vue';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
const { t } = useI18n();
const route = useRoute();
const tableRef = ref();
// const rows = ref([]);
const filter = {
include: [
@ -70,15 +65,6 @@ const columns = computed(() => [
},
},
]);
// watch(
// () => route.params.id,
// (newValue) => {
// if (!newValue) return;
// filter.where.clientFk = newValue;
// clientInformasRef.value?.fetch();
// }
// );
</script>
<template>

View File

@ -1,7 +1,6 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import VnTable from 'src/components/VnTable/VnTable.vue';
import axios from 'axios';
import { useQuasar } from 'quasar';

View File

@ -61,7 +61,7 @@ const creditWarning = computed(() => {
return tooMuchInsurance || noCreditInsurance ? 'negative' : '';
});
const sumRisk = ({ clientRisks }) => {
let total = clientRisks.reduce((acc, risk) => acc + risk.amount, 0);
let total = clientRisks.reduce((acc, { amount }) => acc + amount, 0);
return total;
};
@ -153,8 +153,6 @@ const sumRisk = ({ clientRisks }) => {
:label="t('customer.summary.isActive')"
:value="entity.isActive"
/>
<!-- </VnRow>
<VnRow> -->
<VnLv
:label="t('customer.summary.verifiedData')"
:value="entity.isTaxDataChecked"
@ -163,8 +161,6 @@ const sumRisk = ({ clientRisks }) => {
:label="t('customer.summary.hasToInvoice')"
:value="entity.hasToInvoice"
/>
<!-- </VnRow>
<VnRow> -->
<VnLv
:label="t('customer.summary.notifyByEmail')"
:value="entity.isToBeMailed"
@ -231,7 +227,7 @@ const sumRisk = ({ clientRisks }) => {
</QCard>
<QCard class="vn-one" v-if="entity.account">
<VnTitle
:url="`https://grafana.verdnatura.es/d/adjlxzv5yjt34d/analisis-de-clientes-7c-crm?orgId=1&var-clientFk=${entityId}`"
:url="`${grafanaUrl}/d/adjlxzv5yjt34d/analisis-de-clientes-7c-crm?orgId=1&var-clientFk=${entityId}`"
:text="t('customer.summary.businessData')"
icon="vn:grafana"
/>
@ -258,7 +254,7 @@ const sumRisk = ({ clientRisks }) => {
</QCard>
<QCard class="vn-one" v-if="entity.account">
<VnTitle
:url="`https://grafana.verdnatura.es/d/40buzE4Vk/comportamiento-pagos-clientes?orgId=1&var-clientFk=${entityId}`"
:url="`${grafanaUrl}/d/40buzE4Vk/comportamiento-pagos-clientes?orgId=1&var-clientFk=${entityId}`"
:text="t('customer.summary.payMethodFk')"
icon="vn:grafana"
/>

View File

@ -48,7 +48,6 @@ const toCustomerCreditContracts = () => {
clearable
type="number"
v-model.number="data.credit"
autofocus
/>
</div>
<div class="col">