1919 <a-form layout =" vertical" >
2020 <a-form-item :label =" $t('label.owner.type')" >
2121 <a-select
22- @change =" changeDomain "
22+ @change =" changeAccountTypeOrDomain "
2323 v-model:value =" selectedAccountType"
2424 defaultValue =" account"
2525 autoFocus
3737 </a-form-item >
3838 <a-form-item :label =" $t('label.domain')" required >
3939 <a-select
40- @change =" changeDomain "
40+ @change =" changeAccountTypeOrDomain "
4141 v-model:value =" selectedDomain"
4242 showSearch
4343 optionFilterProp =" label"
@@ -144,7 +144,8 @@ export default {
144144 selectedDomain: null ,
145145 selectedAccount: null ,
146146 selectedProject: null ,
147- loading: false
147+ loading: false ,
148+ requestToken: 0
148149 }
149150 },
150151 props: {
@@ -178,7 +179,7 @@ export default {
178179 const domainIds = this .domains ? .map (domain => domain .id )
179180 const ownerDomainId = this .$store .getters .project ? .domainid || this .$store .getters .userInfo .domainid
180181 this .selectedDomain = domainIds? .includes (ownerDomainId) ? ownerDomainId : this .domains ? .[0 ]? .id
181- this .changeDomain ()
182+ this .fetchOwnerData ()
182183 })
183184 .catch ((error ) => {
184185 this .$notifyError (error)
@@ -187,8 +188,13 @@ export default {
187188 this .loading = false
188189 })
189190 },
191+ increamentAndGetRequestToken () {
192+ this .requestToken += 1
193+ return this .requestToken
194+ },
190195 fetchAccounts () {
191196 this .loading = true
197+ const currentToken = this .increamentAndGetRequestToken ()
192198 getAPI (' listAccounts' , {
193199 response: ' json' ,
194200 domainId: this .selectedDomain ,
@@ -197,6 +203,9 @@ export default {
197203 isrecursive: false
198204 })
199205 .then ((response ) => {
206+ if (currentToken !== this .requestToken ) {
207+ return
208+ }
200209 this .accounts = response .listaccountsresponse .account || []
201210 if (this .override ? .accounts && this .accounts ) {
202211 this .accounts = this .accounts .filter (item => this .override .accounts .has (item .name ))
@@ -220,6 +229,7 @@ export default {
220229 },
221230 fetchProjects () {
222231 this .loading = true
232+ const currentToken = this .increamentAndGetRequestToken ()
223233 getAPI (' listProjects' , {
224234 response: ' json' ,
225235 domainId: this .selectedDomain ,
@@ -229,6 +239,9 @@ export default {
229239 isrecursive: false
230240 })
231241 .then ((response ) => {
242+ if (currentToken !== this .requestToken ) {
243+ return
244+ }
232245 this .projects = response .listprojectsresponse .project
233246 if (this .override ? .projects && this .projects ) {
234247 this .projects = this .projects .filter (item => this .override .projects .has (item .id ))
@@ -245,7 +258,11 @@ export default {
245258 this .initialized = true
246259 })
247260 },
248- changeDomain () {
261+ changeAccountTypeOrDomain () {
262+ this .initialized = true
263+ this .fetchOwnerData ()
264+ },
265+ fetchOwnerData () {
249266 if (this .selectedAccountType === ' Account' ) {
250267 this .fetchAccounts ()
251268 } else {
0 commit comments