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

@ -23,6 +23,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="1"></el-option>
@ -56,6 +59,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>
</div>
</div>
</div>
@ -379,6 +383,7 @@ const taskStatus = ref('');
const priority = ref('');
const executor = ref('');
const dateRange = ref([]);
const keyword = ref('');
// 分页相关
const currentPage = ref(1);
@ -438,8 +443,13 @@ const fetchRepairRecords = async () => {
// 筛选后的记录
const filteredRecords = computed(() => {
// 实际应用中这里会根据筛选条件过滤数据
return repairRecords.value;
const kw = keyword.value.trim().toLowerCase();
if (!kw) return repairRecords.value;
return repairRecords.value.filter((r) =>
[r.id, r.reportInfo, r.reportName, r.sendPersonVo?.userName, getStatusText(r.status)]
.filter(Boolean)
.some((v) => String(v).toLowerCase().includes(kw))
);
});
// 搜索处理
@ -448,6 +458,17 @@ const handleSearch = () => {
fetchRepairRecords(); // 重新获取数据
};
// 重置筛选
const resetFilters = () => {
taskStatus.value = '';
priority.value = '';
executor.value = '';
dateRange.value = [];
keyword.value = '';
currentPage.value = 1;
fetchRepairRecords();
};
// 分页事件
const handleSizeChange = (val) => {
pageSize.value = val;