Selaa lähdekoodia

首页增加提示类tab,B类指标页优化,我的-增加业务员日常工作统计

zhujindu 1 vuosi sitten
vanhempi
commit
66e0868fd2
2 muutettua tiedostoa jossa 24 lisäystä ja 6 poistoa
  1. 13 1
      src/permission.js
  2. 11 5
      src/views/home/index.vue

+ 13 - 1
src/permission.js

@@ -12,7 +12,7 @@ router.beforeEach((to, from, next) => {
       store
         .dispatch('getUserInfo')
         .then(() => {
-          next();
+          getDict(next);
         })
         .catch(() => {
           next();
@@ -32,3 +32,15 @@ router.beforeEach((to, from, next) => {
     // }
   }
 });
+
+const getDict = async function () {
+  let gz_Option = await getDictOption({}, 'gz_customer_post'); //公装业务员岗位
+  let jz_Option = await getDictOption({}, 'jz_post_name'); //家装业务员岗位
+  let postName = store.state.user.userInfo.postName;
+  if (gz_Option.indexof(postName) == -1 || jz_Option.indexof(postName) == -1) {
+    localStorage.setItem('isGZorJZ', 'false');
+  } else {
+    localStorage.setItem('isGZorJZ', 'true');
+  }
+  next();
+};

+ 11 - 5
src/views/home/index.vue

@@ -2,7 +2,7 @@
   <div class="homePage" ref="homePage">
     <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft" />
     <van-tabs class="myTab" type="card" v-model="tabVal" color="#0057ba" @click="onClickTabs">
-      <van-tab title="提示类" name="-1">
+      <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false'">
         <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage
       ></van-tab>
       <van-tab title="A类指标" name="0"
@@ -47,23 +47,29 @@ export default {
   },
   data() {
     return {
-      tabVal: '-1',
+      tabVal: '0',
       hintTabPageIndex: 0,
+      isGZorJZ: 'true',
     };
   },
   watch: {
     // 监听切换用户
     'userInfo.userName': {
       handler(val) {
-        this.tabVal = '-1';
+        // 家装或工装不显示提示类tab
+        this.isGZorJZ = localStorage.getItem('isGZorJZ');
+        if (this.isGZorJZ == 'true') {
+          this.tabVal = '0';
+        } else {
+          this.tabVal = '-1';
+        }
       },
       immediete: true,
     },
   },
   activated() {
-    // 从其他页面跳转过来如果;要重新获取对应tab数据
     if (this.tabVal == '-1') {
-      // postName;jz_post_name gz_customer_post
+      // 从其他页面跳转过来如果;要重新获取对应tab数据
       if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
     } else if (this.tabVal == '0') {
       if (this.$refs.Atarget) this.$refs.Atarget.initData();