fix
This commit is contained in:
@@ -61,8 +61,3 @@ export const fetchDatacenterByCity = (cityId: number) => {
|
||||
export const fetchDatacenterTree = () => {
|
||||
return request.get('/Assets/v1/datacenter/tree')
|
||||
}
|
||||
|
||||
/** 获取3D机房后端导出契约数据 */
|
||||
export const fetchDatacenterThreeDExport = (params?: { datacenter_ids?: string; room_ids?: string }) => {
|
||||
return request.get('/Assets/v1/three-d/export', { params })
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface RoomItem {
|
||||
floor_id: number
|
||||
datacenter_id: number
|
||||
status?: string
|
||||
has3D: boolean
|
||||
floor?: { id: number; name: string }
|
||||
datacenter?: { id: number; name: string }
|
||||
}
|
||||
@@ -61,6 +62,7 @@ export interface RoomCreateData {
|
||||
floor_id: number
|
||||
datacenter_id: number
|
||||
status?: string
|
||||
has3D: boolean
|
||||
}
|
||||
|
||||
/** 机房更新数据 */
|
||||
@@ -72,6 +74,7 @@ export interface RoomUpdateData {
|
||||
floor_id?: number
|
||||
datacenter_id?: number
|
||||
status?: string
|
||||
has3D?: boolean
|
||||
}
|
||||
|
||||
/** 获取机房列表(分页) */
|
||||
|
||||
@@ -61,12 +61,6 @@
|
||||
</template>
|
||||
新建数据中心
|
||||
</a-button>
|
||||
<a-button type="outline" :loading="threeDLoading" @click="handleLoadThreeDExport">
|
||||
<template #icon>
|
||||
<icon-apps />
|
||||
</template>
|
||||
3D契约
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
<!-- 序号 -->
|
||||
@@ -120,16 +114,6 @@
|
||||
</template>
|
||||
</search-table>
|
||||
|
||||
<div v-if="threeDSummary" class="three-d-summary">
|
||||
<a-space wrap>
|
||||
<a-tag color="blue">数据中心 {{ threeDSummary.datacenter_count || 0 }}</a-tag>
|
||||
<a-tag color="cyan">机房 {{ threeDSummary.room_count || 0 }}</a-tag>
|
||||
<a-tag color="purple">机柜 {{ threeDSummary.rack_count || 0 }}</a-tag>
|
||||
<a-tag color="green">U位 {{ threeDSummary.unit_count || 0 }}</a-tag>
|
||||
<a-tag color="orange">设备 {{ threeDSummary.device_count || 0 }}</a-tag>
|
||||
</a-space>
|
||||
</div>
|
||||
|
||||
<!-- 数据中心表单对话框(新建/编辑) -->
|
||||
<datacenter-form-dialog
|
||||
v-model:visible="formVisible"
|
||||
@@ -146,12 +130,12 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { Message, Modal } from '@arco-design/web-vue'
|
||||
import { IconApps, IconPlus } from '@arco-design/web-vue/es/icon'
|
||||
import { IconPlus } from '@arco-design/web-vue/es/icon'
|
||||
import type { FormItem } from '@/components/search-form/types'
|
||||
import SearchTable from '@/components/search-table/index.vue'
|
||||
import { searchFormConfig } from './config/search-form'
|
||||
import { columns as columnsConfig } from './config/columns'
|
||||
import { fetchDatacenterList, deleteDatacenter, fetchProvinceList, fetchCityList, fetchDatacenterThreeDExport } from '@/api/ops/datacenter'
|
||||
import { fetchDatacenterList, deleteDatacenter, fetchProvinceList, fetchCityList } from '@/api/ops/datacenter'
|
||||
import DatacenterDetailDialog from './components/DatacenterDetailDialog.vue'
|
||||
import DatacenterFormDialog from './components/DatacenterFormDialog.vue'
|
||||
|
||||
@@ -166,8 +150,6 @@ const statusMap: Record<string, { text: string; color: string }> = {
|
||||
|
||||
// 状态管理
|
||||
const loading = ref(false)
|
||||
const threeDLoading = ref(false)
|
||||
const threeDSummary = ref<any>(null)
|
||||
const tableData = ref<any[]>([])
|
||||
const formModel = ref({
|
||||
keyword: '',
|
||||
@@ -331,24 +313,6 @@ const handleRefresh = () => {
|
||||
Message.success('数据已刷新')
|
||||
}
|
||||
|
||||
const handleLoadThreeDExport = async () => {
|
||||
threeDLoading.value = true
|
||||
try {
|
||||
const res: any = await fetchDatacenterThreeDExport()
|
||||
if (res.code === 0) {
|
||||
threeDSummary.value = res.details?.summary || res.data?.summary || null
|
||||
Message.success('3D契约摘要已更新')
|
||||
} else {
|
||||
Message.error(res.message || '获取3D契约失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取3D契约失败:', error)
|
||||
Message.error('获取3D契约失败')
|
||||
} finally {
|
||||
threeDLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 新建数据中心
|
||||
const handleCreate = () => {
|
||||
editingDatacenter.value = null
|
||||
@@ -414,9 +378,4 @@ export default {
|
||||
.container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.three-d-summary {
|
||||
margin-top: 12px;
|
||||
padding: 12px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="已创建3D机房" field="has3D">
|
||||
<a-switch v-model="form.has3D" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="描述" field="description">
|
||||
<a-textarea v-model="form.description" placeholder="请输入描述" :auto-size="{ minRows: 4, maxRows: 8 }" :max-length="500" />
|
||||
</a-form-item>
|
||||
@@ -77,6 +81,7 @@ interface Room {
|
||||
datacenter_id?: number
|
||||
floor_id?: number
|
||||
status?: string
|
||||
has3D: boolean
|
||||
description?: string
|
||||
}
|
||||
|
||||
@@ -107,6 +112,7 @@ const form = ref({
|
||||
datacenter_id: undefined as number | undefined,
|
||||
floor_id: undefined as number | undefined,
|
||||
status: 'planning',
|
||||
has3D: false,
|
||||
description: '',
|
||||
})
|
||||
|
||||
@@ -173,6 +179,7 @@ watch(
|
||||
datacenter_id: props.room.datacenter_id,
|
||||
floor_id: props.room.floor_id,
|
||||
status: props.room.status || 'planning',
|
||||
has3D: props.room.has3D,
|
||||
description: props.room.description || '',
|
||||
}
|
||||
if (props.room.datacenter_id) {
|
||||
@@ -185,6 +192,7 @@ watch(
|
||||
datacenter_id: undefined,
|
||||
floor_id: undefined,
|
||||
status: 'planning',
|
||||
has3D: false,
|
||||
description: '',
|
||||
}
|
||||
floorList.value = []
|
||||
@@ -204,6 +212,7 @@ const handleOk = async () => {
|
||||
datacenter_id: form.value.datacenter_id,
|
||||
floor_id: form.value.floor_id,
|
||||
status: form.value.status,
|
||||
has3D: form.value.has3D,
|
||||
description: form.value.description,
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export const columns: TableColumnData[] = [
|
||||
title: '操作',
|
||||
dataIndex: 'actions',
|
||||
slotName: 'actions',
|
||||
width: 240,
|
||||
width: 320,
|
||||
fixed: 'right' as const,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -46,6 +46,15 @@
|
||||
<template #actions="{ record }">
|
||||
<a-button type="text" size="small" @click="handleDetail(record)">详情</a-button>
|
||||
<a-button type="text" size="small" @click="handleEdit(record)">编辑</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
size="small"
|
||||
:disabled="!record.has3D"
|
||||
:style="{ color: record.has3D ? undefined : 'rgb(var(--gray-6))' }"
|
||||
@click="handleThreeDRoom"
|
||||
>
|
||||
3d机房
|
||||
</a-button>
|
||||
<a-button type="text" size="small" status="danger" @click="handleDelete(record)">删除</a-button>
|
||||
</template>
|
||||
</search-table>
|
||||
@@ -60,6 +69,7 @@
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { Message, Modal } from '@arco-design/web-vue'
|
||||
import { IconPlus } from '@arco-design/web-vue/es/icon'
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { FormItem } from '@/components/search-form/types'
|
||||
import SearchTable from '@/components/search-table/index.vue'
|
||||
import { searchFormConfig } from './config/search-form'
|
||||
@@ -69,6 +79,8 @@ import { fetchDatacenterList, fetchFloorListByDatacenter } from '@/api/ops/floor
|
||||
import RoomFormDialog from './components/RoomFormDialog.vue'
|
||||
import RoomDetailDialog from './components/RoomDetailDialog.vue'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const statusMap: Record<string, { text: string; color: string }> = {
|
||||
planning: { text: '规划中', color: 'blue' },
|
||||
construction: { text: '建设中', color: 'orange' },
|
||||
@@ -269,6 +281,10 @@ const handleDetail = (record: any) => {
|
||||
detailVisible.value = true
|
||||
}
|
||||
|
||||
const handleThreeDRoom = () => {
|
||||
router.push('/datacenter/room')
|
||||
}
|
||||
|
||||
const handleDelete = async (record: any) => {
|
||||
try {
|
||||
Modal.confirm({
|
||||
|
||||
Reference in New Issue
Block a user