feat: 裸金属创建
parent
819c933aed
commit
99a1733bd8
|
@ -1,117 +1,393 @@
|
|||
<template>
|
||||
<div class="wrapper-container">
|
||||
<el-card>
|
||||
<el-steps :active="active" align-center style="width: 60%" finish-status="success">
|
||||
<el-step title="地域和操作系统"></el-step>
|
||||
<el-step title="存储和网络"></el-step>
|
||||
</el-steps>
|
||||
<el-col :span="24" class="panel-body" v-if="active == 0">
|
||||
<AddPageOne :addData="addData" :vendor-id="vendorId" :platform-object="platformObject"></AddPageOne>
|
||||
</el-col>
|
||||
<el-col :span="24" class="panel-body" v-if="active == 1">
|
||||
<AddPageTwo :addData="addData" ref="header" :vendor-id="vendorId" :platform-object="platformObject"></AddPageTwo>
|
||||
</el-col>
|
||||
<el-col :span="24" class="panel-body" v-if="active == 2">
|
||||
<AddPageThree :addData="addData" :vendor-id="vendorId"></AddPageThree>
|
||||
</el-col>
|
||||
<el-col :span="24" class="m-b-lg">
|
||||
<el-col :span="6" :offset="5" v-if="active == 0">
|
||||
<el-button type="ghost" style="width: 100%" @click="goBack">取消</el-button>
|
||||
<cb-form ref="addData" :model="addData" status-icon label-width="110px">
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="可用地域:" prop="regionId" :rules="[required]">
|
||||
<el-select v-model="addData.regionId" @change="regionChange">
|
||||
<el-option v-for="item in regionData" :key="item.id" :label="item.name" :value="item.code"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" :offset="5" v-if="active != 0">
|
||||
<el-button type="primary" style="width: 100%" @click="LastStep()">上一步</el-button>
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="可用区域:" prop="zoneId" :rules="[required]">
|
||||
<el-select v-model="addData.zoneId" @change="getSizeData">
|
||||
<el-option v-for="item in zoneData" :key="item.id" :label="item.name" :value="item.zoneId"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" :offset="1" v-if="active == 1">
|
||||
<el-button type="primary" style="width: 100%" :loading="addData.loading" @click="ok">确定</el-button>
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="实例规格:" prop="flavorId" :rules="[required]">
|
||||
<el-select v-model="addData.flavorId">
|
||||
<el-option v-for="item in flavorList" :key="item.id" :label="item.name + '(' + item.cpu + 'C/' + item.memory + 'GB' + ')'" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" :offset="1" v-if="active == 0">
|
||||
<el-button type="primary" style="width: 100%" :disabled="addData.data.operatingSystem == ''" @click="next()">下一步</el-button>
|
||||
<images :add-data="addData" :vendor-id="vendorId" :region-id="addData.regionId"></images>
|
||||
<el-col :span="24">
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="所属VPC:" prop="vpcUuid" :rules="[required]">
|
||||
<el-select v-model="addData.vpcUuid" @change="changeVpc">
|
||||
<el-option v-for="item in routerList" :label="item.name" :value="item.vpcId" :key="item.vpcId"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="所属子网:" prop="subnetId" :rules="[required]">
|
||||
<el-select v-model="addData.subnetId">
|
||||
<el-option v-for="item in subnetList" :label="item.name" :value="item.id" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<!-- <flavor :add-data="addData" :list="flavorList" v-if="flavorList.length" :zone-id="addData.zoneId" vendorType='TIANYI'></flavor> -->
|
||||
<!-- <el-col :span="24">
|
||||
<cb-form-item label="登录方式:">
|
||||
<el-radio-group v-model="keypair" @change="chooseLoginWay">
|
||||
<el-radio :label="item.name" :key="index" v-for="(item, index) in loginWays" border> {{ item.name }}</el-radio>
|
||||
</el-radio-group>
|
||||
</cb-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="24" v-if="keypair == '密钥'">
|
||||
<cb-form-item label="物理机密钥:" prop="keypairName" :rules="[required]">
|
||||
<el-select v-model="addData.keypairName">
|
||||
<el-option v-for="item in keypairList" :key="item.id" :label="item.name" :value="item.name"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-else-if="keypair == '密码'">
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="登录密码:" prop="password" :rules="[required, tyVmPassword]">
|
||||
<el-input type="password" v-model="addData.password" @blur="PswBlur" show-password></el-input>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="确认密码:" prop="endPassword" :rules="[required, tyVmPassword]">
|
||||
<el-input type="password" v-model="addData.endPassword" @blur="PswBlur"></el-input>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="物理机名称:" prop="name" :rules="[required, noChinese]">
|
||||
<el-input v-model="addData.name"></el-input>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="安全组:" prop="groups" :rules="[required]">
|
||||
<el-select v-model="addData.groups" multiple placeholder="请选择">
|
||||
<el-option v-for="item in groupList" :key="item.id" :label="item.name" :value="item.value"> </el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<cb-form-item label="数量:" prop="count" :rules="[required]">
|
||||
<el-input-number v-model="addData.count" style="width: 100%" :min="1"></el-input-number>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-for="(item, index) in addData.diskDevices" :key="index">
|
||||
<cb-form-item :label="'数据盘' + (index + 1) + ':'">
|
||||
<el-col :span="6">
|
||||
<cb-form-item label="类型:" validate="required" :prop="`diskDevices.${index}.type`" label-width="70px">
|
||||
<el-select v-model="item.type">
|
||||
<el-option v-for="row in dataTypeData" :label="row.name" :value="row.value" :key="row.value"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<cb-form-item label="名称:" validate="required,vmName" :prop="`diskDevices.${index}.title`" label-width="70px">
|
||||
<el-input v-model="item.title"></el-input>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<cb-form-item label="大小:" validate="required" :prop="`diskDevices.${index}.size`" label-width="70px">
|
||||
<el-input-number v-model="item.size" :min="10"></el-input-number>
|
||||
<span>GB</span>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<el-button type="danger" @click="diskDevicesRemove(index)">删除</el-button>
|
||||
</el-col>
|
||||
</cb-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="24">
|
||||
<cb-form-item>
|
||||
<el-button type="primary" @click="addDiskDevices" v-if="addData.diskDevices.length <= 9">添加数据盘</el-button>
|
||||
</cb-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="24" class="m-b-lg">
|
||||
<el-col :span="6" :offset="5">
|
||||
<el-button type="ghost" style="width: 100%" @click="goBack">取消</el-button>
|
||||
</el-col>
|
||||
<el-col :span="6" :offset="1">
|
||||
<el-button type="primary" style="width: 100%" @click="ok" :loading="loading">确定</el-button>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</cb-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddPageOne from './addPageOne.vue'
|
||||
import AddPageTwo from './addPageTwo.vue'
|
||||
import AddPageThree from './addPageThree.vue'
|
||||
import validate from '@/validate'
|
||||
import { getRegion, getZone } from 'services/platform/index'
|
||||
import { getVpc } from 'views/resource/ctstack/services/vpcs'
|
||||
import { getFlavor } from 'views/resource/ctstack/services/flavors'
|
||||
import { getSubnet } from 'views/resource/ctstack/services/subnet'
|
||||
import { getGroup } from 'views/resource/ctstack/services/group'
|
||||
import { getKey } from 'views/resource/ctstack/services/key'
|
||||
import { typeData, dataTypeData } from 'views/resource/ctstack/page/hardDisk/config'
|
||||
import images from 'views/platform/components/image.vue'
|
||||
import { encrypt } from '@cmp/cmp-element'
|
||||
import { addBMS } from 'views/resource/ctstack/services/bms.js'
|
||||
|
||||
export default {
|
||||
components: { images },
|
||||
props: {
|
||||
platformObject: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddPageOne,
|
||||
AddPageTwo,
|
||||
AddPageThree
|
||||
computed: {
|
||||
pwdRule() {
|
||||
return this.$store.state.app.systemConfig.pwdStrength + ',required'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
active: 0,
|
||||
vendorId: parseInt(this.$router.currentRoute.query.vendorId),
|
||||
required: validate.required,
|
||||
noChinese: validate.noChinese,
|
||||
addData: {
|
||||
loading: false,
|
||||
data: {
|
||||
placement: {
|
||||
Zone: 'yfm14az1'
|
||||
},
|
||||
flavorId: '',
|
||||
operatingSystemType: '',
|
||||
operatingSystem: '',
|
||||
virtualPrivateCloud: {
|
||||
vpcId: '',
|
||||
subnetId: '',
|
||||
privateIpAddresses: ''
|
||||
},
|
||||
loginSettings: {
|
||||
Password: '',
|
||||
Password_config: ''
|
||||
},
|
||||
raidType: '',
|
||||
internetAccessible: {
|
||||
internetMaxBandwidthOut: 0,
|
||||
publicIpAssigned: false,
|
||||
internetServiceProvider: ''
|
||||
},
|
||||
instanceName: '',
|
||||
instanceCount: 1,
|
||||
enhancedService: {
|
||||
SecurityService: {
|
||||
Enabled: 'false'
|
||||
},
|
||||
MonitorService: {
|
||||
Enabled: 'false'
|
||||
regionId: '',
|
||||
zoneId: '',
|
||||
flavorId: '',
|
||||
name: '',
|
||||
password: '',
|
||||
endPassword: '',
|
||||
keypairName: '',
|
||||
imageId: '',
|
||||
vpcUuid: '',
|
||||
subnetId: '',
|
||||
count: 1,
|
||||
groups: [],
|
||||
networks: [],
|
||||
diskDevices: []
|
||||
},
|
||||
tyVmPassword: {
|
||||
validator: (rule, value, callback) => {
|
||||
const users = ['admin', 'adminstartor', 'root', 'nimda', 'rotratsnimda', 'toor']
|
||||
const pattern = '^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,26}$'
|
||||
users.forEach(item => {
|
||||
if (value.indexOf(item) != -1) {
|
||||
callback(new Error('密码不能包含用户名或用户名的逆序'))
|
||||
}
|
||||
})
|
||||
if (!value.match(pattern)) {
|
||||
callback(new Error('只能包含大写字母、小写字母、数字和特殊字符(!@$%^-_=+[{}]:,./?~#*)且至少包含四种字符中的三种,密码不能包含用户名或用户名的逆序,长度介于8-26字符'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
selectComboData: {
|
||||
cpu: '',
|
||||
flavorId: '',
|
||||
flavorName: '',
|
||||
memory: '',
|
||||
systemDisk: ''
|
||||
}
|
||||
}
|
||||
trigger: null
|
||||
},
|
||||
regionData: [],
|
||||
typeData,
|
||||
dataTypeData,
|
||||
routerList: [],
|
||||
flavorList: [],
|
||||
loginWays: [{ name: '密码' }, { name: '密钥' }],
|
||||
groupList: [],
|
||||
keypairList: [],
|
||||
keypair: '密码',
|
||||
zoneData: [],
|
||||
subnetList: [],
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
ok() {
|
||||
this.$refs.header.getData()
|
||||
},
|
||||
goBack() {
|
||||
this.$router.back(-1)
|
||||
},
|
||||
next() {
|
||||
this.active++
|
||||
ok() {
|
||||
const data = this.getPostData()
|
||||
if (!data) return
|
||||
if (data.password) data.password = encrypt(data.password)
|
||||
if (data.endPassword) data.endPassword = encrypt(data.endPassword)
|
||||
this.loading = true
|
||||
addBMS(data)
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: data.message
|
||||
})
|
||||
this.goBack()
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
LastStep() {
|
||||
this.active--
|
||||
PswBlur(e) {
|
||||
const value = e.target.value
|
||||
},
|
||||
// 可用区
|
||||
regionChange() {
|
||||
if (this.addData.zoneId) this.addData.zoneId = ''
|
||||
if (this.addData.vpcUuid) this.addData.vpcUuid = ''
|
||||
if (this.addData.imageId) this.addData.imageId = ''
|
||||
if (this.addData.subnetId) this.addData.subnetId = ''
|
||||
this.subnetList = []
|
||||
this.addData.groups = []
|
||||
this.getZone()
|
||||
this.getVpcData()
|
||||
this.getKeypair()
|
||||
},
|
||||
// 删除数据盘
|
||||
diskDevicesRemove(index) {
|
||||
this.addData.diskDevices.splice(index, 1)
|
||||
},
|
||||
// 添加数据盘
|
||||
addDiskDevices() {
|
||||
this.addData.diskDevices.push({
|
||||
type: this.dataTypeData[0].value,
|
||||
size: 10
|
||||
})
|
||||
},
|
||||
// 请求区域
|
||||
getRegion() {
|
||||
getRegion({ vendorId: this.vendorId, regionId: this.addData.regionId }).then(data => {
|
||||
if (data.success) {
|
||||
this.regionData = data.data
|
||||
}
|
||||
})
|
||||
},
|
||||
// 请求子网
|
||||
getSubnet() {
|
||||
this.addData.subnetId = ''
|
||||
const params = JSON.stringify([
|
||||
{
|
||||
param: {
|
||||
vpcUuid: this.addData.vpcUuid,
|
||||
vendorId: this.vendorId,
|
||||
regionId: this.addData.regionId
|
||||
},
|
||||
sign: 'EQ'
|
||||
}
|
||||
])
|
||||
getSubnet({
|
||||
simple: true,
|
||||
params
|
||||
}).then(data => {
|
||||
if (data.success) {
|
||||
this.subnetList = data.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
// 请求网络
|
||||
getVpcData() {
|
||||
const params = {
|
||||
page: 1,
|
||||
rows: 9999,
|
||||
params: JSON.stringify([{ param: { vendorId: this.vendorId, regionId: this.addData.regionId, tenantId: 0 }, sign: 'EQ' }])
|
||||
}
|
||||
getVpc(params).then(data => {
|
||||
if (data.success) {
|
||||
this.routerList = data.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
changeVpc() {
|
||||
this.addData.subnetId = ''
|
||||
this.addData.groups = []
|
||||
this.getSubnet()
|
||||
this.getGroupData()
|
||||
},
|
||||
// 请求规格
|
||||
getSizeData() {
|
||||
const params = {
|
||||
simple: true
|
||||
}
|
||||
const searchParam = [
|
||||
{ param: { vendorId: this.vendorId, regionId: this.addData.regionId }, sign: 'EQ' },
|
||||
{ param: { zone: this.addData.zoneId }, sign: 'LK' }
|
||||
]
|
||||
params.params = JSON.stringify(searchParam)
|
||||
getFlavor(params).then(data => {
|
||||
if (data.success) {
|
||||
this.flavorList = data.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取安全组
|
||||
getGroupData() {
|
||||
const vpcId = this.routerList.find(item => item.vpcId === this.addData.vpcUuid)?.id
|
||||
getGroup({
|
||||
simple: true,
|
||||
params: JSON.stringify([{ param: { vendorId: this.vendorId, regionId: this.addData.regionId, tenantId: 0, vpcId }, sign: 'EQ' }])
|
||||
}).then(data => {
|
||||
if (data.success) {
|
||||
this.groupList = data.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
chooseLoginWay(item) {
|
||||
if (this.keypair == '密钥') {
|
||||
delete this.addData.password
|
||||
delete this.addData.endPassword
|
||||
} else if (this.keypair == '密码') {
|
||||
this.addData.keypairName = ''
|
||||
} else {
|
||||
this.addData.password = ''
|
||||
delete this.addData.endPassword
|
||||
}
|
||||
},
|
||||
getZone() {
|
||||
getZone({
|
||||
regionId: this.addData.regionId,
|
||||
vendorId: this.vendorId
|
||||
}).then(data => {
|
||||
if (data.success) {
|
||||
this.zoneData = data.data
|
||||
}
|
||||
})
|
||||
},
|
||||
getKeypair() {
|
||||
getKey({
|
||||
simple: true,
|
||||
params: JSON.stringify([{ param: { vendorId: this.vendorId, regionId: this.addData.regionId }, sign: 'EQ' }])
|
||||
}).then(data => {
|
||||
if (data.success) {
|
||||
this.keypairList = data.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
getPostData() {
|
||||
let addData = ''
|
||||
this.$refs.addData.validate(valid => {
|
||||
if (valid) {
|
||||
this.addData.vendorId = this.vendorId
|
||||
this.addData.networks = []
|
||||
if (this.addData.password != this.addData.endPassword && this.keypair == '密码') {
|
||||
this.$notify({
|
||||
title: '提示',
|
||||
message: '两次密码输入不一致'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.addData.content) {
|
||||
this.addData.name = this.addData.content + this.addData.name
|
||||
}
|
||||
addData = JSON.parse(JSON.stringify(this.addData))
|
||||
}
|
||||
})
|
||||
return addData
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getRegion()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
<template>
|
||||
<div class="">
|
||||
<cb-form :model="addData.data" ref="addData" label-width="140px">
|
||||
<h3>地域和机型</h3>
|
||||
<cb-form-item label="地域">
|
||||
<el-select v-model="addData.data.regionId" @change="getZoomData">
|
||||
<el-option v-for="(item, index) in regionList" :label="item.name" :value="item.regionId" :key="index"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="可用区">
|
||||
<el-select v-model="addData.data.zone" @change="comboGetList">
|
||||
<el-option v-for="item in zoneList" :label="item.name" :value="item.zoneId" :key="item.id"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="CPU架构">
|
||||
<el-radio-group v-model="cpuArch" @change="comboGetList">
|
||||
<el-radio-button label="X86"></el-radio-button>
|
||||
<el-radio-button label="ARM"></el-radio-button>
|
||||
</el-radio-group>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="机型">
|
||||
<el-alert title="注意:机型只能单选" type="warning"> </el-alert>
|
||||
<cb-advance-table ref="list" title="" :data="comboData" :params="comboParams" :columns="comboColumns" :get-list="comboGetList" :total="comboTotal" :loading="comboLoading" @selection-change="handleSelectChange" :search-configs="comboSearchConfigs">
|
||||
<template #raidType="val">
|
||||
<span v-if="val">{{ val.join(' ') }}</span>
|
||||
</template>
|
||||
<div slot="pagination"></div>
|
||||
</cb-advance-table>
|
||||
</cb-form-item>
|
||||
<h3>操作系统</h3>
|
||||
<cb-form-item label="镜像提供方">
|
||||
<span>公共镜像</span>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="操作系统" v-model="addData.data.operatingSystemType">
|
||||
<div v-if="selectComboData.length == '1'">
|
||||
<span v-if="selectComboData.operatingSystem != null">windows</span>
|
||||
<span v-else>linux</span>
|
||||
</div>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="系统版本" prop="operatingSystem" validate="required">
|
||||
<el-select v-model="addData.data.operatingSystem" placeholder="请选择系统版本" style="width: 160px">
|
||||
<el-option v-for="item in version" :key="item" :label="item" :value="item"> </el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="主机安全agent">
|
||||
<el-radio v-model="addData.data.enhancedService.SecurityService.Enabled" label="true">安装</el-radio>
|
||||
<el-radio v-model="addData.data.enhancedService.SecurityService.Enabled" label="false">不安装</el-radio>
|
||||
</cb-form-item>
|
||||
</cb-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCombo } from 'views/resource/ctstack/services/bms.js'
|
||||
import { getRegion, getZone } from 'views/resource/ctstack/services/regions.js'
|
||||
const comboColumns = [
|
||||
{
|
||||
type: 'selection',
|
||||
selectable: (row, index) => {
|
||||
if (row.soldout == 1) return false
|
||||
else return true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '机型',
|
||||
prop: 'flavorName'
|
||||
},
|
||||
{
|
||||
label: '计费机型',
|
||||
prop: 'flavorType'
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
prop: 'key'
|
||||
},
|
||||
{
|
||||
label: 'CPU',
|
||||
prop: 'cpu'
|
||||
},
|
||||
{
|
||||
label: '内存',
|
||||
prop: 'memory'
|
||||
},
|
||||
{
|
||||
label: '硬盘',
|
||||
prop: 'systemDisk'
|
||||
},
|
||||
{
|
||||
label: 'RAID',
|
||||
prop: 'raidType',
|
||||
scopedSlots: { customRender: 'raidType' }
|
||||
}
|
||||
]
|
||||
export default {
|
||||
props: ['vendorId', 'addData', 'platformObject'],
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
comboData: [],
|
||||
comboParams: {
|
||||
page: 1,
|
||||
rows: 10
|
||||
},
|
||||
comboColumns,
|
||||
comboTotal: 0,
|
||||
comboLoading: false,
|
||||
mountedData: '',
|
||||
radio: '1',
|
||||
options: '',
|
||||
allZone: '',
|
||||
regionList: '',
|
||||
selectComboData: {
|
||||
operatingSystem: {
|
||||
windows: [],
|
||||
linux: []
|
||||
}
|
||||
},
|
||||
version: [],
|
||||
versionList: ['TencentOS Server 2.2 (TK2-0052)', 'Centos 7.7 minimal for x86_64'],
|
||||
cpuArch: 'X86'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRegion()
|
||||
},
|
||||
methods: {
|
||||
handleSelectChange(selection) {
|
||||
if (selection.length >= 2) {
|
||||
this.$refs.list.clearSelection()
|
||||
}
|
||||
if (selection.length > 0) {
|
||||
this.selectComboData = selection
|
||||
this.addData.selectComboData = selection[0]
|
||||
this.addData.data.flavorId = this.selectComboData[0].flavorId
|
||||
if (this.selectComboData[0].operatingSystem.windows == null) {
|
||||
this.version = this.selectComboData[0].operatingSystem.linux
|
||||
this.addData.data.operatingSystemType = 'linux'
|
||||
} else {
|
||||
this.addData.data.operatingSystemType = 'windows'
|
||||
this.version = this.selectComboData[0].operatingSystem.windows
|
||||
}
|
||||
} else {
|
||||
this.selectComboData = selection
|
||||
this.addData.selectComboData = {}
|
||||
this.addData.data.operatingSystem = ''
|
||||
this.version = []
|
||||
}
|
||||
},
|
||||
getRegion() {
|
||||
getRegion({ vendorId: this.vendorId }).then(data => {
|
||||
if (data.success) {
|
||||
this.regionList = data.data
|
||||
this.$set(this.addData.data, 'regionId', data.data[0].regionId)
|
||||
this.getZoomData()
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取可用域
|
||||
getZoomData() {
|
||||
getZone({ vendorId: this.vendorId, regionId: this.addData.data.regionId }).then(data => {
|
||||
if (data.success) {
|
||||
this.zoneList = data.data
|
||||
this.$set(this.addData.data, 'zone', data.data[0].zoneId)
|
||||
this.comboGetList()
|
||||
}
|
||||
})
|
||||
},
|
||||
comboGetList() {
|
||||
// 获取套餐
|
||||
const params = {
|
||||
zone: [this.addData.data.zone],
|
||||
regionId: this.addData.data.regionId,
|
||||
cpuArch: this.cpuArch,
|
||||
}
|
||||
getCombo(this.vendorId, params).then(res => {
|
||||
this.comboData = res.data.flavorSet
|
||||
this.comboData.forEach((item, index) => {
|
||||
if (item.raidType[0] == '') {
|
||||
this.comboData.splice(index, 1)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,27 +0,0 @@
|
|||
<template>
|
||||
<div class="">
|
||||
<cb-form label-width="140px">
|
||||
<h3>确认信息</h3>
|
||||
<cb-form-item label="地域">重庆</cb-form-item>
|
||||
<cb-form-item label="可用区">yfm14</cb-form-item>
|
||||
<cb-form-item label="机型">{{ addData.selectComboData.flavorName }},{{ addData.selectComboData.cpu }},{{ addData.selectComboData.memory }},{{ addData.selectComboData.systemDisk }}</cb-form-item>
|
||||
<cb-form-item label="操作系统">{{ addData.data.operatingSystemType }} | {{ addData.data.operatingSystem }}</cb-form-item>
|
||||
<cb-form-item label="RAID类型">{{ addData.data.raidType }}</cb-form-item>
|
||||
<cb-form-item label="私有网络">{{ addData.data.virtualPrivateCloud.vpcId }}</cb-form-item>
|
||||
<cb-form-item label="子网">{{ addData.data.virtualPrivateCloud.subnetId }}</cb-form-item>
|
||||
<cb-form-item label="服务器数量">{{ addData.data.instanceCount }}台</cb-form-item>
|
||||
<cb-form-item v-if="addData.data.internetAccessible.publicIpAssigned" label="弹性公网IP">{{ addData.data.internetAccessible.publicIpAssigned }}Mpbs</cb-form-item>
|
||||
<cb-form-item v-else label="弹性公网IP">不分配</cb-form-item>
|
||||
<cb-form-item v-if="addData.data.virtualPrivateCloud.privateIpAddresses.length > 0" label="服务器内网IP">{{ addData.data.virtualPrivateCloud.privateIpAddresses }}</cb-form-item>
|
||||
<cb-form-item v-else label="服务器内网IP">自动分配</cb-form-item>
|
||||
<cb-form-item label="实例名称">{{ addData.data.instanceName }}</cb-form-item>
|
||||
<cb-form-item label="登录方式">密码登陆(自定义密码)</cb-form-item>
|
||||
</cb-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ['vendorId', 'addData']
|
||||
}
|
||||
</script>
|
|
@ -1,197 +0,0 @@
|
|||
<template>
|
||||
<div class="">
|
||||
<cb-form :model="addData.data" ref="addData" label-width="140px">
|
||||
<h3>已选配置</h3>
|
||||
<cb-form-item label="机型">{{ addData.selectComboData.flavorName }},{{ addData.selectComboData.cpu }},{{ addData.selectComboData.memory }},{{ addData.selectComboData.systemDisk }}</cb-form-item>
|
||||
<cb-form-item label="操作系统">{{ addData.data.operatingSystemType }} | {{ addData.data.operatingSystem }}</cb-form-item>
|
||||
<h3>存储</h3>
|
||||
<cb-form-item label="RAID类型" prop="raidType" validate="required" required-message="请选择RAID类型">
|
||||
<el-select v-model="addData.data.raidType" placeholder="请选择RAID类型" style="width: 160px">
|
||||
<el-option v-for="item in addData.selectComboData.raidType" :key="item" :label="item" :value="item"> </el-option>
|
||||
</el-select>
|
||||
<span style="display: block">系统盘容量为{{ addData.selectComboData.systemDisk }}</span>
|
||||
</cb-form-item>
|
||||
<h3>网络</h3>
|
||||
<cb-form-item label="私有网络" prop="virtualPrivateCloud.vpcId" validate="required" required-message="请选择">
|
||||
<el-select v-model="addData.data.virtualPrivateCloud.vpcId" @change="change" placeholder="请选择VPC" style="width: 160px">
|
||||
<el-option v-for="item in vpcList" :key="item.vpcId" :label="item.name" :value="item.vpcId"> </el-option>
|
||||
</el-select>
|
||||
<el-select v-model="addData.data.virtualPrivateCloud.subnetId" placeholder="请选择子网" style="width: 160px; margin-left: 10px">
|
||||
<el-option v-for="item in subNetList" :key="item.subnetId" :label="item.name" :value="item.subnetId"> </el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="弹性公网IP">
|
||||
<el-checkbox v-model="addData.data.internetAccessible.publicIpAssigned">弹性公网IP</el-checkbox>
|
||||
<el-input-number v-if="addData.data.internetAccessible.publicIpAssigned" v-model="addData.data.internetAccessible.internetMaxBandwidthOut" @change="handleChange" :min="0" :max="100"></el-input-number> <template v-if="addData.data.internetAccessible.publicIpAssigned">Mbps</template>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="外网运营商" prop="internetAccessible.internetServiceProvider" required-message="请选择运营商" v-if="addData.data.internetAccessible.publicIpAssigned">
|
||||
<el-select v-model="addData.data.internetAccessible.internetServiceProvider" placeholder="请选择运营商" style="width: 160px">
|
||||
<el-option v-for="item in operatorData.ispInfoSet" :key="item.name" :label="item.name" :value="item.type"> </el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="服务器数量"> <el-input-number v-model="addData.data.instanceCount" :min="1" :max="10"></el-input-number>台 </cb-form-item>
|
||||
<cb-form-item label="服务器内网IP" prop="virtualPrivateCloud.privateIpAddresses">
|
||||
<el-radio v-model="radio" label="1">自动分配</el-radio>
|
||||
<el-radio v-model="radio" label="2">手动指定</el-radio>
|
||||
<div v-if="radio == '2'">
|
||||
<span style="display: block">您需要指定{{ addData.data.instanceCount }}个内网IP,使用","分割</span>
|
||||
<el-input type="textarea" :rows="2" v-model="addData.data.virtualPrivateCloud.privateIpAddresses"> </el-input>
|
||||
</div>
|
||||
</cb-form-item>
|
||||
<h3>主机设置</h3>
|
||||
<el-alert title="设置登录密码不支持找回功能,如需重置登录密码需要重装系统,请您牢记密码!" type="warning" :closable="false"> </el-alert>
|
||||
<cb-form-item label="实例名称" prop="instanceName" validate="required" required-message="请输入实例名称">
|
||||
<el-input v-model="addData.data.instanceName"></el-input>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="密码" prop="loginSettings.Password" validate="required,tceClusterPassword" required-message="请输入密码">
|
||||
<el-input v-model="addData.data.loginSettings.Password" show-password></el-input>
|
||||
<span style="display: block">linux机器密码需10到30位,至少包括三项([a-z,A-Z],[0-9]和[()`~!@#$%^&*-+=_|{}[]:;'&It\;>,.?/]的特殊符号)</span>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="确认密码" prop="loginSettings.Password_config" validate="required,tceClusterPassword" required-message="请输入确认密码">
|
||||
<el-input v-model="addData.data.loginSettings.Password_config" show-password></el-input>
|
||||
</cb-form-item>
|
||||
<h3>确认信息</h3>
|
||||
<cb-form-item label="地域">重庆</cb-form-item>
|
||||
<cb-form-item label="可用区">yfm14</cb-form-item>
|
||||
<cb-form-item label="机型">{{ addData.selectComboData.flavorName }},{{ addData.selectComboData.cpu }},{{ addData.selectComboData.memory }},{{ addData.selectComboData.systemDisk }}</cb-form-item>
|
||||
<cb-form-item label="操作系统">{{ addData.data.operatingSystemType }} | {{ addData.data.operatingSystem }}</cb-form-item>
|
||||
<cb-form-item label="RAID类型">{{ addData.data.raidType }}</cb-form-item>
|
||||
<cb-form-item label="私有网络">{{ getVpcName(addData.data.virtualPrivateCloud.vpcId) }}</cb-form-item>
|
||||
<cb-form-item label="子网">{{ getSubnetName(addData.data.virtualPrivateCloud.subnetId) }}</cb-form-item>
|
||||
<cb-form-item label="服务器数量">{{ addData.data.instanceCount }}台</cb-form-item>
|
||||
<cb-form-item v-if="addData.data.internetAccessible.publicIpAssigned" label="弹性公网IP">{{ addData.data.internetAccessible.internetMaxBandwidthOut }}Mpbs</cb-form-item>
|
||||
<cb-form-item v-else label="弹性公网IP">不分配</cb-form-item>
|
||||
<cb-form-item v-if="addData.data.virtualPrivateCloud.privateIpAddresses.length > 0" label="服务器内网IP">{{ addData.data.virtualPrivateCloud.privateIpAddresses }}</cb-form-item>
|
||||
<cb-form-item v-else label="服务器内网IP">自动分配</cb-form-item>
|
||||
<cb-form-item label="实例名称">{{ addData.data.instanceName }}</cb-form-item>
|
||||
<cb-form-item label="登录方式">密码登陆(自定义密码)</cb-form-item>
|
||||
</cb-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getOperator, addBMS } from 'views/resource/ctstack/services/bms.js'
|
||||
import { getVpc } from 'views/resource/ctstack/services/vpcs.js'
|
||||
import { getSubnet } from 'views/resource/ctstack/services/subnet.js'
|
||||
export default {
|
||||
props: ['vendorId', 'addData', 'platformObject'],
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
page: 1,
|
||||
rows: 10
|
||||
},
|
||||
searchConfigs: [{ type: 'Const', value: 'vendorId', initValue: this.vendorId }],
|
||||
value8: 0,
|
||||
options: '',
|
||||
checked: true,
|
||||
num1: 1,
|
||||
radio: '1',
|
||||
ruleForm: {},
|
||||
operatorData: {},
|
||||
vpcList: [],
|
||||
subNetList: []
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
this.getOperatorList()
|
||||
this.getSelectVpc()
|
||||
},
|
||||
methods: {
|
||||
// 校验信息
|
||||
getData() {
|
||||
this.$refs.addData.validate(valid => {
|
||||
if (valid) {
|
||||
this.addData.loading = true
|
||||
if (this.addData.data.loginSettings.Password !== this.addData.data.loginSettings.Password_config) {
|
||||
this.$message.error('两次密码输入不一致')
|
||||
this.addData.loading = false
|
||||
} else {
|
||||
this.addData.data.loginSettings.Password = window.btoa(this.addData.data.loginSettings.Password)
|
||||
if (this.addData.data.virtualPrivateCloud.privateIpAddresses == '') {
|
||||
delete this.addData.data.virtualPrivateCloud.privateIpAddresses
|
||||
} else {
|
||||
this.addData.data.virtualPrivateCloud.privateIpAddresses = this.addData.data.virtualPrivateCloud.privateIpAddresses.split(',')
|
||||
}
|
||||
const params = this.addData.data
|
||||
addBMS(this.vendorId, params).then(res => {
|
||||
this.$message.success(res.message)
|
||||
this.goBack()
|
||||
this.addData.dialog = false
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
this.$router.back(-1)
|
||||
},
|
||||
// 获取运营商
|
||||
getOperatorList() {
|
||||
getOperator({
|
||||
regionId: this.addData.data.regionId
|
||||
}).then(res => {
|
||||
this.operatorData = res.data
|
||||
})
|
||||
},
|
||||
getSelectVpc() {
|
||||
this.params.params = JSON.stringify([{ param: { vendorId: this.vendorId }, sign: 'EQ' }])
|
||||
getVpc(this.params).then(res => {
|
||||
this.vpcList = res.data.rows
|
||||
})
|
||||
},
|
||||
getVpcName(id) {
|
||||
let name = ''
|
||||
this.vpcList.forEach(item => {
|
||||
if (item.vpcId == id) {
|
||||
name = item.name
|
||||
}
|
||||
})
|
||||
return name
|
||||
},
|
||||
getSubnetName(id) {
|
||||
let name = ''
|
||||
this.subNetList.forEach(item => {
|
||||
if (item.subnetId == id) {
|
||||
name = item.name
|
||||
}
|
||||
})
|
||||
return name
|
||||
},
|
||||
change() {
|
||||
const param = {
|
||||
type: 9,
|
||||
vendorId: this.vendorId,
|
||||
vpcUuid: this.addData.data.virtualPrivateCloud.vpcId,
|
||||
regionId: this.addData.data.regionId,
|
||||
zone: this.addData.data.zone
|
||||
}
|
||||
const params = {
|
||||
page: 1,
|
||||
rows: 9999,
|
||||
params: JSON.stringify([{ param, sign: 'EQ' }])
|
||||
}
|
||||
getSubnet(params).then(res => {
|
||||
this.subNetList = res.data.rows
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
span {
|
||||
font-size: 12px;
|
||||
color: #ccc;
|
||||
}
|
||||
.el-alert {
|
||||
margin-left: 25px;
|
||||
width: 800px;
|
||||
border: 1px solid orange;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.el-input {
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
|
@ -1,180 +0,0 @@
|
|||
<template>
|
||||
<el-dialog title="分配" :close-on-click-modal="false" v-if="addData.dialog" :visible.sync="addData.dialog">
|
||||
<cb-form :model="addData.data" label-width="100px" ref="authData">
|
||||
<cb-form-item label="分配方式:" prop="type" validate="required" v-if="showType">
|
||||
<el-radio-group v-model="addData.data.type" size="mini" @change="getList">
|
||||
<el-radio-button label="tenant">租户</el-radio-button>
|
||||
</el-radio-group>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="租户列表:" prop="tenantId" validate="required" v-if="addData.data.type == 'tenant'" key="tenant">
|
||||
<el-select v-model="addData.data.tenantId" @change="handleSearchProject" filterable>
|
||||
<el-option v-for="(item, index) in tenantList" :key="index" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="系统列表:" prop="projectId" v-if="showType && addData.data.type == 'tenant'" key="1">
|
||||
<el-select v-model="addData.data.projectId" placeholder="请选择" filterable @change="getTenantData">
|
||||
<el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
<cb-form-item label="系统列表:" prop="projectId" validate="required" v-if="showType && addData.data.type == 'all'" key="2">
|
||||
<el-select v-model="addData.data.projectId" placeholder="请选择" filterable @change="getTenantData">
|
||||
<el-option v-for="item in projectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</cb-form-item>
|
||||
</cb-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="ghost" @click.native="addData.dialog = false">取消</el-button>
|
||||
<el-button type="primary" @click.native="authSubmit" :disabled="disabled" :loading="loading">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getProject } from 'views/resource/ctstack/services/projects.js'
|
||||
import { getListTenantTree } from 'views/resource/ctstack/services/tenants.js'
|
||||
import { getUser } from 'views/resource/ctstack/services/users.js'
|
||||
import { vmUsers } from 'views/resource/ctstack/services/vm.js'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
addData: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return {
|
||||
data: {
|
||||
months: 1,
|
||||
userId: '',
|
||||
projectId: ''
|
||||
},
|
||||
dialog: false
|
||||
}
|
||||
}
|
||||
},
|
||||
showType: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userList: [],
|
||||
projectList: [],
|
||||
props: {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
children: 'children'
|
||||
},
|
||||
departMap: {},
|
||||
tenantList: [],
|
||||
disabled: false,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
if (this.addData.data.type == 'tenant') {
|
||||
if (this.addData.data.projectId) this.$set(this.addData.data, 'projectId', '')
|
||||
if (this.addData.data.userId) this.$set(this.addData.data, 'userId', '')
|
||||
if (this.addData.data.tenantId) this.$set(this.addData.data, 'tenantId', '')
|
||||
this.getTenantList()
|
||||
} else {
|
||||
if (this.addData.data.projectId) this.$set(this.addData.data, 'projectId', '')
|
||||
if (this.addData.data.userId) this.$set(this.addData.data, 'userId', '')
|
||||
this.getAllTenant()
|
||||
}
|
||||
},
|
||||
authSubmit() {
|
||||
this.$refs.authData.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
let obj = {}
|
||||
if (this.addData.data.type == 'tenant') {
|
||||
obj = {
|
||||
ids: this.addData.data.ids,
|
||||
userId: this.addData.data.userId,
|
||||
projectId: this.addData.data.projectId,
|
||||
tenantId: this.addData.data.tenantId,
|
||||
resourceCategory: this.addData.data.resourceCategory,
|
||||
vendorType: this.addData.data.vendorType
|
||||
}
|
||||
} else {
|
||||
obj = {
|
||||
ids: this.addData.data.ids,
|
||||
userId: this.addData.data.userId,
|
||||
projectId: this.addData.data.projectId,
|
||||
resourceCategory: this.addData.data.resourceCategory,
|
||||
vendorType: this.addData.data.vendorType
|
||||
}
|
||||
}
|
||||
vmUsers(obj).then(data => {
|
||||
if (data.success) {
|
||||
this.$message.success(data.message)
|
||||
this.addData.dialog = false
|
||||
this.$emit('back')
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取租户列表
|
||||
getTenantList(value) {
|
||||
getListTenantTree({ parentId: 0 })
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
this.tenantList = data.data
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 获取系统
|
||||
handleSearchProject() {
|
||||
if (this.addData.data.vendorType == 'OPENSTACK' && this.addData.data.resourceCategory == 'Storage') this.getTenantData()
|
||||
if (this.addData.data.projectId) this.$set(this.addData.data, 'projectId', '')
|
||||
getProject({
|
||||
page: 1,
|
||||
rows: 9999,
|
||||
params: JSON.stringify([{ param: { tenantId: this.addData.data.tenantId }, sign: 'EQ' }])
|
||||
}).then(data => {
|
||||
if (data.success) {
|
||||
this.projectList = data.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
getAllTenant() {
|
||||
getProject({
|
||||
page: 1,
|
||||
rows: 9999,
|
||||
params: JSON.stringify([{ param: { tenantId: 'null' }, sign: 'NUL' }])
|
||||
}).then(data => {
|
||||
if (data.success) {
|
||||
this.projectList = data.data.rows
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取租户
|
||||
getTenantData(value) {
|
||||
if (this.addData.data.userId) this.$set(this.addData.data, 'userId', '')
|
||||
getUser({
|
||||
simple: true,
|
||||
params: this.handleSearchParam({
|
||||
projectId: this.addData.data.projectId,
|
||||
tenantId: this.addData.data.projectId ? '' : this.addData.data.tenantId
|
||||
})
|
||||
}).then(data => {
|
||||
if (data.success) {
|
||||
this.userList = data.data.rows
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
created() {
|
||||
this.projectList = []
|
||||
this.userList = []
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -97,6 +97,7 @@
|
|||
import { bareMetalState, bareMetalColor } from 'filters'
|
||||
import { getBareMetalList, modifyBareMetal, bmsReboot, bmsBootUp, bmsStop, bmsedt, getDisk, getCombo, bmsReload } from 'views/resource/ctstack/services/bms.js'
|
||||
import { removeVmUsers } from 'views/resource/ctstack/services/vm.js'
|
||||
import { getRegion } from 'services/platform/index'
|
||||
const columns = [
|
||||
{
|
||||
type: 'selection'
|
||||
|
@ -169,6 +170,21 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRegion()
|
||||
},
|
||||
watch: {
|
||||
platformObject: {
|
||||
handler(newVal, oldVal) {
|
||||
this.searchConfigs = [
|
||||
{ type: 'Input', label: '名称', value: 'name' },
|
||||
{ type: 'Select', label: '所属地域', data: [], value: 'regionId', props: { value: 'regionId' } },
|
||||
{ type: 'Const', value: 'vendorId', initValue: this.platformObject.vendorId }
|
||||
]
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns,
|
||||
|
@ -180,7 +196,11 @@ export default {
|
|||
},
|
||||
data: [],
|
||||
total: 0,
|
||||
searchConfigs: [{ type: 'Const', value: 'vendorId', initValue: this.platformObject.vendorId }],
|
||||
searchConfigs: [
|
||||
{ type: 'Input', label: '名称', value: 'name' },
|
||||
{ type: 'Select', label: '所属地域', data: [], value: 'regionId', props: { value: 'regionId' } },
|
||||
{ type: 'Const', value: 'vendorId', initValue: this.platformObject.vendorId }
|
||||
],
|
||||
// 编辑数据
|
||||
editData: {
|
||||
dialog: false,
|
||||
|
@ -210,11 +230,7 @@ export default {
|
|||
row: {}
|
||||
},
|
||||
comboData: '',
|
||||
selectCombo: {},
|
||||
assignData: {
|
||||
dialog: false,
|
||||
data: {}
|
||||
}
|
||||
selectCombo: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -407,34 +423,6 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
assign(row) {
|
||||
this.assignData = {
|
||||
dialog: true,
|
||||
data: {
|
||||
type: 'tenant',
|
||||
ids: [row.id],
|
||||
resourceCategory: 'Bms',
|
||||
vendorType: 'CTSTACK'
|
||||
}
|
||||
}
|
||||
},
|
||||
recycle(row) {
|
||||
this.$confirm('确认回收该资源嘛?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const params = {
|
||||
ids: [row.id],
|
||||
resourceCategory: 'Bms',
|
||||
vendorType: 'CTSTACK'
|
||||
}
|
||||
removeVmUsers(params).then(data => {
|
||||
this.$message.success(data.message)
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
this.loading = true
|
||||
// const params = {
|
||||
|
@ -457,14 +445,15 @@ export default {
|
|||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
platformObject: {
|
||||
handler(newVal, oldVal) {
|
||||
this.searchConfigs = [{ type: 'Const', value: 'vendorId', initValue: this.platformObject.vendorId }]
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
// 获取域
|
||||
getRegion() {
|
||||
getRegion({ vendorId: this.platformObject.vendorId }).then(data => {
|
||||
if (data.success) {
|
||||
this.regionList = data.data
|
||||
this.searchConfigs[1].data = data.data
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue