ref #5417 params fixed
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2023-10-11 12:32:33 +02:00
parent 6d116b9798
commit e5ffd2faad
1 changed files with 7 additions and 7 deletions

View File

@ -33,16 +33,15 @@ const store = arrayData.store;
const userParams = ref({});
onMounted(() => {
if (props.params) userParams.value = props.params;
const params = store.userParams;
if (Object.keys(params).length > 0) {
userParams.value = Object.assign({}, params);
if (props.params) userParams.value = JSON.parse(JSON.stringify(props.params));
if (Object.keys(store.userParams).length > 0) {
userParams.value = JSON.parse(JSON.stringify(store.userParams));
}
});
const isLoading = ref(false);
async function search() {
const params = userParams.value;
const params = JSON.parse(JSON.stringify(userParams.value));
for (const param in params) {
if (params[param] === '' || params[param] === null) {
delete userParams.value[param];
@ -51,16 +50,17 @@ async function search() {
}
isLoading.value = true;
await arrayData.addFilter({ params });
if (!props.showAll && !Object.values(store.userParams).length) store.data = [];
if (!props.showAll && !Object.values(params).length) store.data = [];
isLoading.value = false;
}
async function reload() {
isLoading.value = true;
const params = Object.values(userParams.value).filter((param) => param);
await arrayData.fetch({ append: false });
if (!props.showAll && !Object.values(store.userParams).length) store.data = [];
if (!props.showAll && !params.length) store.data = [];
isLoading.value = false;
emit('refresh');
}