From f0f64b9d454d7dd6c8f03c72e7be1fcf44a396e6 Mon Sep 17 00:00:00 2001 From: luoyu Date: Wed, 21 May 2025 21:15:37 +0800 Subject: [PATCH] =?UTF-8?q?202505212115=E4=BF=AE=E5=A4=8D=20=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E8=BF=87=E5=90=8E,=E7=82=B9=E5=87=BB=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E6=9F=A5=E7=9C=8B=E5=B9=B6=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=90=8E,=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E9=83=BD=E6=B2=A1=E4=BA=86,=E8=BF=98=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=AD=9B=E9=80=89,=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=B5=B7=E6=9D=A5=E6=AF=94=E8=BE=83=E9=BA=BB?= =?UTF-8?q?=E7=83=A6=E6=AF=8F=E6=AC=A1=E9=83=BD=E9=9C=80=E8=A6=81=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E8=BF=9B=E8=A1=8C=E7=AD=9B=E9=80=89.=20=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=96=B9=E6=A1=88=EF=BC=9A=20=E9=87=87=E7=94=A8?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E5=AD=98=E5=82=A8=E3=80=81=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6=E3=80=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E6=96=B0=E5=A2=9E=E8=BF=94=E5=9B=9E=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=8C=E4=BE=BF=E4=BA=8E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/admin/RepairList.vue | 110 +++++++++------------------------ 1 file changed, 30 insertions(+), 80 deletions(-) diff --git a/src/views/admin/RepairList.vue b/src/views/admin/RepairList.vue index 6e3f937..780bd40 100644 --- a/src/views/admin/RepairList.vue +++ b/src/views/admin/RepairList.vue @@ -84,8 +84,6 @@ 查询 重置 - 保存筛选条件 - 清除筛选条件 导出工单模版 导入 导出工单数据 @@ -403,8 +401,30 @@ export default { this.selectedRows = selectedRows }, reset() { - // 直接调用清除筛选条件的方法 - this.clearUserFilterConditions() + this.queryParam = { + 'type': 'all', + 'explain': '', + 'sn': '', + 'typeId': '', + 'deviceId': '', + 'status': '', + 'repairLevel': '', + 'beginTime': '', + 'endTime': '', + 'evalService': '', + 'timeout': '', + 'remark': '', + 'name': '' + } + this.dateRange = [] + + // 清除localStorage中保存的筛选条件 + localStorage.removeItem('repairListFilterConditions') + + this.handleOk(true) + // this.queryParam = {} + // this.queryParam.typeId = '' + // this.selectRepairList() }, customRequest(file) { // file 是上传的文件 其内容会在放在下面截图中 @@ -571,12 +591,12 @@ export default { this.$refs.modal.add() }, handleView(repairId) { - // 不再自动保存筛选条件,而是依赖用户主动点击保存按钮 - // try { - // this.saveFilterConditions() - // } catch (e) { - // console.error('保存筛选条件失败', e) - // } + // 保存当前筛选条件 + try { + this.saveFilterConditions() + } catch (e) { + console.error('保存筛选条件失败', e) + } // 跳转到详情页 this.$router.push({ name: 'repairView', query: { repairId: repairId } }) }, @@ -673,82 +693,12 @@ export default { this.$nextTick(() => { if (this.$refs.table) { this.$refs.table.refresh(true) - // 提示用户当前使用的是保存的筛选条件 - this.$message.info('已应用保存的筛选条件') } }) } catch (e) { console.error('恢复筛选条件失败:', e) } } - }, - saveUserFilterConditions() { - // 实现保存筛选条件的逻辑 - try { - // 检查是否有有效的筛选条件 - const hasFilter = Object.keys(this.queryParam).some(key => { - // 排除type为'all'的情况,这是默认值 - if (key === 'type' && this.queryParam[key] === 'all') { - return false - } - // 检查其他参数是否有值 - return this.queryParam[key] !== '' && this.queryParam[key] !== null && this.queryParam[key] !== undefined - }) - - // 检查日期范围 - const hasDateRange = this.dateRange && this.dateRange.length === 2 - - if (!hasFilter && !hasDateRange) { - this.$message.info('当前没有设置筛选条件,无需保存') - return - } - - // 保存筛选条件 - this.saveFilterConditions() - this.$message.success('筛选条件已保存,下次访问将自动应用') - } catch (e) { - console.error('保存筛选条件失败', e) - this.$message.error('保存筛选条件失败') - } - }, - clearUserFilterConditions() { - // 实现清除筛选条件的逻辑 - try { - // 清除localStorage中保存的筛选条件 - localStorage.removeItem('repairListFilterConditions') - - // 重置查询参数 - this.queryParam = { - 'type': 'all', - 'explain': '', - 'sn': '', - 'typeId': '', - 'deviceId': '', - 'status': '', - 'repairLevel': '', - 'beginTime': '', - 'endTime': '', - 'evalService': '', - 'timeout': '', - 'remark': '', - 'name': '' - } - - // 重置时间范围 - this.dateRange = [] - - // 刷新列表数据 - this.$nextTick(() => { - if (this.$refs.table) { - this.$refs.table.refresh(true) - } - }) - - this.$message.success('筛选条件已清除,列表已重置') - } catch (e) { - console.error('清除筛选条件失败', e) - this.$message.error('清除筛选条件失败') - } } }, watch: {}