Ver código fonte

feat(repair): 调整「我的工单」不默认按部门筛选

- 新增 searchType === 2 判断,使「我的工单」跳过部门默认筛选
- 重构 resetSearchForm 逻辑,将 table.refresh 调用统一至条件分支外部
- 更新相关注释,明确三种不限制部门的场景
dazhaxie 2 semanas atrás
pai
commit
0db77f46f7
1 arquivos alterados com 7 adições e 6 exclusões
  1. 7 6
      src/views/repair/application-form/RepairForm.vue

+ 7 - 6
src/views/repair/application-form/RepairForm.vue

@@ -162,12 +162,13 @@ export default {
     }
     }
   },
   },
   data() {
   data() {
-    // 从通知链接跳转时(带no参数)不默认按本部门筛选,其他情况默认显示本部门工单
+    // 「所有工单」默认展示本部门;「我的工单」和通知跳转(带no参数)不限制部门
     const hasNoParam = this.$route.query.no != null
     const hasNoParam = this.$route.query.no != null
+    const skipDeptDefault = hasNoParam || this.searchType === 2
     return {
     return {
       // 查询参数
       // 查询参数
       queryParam: {
       queryParam: {
-        deptIdList: hasNoParam ? [] : [this.$store.getters.userInfo.deptId],
+        deptIdList: skipDeptDefault ? [] : [this.$store.getters.userInfo.deptId],
         searchStartTime: null,
         searchStartTime: null,
         searchEndTime: null
         searchEndTime: null
       },
       },
@@ -442,22 +443,22 @@ export default {
       this.selectedRows = selectedRows
       this.selectedRows = selectedRows
     },
     },
     resetSearchForm() {
     resetSearchForm() {
-      // 重置时:仅通知跳转(带no参数)不恢复部门筛选,其他情况恢复默认部门
+      // 「所有工单」重置后恢复本部门;「我的工单」和通知跳转不限制部门
       const no = this.$route.query.no
       const no = this.$route.query.no
+      const skipDeptDefault = no != null || this.searchType === 2
       // 先清空所有查询条件,让 a-select 组件先响应清空状态
       // 先清空所有查询条件,让 a-select 组件先响应清空状态
       this.queryParam.deptIdList = []
       this.queryParam.deptIdList = []
       this.queryParam.searchStartTime = null
       this.queryParam.searchStartTime = null
       this.queryParam.searchEndTime = null
       this.queryParam.searchEndTime = null
       if (no != null) {
       if (no != null) {
         this.queryParam.no = no
         this.queryParam.no = no
-      this.$refs.table.refresh(true)
-      } else {
+      } else if (!skipDeptDefault) {
         // 等 a-select 同步清空后,再恢复默认部门,避免标签删不掉
         // 等 a-select 同步清空后,再恢复默认部门,避免标签删不掉
         this.$nextTick(() => {
         this.$nextTick(() => {
           this.queryParam.deptIdList = [this.$store.getters.userInfo.deptId]
           this.queryParam.deptIdList = [this.$store.getters.userInfo.deptId]
-      this.$refs.table.refresh(true)
         })
         })
       }
       }
+      this.$refs.table.refresh(true)
     },
     },
     doExport() {
     doExport() {
       const parameter = {
       const parameter = {