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