@@ -12,19 +12,7 @@ import { nodeDict } from '@/workflow/common/data'
1212import { isActive , connect , disconnect } from './teleport'
1313import { t } from '@/locales'
1414import { type Dict } from '@/api/type/common'
15- const getNodeName = ( nodes : Array < any > , baseName : string ) => {
16- let index = 0
17- let name = baseName
18- while ( true ) {
19- if ( index > 0 ) {
20- name = baseName + index
21- }
22- if ( ! nodes . some ( ( node : any ) => node . properties . stepName === name . trim ( ) ) ) {
23- return name
24- }
25- index ++
26- }
27- }
15+
2816class AppNode extends HtmlResize . view {
2917 isMounted
3018 r ?: any
@@ -45,7 +33,7 @@ class AppNode extends HtmlResize.view {
4533 if ( props . model . properties . noRender ) {
4634 delete props . model . properties . noRender
4735 } else {
48- props . model . properties . stepName = getNodeName (
36+ props . model . properties . stepName = this . getNodeName (
4937 props . graphModel . nodes . filter ( ( node : any ) => node . id !== props . model . id ) ,
5038 props . model . properties . stepName ,
5139 )
@@ -56,6 +44,19 @@ class AppNode extends HtmlResize.view {
5644 props . model . height = props . model . properties . height
5745 }
5846 }
47+ getNodeName ( nodes : Array < any > , baseName : string ) {
48+ let index = 0
49+ let name = baseName
50+ while ( true ) {
51+ if ( index > 0 ) {
52+ name = baseName + index
53+ }
54+ if ( ! nodes . some ( ( node : any ) => node . properties . stepName === name . trim ( ) ) ) {
55+ return name
56+ }
57+ index ++
58+ }
59+ }
5960 get_node_field_list ( ) {
6061 const result = [ ]
6162 if ( this . props . model . type === 'start-node' ) {
0 commit comments