浏览代码

缓存科室数据

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