mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 15:32:17 +00:00
work in progress, add reset function to EventLoader composable, to be able to reload when external parameters are changed
This commit is contained in:
@@ -193,7 +193,7 @@ const router = VueRouter.createRouter({
|
||||
}
|
||||
},
|
||||
{
|
||||
path: `/Cis/StgOrgLvPlan/:mode?/:focus_date?`,
|
||||
path: `/Cis/StgOrgLvPlan/:mode?/:focus_date?/:stgkz?/:sem?/:verband?/:gruppe?`,
|
||||
name: 'StgOrgLvPlan',
|
||||
component: StgOrgLvPlan,
|
||||
props(route) {
|
||||
|
||||
@@ -88,12 +88,15 @@ export default {
|
||||
updateRange(rangeInterval) {
|
||||
this.rangeInterval = rangeInterval;
|
||||
this.$emit('update:range', rangeInterval);
|
||||
},
|
||||
resetEventLoader() {
|
||||
this.reset();
|
||||
}
|
||||
},
|
||||
setup(props, context) {
|
||||
const rangeInterval = Vue.ref(null);
|
||||
|
||||
const { events, lv } = useEventLoader(rangeInterval, props.getPromiseFunc);
|
||||
const { events, lv, reset } = useEventLoader(rangeInterval, props.getPromiseFunc);
|
||||
|
||||
Vue.watch(lv, newValue => {
|
||||
context.emit('update:lv', newValue);
|
||||
@@ -102,7 +105,8 @@ export default {
|
||||
return {
|
||||
rangeInterval,
|
||||
events,
|
||||
lv
|
||||
lv,
|
||||
reset
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -136,7 +136,10 @@ export default {
|
||||
},
|
||||
});
|
||||
|
||||
this.$refs['calendar'].resetEventLoader();
|
||||
|
||||
//wenn sich formvariablen ändern?
|
||||
/*
|
||||
if(this.rangeIntervalFirst) {
|
||||
console.log("in range IntervalFirst second try ");
|
||||
const start = luxon.DateTime.fromISO(this.rangeIntervalFirst.start).toISODate();
|
||||
@@ -145,6 +148,8 @@ export default {
|
||||
this.getPromiseFunc(start, end);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
},
|
||||
loadListSem(){
|
||||
this.listSem = [...Array(this.maxSemester).keys()].map(i => i + 1);
|
||||
@@ -218,6 +223,7 @@ export default {
|
||||
});
|
||||
|
||||
//try for reload
|
||||
/*
|
||||
if(this.rangeIntervalFirst) {
|
||||
console.log("in range IntervalFirst second try ");
|
||||
const start = luxon.DateTime.fromISO(this.rangeIntervalFirst.start).toISODate();
|
||||
@@ -225,6 +231,7 @@ export default {
|
||||
console.log("start und end" + start + " - " + end);
|
||||
this.getPromiseFunc(start, end);
|
||||
}
|
||||
*/
|
||||
|
||||
},
|
||||
updateRange(rangeInterval) {
|
||||
@@ -372,6 +379,7 @@ export default {
|
||||
<fhc-calendar
|
||||
v-if="propsViewData && propsViewData.stgkz"
|
||||
ref="calendar"
|
||||
v-model:lv="formData"
|
||||
:timezone="viewData.timezone"
|
||||
:get-promise-func="getPromiseFunc"
|
||||
:date="currentDay"
|
||||
|
||||
@@ -111,7 +111,7 @@ export function useEventLoader(rangeInterval, getPromiseFunc) {
|
||||
return mergePromiseArr(getPromiseFunc(start, end), result);
|
||||
};
|
||||
|
||||
Vue.watchEffect(() => {
|
||||
const reload = () => {
|
||||
const range = Vue.toValue(rangeInterval);
|
||||
if (!(range instanceof luxon.Interval))
|
||||
return;
|
||||
@@ -132,7 +132,18 @@ export function useEventLoader(rangeInterval, getPromiseFunc) {
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
return { events: allEvents, lv }
|
||||
Vue.watchEffect(reload);
|
||||
|
||||
const reset = () => {
|
||||
loading_id = 0;
|
||||
events.value = [];
|
||||
loadingEvents.value = [];
|
||||
eventsLoaded.splice(0, eventsLoaded.length);
|
||||
|
||||
reload();
|
||||
}
|
||||
|
||||
return { events: allEvents, lv, reset }
|
||||
}
|
||||
Reference in New Issue
Block a user