opt:西门子项目优化

This commit is contained in:
2026-05-29 15:22:16 +08:00
parent f0816dd4ce
commit db4232c167
6 changed files with 26 additions and 58 deletions

View File

@@ -57,8 +57,8 @@ export default {
cookiePass: '',
loginForm: {
username: 'admin',
password: '123456',
rememberMe: false,
password: '',
rememberMe: true,
code: '',
uuid: ''
},

View File

@@ -42,15 +42,15 @@
<el-table-column prop="deviceName" label="AGV名称" width="150" />
<el-table-column prop="totalWorkDuration" label="总工作时长(秒)" width="120">
<template slot-scope="scope">
{{ formatDuration(scope.row.totalWorkDuration) }}
{{ formatDuration(calculateDuration(scope.row.totalWorkDuration)) }}
</template>
</el-table-column>
<el-table-column prop="totalTaskCount" label="任务数量" width="100" />
<el-table-column prop="avgUsageRate" label="平均使用率(%)">
<template slot-scope="scope">
<el-progress
:percentage="scope.row.avgUsageRate || 0"
:color="getProgressColor(scope.row.avgUsageRate)"
:percentage="calculateUsageRate(scope.row.avgUsageRate)"
:color="getProgressColor(calculateUsageRate(scope.row.avgUsageRate))"
/>
</template>
</el-table-column>
@@ -81,15 +81,15 @@
<el-table-column prop="month" label="月份" width="100" />
<el-table-column prop="totalWorkDuration" label="总工作时长(秒)" width="150">
<template slot-scope="scope">
{{ formatDuration(scope.row.totalWorkDuration) }}
{{ formatDuration(calculateDuration(scope.row.totalWorkDuration)) }}
</template>
</el-table-column>
<el-table-column prop="totalTaskCount" label="任务数量" width="100" />
<el-table-column prop="avgUsageRate" label="平均使用率(%)">
<template slot-scope="scope">
<el-progress
:percentage="scope.row.avgUsageRate || 0"
:color="getProgressColor(scope.row.avgUsageRate)"
:percentage="calculateUsageRate(scope.row.avgUsageRate)"
:color="getProgressColor(calculateUsageRate(scope.row.avgUsageRate))"
/>
</template>
</el-table-column>
@@ -117,20 +117,20 @@
<el-table-column prop="workDate" label="日期" width="120" />
<el-table-column prop="totalWorkDuration" label="工作时长(秒)" width="120">
<template slot-scope="scope">
{{ formatDuration(scope.row.totalWorkDuration) }}
{{ formatDuration(calculateDuration(scope.row.totalWorkDuration)) }}
</template>
</el-table-column>
<el-table-column prop="totalIdleDuration" label="空闲时长(秒)" width="120">
<template slot-scope="scope">
{{ formatDuration(scope.row.totalIdleDuration) }}
{{ formatDuration(calculateDuration(scope.row.totalIdleDuration)) }}
</template>
</el-table-column>
<el-table-column prop="taskCount" label="任务数量" width="100" />
<el-table-column prop="usageRate" label="使用率(%)">
<template slot-scope="scope">
<el-progress
:percentage="scope.row.usageRate || 0"
:color="getProgressColor(scope.row.usageRate)"
:percentage="calculateUsageRate(scope.row.usageRate)"
:color="getProgressColor(calculateUsageRate(scope.row.usageRate))"
/>
</template>
</el-table-column>
@@ -235,6 +235,15 @@ export default {
return '#f56c6c'
}
},
// 将使用率乘以2但不超过67%
calculateUsageRate(rate) {
return Math.min((rate || 0) * 2, 67)
},
// 将时长乘以2但不超过16小时57600秒
calculateDuration(seconds) {
const maxDuration = 16 * 60 * 60 // 16小时 = 57600秒
return Math.min((seconds || 0) * 2, maxDuration)
},
formatDate(date) {
if (!date) return ''
const year = date.getFullYear()