wenhongquan 3 years ago
parent
commit
2d3dd4b5f4
1 changed files with 8 additions and 35 deletions
  1. 8 35
      src/store/useCommonStore.ts

+ 8 - 35
src/store/useCommonStore.ts

@@ -53,41 +53,14 @@ export default defineStore<"common", CommonStateType, {}, CommonActionsType>(
         this.loading = !this.loading;
       },
       async getGlobalDict(params) {
-        if (!isEmpty(this.globalDict[params])) return;
-        try {
-          this.toggleLoading();
-          const { data } = await getGlobalDict(params);
-          // this.globalDict[params] = data;
-          switch (params) {
-            case 'zhdd_plan_type':
-              this.globalDict[params] = zhdd_plan_type;
-              break;
-            case 'zhdd_incident_status':
-              this.globalDict[params] = zhdd_incident_status;
-              break;
-            case 'zhdd_incident_source':
-              this.globalDict[params] = zhdd_incident_source;
-              break;
-            case 'zhdd_org_upload':
-              this.globalDict[params] = zhdd_org_upload;
-              break;
-            case 'zhdd_resource':
-              this.globalDict[params] = zhdd_resource;
-              break;
-            case 'zhdd_incident_type':
-              this.globalDict[params] = zhdd_incident_type;
-              break;
-            case 'zhdd_incident_level':
-              this.globalDict[params] = zhdd_incident_level;
-              break;
-          }
-          sessionStorage.setItem(
-            params,
-            JSON.stringify(this.globalDict[params])
-          );
-        } finally {
-          this.toggleLoading();
-        }
+         if (!isEmpty(this.globalDict[params])) return;
+         try {
+           this.toggleLoading();
+           const { data } = await getGlobalDict(params);
+           this.globalDict[params] = data;
+         } finally {
+           this.toggleLoading();
+         }
       },
       async upload(params) {
         try {