Compare commits

..

No commits in common. "f831f905a5d88a1123443fb337a58dcec3a28549" and "93994d5dd77d61d4f005d42114177701461f9a9d" have entirely different histories.

3 changed files with 11 additions and 18 deletions

View File

@ -62,8 +62,10 @@
client: Object client: Object
}, },
data() { data() {
var resources = state.resources;
var today = dateonly(new Date()); var today = dateonly(new Date());
return { return {
selection: resources ? (resources.split(',').filter(x => x) || []) : [],
patients: [], patients: [],
production: true, production: true,
date_begin: new Date(today.getFullYear() - 1, today.getMonth(), today.getDate()), date_begin: new Date(today.getFullYear() - 1, today.getMonth(), today.getDate()),
@ -72,10 +74,6 @@
}; };
}, },
computed: { computed: {
selection: {
get() { return state.resources ? (state.resources.split(',').filter(x => x) || []) : [] },
set(value) { state.resources = value.join(','); }
},
patients_lost() { patients_lost() {
return this.patients.filter(x => x.TimeLastDiff >= 0).sort((a, b) => b.TimeLastDiff - a.TimeLastDiff); return this.patients.filter(x => x.TimeLastDiff >= 0).sort((a, b) => b.TimeLastDiff - a.TimeLastDiff);
}, },
@ -84,9 +82,8 @@
} }
}, },
watch: { watch: {
selection: { selection(value) {
handler(value) { this.$nextTick(() => this.debounced_selection(value)); }, this.debounced_selection(value);
immediate: true
} }
}, },
methods: { methods: {
@ -98,6 +95,7 @@
}, },
created() { created() {
this.debounced_selection = debounce(async function(value) { this.debounced_selection = debounce(async function(value) {
state.resources = value.join(',');
var patients = this.selection.length > 0 ? groupByArray(await this.client.SDEC_CLINLET(this.selection.join('|') + '|', strftime_vista(this.date_begin), strftime_vista(this.date_end)), x => x.HRN) : [], now = new Date(), group, values, appt; var patients = this.selection.length > 0 ? groupByArray(await this.client.SDEC_CLINLET(this.selection.join('|') + '|', strftime_vista(this.date_begin), strftime_vista(this.date_end)), x => x.HRN) : [], now = new Date(), group, values, appt;
for(var i = patients.length - 1; i >= 0; --i) { for(var i = patients.length - 1; i >= 0; --i) {
group = patients[i]; group = patients[i];

View File

@ -37,15 +37,16 @@
client: Object client: Object
}, },
data() { data() {
var resources = state.resources;
return { return {
selection: resources ? (resources.split(',').filter(x => x) || []) : [],
date: dateonly(new Date()), date: dateonly(new Date()),
date_end: dateonly(new Date()) date_end: dateonly(new Date())
}; };
}, },
computed: { watch: {
selection: { selection(value, oldvalue) {
get() { return state.resources ? (state.resources.split(',').filter(x => x) || []) : [] }, state.resources = value.join(',');
set(value) { state.resources = value.join(','); }
} }
} }
}; };

View File

@ -10,13 +10,7 @@ if((!state.cid) && (cookie.get('cid'))) state.resources = cookie.get('cid');
if((!state.host) && (cookie.get('host'))) state.resources = cookie.get('host'); if((!state.host) && (cookie.get('host'))) state.resources = cookie.get('host');
if((!state.resources) && (cookie.get('vista.resources'))) state.resources = cookie.get('vista.resources'); if((!state.resources) && (cookie.get('vista.resources'))) state.resources = cookie.get('vista.resources');
if((!state.practitioner) && (cookie.get('vista.practitioner'))) state.practitioner = JSON.parse(cookie.get('vista.practitioner')); if((!state.practitioner) && (cookie.get('vista.practitioner'))) state.practitioner = JSON.parse(cookie.get('vista.practitioner'));
window.addEventListener('storage', function(evt) { watch(state, value => cookie.set('state', JSON.stringify(value), 45), { immediate: true, deep: true });
if((evt.storageArea == window.localStorage) && (evt.key == 'state') && (evt.newValue)) Object.assign(state, JSON.parse(evt.newValue));
});
watch(state, function(value) {
cookie.set('state', value = JSON.stringify(value), 45);
window.localStorage.setItem('state', value);
}, { immediate: true, deep: true });
function RPCError(type, ...args) { function RPCError(type, ...args) {
this.name = type; this.name = type;