Ver Fonte

refactor(repair-form): 重构搜索表单重置逻辑,清空所有查询条件

- 重置时新增清空 keyword、zbh、actualUser、repairUserName、content、statusList 等字段
- 将部门清空与恢复默认部门的逻辑拆分为独立判断
- 统一 no 参数保留与 skipDeptDefault 的条件分支结构
- 更新注释说明重置目标为初始进入界面时的查询状态
dazhaxie há 2 semanas atrás
pai
commit
885e24283c
1 ficheiros alterados com 14 adições e 5 exclusões
  1. 14 5
      src/views/repair/application-form/RepairForm.vue

+ 14 - 5
src/views/repair/application-form/RepairForm.vue

@@ -443,17 +443,26 @@ export default {
       this.selectedRows = selectedRows
     },
     resetSearchForm() {
-      // 「所有工单」重置后恢复本部门;「我的工单」和通知跳转不限制部门
+      // 重置为刚进界面时的查询状态
       const no = this.$route.query.no
       const skipDeptDefault = no != null || this.searchType === 2
-      // 先清空所有查询条件,让 a-select 组件先响应清空状态
-      this.queryParam.deptIdList = []
+      // 清空所有查询条件,与初始化时保持一致
+      this.queryParam.keyword = null
+      this.queryParam.zbh = null
+      this.queryParam.actualUser = null
+      this.queryParam.repairUserName = null
+      this.queryParam.content = null
+      this.queryParam.statusList = null
       this.queryParam.searchStartTime = null
       this.queryParam.searchEndTime = null
+      // 部门:先清空让 a-select 同步状态
+      this.queryParam.deptIdList = []
+      // 保留 no 参数(通知跳转场景)
       if (no != null) {
         this.queryParam.no = no
-      } else if (!skipDeptDefault) {
-        // 等 a-select 同步清空后,再恢复默认部门,避免标签删不掉
+      }
+      // 「所有工单」恢复默认部门,等 a-select 同步清空后再设值,避免标签删不掉
+      if (!skipDeptDefault) {
         this.$nextTick(() => {
           this.queryParam.deptIdList = [this.$store.getters.userInfo.deptId]
         })