@@ -24,6 +24,9 @@ interface Tree {
2424 children? : Tree []
2525}
2626
27+ const props = defineProps ({
28+ ID: String ,
29+ })
2730const testCaseName = ref (' ' )
2831const testSuite = ref (' ' )
2932const testKind = ref (' ' )
@@ -151,19 +154,36 @@ function loadStores(lastSuitName?: string, lastCaseName?: string) {
151154
152155 let targetSuite = {} as Tree
153156 let targetChild = {} as Tree
154- if (key .suite !== ' ' && key .testcase !== ' ' ) {
155- for (var i = 0 ; i < treeData .value .length ; i ++ ) {
156- const item = treeData .value [i ]
157- if (item .id === key .suite && item .children ) {
158- for (var j = 0 ; j < item .children .length ; j ++ ) {
159- const child = item .children [j ]
160- if (child .id === key .testcase ) {
161- targetSuite = item
162- targetChild = child
163- break
157+
158+ const targetID = props .ID
159+ if (targetID && targetID !== ' ' ) {
160+ for (const suite of treeData .value ) {
161+ if (suite .children ) {
162+ const foundChild = suite .children .find (child => child .id === targetID )
163+ if (foundChild ) {
164+ targetSuite = suite
165+ targetChild = foundChild
166+ handleNodeClick (targetChild )
167+ updateTreeSelection (targetSuite , targetChild )
168+ return
169+ }
170+ }
171+ }
172+ } else {
173+ if (key .suite !== ' ' && key .testcase !== ' ' ) {
174+ for (var i = 0 ; i < treeData .value .length ; i ++ ) {
175+ const item = treeData .value [i ]
176+ if (item .id === key .suite && item .children ) {
177+ for (var j = 0 ; j < item .children .length ; j ++ ) {
178+ const child = item .children [j ]
179+ if (child .id === key .testcase ) {
180+ targetSuite = item
181+ targetChild = child
182+ break
183+ }
164184 }
185+ break
165186 }
166- break
167187 }
168188 }
169189 }
@@ -175,14 +195,7 @@ function loadStores(lastSuitName?: string, lastCaseName?: string) {
175195 }
176196
177197 viewName .value = ' testsuite'
178- currentNodekey .value = targetChild .id
179-
180- treeRef .value ! .setCurrentKey (targetChild .id )
181- treeRef .value ! .setCheckedKeys ([targetChild .id ], false )
182-
183- testSuite .value = targetSuite .label
184- Cache .SetCurrentStore (targetSuite .store )
185- testKind .value = targetChild .kind
198+ updateTreeSelection (targetSuite , targetChild )
186199 } else {
187200 viewName .value = " "
188201 }
@@ -198,6 +211,17 @@ function loadStores(lastSuitName?: string, lastCaseName?: string) {
198211}
199212loadStores ()
200213
214+ function updateTreeSelection(targetSuite : Tree , targetChild : Tree ) {
215+ currentNodekey .value = targetChild .id
216+
217+ treeRef .value ! .setCurrentKey (targetChild .id )
218+ treeRef .value ! .setCheckedKeys ([targetChild .id ], false )
219+
220+ testSuite .value = targetSuite .label
221+ Cache .SetCurrentStore (targetSuite .store )
222+ testKind .value = targetChild .kind
223+ }
224+
201225const filterText = ref (' ' )
202226watch (filterText , (val ) => {
203227 treeRef .value ! .filter (val )
@@ -239,10 +263,8 @@ const deviceAuthNext = () => {
239263 <el-main style =" padding-top : 5px ; padding-bottom : 5px ;" >
240264 <el-container style =" height : 100% " >
241265 <el-aside >
242- <el-button type =" primary" @click =" Set" data-intro =" History Set" test-id =" history-set" >设置</el-button >
243266 <el-button type =" primary" @click =" loadStores" :icon =" Refresh" >{{ t('button.refresh') }}</el-button >
244267 <el-input v-model =" filterText" :placeholder =" t('tip.filter')" test-id =" search" style =" padding : 5px ;" />
245-
246268 <el-tree
247269 v-loading =" storesLoading"
248270 :data =treeData
0 commit comments