From e50bc030c9cc3d16baaa37df889ee9a7625ed774 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Fri, 11 Sep 2026 11:26:49 +0200 Subject: [PATCH] Fix: v-model chain --- .../Dashboard/WidgetAdmin/Edit/Report/Vars.js | 26 +---------- .../WidgetAdmin/Edit/Report/Vars/Var.js | 13 +++--- .../DashboardWidget/Report/Config/Kpi.js | 44 ++++++++++++++----- 3 files changed, 39 insertions(+), 44 deletions(-) diff --git a/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars.js b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars.js index 0bb1b1de6..f63a4fef0 100644 --- a/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars.js +++ b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars.js @@ -18,36 +18,14 @@ export default { emits: [ "update:modelValue", ], - watch: { - details() { - this.cleanupVars(); - }, - }, - methods: { - cleanupVars() { - /*const allowedKeys = this.details.map(detail => detail.kurzbz); - Object.keys(this.modelValue).forEach(key => { - if (!allowedKeys.includes(key)) - delete this.modelValue[key]; - }); - this.details.forEach(detail => { - if (!this.modelValue[detail.kurzbz]) - this.modelValue[detail.kurzbz] = { type: 'fix' }; - }); - this.$emit('update:modelValue', this.modelValue);*/ - }, - }, - created() { - this.cleanupVars(); - }, template: /*html*/ `
diff --git a/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Var.js b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Var.js index e9fae5e43..6d4c4508f 100644 --- a/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Var.js +++ b/public/js/components/Dashboard/WidgetAdmin/Edit/Report/Vars/Var.js @@ -34,9 +34,6 @@ export default { type: this.detail.type, }; - if (attrs.type == 'text') - attrs.type = 'input'; - if (this.detail.placeholder) attrs.placeholder = this.detail.placeholder; @@ -80,9 +77,9 @@ export default { return this.calcComponents[this.extendedType[1]]; }, options() { - if (this.extendedType.length < 1) + if (this.extendedType.length < 1 && !this.noType) return []; - if (this.extendedType[0] == 'calc') + if (this.extendedType[0] == 'calc' && !this.noType) return this.calcOptions; if (this.detail.type == 'select') return this.detail.options; @@ -94,7 +91,7 @@ export default { return 'Report' + capitalize(string); }, setType(type) { - if (type == 'user') { + if (type == 'user' || type.substr(0, 5) == 'calc:') { this.$emit('update:modelValue', { type, detail: this.detail }); } else { this.$emit('update:modelValue', { type }); @@ -102,7 +99,7 @@ export default { }, setSubType(subtype) { let type = 'calc:' + subtype; - this.$emit('update:modelValue', { type }); + this.$emit('update:modelValue', { type, detail: this.detail }); }, setValue(value) { this.modelValue.value = value; @@ -140,7 +137,7 @@ export default { { + if (variable.type == 'user') { + res[key] = { + modelValue: uservars[key] || {}, + detail: variable.detail, + }; + } else if (this.sharedData[key]) { + res[key] = { + modelValue: uservars[key] || {}, + detail: this.sharedData[key], + }; + } + return res; + }, {}); + }, hasCustomVars() { - return Object.values(this.config.vars).some(v => v.type == 'user'); + return Object.keys(this.customVars).length; + }, + }, + methods: { + updateUserVar(key, { value }) { + if (!this.config.uservars) + this.config.uservars = {}; + this.config.uservars[key] = { value }; }, }, template: /*html*/ `