浏览代码

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

zhujindu 1 年之前
父节点
当前提交
1001caf66f

+ 9 - 0
src/api/index.js

@@ -897,3 +897,12 @@ export function selectPendingCasesInfo(query) {
     params: query,
   });
 }
+
+// 获取字典
+export function getDictOption(query, dictTypr) {
+  return request({
+    url: '/mobile/storeGroup/' + dictTypr,
+    method: 'get',
+    params: query,
+  });
+}

+ 1 - 13
src/permission.js

@@ -12,7 +12,7 @@ router.beforeEach((to, from, next) => {
       store
         .dispatch('getUserInfo')
         .then(() => {
-          getDict(next);
+          next();
         })
         .catch(() => {
           next();
@@ -32,15 +32,3 @@ 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();
-};

+ 4 - 0
src/views/componentsTarget/performanceSAP.vue

@@ -70,6 +70,10 @@ export default {
     reportTargetAll: {
       type: Object,
     },
+    JZQuota: {
+      type: Boolean,
+      default: false,
+    },
   },
   data() {
     return {};

+ 1 - 1
src/views/home/ABtarget.vue

@@ -31,7 +31,7 @@
         <van-collapse v-model="activeNames">
           <!-- performanceSAP -->
           <van-collapse-item v-if="type != 3 && type != 4" name="1" :title="saptitle">
-            <performanceSAP :reportTargetAll="reportTargetAll"></performanceSAP>
+            <performanceSAP :reportTargetAll="reportTargetAll" :JZQuota="JZQuota"></performanceSAP>
           </van-collapse-item>
           <van-collapse-item v-if="GZdata" name="43" title="纯态之家SAP(千元)">
             <chunTaiSAP :reportTargetAll="reportTargetAll"></chunTaiSAP>

+ 2 - 2
src/views/home/hintTabPage/index.vue

@@ -337,7 +337,7 @@ export default {
                 leftUnit: '家',
                 leftIsClick: false,
                 rightTable: '7天未完工:',
-                rightProp: 'jinPaiAbnormalNum',
+                rightProp: 'jinPaiUnfinishedNum',
                 rightUnit: '家',
                 rightIsClick: true,
               },
@@ -347,7 +347,7 @@ export default {
                 leftUnit: '家',
                 leftIsClick: false,
                 rightTable: '30天未结案:',
-                rightProp: 'jinPaiUnfinishedNum',
+                rightProp: 'jinPaiAbnormalNum',
                 rightUnit: '家',
                 rightIsClick: true,
               },

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

@@ -1,7 +1,13 @@
 <template>
   <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-tabs
+      class="myTab"
+      type="card"
+      v-model="tabVal"
+      color="#0057ba"
+      @click="onClickTabs"
+      v-if="isGZorJZ">
       <van-tab title="提示类" name="-1" v-if="isGZorJZ == 'false'">
         <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage
       ></van-tab>
@@ -32,7 +38,7 @@
 </template>
 
 <script>
-import { getReportInfo } from '@/api/index';
+import { getReportInfo, getDictOption } from '@/api/index';
 import hintTabPage from './hintTabPage/index.vue';
 import tabBar from '@/components/tabBar';
 import ABtarget from './ABtarget.vue';
@@ -47,27 +53,23 @@ export default {
   },
   data() {
     return {
-      tabVal: '0',
+      tabVal: '-1',
       hintTabPageIndex: 0,
-      isGZorJZ: 'true',
+      isGZorJZ: null,
     };
   },
   watch: {
     // 监听切换用户
     'userInfo.userName': {
       handler(val) {
-        // 家装或工装不显示提示类tab
-        this.isGZorJZ = localStorage.getItem('isGZorJZ');
-        if (this.isGZorJZ == 'true') {
-          this.tabVal = '0';
-        } else {
-          this.tabVal = '-1';
-        }
+        if (val) this.getDict();
       },
       immediete: true,
     },
   },
   activated() {
+    console.log(this.isGZorJZ);
+    console.log(this.tabVal);
     if (this.tabVal == '-1') {
       // 从其他页面跳转过来如果;要重新获取对应tab数据
       if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
@@ -78,9 +80,32 @@ export default {
     }
   },
   created() {
+    this.getDict();
     this.getReportInfo();
   },
   methods: {
+    async getDict() {
+      this.isGZorJZ = null;
+      let gz_Option = await getDictOption({}, 'gz_customer_post'); //公装业务员岗位
+      let jz_Option = await getDictOption({}, 'jz_post_name'); //家装业务员岗位
+      let postName = this.userInfo.postName;
+      let is_gz = gz_Option.data.find((res) => res.dictLabel == postName);
+      let is_jz = jz_Option.data.find((res) => res.dictLabel == postName);
+      if (is_gz || is_jz) {
+        localStorage.setItem('isGZorJZ', 'true');
+      } else {
+        localStorage.setItem('isGZorJZ', 'false');
+      }
+      this.$nextTick(() => {
+        // 家装或工装不显示提示类tab
+        this.isGZorJZ = localStorage.getItem('isGZorJZ');
+        if (this.isGZorJZ == 'true') {
+          this.tabVal = '0';
+        } else {
+          this.tabVal = '-1';
+        }
+      });
+    },
     onClickTabs(val) {
       this.$nextTick(() => {
         // this.tabVal == '-1' 有watch监听不需要在触发