fix: 区分数据中心
parent
f208a516a7
commit
1b8a63a24d
|
@ -151,6 +151,11 @@ export function getVms(params) {
|
||||||
params: params
|
params: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function getVmsByDc(params) {
|
||||||
|
return request.get('/cms/v1/vms/listByDataCenter', {
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function getDataStore(params) {
|
export function getDataStore(params) {
|
||||||
return request.get('/cms/v1/datastores', {
|
return request.get('/cms/v1/datastores', {
|
||||||
|
|
|
@ -60,3 +60,11 @@ export function detailVolume(type, id) {
|
||||||
export function getResourceList() {
|
export function getResourceList() {
|
||||||
return request.get('/cms/v1/monitor/resourcetype', { params: { rows: 99, page: 1 } })
|
return request.get('/cms/v1/monitor/resourcetype', { params: { rows: 99, page: 1 } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 数据中心
|
||||||
|
const dcUrl = 'cmp/v1/dcs'
|
||||||
|
export function getDc(params) {
|
||||||
|
return request.get(dcUrl, {
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<el-card>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
|
<el-row :gutter="10" class="m-b">
|
||||||
|
<!-- <el-col :span="5">
|
||||||
|
<el-input v-model="searchObj.name" placeholder="名称"></el-input>
|
||||||
|
</el-col> -->
|
||||||
|
<el-col :span="5">
|
||||||
|
<el-select v-model="searchObj.dcId" @change="handleSearch" placeholder="请选择数据中心" clearable>
|
||||||
|
<el-option v-for="item in dcList" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-button type="ghost" icon="el-icon-search" @click="handleSearch">搜索</el-button>
|
||||||
|
<el-button type="ghost" icon="el-icon-refresh" @click="handleReset">重置</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-col :span="6" class="m-b" v-for="item in vendorData" :key="item.id">
|
<el-col :span="6" class="m-b" v-for="item in vendorData" :key="item.id">
|
||||||
<el-card class="server_view">
|
<el-card class="server_view">
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
|
@ -391,15 +405,15 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</cb-form>
|
</cb-form>
|
||||||
</cb-dialog>
|
</cb-dialog>
|
||||||
</div>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { platformStatusFilter } from '@/filters/index'
|
import { platformStatusFilter } from '@/filters/index'
|
||||||
import webSocket from '@cmp/cmp-common/mixins/getGlobalSocket'
|
import webSocket from '@cmp/cmp-common/mixins/getGlobalSocket'
|
||||||
import { encrypt, decrypt } from '@cmp/cmp-element'
|
import { encrypt, decrypt, handleSearchParam } from '@cmp/cmp-element'
|
||||||
import { openMonitor, closeMonitor, getRatio, ratioOk, getAuthentications, authenticationsOk } from 'services/monitor'
|
import { openMonitor, closeMonitor, getRatio, ratioOk, getAuthentications, authenticationsOk } from 'services/monitor'
|
||||||
import { conditionCloudVendor } from 'services/platform/index'
|
import { conditionCloudVendor, getDc } from 'services/platform/index'
|
||||||
const FUSIONCLOUD = {
|
const FUSIONCLOUD = {
|
||||||
btn: ['编辑', '删除', '同步', '设置'],
|
btn: ['编辑', '删除', '同步', '设置'],
|
||||||
value: [
|
value: [
|
||||||
|
@ -424,9 +438,6 @@ export default {
|
||||||
FUSIONCLOUD,
|
FUSIONCLOUD,
|
||||||
HMC,
|
HMC,
|
||||||
vendorData: [],
|
vendorData: [],
|
||||||
search: {
|
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
params: {
|
params: {
|
||||||
page: 1,
|
page: 1,
|
||||||
rows: 10000
|
rows: 10000
|
||||||
|
@ -437,10 +448,22 @@ export default {
|
||||||
timeout: 1800
|
timeout: 1800
|
||||||
},
|
},
|
||||||
opVisible: false,
|
opVisible: false,
|
||||||
opData: {}
|
opData: {},
|
||||||
|
dcList: [],
|
||||||
|
searchObj: {
|
||||||
|
name: '',
|
||||||
|
dcId: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getDc() {
|
||||||
|
getDc({ simple: true }).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.dcList = res.data.rows
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 跳转
|
// 跳转
|
||||||
go(item) {
|
go(item) {
|
||||||
if (!item.isAlarm) {
|
if (!item.isAlarm) {
|
||||||
|
@ -714,8 +737,34 @@ export default {
|
||||||
this.getVendor()
|
this.getVendor()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleSearch() {
|
||||||
|
this.getVendor()
|
||||||
|
},
|
||||||
|
handleReset() {
|
||||||
|
this.searchObj.name = ''
|
||||||
|
this.searchObj.dcId = ''
|
||||||
|
this.getVendor()
|
||||||
|
},
|
||||||
getVendor() {
|
getVendor() {
|
||||||
|
const params = JSON.parse(
|
||||||
|
handleSearchParam({
|
||||||
|
'name:LK': this.searchObj.name,
|
||||||
|
dcId: this.searchObj.dcId
|
||||||
|
})
|
||||||
|
)
|
||||||
|
// 转换参数格式
|
||||||
|
const convertedParams = []
|
||||||
|
params.forEach((item) => {
|
||||||
|
const paramKeys = Object.keys(item.param)
|
||||||
|
paramKeys.forEach((key) => {
|
||||||
|
convertedParams.push({
|
||||||
|
param: { [key]: item.param[key] },
|
||||||
|
sign: item.sign
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
conditionCloudVendor({
|
conditionCloudVendor({
|
||||||
|
params: JSON.stringify(convertedParams),
|
||||||
condition: JSON.stringify({
|
condition: JSON.stringify({
|
||||||
condition: 'listByTypes',
|
condition: 'listByTypes',
|
||||||
types: ['KVM', 'OPENSTACK', 'VMWARE', 'FUSIONCLOUD', 'HMC', 'MANAGEONE', 'KUBERNETES', 'TIANYI', 'HUAWEI', 'CAS', 'ALIYUN', 'TCE', 'ABCSTACK', 'AWS', 'HCSO', 'EASYSTACK', 'HWACCESS', 'APSARASTACK', 'ZSTACK', 'CNWARE', 'KINGCLOUD', 'SMARTX', 'QCLOUD', 'CLOUDOS', 'CTSTACK']
|
types: ['KVM', 'OPENSTACK', 'VMWARE', 'FUSIONCLOUD', 'HMC', 'MANAGEONE', 'KUBERNETES', 'TIANYI', 'HUAWEI', 'CAS', 'ALIYUN', 'TCE', 'ABCSTACK', 'AWS', 'HCSO', 'EASYSTACK', 'HWACCESS', 'APSARASTACK', 'ZSTACK', 'CNWARE', 'KINGCLOUD', 'SMARTX', 'QCLOUD', 'CLOUDOS', 'CTSTACK']
|
||||||
|
@ -856,6 +905,7 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getVendor()
|
this.getVendor()
|
||||||
|
this.getDc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -10,22 +10,27 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<!-- <el-cascader placeholder="租户" v-model="listQuery.tenantId" :options="tenantList" clearable :props="{ emitPath: false, value: 'id', label: 'name', children: 'children' }"></el-cascader> -->
|
<!-- <el-cascader placeholder="租户" v-model="listQuery.tenantId" :options="tenantList" clearable :props="{ emitPath: false, value: 'id', label: 'name', children: 'children' }"></el-cascader> -->
|
||||||
<el-select v-model="listQuery.tenantId" clearable placeholder="租户" filterable>
|
<el-select v-model="listQuery.tenantId" @change="handleSearch" clearable placeholder="租户" filterable>
|
||||||
<el-option v-for="item in tenantList" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
<el-option v-for="item in tenantList" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select v-model="listQuery.projectId" clearable placeholder="项目" filterable>
|
<el-select v-model="listQuery.projectId" @change="handleSearch" clearable placeholder="项目" filterable>
|
||||||
<el-option v-for="item in projectList" :key="item.value" :value="item.id" :label="item.name"></el-option>
|
<el-option v-for="item in projectList" :key="item.value" :value="item.id" :label="item.name"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select v-model="listQuery.vendorId" clearable placeholder="平台" filterable>
|
<el-select v-model="listQuery.vendorId" @change="handleSearch" clearable placeholder="平台" filterable>
|
||||||
<el-option v-for="item in platformData" :key="item.value" :value="item.id" :label="item.name"></el-option>
|
<el-option v-for="item in platformData" :key="item.value" :value="item.id" :label="item.name"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-select v-model="listQuery.status" clearable placeholder="请选择状态">
|
<el-select v-model="listQuery.dcId" @change="handleSearch" placeholder="数据中心" clearable>
|
||||||
|
<el-option v-for="item in dcList" :key="item.id" :value="item.id" :label="item.name"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-select v-model="listQuery.status" @change="handleSearch" clearable placeholder="请选择状态">
|
||||||
<el-option v-for="item in statusData" :key="item.value" :value="item.value" :label="item.name"></el-option>
|
<el-option v-for="item in statusData" :key="item.value" :value="item.value" :label="item.name"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -165,10 +170,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { vmStatusColorFilter, openstackServerFilter } from '@/filters/index'
|
import { vmStatusColorFilter, openstackServerFilter } from '@/filters/index'
|
||||||
import { getVms, setIps, getRuleGroupBind } from 'services/monitor/index.js'
|
import { getVmsByDc, setIps, getRuleGroupBind } from 'services/monitor/index.js'
|
||||||
import { getTenant } from '@cmp/cmp-api/system/tenant'
|
import { getTenant } from '@cmp/cmp-api/system/tenant'
|
||||||
import { getProject } from '@cmp/cmp-api/system/project'
|
import { getProject } from '@cmp/cmp-api/system/project'
|
||||||
import { conditionCloudVendor } from 'services/platform/index'
|
import { conditionCloudVendor, getDc } from 'services/platform/index'
|
||||||
import aliyunDetail from './cloud/aliyun/detail.vue'
|
import aliyunDetail from './cloud/aliyun/detail.vue'
|
||||||
import ctstackDetail from './cloud/ctstack/detail.vue'
|
import ctstackDetail from './cloud/ctstack/detail.vue'
|
||||||
import openstackDetail from './cloud/openstack/vm_detail.vue'
|
import openstackDetail from './cloud/openstack/vm_detail.vue'
|
||||||
|
@ -320,7 +325,8 @@ export default {
|
||||||
ruleGroupIds: [],
|
ruleGroupIds: [],
|
||||||
resourceType: '',
|
resourceType: '',
|
||||||
activeTab: '1',
|
activeTab: '1',
|
||||||
vmData
|
vmData,
|
||||||
|
dcList: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -336,7 +342,24 @@ export default {
|
||||||
getList() {
|
getList() {
|
||||||
this.refreshId()
|
this.refreshId()
|
||||||
this.loading = true
|
this.loading = true
|
||||||
getVms(this.params).then((data) => {
|
const cloneParams = JSON.parse(this.params.params)
|
||||||
|
console.log(cloneParams)
|
||||||
|
// 转换参数格式
|
||||||
|
const convertedParams = []
|
||||||
|
cloneParams.forEach((item) => {
|
||||||
|
const paramKeys = Object.keys(item.param)
|
||||||
|
paramKeys.forEach((key) => {
|
||||||
|
convertedParams.push({
|
||||||
|
param: { [key]: item.param[key] },
|
||||||
|
sign: item.sign
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const params = {
|
||||||
|
...this.params,
|
||||||
|
params: JSON.stringify(convertedParams)
|
||||||
|
}
|
||||||
|
getVmsByDc(params).then((data) => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
this.list = data.data.rows
|
this.list = data.data.rows
|
||||||
|
@ -430,7 +453,8 @@ export default {
|
||||||
tenantId: this.listQuery.tenantId || '',
|
tenantId: this.listQuery.tenantId || '',
|
||||||
projectId: this.listQuery.projectId || '',
|
projectId: this.listQuery.projectId || '',
|
||||||
vendorId: this.listQuery.vendorId || '',
|
vendorId: this.listQuery.vendorId || '',
|
||||||
status: this.listQuery.status || ''
|
status: this.listQuery.status || '',
|
||||||
|
dcId: this.listQuery.dcId || ''
|
||||||
})
|
})
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
|
@ -465,6 +489,13 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getDc() {
|
||||||
|
getDc({ simple: true }).then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.dcList = res.data.rows
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
getProject() {
|
getProject() {
|
||||||
getProject({
|
getProject({
|
||||||
page: 1,
|
page: 1,
|
||||||
|
@ -555,6 +586,7 @@ export default {
|
||||||
this.getProject()
|
this.getProject()
|
||||||
this.getPlatformData()
|
this.getPlatformData()
|
||||||
this.getQuotas()
|
this.getQuotas()
|
||||||
|
this.getDc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue