fix: 弹性IP列表执行绑定云主机操作,云主机存在2个网卡,在下拉列表中无法单独选择云主机的某一个网卡,前端自动选中了该云主机的2个网卡数据

develop
时启龙 2024-08-28 22:59:20 +08:00
parent 336543beeb
commit 59b0c799d1
1 changed files with 11 additions and 6 deletions

View File

@ -3,9 +3,9 @@
<el-dialog title="绑定云主机" :visible.sync="addData.dialog" width="40%">
<el-row>
<cb-form label-width="90px" :model="addData.data" ref="data">
<cb-form-item label="云主机:" prop="instanceId" :rules="[required]" required-message="">
<el-select v-model="addData.data.instanceId" filterable>
<el-option v-for="(item, index) in vmList" :label="item.serverName + '(' + item.ipAddress + ')'" :value="item.instanceId" :key="index"></el-option>
<cb-form-item label="云主机:" prop="networkcardUuid" :rules="[required]" required-message="">
<el-select v-model="addData.data.networkcardUuid" filterable>
<el-option v-for="(item, index) in vmList" :label="item.serverName + '(' + item.ipAddress + ')'" :value="item.networkcardUuid" :key="index"></el-option>
</el-select>
</cb-form-item>
</cb-form>
@ -47,22 +47,27 @@ export default {
ok() {
this.$refs.data.validate(valid => {
if (valid) {
let instanceId = ''
let networkCardId = ''
let fixedIpAddress = '',
serverId
let cell = null
this.vmList.forEach(item => {
if (item.instanceId == this.addData.data.instanceId) {
if (item.networkcardUuid == this.addData.data.networkcardUuid) {
cell = item
networkCardId = item.id
instanceId = item.instanceId
fixedIpAddress = item.ipAddress
}
})
floatIpPorts({
networkCardId,
fixedIpAddress,
portUuid: cell.networkcardUuid,
...this.addData.data
instanceId,
portUuid: this.addData.data.networkcardUuid,
id: this.addData.data.id,
regionId: this.addData.data.regionId,
vendorId: this.addData.data.vendorId
}).then(data => {
if (data.success) {
this.$message({