diff --git a/src/api/devops/storage.js b/src/api/devops/storage.js index be593db..9b0d011 100644 --- a/src/api/devops/storage.js +++ b/src/api/devops/storage.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 系统运维->TF存储->查询存储信息 export function getStorageInfoAPI(params) { return request({ - url: '/smartCar/data/device/getStorageInfo', + url: '/smartCar/data/storage/getStorageInfo', method: 'GET', params }) @@ -12,7 +12,7 @@ export function getStorageInfoAPI(params) { // 系统运维->TF存储->格式化存储 export function formatStorageAPI(data) { return request({ - url: '/smartCar/data/device/formatStorage', + url: '/smartCar/data/storage/formatStorage', method: 'POST', data }) diff --git a/src/views/devops/storage/index.vue b/src/views/devops/storage/index.vue index 65c033c..aabb220 100644 --- a/src/views/devops/storage/index.vue +++ b/src/views/devops/storage/index.vue @@ -74,13 +74,27 @@ export default { data() { return { loading: false, - totalSpace: 128, - usedSpace: 100, - availableSpace: 28, + storageInfo: { + systemStorageId: null, + systemId: null, + storageType: '', + capacity: 0, + availableCapacity: 0, + usedCapacity: 0 + }, formatDialogVisible: false } }, computed: { + totalSpace() { + return Number(this.storageInfo.capacity) || 0 + }, + usedSpace() { + return Number(this.storageInfo.usedCapacity) || 0 + }, + availableSpace() { + return Number(this.storageInfo.availableCapacity) || 0 + }, usedPercentage() { if (this.totalSpace === 0) return 0 return Math.round((this.usedSpace / this.totalSpace) * 100) @@ -100,9 +114,14 @@ export default { const res = await getStorageInfoAPI() if (res.code === 200 && res.data) { const data = res.data - this.totalSpace = data.totalSpace || 128 - this.usedSpace = data.usedSpace || 100 - this.availableSpace = data.availableSpace || 28 + this.storageInfo = { + systemStorageId: data.systemStorageId || null, + systemId: data.systemId || null, + storageType: data.storageType || '', + capacity: data.capacity || 0, + availableCapacity: data.availableCapacity || 0, + usedCapacity: data.usedCapacity || 0 + } } } catch (error) { console.error('获取存储信息失败:', error) @@ -212,18 +231,19 @@ export default { } .format-btn { - background: #f5f7fa; - border: 1px solid #dcdfe6; - color: #606266; - font-size: 14px; - padding: 8px 16px; + width: 98px; + height: 36px; + background: #1f72ea; + box-shadow: 0px 4px 8px 0px rgba(51, 135, 255, 0.5); border-radius: 4px; + color: #fff; + border: none; + font-size: 14px; transition: all 0.3s; &:hover { - background: #e4e7ed; - border-color: #c0c4cc; - color: #303133; + background: #4a8bff; + box-shadow: 0px 6px 12px 0px rgba(51, 135, 255, 0.6); } } }