소스 검색

缓存科室数据

zhouna 6 년 전
부모
커밋
166b815b38
2개의 변경된 파일20개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      src/components/preTreat/AddQuestionModules.vue
  2. 10 0
      src/components/preTreat/QuestionModules.vue

+ 10 - 0
src/components/preTreat/AddQuestionModules.vue

@@ -176,9 +176,19 @@
             this.moduleTypes =  res.data.data[4];
           }
         });
+        this.getDeptList();
+      },
+      getDeptList(){
+        const depts = localStorage.getItem("precDeptList");
+        const list = depts?JSON.parse(depts):[];
+        if(list&&list.length>0){
+          this.deptList = list;
+          return ;
+        }
         api.getDeptList({moduleType:0,type:1}).then((res) =>{
           if(res.data.code === '0') {
             this.deptList = res.data.data&&res.data.data.deptDTOS||[];
+            localStorage.setItem("precDeptList",JSON.stringify(this.deptList));
           }
         });
       },

+ 10 - 0
src/components/preTreat/QuestionModules.vue

@@ -132,9 +132,19 @@
             this.tagTypes =  res.data.data[4];
           }
         });
+        this.getDeptList();
+      },
+      getDeptList(){
+        const depts = localStorage.getItem("precDeptList");
+        const list = depts?JSON.parse(depts):[];
+        if(list&&list.length>0){
+          this.deptList = list;
+          return ;
+        }
         api.getDeptList({moduleType:0,type:1}).then((res) =>{
           if(res.data.code === '0') {
             this.deptList = res.data.data&&res.data.data.deptDTOS||[];
+            localStorage.setItem("precDeptList",JSON.stringify(this.deptList));
           }
         });
       },