5959 initialValue: fieldValues[field.name] || null
6060 }]"
6161 showSearch
62+ :dropdownMatchSelectWidth =" false"
6263 optionFilterProp =" children"
6364 :filterOption =" (input, option) => {
6465 return option.componentOptions.propsData.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
8283 </span >
8384 <a-icon v-else type =" block" style =" margin-right : 5px " />
8485 </span >
85- {{ $t(opt.name) }}
86+ {{ $t(opt.path || opt. name) }}
8687 </div >
8788 </a-select-option >
8889 </a-select >
@@ -309,25 +310,25 @@ export default {
309310 if (zoneIndex > - 1 ) {
310311 const zones = response .filter (item => item .type === ' zoneid' )
311312 if (zones && zones .length > 0 ) {
312- this .fields [zoneIndex].opts = zones[0 ].data
313+ this .fields [zoneIndex].opts = this . sortArray ( zones[0 ].data )
313314 }
314315 }
315316 if (domainIndex > - 1 ) {
316317 const domain = response .filter (item => item .type === ' domainid' )
317318 if (domain && domain .length > 0 ) {
318- this .fields [domainIndex].opts = domain[0 ].data
319+ this .fields [domainIndex].opts = this . sortArray ( domain[0 ].data , ' path ' )
319320 }
320321 }
321322 if (podIndex > - 1 ) {
322323 const pod = response .filter (item => item .type === ' podid' )
323324 if (pod && pod .length > 0 ) {
324- this .fields [podIndex].opts = pod[0 ].data
325+ this .fields [podIndex].opts = this . sortArray ( pod[0 ].data )
325326 }
326327 }
327328 if (clusterIndex > - 1 ) {
328329 const cluster = response .filter (item => item .type === ' clusterid' )
329330 if (cluster && cluster .length > 0 ) {
330- this .fields [clusterIndex].opts = cluster[0 ].data
331+ this .fields [clusterIndex].opts = this . sortArray ( cluster[0 ].data )
331332 }
332333 }
333334 this .$forceUpdate ()
@@ -347,6 +348,14 @@ export default {
347348 this .fillFormFieldValues ()
348349 })
349350 },
351+ sortArray (data , key = ' name' ) {
352+ return data .sort (function (a , b ) {
353+ if (a[key] < b[key]) { return - 1 }
354+ if (a[key] > b[key]) { return 1 }
355+
356+ return 0
357+ })
358+ },
350359 fillFormFieldValues () {
351360 this .fieldValues = {}
352361 if (Object .keys (this .$route .query ).length > 0 ) {
0 commit comments