kumu 1 год назад
Родитель
Сommit
ccef4390c4
1 измененных файлов с 13 добавлено и 5 удалено
  1. 13 5
      src/layout/components/Navbar.vue

+ 13 - 5
src/layout/components/Navbar.vue

@@ -33,6 +33,7 @@
         <!--        </el-tooltip>el-tooltip-->
         <!--        </el-tooltip>el-tooltip-->
 
 
         <el-select
         <el-select
+          v-if="!hidePharmacyControl"
           v-model="pharmacyId"
           v-model="pharmacyId"
           placeholder="请选择药房"
           placeholder="请选择药房"
           style="margin-right: 20px; width: 150px"
           style="margin-right: 20px; width: 150px"
@@ -106,16 +107,23 @@ export default {
   data() {
   data() {
     return {
     return {
       pharmacyId: "",
       pharmacyId: "",
+      hidePharmacyControl: true,
     };
     };
   },
   },
   created() {
   created() {
-    let pharmacyId = window.localStorage.getItem("pharmacyId");
-    if (pharmacyId == null) {
-      this.pharmacyId = this.pharmacyList[0].id;
-      window.localStorage.setItem("pharmacyId", this.pharmacyId);
+    if (this.hidePharmacyControl) {
+      window.localStorage.removeItem("pharmacyId");
+      this.pharmacyId = '';
     } else {
     } else {
-      this.pharmacyId = Number(pharmacyId);
+      let pharmacyId = window.localStorage.getItem("pharmacyId");
+      if (pharmacyId == null) {
+        this.pharmacyId = this.pharmacyList[0].id;
+        window.localStorage.setItem("pharmacyId", this.pharmacyId);
+      } else {
+        this.pharmacyId = Number(pharmacyId);
+      }
     }
     }
+
   },
   },
   computed: {
   computed: {
     ...mapGetters(["sidebar", "avatar", "name", "device", "pharmacyList"]),
     ...mapGetters(["sidebar", "avatar", "name", "device", "pharmacyList"]),