Files
maintenance_system/src/views/zhinengxunjian/cheliangzhuangtai.vue

740 lines
18 KiB
Vue
Raw Normal View History

2025-09-17 15:53:38 +08:00
<template>
<div>
<div class="execution-records">
<!-- 顶部导航栏 -->
<div class="navigation-tabs">
<div class="nav-tab" @click="handleInspection1">待办事项</div>
<div class="nav-tab" @click="handleInspection2">巡检管理</div>
<div class="nav-tab" @click="handleInspection3">试验管理</div>
<div class="nav-tab" @click="handleInspection4">报修管理</div>
<div class="nav-tab" @click="handleInspection5">抢修管理</div>
<div class="nav-tab" @click="handleInspection6">工单管理</div>
<div class="nav-tab active" @click="handleInspection7">运维组织</div>
</div>
<!-- 页面标题 -->
<TitleComponent title="运维组织模块" subtitle="实时监控人员状态、车辆状态和班组状态"></TitleComponent>
<!-- 选项卡 -->
<div class="tabs-wrapper">
<div style="display: flex; align-items: center; gap: 10px">
<el-button type="primary" @click="handleInspectionManagement1">人员状态</el-button>
<el-button type="primary" @click="handleInspectionManagement2">车辆状态</el-button>
<el-button type="primary" @click="handleInspectionManagement3">班组状态</el-button>
</div>
</div>
<!-- 搜索和筛选区 -->
<div class="search-filter">
<div class="search-container">
<!-- 左侧统计数据和车辆图片组合 -->
<div class="stats-and-image">
<div class="vehicle-stats">
<div class="stats-container">
<div class="vehicle-stats">
<!-- 总车辆数 -->
<div class="stat-item">
<div class="stat-label">总车辆数</div>
<div class="stat-value">{{ totalVehicles }}</div>
<div class="stat-desc">所有运维车辆总数</div>
</div>
<!-- 可用车辆 -->
<div class="stat-item">
<div class="stat-label">可用车辆</div>
<div class="stat-value">{{ availableVehicles }}</div>
<div class="stat-desc available">可立即调度</div>
</div>
<!-- 使用中 -->
<div class="stat-item">
<div class="stat-label">使用中</div>
<div class="stat-value">{{ inUseVehicles }}</div>
<div class="stat-desc in-use">执行任务中</div>
</div>
<!-- 维修/保养 -->
<div class="stat-item">
<div class="stat-label">维修/保养</div>
<div class="stat-value">{{ maintenanceVehicles }}</div>
<div class="stat-desc maintenance">预计2天后可用</div>
</div>
<img src="@/assets/images/car.png" class="img-car" alt="车辆图片" />
</div>
</div>
</div>
</div>
<!-- 右侧搜索区域 -->
<div class="search-integrated">
<div class="search-box">
<div class="search-label">搜索车牌号</div>
<div class="license-plate-input">
<span class="plate-prefix"></span>
<span class="plate-dot">·</span>
<el-input v-model="plateNumber1" maxlength="1" class="plate-char"></el-input>
<el-input v-model="plateNumber2" maxlength="1" class="plate-char"></el-input>
<el-input v-model="plateNumber3" maxlength="1" class="plate-char"></el-input>
<el-input v-model="plateNumber4" maxlength="1" class="plate-char"></el-input>
<el-input v-model="plateNumber5" maxlength="1" class="plate-char"></el-input>
</div>
</div>
</div>
</div>
</div>
<!-- 车辆列表表格 -->
<div class="table-wrapper">
<el-table :data="pagedTableData" stripe style="width: 100%" highlight-current-row class="custom-table">
<el-table-column align="center" prop="vehicleId" label="车辆编号" min-width="120"></el-table-column>
<el-table-column align="center" prop="licensePlate" label="车牌号" min-width="120"></el-table-column>
<el-table-column align="center" prop="vehicleType" label="车辆类型" min-width="120"></el-table-column>
<el-table-column align="center" prop="team" label="所属班组" min-width="120"></el-table-column>
<el-table-column align="center" prop="responsiblePerson" label="负责人" min-width="120"></el-table-column>
<el-table-column align="center" prop="currentTask" label="当前任务" min-width="150"></el-table-column>
<el-table-column align="center" prop="status" label="当前状态" min-width="120">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)" class="status-tag">
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="nextMaintenance" label="下次保养" min-width="120"></el-table-column>
<el-table-column align="center" label="操作" min-width="180" fixed="right">
<template #default="scope">
<el-button type="text" @click="handleViewDetails(scope.row)" size="small" class="action-btn">详情</el-button>
<el-button
type="text"
@click="handleDispatch(scope.row)"
size="small"
class="action-btn dispatch-btn"
v-if="scope.row.status === '可用'"
>
调度
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页区域 -->
<div class="pagination-section">
<div class="pagination-info">
显示第{{ (currentPage - 1) * pageSize + 1 }}{{ Math.min(currentPage * pageSize, total) }}{{ total }}条记录
</div>
<div class="pagination-controls">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="prev, pager, next, jumper"
:total="total"
background
>
</el-pagination>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, computed } from 'vue';
import router from '@/router';
import TitleComponent from './TitleComponent.vue';
// 搜索和筛选条件
const searchKeyword = ref('');
const plateNumber1 = ref('');
const plateNumber2 = ref('');
const plateNumber3 = ref('');
const plateNumber4 = ref('');
const plateNumber5 = ref('');
// 车辆数据
const rawTableData = ref([
{
vehicleId: 'CAR-001',
licensePlate: '京A·12345',
vehicleType: '工具车',
team: '第一运维组',
responsiblePerson: '赵工',
currentTask: '无',
status: '可用',
nextMaintenance: '2023-07-15'
},
{
vehicleId: 'CAR-003',
licensePlate: '京B·67890',
vehicleType: '小型货车',
team: '第二运维组',
responsiblePerson: '赵工',
currentTask: 'WO-2023-0619-055',
status: '使用中',
nextMaintenance: '2023-08-20'
},
{
vehicleId: 'CAR-005',
licensePlate: '京C·24680',
vehicleType: '工程车',
team: '第一运维组',
responsiblePerson: '赵工',
currentTask: 'WO-2023-0618-054',
status: '使用中',
nextMaintenance: '2023-07-15'
},
{
vehicleId: 'CAR-007',
licensePlate: '京D·13579',
vehicleType: '面包车',
team: '第三运维组',
responsiblePerson: '赵工',
currentTask: '无',
status: '维修中',
nextMaintenance: '2023-07-15'
},
{
vehicleId: 'CAR-009',
licensePlate: '京E·12345',
vehicleType: '工具车',
team: '第一运维组',
responsiblePerson: '赵工',
currentTask: '无',
status: '可用',
nextMaintenance: '2023-07-15'
},
{
vehicleId: 'CAR-011',
licensePlate: '京F·12345',
vehicleType: '工具车',
team: '第一运维组',
responsiblePerson: '赵工',
currentTask: '无',
status: '可用',
nextMaintenance: '2023-07-15'
},
{
vehicleId: 'CAR-013',
licensePlate: '京G·12345',
vehicleType: '工具车',
team: '第一运维组',
responsiblePerson: '赵工',
currentTask: '无',
status: '可用',
nextMaintenance: '2023-07-15'
}
]);
// 分页相关
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(rawTableData.value.length);
// 统计数据
const totalVehicles = computed(() => rawTableData.value.length);
const availableVehicles = computed(() => rawTableData.value.filter((v) => v.status === '可用').length);
const inUseVehicles = computed(() => rawTableData.value.filter((v) => v.status === '使用中').length);
const maintenanceVehicles = computed(() => rawTableData.value.filter((v) => v.status === '维修中').length);
// 分页处理后的数据
const pagedTableData = computed(() => {
// 筛选逻辑
let filteredData = [...rawTableData.value];
// 搜索关键词筛选
if (searchKeyword.value) {
const keyword = searchKeyword.value.toLowerCase();
filteredData = filteredData.filter(
(item) =>
item.vehicleId.toLowerCase().includes(keyword) ||
item.licensePlate.toLowerCase().includes(keyword) ||
item.vehicleType.toLowerCase().includes(keyword)
);
}
// 车牌号筛选
const plateNumber = plateNumber1.value + plateNumber2.value + plateNumber3.value + plateNumber4.value + plateNumber5.value;
if (plateNumber) {
filteredData = filteredData.filter((item) => item.licensePlate.replace(/[·\s]/g, '').includes(plateNumber));
}
// 更新总条数
total.value = filteredData.length;
// 分页处理
const startIndex = (currentPage.value - 1) * pageSize.value;
const endIndex = startIndex + pageSize.value;
return filteredData.slice(startIndex, endIndex);
});
// 获取状态标签样式
const getStatusTagType = (status) => {
const statusMap = {
'可用': 'success',
'使用中': 'primary',
'维修中': 'warning'
};
return statusMap[status] || 'default';
};
// 搜索处理
const handleSearch = () => {
currentPage.value = 1; // 重置到第一页
};
// 分页事件
const handleSizeChange = (val) => {
pageSize.value = val;
currentPage.value = 1;
};
const handleCurrentChange = (val) => {
currentPage.value = val;
};
// 操作按钮事件
const handleViewDetails = (row) => {
console.log('查看详情:', row);
// 实际应用中这里会跳转到详情页
};
const handleDispatch = (row) => {
console.log('调度车辆:', row);
// 实际应用中这里会打开调度表单
};
// 导航路由跳转
const handleInspection1 = () => {
router.push('/rili/rili');
};
const handleInspection2 = () => {
router.push('/rili/InspectionManagement');
};
const handleInspection3 = () => {
router.push('/rili/shiyanguanli');
};
const handleInspection4 = () => {
router.push('/rili/baoxiuguanli');
};
const handleInspection5 = () => {
router.push('/rili/qiangxiuguanli');
};
const handleInspection6 = () => {
router.push('/rili/gongdanliebiao');
};
const handleInspection7 = () => {
router.push('/rili/renyuanzhuangtai');
};
const handleInspectionManagement1 = () => {
router.push('/rili/renyuanzhuangtai');
};
const handleInspectionManagement2 = () => {
router.push('/rili/cheliangzhuangtai');
};
const handleInspectionManagement3 = () => {
router.push('/rili/banzhuzhuangtai');
};
</script>
<style scoped>
.execution-records {
padding: 20px;
background-color: #f5f7fa;
min-height: 100vh;
}
/* 选项卡样式 */
.tabs-wrapper {
background-color: #fff;
padding: 20px;
border-radius: 8px;
margin-bottom: 16px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
/* 搜索和筛选区样式 */
.search-filter {
border-radius: 12px;
margin-bottom: 24px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
overflow: hidden;
transition: box-shadow 0.3s ease;
background: linear-gradient(135deg, #f0f7ff 0%, #f5f7fa 100%);
}
.search-container {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24px 32px;
min-height: 140px;
position: relative;
}
/* 统计数据和车辆图片组合容器 */
.stats-and-image {
display: flex;
align-items: center;
gap: 40px;
flex: 1;
max-width: calc(100% - 350px);
}
/* 车辆统计区域 */
.vehicle-stats {
display: flex;
gap: 28px;
align-items: center;
flex-wrap: wrap;
position: relative;
z-index: 2;
}
/* 搜索区域 */
.search-integrated {
display: flex;
align-items: center;
justify-content: flex-end;
width: 320px;
z-index: 2;
}
.search-box {
background-color: rgba(255, 255, 255, 0.95);
border-radius: 12px;
padding: 20px 24px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.5);
}
.search-label {
font-size: 14px;
font-weight: 600;
color: #2c3e50;
margin-bottom: 10px;
}
.stat-item {
flex: 1;
background-color: rgba(255, 255, 255, 0.95);
padding: 20px 28px;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
min-width: 160px;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.5);
}
.stat-item:hover {
transform: translateY(-5px) scale(1.02);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
border-color: rgba(255, 255, 255, 0.8);
}
.stat-value {
font-size: 32px;
font-weight: 700;
margin-bottom: 6px;
line-height: 1.2;
letter-spacing: -0.5px;
}
.stat-label {
font-size: 16px;
font-weight: 600;
margin-bottom: 4px;
color: #2c3e50;
}
.stat-desc {
font-size: 13px;
color: #606266;
opacity: 0.9;
}
.stats-container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
display: inline-block; /* 适应内容宽度 */
}
.vehicle-stats {
display: flex;
gap: 40px; /* 统计项之间的间距 */
align-items: flex-start; /* 顶部对齐 */
}
.stat-item {
text-align: center;
min-width: 120px; /* 保证每个项的最小宽度 */
}
.stat-label {
font-size: 16px;
font-weight: bold;
color: #1f2937; /* 深色标题(与参考图一致) */
margin-bottom: 8px;
}
.stat-value {
font-size: 24px;
font-weight: bold;
color: #1f2937; /* 深色数值(与参考图一致) */
margin-bottom: 4px;
}
.stat-desc {
font-size: 12px;
color: #6b7280; /* 浅灰色默认描述 */
}
/* 不同状态的描述文字颜色 */
.stat-desc.available {
color: #059669; /* 绿色(可立即调度) */
}
.stat-desc.in-use {
color: #d97706; /* 橙色(执行任务中) */
}
.stat-desc.maintenance {
color: #dc2626; /* 红色预计2天后可用 */
}
/* 车牌号输入样式 */
.license-plate-input {
display: flex;
align-items: center;
background-color: #fff;
border: 2px solid #e6e6e6;
border-radius: 8px;
overflow: hidden;
transition: all 0.3s ease;
}
.license-plate-input:hover {
border-color: #c0c4cc;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.plate-prefix {
background-color: #f5f7fa;
padding: 0 12px;
height: 42px;
line-height: 42px;
border-right: 1px solid #dcdfe6;
font-weight: 600;
font-size: 14px;
color: #303133;
}
.plate-dot {
padding: 0 6px;
height: 42px;
line-height: 42px;
color: #606266;
font-size: 24px;
font-weight: 500;
}
.plate-char {
width: 32px !important;
height: 42px !important;
text-align: center;
border: none;
border-right: 1px solid #f0f0f0;
background-color: #fff;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
}
.plate-char:focus {
background-color: #f0f7ff;
color: #409eff;
font-weight: 600;
}
.plate-char:last-child {
border-right: none;
}
/* 表格样式优化 */
.table-wrapper {
background-color: #fff;
border-radius: 8px;
margin-bottom: 24px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
overflow: hidden;
}
/* 状态标签样式 */
.status-tag {
padding: 4px 10px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}
/* 操作按钮样式优化 */
.action-btn {
color: #165dff;
font-size: 13px;
padding: 4px 10px;
margin: 0 3px;
transition: all 0.2s ease;
}
.action-btn:hover {
color: #094ab2;
background-color: #e6f7ff;
}
.dispatch-btn {
color: #52c41a;
}
.dispatch-btn:hover {
color: #389e0d;
background-color: #f6ffed;
}
/* 分页区域样式 */
.pagination-section {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #fff;
padding: 16px 24px;
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
.pagination-info {
font-size: 14px;
color: #606266;
}
.pagination-controls .el-pagination {
margin: 0;
}
.pagination-controls .el-pagination button,
.pagination-controls .el-pagination .el-pager li {
min-width: 36px;
height: 36px;
line-height: 36px;
border-radius: 4px;
}
.pagination-controls .el-pagination .el-pager li.active {
background-color: #165dff;
color: #fff;
}
.img-car {
max-width: 350px;
max-height: 350px;
}
/* 导航栏样式 */
.navigation-tabs {
display: flex;
margin-bottom: 20px;
background-color: #fff;
border-radius: 4px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
padding: 2px;
}
.nav-tab {
padding: 12px 24px;
cursor: pointer;
transition: all 0.3s ease;
border-radius: 4px;
font-size: 14px;
color: #606266;
border-right: 1px solid #f0f0f0;
flex: 1;
text-align: center;
}
.nav-tab:last-child {
border-right: none;
}
.nav-tab:hover {
color: #409eff;
background-color: #ecf5ff;
}
.nav-tab.active {
background-color: #409eff;
color: #fff;
box-shadow: 0 2px 4px rgba(64, 158, 255, 0.3);
}
/* 响应式设计 */
@media (max-width: 1200px) {
.search-container {
flex-direction: column;
align-items: flex-start;
}
.stats-and-image {
max-width: 100%;
width: 100%;
}
.search-integrated {
width: 100%;
justify-content: flex-start;
}
}
@media (max-width: 992px) {
.stats-and-image {
flex-direction: column;
align-items: flex-start;
}
.vehicle-image-container {
width: 100%;
max-width: 300px;
}
}
@media (max-width: 768px) {
.execution-records {
padding: 10px;
}
.navigation-tabs {
flex-wrap: wrap;
}
.nav-tab {
flex: 1 0 33%;
padding: 10px 0;
font-size: 12px;
}
.vehicle-stats {
gap: 10px;
}
.stat-item {
flex: 1 0 40%;
padding: 10px;
}
.stat-value {
font-size: 20px;
}
.pagination-section {
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
}
</style>