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