CzRger 5 dienas atpakaļ
vecāks
revīzija
842e694a52

+ 7 - 7
src/components/czr-ui/czr-form-link/input.vue

@@ -51,7 +51,7 @@ const props = defineProps({
     },
   },
   must: { default: false },
-  regex: { default: '' },
+  regex: { default: null },
 })
 const state = reactive({
   paramVal: props.param,
@@ -61,12 +61,11 @@ const ref_el = ref()
 watch(
   () => state.paramVal,
   (n, o) => {
-    // if (props.regex) {
-    //   const r = new RegExp(props.regex)
-    //   if (!r.test(n)) {
-    //     state.paramVal = o
-    //   }
-    // }
+    if (props.regex) {
+      if (!props.regex.test(n)) {
+        state.paramVal = o
+      }
+    }
     if (props.must && !isValue(n)) {
       state.paramVal = o
     }
@@ -79,6 +78,7 @@ watch(
     state.paramVal = n
   },
 )
+
 defineExpose({
   focus: () => ref_el.value.focus(),
 })

+ 3 - 4
src/views/workflow/handle.ts

@@ -7,7 +7,6 @@ import {
   NodeType,
   VarsSource,
 } from '@/views/workflow/types'
-import variableAggregatorNodeDefault from '@/views/workflow/instance/variable-aggregator/default'
 
 const systemVars = [
   {
@@ -209,7 +208,6 @@ export const handleEdge = (ed) => {
   return edge
 }
 export const handleNodeSubmit = (no) => {
-  console.log(no)
   switch (no.type) {
     case NodeType.Start:
       {
@@ -380,11 +378,12 @@ export const handleNodeSubmit = (no) => {
     case NodeType.VariableAggregator:
       {
         if (no.advancedSettings.groupEnabled) {
+          no.advancedSettings.groups.forEach((v) => {
+            v.variables = v.__variables.map((v) => v.keyValue)
+          })
         } else {
           no.variables = no.__variables.map((v) => v.keyValue)
-          no.__outVars = variableAggregatorNodeDefault.defaultValue().__outVars
         }
-        // no.__outVars
       }
       break
   }

+ 21 - 1
src/views/workflow/instance/variable-aggregator/panel/index.vue

@@ -15,7 +15,7 @@
               :must="true"
               :max-length="20"
               :clearable="false"
-              regex="/^[a-zA-Z0-9_]+$/"
+              :regex="/^[a-zA-Z][a-zA-Z0-9_]*$/"
             />
           </div>
           <varsPopover
@@ -150,6 +150,7 @@ import { v4 } from 'uuid'
 import varsPopover from '@/views/workflow/instance/component/vars/vars-popover.vue'
 import { Plus } from '@element-plus/icons-vue'
 import varsValue from '@/views/workflow/instance/component/vars/vars-value.vue'
+import variableAggregatorNodeDefault from '@/views/workflow/instance/variable-aggregator/default'
 
 const emit = defineEmits([])
 const props = defineProps({
@@ -168,6 +169,25 @@ watch(
   },
   { immediate: true },
 )
+watch(
+  () => [
+    state.nodeData.advancedSettings.groupEnabled,
+    state.nodeData.advancedSettings.groups,
+  ],
+  (n) => {
+    if (n[0]) {
+      state.nodeData.__outVars = n[1].map((v) => ({
+        label: `${v.groupName}的输出变量`,
+        key: `${v.groupName}`,
+        type: 'Object',
+      }))
+    } else {
+      state.nodeData.__outVars =
+        variableAggregatorNodeDefault.defaultValue().__outVars
+    }
+  },
+  { deep: true },
+)
 </script>
 
 <style lang="scss" scoped>