This commit is contained in:
dhr
2025-09-29 17:17:42 +08:00
parent db9e2e55ea
commit f58efb0e08
15 changed files with 411 additions and 364 deletions

View File

@ -22,6 +22,9 @@
<!-- 筛选栏 -->
<div class="filter-bar">
<div class="filter-container">
<div class="filter-item">
<el-input v-model="keyword" placeholder="关键字(名称/报修人/维修人/位置)" clearable @keyup.enter="handleSearch" />
</div>
<div class="filter-item">
<el-select v-model="taskStatus" placeholder="任务状态">
<el-option label="待执行" value="pending"></el-option>
@ -49,6 +52,7 @@
</div>
<div class="filter-actions">
<el-button type="primary" icon="Search" class="search-btn" @click="handleSearch"> 搜索 </el-button>
<el-button icon="Refresh" class="create-btn" @click="resetFilters"> 重置 </el-button>
<el-button type="primary" icon="Plus" class="create-btn" @click="handleCreateTask"> 手动创建任务 </el-button>
</div>
</div>
@ -426,6 +430,7 @@ import { xunjianUserlist } from '@/api/zhinengxunjian/xunjian';
const taskStatus = ref('all');
const planType = ref('all');
const executor = ref('all');
const keyword = ref('');
// 任务数据 - 添加了更多字段以展示滚动效果
const tasks = ref([]);
// 分页相关
@ -458,6 +463,16 @@ const handleSearch = () => {
getTaskList(); // 调用接口获取数据
};
// 重置筛选
const resetFilters = () => {
taskStatus.value = 'all';
planType.value = 'all';
executor.value = 'all';
keyword.value = '';
currentPage.value = 1;
getTaskList();
};
// 创建紧急抢修任务弹窗相关
const createTaskDialogVisible = ref(false);
const createTaskFormRef = ref(null); // 表单引用
@ -1090,9 +1105,8 @@ async function getTaskList() {
const res = await qiangxiulist(requestParams);
if (res.code === 200 && res.rows) {
total.value = res.total || 0;
// 将API返回的数据转换为前端显示所需的格式
tasks.value = res.rows.map((item) => ({
const mapped = res.rows.map((item) => ({
id: item.id,
title: item.name || '未命名抢修任务',
status: mapStatusToKey(item.status),
@ -1124,6 +1138,19 @@ async function getTaskList() {
// 添加needSupport字段确保从API返回数据中获取实际值
needSupport: item.support || ''
}));
// 关键词过滤
const kw = keyword.value.trim().toLowerCase();
const filtered = kw
? mapped.filter((t) =>
[t.title, t.reporter, t.maintainer, t.position, t.statusText]
.filter(Boolean)
.some((v) => String(v).toLowerCase().includes(kw))
)
: mapped;
tasks.value = filtered;
total.value = kw ? filtered.length : res.total || filtered.length;
} else {
tasks.value = [];
total.value = 0;
@ -1578,7 +1605,8 @@ setTimeout(() => {
.detail-value {
flex: 1;
color: #4e5969;
word-break: break-all;
word-break: break-word;
line-height: 1.5;
}
.task-result {
@ -1595,13 +1623,7 @@ setTimeout(() => {
align-items: center;
padding-top: 12px;
border-top: 1px solid #f0f2f5;
position: absolute;
bottom: 16px;
right: 16px;
left: 16px;
background-color: #fff;
padding: 12px 0 0 0;
z-index: 10;
}
.action-btn {
@ -1705,10 +1727,11 @@ setTimeout(() => {
}
.task-title {
font-size: 14px;
font-size: 16px;
font-weight: 500;
color: #1d2129;
line-height: 1.4;
word-break: break-word;
flex: 1;
margin-right: 8px;
}
@ -1721,35 +1744,32 @@ setTimeout(() => {
border: 1px solid transparent;
}
/* 不同故障类型的颜色 */
/* 电力,设备故障为红色 */
.task-type-tag.electric,
.task-type-tag.equipment {
/* 优先级标签背景色样式 - 与保修管理页面保持一致 */
.priority-high {
background-color: #fff2f0;
color: #ff4d4f;
border-color: #ffccc7;
}
/* 供水,设备损坏为黄色 */
.task-type-tag.water,
.task-type-tag.damage {
.priority-medium {
background-color: #fffbe6;
color: #fa8c16;
border-color: #ffe58f;
}
/* 其余为绿色 */
.task-type-tag {
background-color: #f6ffed;
color: #52c41a;
border-color: #b7eb8f;
.priority-low {
background-color: #e6f7ff;
color: #1890ff;
border-color: #91d5ff;
}
.task-card:hover {
transform: translateY(-3px);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.task-card[data-v-2668390e]::before {
/* 左侧状态线样式 - 与保修管理页面保持一致 */
.task-card::before {
content: '';
position: absolute;
left: 0;
@ -1757,6 +1777,22 @@ setTimeout(() => {
bottom: 0;
width: 4px;
}
.left-line-high::before {
background-color: #ff4d4f;
}
.left-line-medium::before {
background-color: #fa8c16;
}
.left-line-low::before {
background-color: #1677ff;
}
.left-line-completed::before {
background-color: #52c41a;
}
.task-details {
margin-bottom: 16px;
}
@ -1769,8 +1805,9 @@ setTimeout(() => {
}
.detail-label {
flex: 0 0 70px;
flex: 0 0 85px;
color: #86909c;
margin-right: 4px;
}
.detail-value {