Selaa lähdekoodia

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

zhujindu 1 vuosi sitten
vanhempi
commit
4646ad92d9

+ 64 - 32
src/views/home/hintTabPage/hintDetail.vue

@@ -6,9 +6,9 @@
     <div class="tabBox">
       <van-tabs class="myTab" v-model="activeTabName" color="#0057ba" @change="tabChange">
         <van-tab
+          v-for="(item, index) in tabsItem"
           :title="item.title"
           :name="item.name"
-          v-for="(item, index) in tabsItem"
           :key="index"></van-tab>
       </van-tabs>
       <van-tabs
@@ -26,13 +26,14 @@
     </div>
     <div class="content">
       <el-table
+        v-if="fromType"
         :data="tableList"
         :load="load"
         :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
         border
         class="elTreeTable"
         lazy
-        row-key="id"
+        :row-key="rowKey"
         :key="toggleIndex">
         <el-table-column
           class="firstName"
@@ -97,10 +98,6 @@ export default {
           title: '建店',
           name: 'createStore',
         },
-        {
-          title: '色卡',
-          name: 'pantone',
-        },
       ],
       activePantoneTabName: '', //色卡tabName
       tabsItemPantone: {}, //色卡tabItem
@@ -142,7 +139,7 @@ export default {
           label: '同B店',
           childredColumn: [
             {
-              label: '(近2月)',
+              label: '(近3月)',
               prop: 'tongBNotVisited',
             },
           ],
@@ -240,6 +237,7 @@ export default {
         },
       ],
       materialCode: null, //色卡物料来源
+      // rowKey: 'id', //tab row-key
     };
   },
   watch: {
@@ -254,6 +252,7 @@ export default {
   activated() {
     this.empLevel = this.userInfo.empLevel;
     this.firstLabel = this.empLevel == '1' ? '组织名称/大区主管' : '组织名称/销售部主管';
+    this.setTabsItem();
     this.fromType = this.$route.query.fromType; // fromType: 'noVisit':未拜访; 'createStore':建店; 'pantone':色卡
     // this.tableColumn = this[this.fromType]; //初始化表格头
     // this.activeTabName = this.fromType;
@@ -263,21 +262,35 @@ export default {
     this.initData();
   },
   methods: {
+    rowKey(row) {
+      return this.fromType == 'pantone' ? row['id'] : row['onlyId'];
+    },
+    setTabsItem() {
+      if (this.empLevel == '2')
+        this.tabsItem.push({
+          title: '色卡',
+          name: 'pantone',
+        });
+    },
     initData(resolve, tree) {
+      this.toggleIndex = this.toggleIndex++;
       if (this.fromType == 'noVisit') {
         // 未拜访
-        if (tree) this.deptId = tree.onlyId;
+        this.deptId = tree ? tree.onlyId : this.userInfo.deptId;
         this.firstProp = 'onlyName';
+        // this.rowKey = 'onlyId';
         this.selectNoVisitsInfoFun(resolve);
       } else if (this.fromType == 'createStore') {
         // 建店
-        if (tree) this.deptId = tree.onlyId;
+        this.deptId = tree ? tree.onlyId : this.userInfo.deptId;
         this.firstProp = 'onlyName';
+        // this.rowKey = 'onlyId';
         this.selectPendingCasesInfoFun(resolve);
       } else if (this.fromType == 'pantone') {
         // 色卡
         this.firstProp = 'warehouseName';
         let empLevel = tree ? tree.empLevel : null;
+        // this.rowKey = 'id';
         this.getPantoneData(resolve, empLevel);
       }
     },
@@ -286,13 +299,11 @@ export default {
       this.tabsItemPantone = {}; // 清楚色卡tab数据
       this.fromType = val;
       this.initData();
-      this.toggleIndex = this.toggleIndex++;
     },
     tabChangePantone(val) {
       this.tableList = [];
       this.materialCode = this.tabsItemPantone[val].materialCode;
       this.initData();
-      this.toggleIndex = this.toggleIndex++;
     },
     onClickLeft() {
       this.$router.go(-1);
@@ -305,28 +316,42 @@ export default {
     // 未拜访
     selectNoVisitsInfoFun(resolve) {
       selectNoVisitsInfo({ deptId: this.deptId }).then((res) => {
-        res.data.forEach((val) => {
-          if (val.onLevel < 3) val.hasChildren = true;
-        });
-        // 是否是子级
-        if (resolve) {
-          resolve && resolve(res.data);
+        if (res.code == 200) {
+          res.data.forEach((val) => {
+            if (val.empLevel < 3) val.hasChildren = true;
+          });
+          // 是否是子级
+          if (resolve) {
+            resolve && resolve(res.data);
+          } else {
+            this.tableList = res.data;
+          }
         } else {
-          this.tableList = res.data;
+          this.Toast({
+            message: res.msg,
+            duration: 5000,
+          });
         }
       });
     },
     // 建店
     selectPendingCasesInfoFun(resolve) {
       selectPendingCasesInfo({ deptId: this.deptId }).then((res) => {
-        res.data.forEach((val) => {
-          if (val.onLevel < 3) val.hasChildren = true;
-        });
-        // 是否是子级
-        if (resolve) {
-          resolve && resolve(res.data);
+        if (res.code == 200) {
+          res.data.forEach((val) => {
+            if (val.empLevel < 3) val.hasChildren = true;
+          });
+          // 是否是子级
+          if (resolve) {
+            resolve && resolve(res.data);
+          } else {
+            this.tableList = res.data;
+          }
         } else {
-          this.tableList = res.data;
+          this.Toast({
+            message: res.msg,
+            duration: 5000,
+          });
         }
       });
     },
@@ -353,14 +378,21 @@ export default {
     getReportMaterialTypeFun(resolve, empLevel) {
       // empLevel 第一次传 null
       getReportMaterialType({ materialCode: this.materialCode, empLevel: empLevel }).then((res) => {
-        res.data.colorCardList.forEach((val) => {
-          if (val.empLevel < 3) val.hasChildren = true;
-        });
-        // 是否是子级
-        if (resolve) {
-          resolve && resolve(res.data.colorCardList);
+        if (res.code == 200) {
+          res.data.colorCardList.forEach((val) => {
+            if (val.empLevel < 3) val.hasChildren = true;
+          });
+          // 是否是子级
+          if (resolve) {
+            resolve && resolve(res.data.colorCardList);
+          } else {
+            this.tableList = res.data.colorCardList;
+          }
         } else {
-          this.tableList = res.data.colorCardList;
+          this.Toast({
+            message: res.msg,
+            duration: 5000,
+          });
         }
       });
     },

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

@@ -113,22 +113,22 @@
                   <div class="firstItem item">
                     <div class="left">
                       <div class="lebel">已领用:</div>
-                      <div class="value">{{ val.ywyylyNum }}</div>
+                      <div class="value">{{ val.ywyylyNum }}</div>
                     </div>
                     <div class="right">
                       <div class="lebel">已发放门店:</div>
-                      <div class="value">{{ val.ywyyffNum }}</div>
+                      <div class="value">{{ val.ywyyffNum }}</div>
                     </div>
                   </div>
                   <div class="secondItem item">
                     <div class="left">
                       <div class="lebel">门店未签收:</div>
-                      <div class="value">{{ val.mdwqsNum }}</div>
+                      <div class="value">{{ val.mdwqsNum }}</div>
                     </div>
                     <div class="right">
                       <div class="lebel">门店未签收:</div>
                       <div class="value valueIsClick" @click="pantoneClick(val, key)">
-                        {{ val.wqsmdNum }}
+                        {{ val.wqsmdNum }}
                       </div>
                     </div>
                   </div>
@@ -142,22 +142,22 @@
                   <div class="firstItem item">
                     <div class="left">
                       <div class="lebel">直发销售部数:</div>
-                      <div class="value">{{ val.zfxsbNum }}</div>
+                      <div class="value">{{ val.zfxsbNum }}</div>
                     </div>
                     <div class="right">
                       <div class="lebel">业务员已领用:</div>
-                      <div class="value">{{ val.ywyylyNum }}</div>
+                      <div class="value">{{ val.ywyylyNum }}</div>
                     </div>
                   </div>
                   <div class="secondItem item">
                     <div class="left">
                       <div class="lebel">业务员已发放:</div>
-                      <div class="value">{{ val.ywyyffNum }}</div>
+                      <div class="value">{{ val.ywyyffNum }}</div>
                     </div>
                     <div class="right">
                       <div class="lebel">门店未签收:</div>
                       <div class="value valueIsClick" @click="pantoneClick(val, key)">
-                        {{ val.wqsmdNum }}
+                        {{ val.wqsmdNum }}
                       </div>
                     </div>
                   </div>

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

@@ -10,7 +10,7 @@
               {{ resData[item.titleProp][list.leftProp] }}
             </div>
           </div>
-          <div class="itemRight">
+          <div class="itemRight" :style="{ width: fromType == 'noVisit' ? '110px' : '130px' }">
             <div class="label">{{ list.rightTable }}</div>
             <div class="label" :style="labelStyle(list)" @click="onClick(item, list)">
               {{ resData[item.titleProp][list.rightProp] }}{{ list.rightUnit }}
@@ -111,7 +111,7 @@ export default {
           flex: 1;
         }
         .itemRight {
-          width: 110px;
+          /* width: 120px; */
           display: flex;
         }
       }