chore: requested changes
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Alex Moreno 2024-11-21 07:42:00 +01:00
parent 42d24359cd
commit c5acde22a3
3 changed files with 19 additions and 28 deletions

View File

@ -2,7 +2,7 @@
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import VnSelect from 'components/common/VnSelect.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnInput from 'src/components/common/VnInput.vue';
const props = defineProps({
@ -31,14 +31,6 @@ const applyTags = () => {
emit('applyTags', tagInfo);
};
const removeTagGroupParam = (valIndex = null) => {
if (!valIndex) {
tagValues.value = [{}];
} else {
(tagValues.value || []).splice(valIndex, 1);
}
};
const getSelectedTagValues = async (tag) => {
if (!tag?.id) return;
const filter = {
@ -57,7 +49,7 @@ const getSelectedTagValues = async (tag) => {
</script>
<template>
<QForm @submit="applyTags(tagValues)" class="all-pointer-events">
<QForm @submit="applyTags()" class="all-pointer-events">
<QCard class="q-pa-sm column q-pa-lg">
<VnSelect
:label="t('params.tag')"
@ -71,7 +63,7 @@ const getSelectedTagValues = async (tag) => {
rounded
:emit-value="false"
use-input
@update:model-value="($event) => getSelectedTagValues($event)"
@update:model-value="getSelectedTagValues"
/>
<div
v-for="(value, index) in tagValues"
@ -83,7 +75,7 @@ const getSelectedTagValues = async (tag) => {
v-if="!selectedTag?.isFree && tagOptions"
:label="t('components.itemsFilterPanel.value')"
v-model="value.value"
:options="tagOptions || []"
:options="tagOptions"
option-value="value"
option-label="value"
dense

View File

@ -4,18 +4,19 @@ import { useRoute, useRouter } from 'vue-router';
import { onBeforeMount, onMounted, onUnmounted, ref, computed, watch } from 'vue';
import axios from 'axios';
import { useI18n } from 'vue-i18n';
import VnPaginate from 'components/ui/VnPaginate.vue';
import CatalogItem from 'components/ui/CatalogItem.vue';
import OrderCatalogFilter from 'pages/Order/Card/OrderCatalogFilter.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
import CatalogItem from 'src/components/ui/CatalogItem.vue';
import OrderCatalogFilter from 'src/pages/Order/Card/OrderCatalogFilter.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import getParamWhere from 'src/filters/getParamWhere';
import { useArrayData } from 'composables/useArrayData';
import { useArrayData } from 'src/composables/useArrayData';
const route = useRoute();
const router = useRouter();
const stateStore = useStateStore();
const { t } = useI18n();
const arrayData = useArrayData('OrderCatalogList');
const dataKey = 'OrderCatalogList';
const arrayData = useArrayData('dataKey');
const store = arrayData.store;
const showFilter = ref(null);
const tags = ref([]);
@ -102,7 +103,7 @@ watch(
<template>
<VnSearchbar
data-key="OrderCatalogList"
:data-key="dataKey"
:user-params="catalogParams"
:static-params="['orderFk', 'orderBy']"
:redirect="false"
@ -113,7 +114,7 @@ watch(
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea v-if="showFilter" class="fit text-grey-8">
<OrderCatalogFilter
data-key="OrderCatalogList"
:data-key="dataKey"
:tag-value="tagValue"
:tags="tags"
:initial-catalog-params="catalogParams"
@ -123,7 +124,7 @@ watch(
<QPage class="column items-center q-pa-md">
<div class="full-width">
<VnPaginate
data-key="OrderCatalogList"
:data-key="dataKey"
url="Orders/CatalogFilter"
:limit="50"
:user-params="catalogParams"

View File

@ -53,6 +53,11 @@ const orderWayList = ref([
const orderBySelected = ref('relevancy DESC, name');
const orderWaySelected = ref('ASC');
onMounted(() => {
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
selectedTypeFk.value = getParamWhere(route, 'typeFk');
});
const resetCategory = (params, search) => {
selectedCategoryFk.value = null;
typeList.value = null;
@ -65,7 +70,6 @@ const resetCategory = (params, search) => {
const selectCategory = (params, category, search) => {
if (params.categoryFk === category?.id) {
resetCategory(params, search);
params.categoryFk = null;
return;
}
selectedCategoryFk.value = category?.id;
@ -131,11 +135,10 @@ async function onSearchByTag(value) {
const removeTagGroupParam = (search, valIndex) => {
if (!valIndex && valIndex !== 0) {
currentParams.value.tagGroups = null;
search();
} else {
currentParams.value.tagGroups.splice(valIndex, 1);
search();
}
search();
};
const setCategoryList = (data) => {
@ -168,11 +171,6 @@ function addOrder(value, field, params) {
params.orderBy = JSON.stringify(orderBy);
vnFilterPanelRef.value.search();
}
onMounted(() => {
selectedCategoryFk.value = getParamWhere(route, 'categoryFk');
selectedTypeFk.value = getParamWhere(route, 'typeFk');
});
</script>
<template>