@@ -155,12 +155,26 @@ export default purify(function CustomRoutePage(props: DuckCmpProps<CreateDuck>)
155
155
< Card . Body title = '主调服务' >
156
156
< Form style = { { padding : '0px' , backgroundColor : 'inherit' } } >
157
157
< FormField field = { sourceNamespace } label = '命名空间' required >
158
- < TeaSelect
159
- value = { sourceNamespace . getValue ( ) }
158
+ < AutoComplete
160
159
options = { [
161
- { text : '全部命名空间' , value : '*' , disabled : destinationNamespace . getValue ( ) === '*' } ,
162
- ...( data ?. namespaceList || [ ] ) ,
160
+ ...new Set ( [
161
+ {
162
+ text : '全部命名空间' ,
163
+ value : '*' ,
164
+ disabled : destinationNamespace . getValue ( ) === '*' ,
165
+ } ,
166
+ ...( sourceNamespace . getValue ( )
167
+ ? [
168
+ {
169
+ text : `(输入值)${ sourceNamespace . getValue ( ) } ` ,
170
+ value : sourceNamespace . getValue ( ) ,
171
+ } ,
172
+ ]
173
+ : [ ] ) ,
174
+ ...data ?. namespaceList ,
175
+ ] ) ,
163
176
] }
177
+ tips = '没有匹配的命名空间名称'
164
178
onChange = { value => {
165
179
if ( value === '*' ) {
166
180
sourceNamespace . setValue ( '*' )
@@ -170,13 +184,26 @@ export default purify(function CustomRoutePage(props: DuckCmpProps<CreateDuck>)
170
184
sourceNamespace . setValue ( value )
171
185
sourceService . setValue ( '' )
172
186
} }
173
- searchable
174
- type = { 'simulate' }
175
- appearance = { 'button' }
176
- matchButtonWidth
177
- placeholder = '请选择命名空间'
178
- style = { { width : '80%' , maxWidth : '600px' } }
179
- />
187
+ >
188
+ { ref => (
189
+ < TeaInput
190
+ ref = { ref }
191
+ value = {
192
+ sourceNamespace . getValue ( ) === '*' ? '全部命名空间' : sourceNamespace . getValue ( )
193
+ }
194
+ onChange = { value => {
195
+ if ( value === '*' ) {
196
+ sourceNamespace . setValue ( '*' )
197
+ sourceService . setValue ( '*' )
198
+ return
199
+ }
200
+ sourceNamespace . setValue ( value )
201
+ sourceService . setValue ( '' )
202
+ } }
203
+ style = { { width : '80%' , maxWidth : '600px' } }
204
+ />
205
+ ) }
206
+ </ AutoComplete >
180
207
</ FormField >
181
208
< FormField field = { sourceService } label = '服务名称' required >
182
209
< AutoComplete
@@ -203,6 +230,7 @@ export default purify(function CustomRoutePage(props: DuckCmpProps<CreateDuck>)
203
230
onChange = { value => {
204
231
sourceService . setValue ( value )
205
232
} }
233
+ disabled = { sourceNamespace . getValue ( ) === '*' }
206
234
style = { { width : '80%' , maxWidth : '600px' } }
207
235
/>
208
236
) }
@@ -222,12 +250,26 @@ export default purify(function CustomRoutePage(props: DuckCmpProps<CreateDuck>)
222
250
< Card . Body title = '被调服务' >
223
251
< Form style = { { padding : '0px' , backgroundColor : 'inherit' } } >
224
252
< FormField field = { destinationNamespace } label = '命名空间' required >
225
- < TeaSelect
226
- value = { destinationNamespace . getValue ( ) }
253
+ < AutoComplete
227
254
options = { [
228
- { text : '全部命名空间' , value : '*' , disabled : sourceNamespace . getValue ( ) === '*' } ,
229
- ...( data ?. namespaceList || [ ] ) ,
255
+ ...new Set ( [
256
+ {
257
+ text : '全部命名空间' ,
258
+ value : '*' ,
259
+ disabled : sourceNamespace . getValue ( ) === '*' ,
260
+ } ,
261
+ ...( destinationNamespace . getValue ( )
262
+ ? [
263
+ {
264
+ text : `(输入值)${ destinationNamespace . getValue ( ) } ` ,
265
+ value : destinationNamespace . getValue ( ) ,
266
+ } ,
267
+ ]
268
+ : [ ] ) ,
269
+ ...data ?. namespaceList ,
270
+ ] ) ,
230
271
] }
272
+ tips = '没有匹配的命名空间名称'
231
273
onChange = { value => {
232
274
if ( value === '*' ) {
233
275
destinationNamespace . setValue ( '*' )
@@ -237,13 +279,28 @@ export default purify(function CustomRoutePage(props: DuckCmpProps<CreateDuck>)
237
279
destinationNamespace . setValue ( value )
238
280
destinationService . setValue ( '' )
239
281
} }
240
- searchable
241
- type = { 'simulate' }
242
- appearance = { 'button' }
243
- matchButtonWidth
244
- placeholder = '请选择命名空间'
245
- style = { { width : '80%' , maxWidth : '600px' } }
246
- />
282
+ >
283
+ { ref => (
284
+ < TeaInput
285
+ ref = { ref }
286
+ value = {
287
+ destinationNamespace . getValue ( ) === '*'
288
+ ? '全部命名空间'
289
+ : destinationNamespace . getValue ( )
290
+ }
291
+ onChange = { value => {
292
+ if ( value === '*' ) {
293
+ destinationNamespace . setValue ( '*' )
294
+ destinationService . setValue ( '*' )
295
+ return
296
+ }
297
+ destinationNamespace . setValue ( value )
298
+ destinationService . setValue ( '' )
299
+ } }
300
+ style = { { width : '80%' , maxWidth : '600px' } }
301
+ />
302
+ ) }
303
+ </ AutoComplete >
247
304
</ FormField >
248
305
< FormField field = { destinationService } label = '服务名称' required >
249
306
< AutoComplete
0 commit comments