perf: minor bugs detected
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
0de4dfd4f8
commit
0b2c404ab3
|
@ -73,6 +73,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
appendParams: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
hasSubToolbar: {
|
||||
type: Boolean,
|
||||
default: null,
|
||||
|
|
|
@ -8,7 +8,7 @@ defineProps({
|
|||
<template>
|
||||
<div :class="$q.screen.gt.md ? 'q-pb-lg' : 'q-pb-md'">
|
||||
<div class="header-link" :style="{ cursor: url ? 'pointer' : 'default' }">
|
||||
<a :href="url" :class="url ? 'link' : 'color-vn-text'">
|
||||
<a :href="url" :class="url ? 'link' : 'color-vn-text'" v-bind="$attrs">
|
||||
{{ text }}
|
||||
<QIcon v-if="url" :name="icon" />
|
||||
</a>
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useRoute } from 'vue-router';
|
|||
import SkeletonSummary from 'components/ui/SkeletonSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { isDialogOpened } from 'src/filters';
|
||||
|
||||
const props = defineProps({
|
||||
url: {
|
||||
|
@ -58,22 +59,6 @@ async function fetch() {
|
|||
emit('onFetch', Array.isArray(data) ? data[0] : data);
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
const showRedirectToSummaryIcon = computed(() => {
|
||||
const exist = existSummary(route.matched);
|
||||
return !isSummary.value && route.meta.moduleName && exist;
|
||||
});
|
||||
|
||||
function existSummary(routes) {
|
||||
const hasSummary = routes.some((r) => r.name === `${route.meta.moduleName}Summary`);
|
||||
if (hasSummary) return hasSummary;
|
||||
for (const current of routes) {
|
||||
if (current.path != '/' && current.children) {
|
||||
const exist = existSummary(current.children);
|
||||
if (exist) return exist;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -84,7 +69,7 @@ function existSummary(routes) {
|
|||
<div class="summaryHeader bg-primary q-pa-sm text-weight-bolder">
|
||||
<slot name="header-left">
|
||||
<router-link
|
||||
v-if="showRedirectToSummaryIcon"
|
||||
v-if="isDialogOpened()"
|
||||
class="header link"
|
||||
:to="{
|
||||
name: `${moduleName ?? route.meta.moduleName}Summary`,
|
||||
|
@ -118,6 +103,7 @@ function existSummary(routes) {
|
|||
|
||||
.cardSummary {
|
||||
width: 100%;
|
||||
max-height: 70vh;
|
||||
.summaryHeader {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
|
|
|
@ -3,6 +3,7 @@ import { useRouter, useRoute } from 'vue-router';
|
|||
import axios from 'axios';
|
||||
import { useArrayDataStore } from 'stores/useArrayDataStore';
|
||||
import { buildFilter } from 'filters/filterPanel';
|
||||
import { isDialogOpened } from 'src/filters';
|
||||
|
||||
const arrayDataStore = useArrayDataStore();
|
||||
|
||||
|
@ -114,8 +115,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
for (const row of response.data) store.data.push(row);
|
||||
} else {
|
||||
store.data = response.data;
|
||||
if (!document.querySelectorAll('[role="dialog"][aria-modal="true"]').length)
|
||||
updateRouter && updateStateParams();
|
||||
if (!isDialogOpened()) updateRouter && updateStateParams();
|
||||
}
|
||||
|
||||
store.isLoading = false;
|
||||
|
@ -249,6 +249,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
function updateStateParams() {
|
||||
if (!route) return;
|
||||
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
|
||||
if (store.appendParams)
|
||||
newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter);
|
||||
|
||||
if (store.navigate) {
|
||||
|
|
|
@ -12,8 +12,10 @@ import dateRange from './dateRange';
|
|||
import toHour from './toHour';
|
||||
import dashOrCurrency from './dashOrCurrency';
|
||||
import getParamWhere from './getParamWhere';
|
||||
import isDialogOpened from './isDialogOpened';
|
||||
|
||||
export {
|
||||
isDialogOpened,
|
||||
toLowerCase,
|
||||
toLowerCamel,
|
||||
toDate,
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
export default function isDialogOpened(query = '[role="dialog"]') {
|
||||
return document.querySelectorAll(query).length > 0;
|
||||
}
|
Loading…
Reference in New Issue