From db42d47f5692ef64e5436c5a6d29dcb537b44596 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 26 一月 2026 16:36:13 +0800
Subject: [PATCH] 浪潮对接单点登录:mis调整
---
src/views/equipmentManagement/operationManagement/index.vue | 370 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 370 insertions(+), 0 deletions(-)
diff --git a/src/views/equipmentManagement/operationManagement/index.vue b/src/views/equipmentManagement/operationManagement/index.vue
new file mode 100644
index 0000000..008cc2c
--- /dev/null
+++ b/src/views/equipmentManagement/operationManagement/index.vue
@@ -0,0 +1,370 @@
+<template>
+ <div class="app-container">
+
+ <!-- 绛涢�夋潯浠� -->
+ <div class="filter-section">
+ <el-select v-model="deviceFilter" placeholder="璁惧鐘舵�佺瓫閫�" clearable style="width: 200px; margin-right: 10px;">
+ <el-option label="鍏ㄩ儴" value="all" />
+ <el-option label="杩愯涓�" value="start" />
+ <el-option label="鍋滄杩愯" value="stop" />
+ </el-select>
+ </div>
+
+ <!-- 璁惧鍚仠璁板綍琛ㄦ牸 -->
+ <el-card class="table-card">
+ <template #header>
+ <span>璁惧杩愯璁板綍</span>
+ </template>
+ <el-table
+ :data="filteredDeviceRecords"
+ style="width: 100%"
+ :header-cell-style="{ background: '#F0F1F5', color: '#333333' }"
+ :row-class-name="getRowClassName"
+ v-loading="loading"
+ >
+ <el-table-column
+ align="center"
+ label="搴忓彿"
+ type="index"
+ width="60"
+ />
+ <el-table-column
+ label="璁惧鍚嶇О"
+ prop="deviceName"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="瑙勬牸鍨嬪彿"
+ prop="deviceModel"
+ show-overflow-tooltip
+ />
+ <el-table-column
+ label="璁惧鐘舵��"
+ prop="status"
+ width="150"
+ align="center"
+ >
+ <template #default="scope">
+ <!-- 瓒呮椂鏈惎鍔ㄦ椂鏄剧ず璀﹀憡 -->
+ <el-tag
+ v-if="isOverdue(scope.row)"
+ type="warning"
+ size="small"
+ effect="dark"
+ >
+ <el-icon><Warning /></el-icon>
+ 瓒呮椂鏈惎鍔�
+ </el-tag>
+ <!-- 姝e父鐘舵�佹椂鏄剧ず璁惧鐘舵�� -->
+ <el-tag
+ v-else
+ :type="getDeviceStatusType(scope.row.status)"
+ size="small"
+ >
+ <el-icon v-if="scope.row.status === '杩愯涓�'"><VideoPlay /></el-icon>
+ <el-icon v-else><VideoPause /></el-icon>
+ {{ scope.row.status || '鏈煡' }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="璁″垝杩愯鏃堕棿"
+ prop="planRuntimeTime"
+ width="150"
+ align="center"
+ >
+ <template #default="scope">
+ {{ scope.row.planRuntimeTime || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="寮�濮嬭繍琛屾椂闂�"
+ prop="startRuntimeTime"
+ width="180"
+ align="center"
+ >
+ <template #default="scope">
+ {{ scope.row.startRuntimeTime || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="缁撴潫杩愯鏃堕棿"
+ prop="endRuntimeTime"
+ width="180"
+ align="center"
+ >
+ <template #default="scope">
+ {{ scope.row.endRuntimeTime || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="杩愯鏃堕暱"
+ prop="runtimeDuration"
+ width="120"
+ align="center"
+ >
+ <template #default="scope">
+ {{ scope.row.runtimeDuration || '-' }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ label="鎿嶄綔"
+ width="120"
+ align="center"
+ >
+ <template #default="scope">
+ <!-- 瓒呮椂鏈惎鍔ㄦ椂鏄剧ず鍚姩鎸夐挳 -->
+ <el-button
+ v-if="isOverdue(scope.row)"
+ type="warning"
+ size="small"
+ @click="changeDeviceStatus(scope.row, '鍚姩杩愯')"
+ >
+ <el-icon><VideoPlay /></el-icon>
+ 绔嬪嵆鍚姩
+ </el-button>
+ <!-- 姝e父鐘舵�佹椂鏄剧ず瀵瑰簲鐨勬搷浣滄寜閽� -->
+ <template v-else>
+ <el-button
+ v-if="scope.row.status === '杩愯涓�'"
+ type="danger"
+ size="small"
+ @click="changeDeviceStatus(scope.row, '鍋滄杩愯')"
+ >
+ <el-icon><VideoPause /></el-icon>
+ 鍋滄杩愯
+ </el-button>
+ <el-button
+ v-else
+ type="success"
+ size="small"
+ @click="changeDeviceStatus(scope.row, '鍚姩杩愯')"
+ >
+ <el-icon><VideoPlay /></el-icon>
+ 鍚姩杩愯
+ </el-button>
+ </template>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-card>
+
+
+ </div>
+</template>
+
+<script setup>
+import { ref, onMounted, computed } from 'vue'
+import { ElMessage } from 'element-plus'
+import {
+ VideoPlay,
+ VideoPause,
+ Warning
+} from '@element-plus/icons-vue'
+import {editLedger, getLedgerPage} from "@/api/equipmentManagement/ledger.js";
+
+// 鍝嶅簲寮忔暟鎹�
+const deviceFilter = ref('all')
+const loading = ref(false)
+const total = ref(0)
+const queryParams = ref({
+ current: -1,
+ size: -1
+})
+
+// 绉婚櫎姒傝鏁版嵁锛屽洜涓虹幇鍦ㄤ娇鐢ㄨ〃鏍煎睍绀�
+
+// 璁惧鍚仠璁板綍鏁版嵁
+const deviceRecords = ref([])
+const allDeviceRecords = ref([]) // 瀛樺偍鎵�鏈夊師濮嬫暟鎹�
+
+// 鏍规嵁绛涢�夋潯浠惰繃婊ゆ暟鎹�
+const filteredDeviceRecords = computed(() => {
+ let filtered = allDeviceRecords.value
+
+ // 鏍规嵁璁惧鐘舵�佺瓫閫�
+ if (deviceFilter.value !== 'all') {
+ if (deviceFilter.value === 'start') {
+ filtered = filtered.filter(device => device.status === '杩愯涓�')
+ } else if (deviceFilter.value === 'stop') {
+ filtered = filtered.filter(device => device.status === '鍋滄杩愯')
+ }
+ }
+
+ return filtered
+})
+
+// 妫�鏌ヨ澶囨槸鍚﹁秴鏃舵湭鍚姩
+const isOverdue = (device) => {
+ if (!device.planRuntimeTime || device.status === '杩愯涓�' || device.startRuntimeTime) {
+ return false
+ }
+
+ const planTime = new Date(device.planRuntimeTime)
+ const currentTime = new Date()
+
+ return currentTime > planTime
+}
+
+// 鏂规硶
+const getList = async () => {
+ loading.value = true
+ try {
+ const response = await getLedgerPage(queryParams.value)
+ if (response.code === 200) {
+ allDeviceRecords.value = response.data.records || []
+ total.value = response.data.total || 0
+ }
+ } catch (error) {
+ console.error('鑾峰彇璁惧鍒楄〃澶辫触:', error)
+ ElMessage.error('鑾峰彇璁惧鍒楄〃澶辫触')
+ } finally {
+ loading.value = false
+ }
+}
+
+const changeDeviceStatus = async (device, status) => {
+ try {
+ const currentTime = new Date().toLocaleString('zh-CN', {
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit',
+ hour12: false
+ }).replace(/\//g, '-')
+
+ // 鏇存柊璁惧鐘舵�佸拰鐩稿叧鏃堕棿瀛楁
+ if (status === '鍚姩杩愯') {
+ device.status = '杩愯涓�'
+ device.startRuntimeTime = currentTime
+ device.endRuntimeTime = null // 娓呯┖缁撴潫鏃堕棿
+ device.runtimeDuration = null // 娓呯┖杩愯鏃堕暱
+ } else {
+ device.status = '鍋滄杩愯'
+ device.endRuntimeTime = currentTime
+ // 璁$畻杩愯鏃堕暱
+ if (device.startRuntimeTime) {
+ const startTime = new Date(device.startRuntimeTime)
+ const endTime = new Date(currentTime)
+ const duration = endTime - startTime
+ const hours = Math.floor(duration / (1000 * 60 * 60))
+ const minutes = Math.floor((duration % (1000 * 60 * 60)) / (1000 * 60))
+ device.runtimeDuration = `${hours}灏忔椂${minutes}鍒嗛挓`
+ }
+ }
+ const params = {
+ id: device.id,
+ status: device.status,
+ planRuntimeTime: device.planRuntimeTime,
+ startRuntimeTime: device.startRuntimeTime,
+ endRuntimeTime: device.endRuntimeTime,
+ runtimeDuration: device.runtimeDuration,
+ }
+ // 璋冪敤API鏇存柊璁惧鐘舵��
+ const response = await editLedger(params)
+ if (response.code === 200) {
+ ElMessage.success(`${device.deviceName} ${status}鎴愬姛`)
+ // 鍒锋柊鍒楄〃
+ await getList()
+ } else {
+ ElMessage.error(response.msg || '鎿嶄綔澶辫触')
+ }
+ } catch (error) {
+ console.error('鏇存柊璁惧鐘舵�佸け璐�:', error)
+ ElMessage.error('鎿嶄綔澶辫触')
+ }
+}
+
+const getDeviceStatusType = (status) => {
+ if (status === '杩愯涓�') {
+ return 'success'
+ } else if (status === '鍋滄杩愯') {
+ return 'danger'
+ } else {
+ return 'info'
+ }
+}
+
+// 鑾峰彇琛ㄦ牸琛岀殑绫诲悕
+const getRowClassName = ({ row }) => {
+ if (isOverdue(row)) {
+ return 'overdue-row'
+ }
+ return ''
+}
+
+
+
+// 缁勪欢鎸傝浇鏃跺垵濮嬪寲鏁版嵁
+onMounted(() => {
+ getList()
+})
+</script>
+
+<style scoped>
+.app-container {
+ padding: 20px;
+ background: #f5f7fa;
+ min-height: 100vh;
+}
+
+
+.filter-section {
+ margin-bottom: 20px;
+ padding: 15px;
+ background: #fff;
+ border-radius: 8px;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+ display: flex;
+ justify-content: flex-start;
+}
+
+.table-card {
+ margin-bottom: 20px;
+ border-radius: 8px;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
+}
+
+:deep(.el-card__header) {
+ background: #f8f9fa;
+ border-bottom: 1px solid #e9ecef;
+ font-weight: 500;
+ font-size: 16px;
+}
+
+:deep(.el-table .el-table__header-wrapper th) {
+ background-color: #F0F1F5 !important;
+ color: #333333;
+ font-weight: 600;
+}
+
+:deep(.el-table .el-table__body-wrapper td) {
+ padding: 12px 0;
+}
+
+:deep(.el-select) {
+ width: 100%;
+}
+
+:deep(.el-tag) {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+}
+
+/* 瓒呮椂鏈惎鍔ㄨ鐨勬牱寮� */
+:deep(.overdue-row) {
+ background-color: #fef0f0 !important;
+ border-left: 4px solid #f56c6c;
+}
+
+:deep(.overdue-row:hover) {
+ background-color: #fde2e2 !important;
+}
+
+:deep(.overdue-row td) {
+ background-color: transparent !important;
+}
+</style>
--
Gitblit v1.9.3