@@ -164,6 +164,9 @@ export default {
164164
165165 // Extract calculated variables (computed properties)
166166 Object .assign (variables, this .extractCalculatedVariables ());
167+
168+ // Extract watcher output variables
169+ Object .assign (variables, this .extractWatcherVariables ());
167170
168171 // Filter: exclude _parent variables, include all others
169172 return Object .keys (variables)
@@ -250,6 +253,11 @@ export default {
250253 ' $root.computed' () {
251254 // Force recomputation when computed properties change
252255 this .$forceUpdate ();
256+ },
257+ // Watch for watchers changes in App.vue
258+ ' $root.watchers' () {
259+ // Force recomputation when watchers change
260+ this .$forceUpdate ();
253261 }
254262 },
255263 methods: {
@@ -348,6 +356,45 @@ export default {
348356
349357 return [];
350358 },
359+
360+ /**
361+ * Extract watcher output variables from the screen
362+ */
363+ extractWatcherVariables () {
364+ const watcherVars = {};
365+ const watchers = this .getWatchers () || [];
366+
367+ watchers .forEach (watcher => {
368+ if (watcher .byPass ) return ;
369+
370+ // Output variable (for scripts)
371+ if (watcher .output_variable ) {
372+ watcherVars[watcher .output_variable ] = null ;
373+ }
374+
375+ // Data mapping variables (for data sources)
376+ try {
377+ const config = typeof watcher .script_configuration === ' string'
378+ ? JSON .parse (watcher .script_configuration )
379+ : watcher .script_configuration ;
380+ (config? .dataMapping || []).forEach (m => {
381+ if (m .key ) watcherVars[m .key ] = null ;
382+ });
383+ } catch (e) {}
384+ });
385+
386+ return watcherVars;
387+ },
388+
389+ /**
390+ * Get watchers from various sources
391+ */
392+ getWatchers () {
393+ return this .$root ? .$data ? .watchers
394+ || this .$root ? .$children ? .[0 ]? .watchers
395+ || this .$root ? .$children ? .[0 ]? .$data ? .watchers
396+ || [];
397+ },
351398
352399 /**
353400 * Extract variables from form config
0 commit comments