Browse Source

缓存科室数据

zhouna 6 năm trước cách đây
mục cha
commit
166b815b38

+ 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));
           }
         });
       },