5353 <a-select
5454 allowClear
5555 v-if =" field.type==='list'"
56- v-decorator =" [field.name]"
56+ v-decorator =" [field.name, {
57+ initialValue: fieldValues[field.name] || null
58+ }]"
5759 :loading =" field.loading" >
5860 <a-select-option
5961 v-for =" (opt, idx) in field.opts"
6264 </a-select >
6365 <a-input
6466 v-else-if =" field.type==='input'"
65- v-decorator =" [field.name]" />
67+ v-decorator =" [field.name, {
68+ initialValue: fieldValues[field.name] || null
69+ }]" />
6670 <div v-else-if =" field.type==='tag'" >
6771 <div >
6872 <a-input-group
@@ -135,7 +139,8 @@ export default {
135139 visibleFilter: false ,
136140 fields: [],
137141 inputKey: null ,
138- inputValue: null
142+ inputValue: null ,
143+ fieldValues: {}
139144 }
140145 },
141146 beforeCreate () {
@@ -275,7 +280,6 @@ export default {
275280 }
276281 if (clusterIndex > - 1 ) {
277282 const cluster = response .filter (item => item .type === ' clusterid' )
278- console .log (cluster)
279283 if (cluster && cluster .length > 0 ) {
280284 this .fields [clusterIndex].opts = cluster[0 ].data
281285 }
@@ -294,8 +298,20 @@ export default {
294298 if (clusterIndex > - 1 ) {
295299 this .fields [clusterIndex].loading = false
296300 }
301+ this .fillFormFieldValues ()
297302 })
298303 },
304+ fillFormFieldValues () {
305+ this .fieldValues = {}
306+ if (Object .keys (this .$route .query ).length > 0 ) {
307+ this .fieldValues = this .$route .query
308+ }
309+ if (this .$route .meta .params ) {
310+ Object .assign (this .fieldValues , this .$route .meta .params )
311+ }
312+ this .inputKey = this .fieldValues [' tags[0].key' ] || null
313+ this .inputValue = this .fieldValues [' tags[0].value' ] || null
314+ },
299315 fetchZones () {
300316 return new Promise ((resolve , reject ) => {
301317 api (' listZones' , { listAll: true }).then (json => {
0 commit comments