refactor: use searchbar prop instead of paths
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-10-22 12:59:15 +02:00
parent a6508ac2dc
commit 38c3697bef
4 changed files with 10 additions and 1 deletions

View File

@ -67,6 +67,10 @@ const props = defineProps({
type: Function,
default: undefined,
},
moduleName: {
type: Boolean,
default: false,
},
});
const searchText = ref();

View File

@ -247,6 +247,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
}
function updateStateParams() {
const usesModuleName = userOptions.moduleName;
const newUrl = { path: route.path, query: { ...(route.query ?? {}) } };
newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter);
@ -261,7 +262,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
const { matched: matches } = router.currentRoute.value;
const { path } = matches.at(-1);
path === '/wagon/list' || path === '/wagon/type/list'
usesModuleName
? (to =
store?.data?.length === 1
? path.replace(

View File

@ -18,6 +18,7 @@ const dialog = ref();
const { push } = useRouter();
const { t } = useI18n();
const tableRef = ref();
const useModuleName = ref(true);
const initialData = computed(() => {
return {
@ -93,6 +94,7 @@ const exprBuilder = (param, value) => {
data-key="WagonTypeList"
:label="t('searchWagonType')"
:info="t('searchInfo')"
:module-name="useModuleName"
:expr-builder="exprBuilder"
/>
<QPage class="column items-center q-pa-md">

View File

@ -14,6 +14,7 @@ const quasar = useQuasar();
const arrayData = useArrayData('WagonList');
const store = arrayData.store;
const router = useRouter();
const useModuleName = ref(true);
const { t } = useI18n();
const tableRef = ref();
const filter = {
@ -105,6 +106,7 @@ const exprBuilder = (param, value) => {
data-key="WagonList"
:label="t('searchWagon')"
:info="t('searchInfo')"
:module-name="useModuleName"
:expr-builder="exprBuilder"
/>
<QPage class="column items-center q-pa-md">