|
220 | 220 | <a-select-option v-for="pod in pods" :key="pod.id" :value="pod.id" :label="pod.name">{{ pod.name }}</a-select-option> |
221 | 221 | </a-select> |
222 | 222 | </a-form-item> |
| 223 | + <a-form-item name="isolationmethod" ref="isolationmethod" class="form__item" v-if="!basicGuestNetwork"> |
| 224 | + <tooltip-label :title="$t('label.isolation.method')" :tooltip="$t('label.choose.isolation.method.public.ip.range')" class="tooltip-label-wrapper"/> |
| 225 | + <a-select |
| 226 | + v-model:value="form.isolationmethod" |
| 227 | + showSearch |
| 228 | + optionFilterProp="label" |
| 229 | + :filterOption="(input, option) => { |
| 230 | + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| 231 | + }" > |
| 232 | + <a-select-option value="">{{ }}</a-select-option> |
| 233 | + <a-select-option value="vlan"> VLAN </a-select-option> |
| 234 | + <a-select-option value="vxlan"> VXLAN </a-select-option> |
| 235 | + </a-select> |
| 236 | + </a-form-item> |
223 | 237 | <a-form-item name="vlan" ref="vlan" :label="$t('label.vlan')" class="form__item" v-if="!basicGuestNetwork"> |
224 | 238 | <a-input v-model:value="form.vlan" /> |
225 | 239 | </a-form-item> |
@@ -452,7 +466,8 @@ export default { |
452 | 466 | initAddIpRangeForm () { |
453 | 467 | this.formRef = ref() |
454 | 468 | this.form = reactive({ |
455 | | - iptype: '' |
| 469 | + iptype: '', |
| 470 | + isolationmethod: '' |
456 | 471 | }) |
457 | 472 | this.rules = reactive({ |
458 | 473 | podid: [{ required: true, message: this.$t('label.required') }], |
@@ -624,6 +639,15 @@ export default { |
624 | 639 | if (!this.basicGuestNetwork) { |
625 | 640 | params.zoneId = this.resource.zoneid |
626 | 641 | params.vlan = values.vlan |
| 642 | + const vlanInput = (values.vlan || '').toString().trim() |
| 643 | + if (vlanInput) { |
| 644 | + const vlanInputLower = vlanInput.toLowerCase() |
| 645 | + const startsWithPrefix = vlanInputLower.startsWith('vlan') || vlanInputLower.startsWith('vxlan') |
| 646 | + const isNumeric = /^[0-9]+$/.test(vlanInput) |
| 647 | + if (!startsWithPrefix && isNumeric && values.isolationmethod) { |
| 648 | + params.vlan = `${values.isolationmethod}://${vlanInput}` |
| 649 | + } |
| 650 | + } |
627 | 651 | params.forsystemvms = values.forsystemvms |
628 | 652 | params.account = values.forsystemvms ? null : values.account |
629 | 653 | params.domainid = values.forsystemvms ? null : values.domain |
|
0 commit comments