Procházet zdrojové kódy

门店拜访任务列表访问速度优化

zhujindu před 6 měsíci
rodič
revize
e8c74ac555

+ 0 - 5
src/router/index.js

@@ -158,11 +158,6 @@ const router = new VueRouter({
           name: 'suishenbangOutstoreVisit',
           name: 'suishenbangOutstoreVisit',
           component: () => import('@/views/deviceOutside/suishenbangOutstoreVisit.vue'),
           component: () => import('@/views/deviceOutside/suishenbangOutstoreVisit.vue'),
         },
         },
-        {
-          path: '/suishenbangOutstoreVisitSEO',
-          name: 'suishenbangOutstoreVisitSEO',
-          component: () => import('@/views/deviceOutside/suishenbangOutstoreVisitSEO.vue'),
-        },
         {
         {
           path: '/projectOut',
           path: '/projectOut',
           name: 'projectOut',
           name: 'projectOut',

+ 1 - 0
src/store/modules/user.js

@@ -38,6 +38,7 @@ const user = {
             localStorage.setItem('userId', res.data.userId);
             localStorage.setItem('userId', res.data.userId);
             localStorage.setItem('deptIds', JSON.stringify(res.data.deptIds));
             localStorage.setItem('deptIds', JSON.stringify(res.data.deptIds));
             localStorage.setItem('chainUser', res.data.chainUser); //是否经销商用户 true
             localStorage.setItem('chainUser', res.data.chainUser); //是否经销商用户 true
+            localStorage.setItem('getRequestFlage', 'true');
             // 门店类型
             // 门店类型
             getDictOption({}, 'sfa_store_type').then((res) => {
             getDictOption({}, 'sfa_store_type').then((res) => {
               commit('SET_STORE_TYPE', res.data);
               commit('SET_STORE_TYPE', res.data);

+ 9 - 11
src/views/deviceOutside/index.vue

@@ -359,7 +359,7 @@
                 <van-col
                 <van-col
                   span="5"
                   span="5"
                   v-if="item.stateString != '已拜访' && customerVisits"
                   v-if="item.stateString != '已拜访' && customerVisits"
-                  @click="storeVisit(item, 'SEO')">
+                  @click="storeVisit(item)">
                   <img :src="call" style="margin: 0 auto; height: 18px; display: block" />
                   <img :src="call" style="margin: 0 auto; height: 18px; display: block" />
                   <p style="text-align: center; margin: 0; font-size: 12px">拜访速度优化</p>
                   <p style="text-align: center; margin: 0; font-size: 12px">拜访速度优化</p>
                 </van-col>
                 </van-col>
@@ -1202,8 +1202,7 @@ export default {
         }
         }
       });
       });
     },
     },
-    storeVisit(val, isSEO) {
-      let path = isSEO ? '/suishenbangOutstoreVisitSEO' : '/suishenbangOutstoreVisit';
+    storeVisit(val) {
       localStorage.setItem('tabVal', this.tabVal);
       localStorage.setItem('tabVal', this.tabVal);
       localStorage.removeItem('visitId');
       localStorage.removeItem('visitId');
       checkVisit({ storeId: val.storeId }).then((res) => {
       checkVisit({ storeId: val.storeId }).then((res) => {
@@ -1236,7 +1235,7 @@ export default {
               lon = val.lon;
               lon = val.lon;
             }
             }
             this.$router.push({
             this.$router.push({
-              path: path,
+              path: '/suishenbangOutstoreVisit',
               query: {
               query: {
                 storeId: val.storeId,
                 storeId: val.storeId,
                 rdId: val.rdId,
                 rdId: val.rdId,
@@ -1276,7 +1275,7 @@ export default {
                 localStorage.setItem('ORGName', val.deptName);
                 localStorage.setItem('ORGName', val.deptName);
                 localStorage.setItem('chainNameR', val.storeName);
                 localStorage.setItem('chainNameR', val.storeName);
                 that.$router.push({
                 that.$router.push({
-                  path: path,
+                  path: '/suishenbangOutstoreVisit',
                   query: {
                   query: {
                     storeId: val.storeId,
                     storeId: val.storeId,
                     rdId: val.rdId,
                     rdId: val.rdId,
@@ -1309,7 +1308,7 @@ export default {
                     localStorage.setItem('lat', this.lat);
                     localStorage.setItem('lat', this.lat);
                     localStorage.setItem('lon', this.lon);
                     localStorage.setItem('lon', this.lon);
                     // var location = this.CJ02BD(res.latitude, res.longitude);
                     // var location = this.CJ02BD(res.latitude, res.longitude);
-                    this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData, isSEO);
+                    this.checkStoreAddressByStoreCodeFun(val, TXisBD, resData);
                   })
                   })
                   .catch((error) => {
                   .catch((error) => {
                     this.$dialog.alert({
                     this.$dialog.alert({
@@ -1326,7 +1325,7 @@ export default {
         }
         }
       });
       });
     },
     },
-    checkStoreAddressByStoreCodeFun(val, location, res, isSEO) {
+    checkStoreAddressByStoreCodeFun(val, location, res) {
       checkStoreAddressByStoreCode({
       checkStoreAddressByStoreCode({
         storeCode: val.storeCode,
         storeCode: val.storeCode,
         lon: location.lon,
         lon: location.lon,
@@ -1406,7 +1405,7 @@ export default {
           }
           }
         } else {
         } else {
           // 门店编码校验门店地址通过 进入拜访
           // 门店编码校验门店地址通过 进入拜访
-          this.toSuishenbangOutstoreVisit(res, val, location, PointSumval, isSEO);
+          this.toSuishenbangOutstoreVisit(res, val, location, PointSumval);
         }
         }
       });
       });
     },
     },
@@ -1445,8 +1444,7 @@ export default {
         });
         });
     },
     },
     // 进入拜访 router.push
     // 进入拜访 router.push
-    toSuishenbangOutstoreVisit(res, val, location, PointSumval, isSEO) {
-      let path = isSEO ? '/suishenbangOutstoreVisitSEO' : '/suishenbangOutstoreVisit';
+    toSuishenbangOutstoreVisit(res, val, location, PointSumval) {
       addVisitsPosition({
       addVisitsPosition({
         storeId: val.storeId,
         storeId: val.storeId,
         visitsId: '',
         visitsId: '',
@@ -1458,7 +1456,7 @@ export default {
         accuracy: res.accuracy,
         accuracy: res.accuracy,
       });
       });
       this.$router.push({
       this.$router.push({
-        path: path,
+        path: '/suishenbangOutstoreVisit',
         query: {
         query: {
           storeId: val.storeId,
           storeId: val.storeId,
           rdId: val.rdId,
           rdId: val.rdId,

+ 2 - 3
src/views/deviceOutside/suishenbangOutstoreVisitSEO.vue

@@ -147,7 +147,6 @@ import {
   stopVisit,
   stopVisit,
   buryingPoint,
   buryingPoint,
   getMaterialHistory,
   getMaterialHistory,
-  getVisitTasks,
 } from '@/api/index';
 } from '@/api/index';
 import axios from 'axios';
 import axios from 'axios';
 import { saveVisitsParams, getOrderUrlByStoreId } from '@/api/inventory';
 import { saveVisitsParams, getOrderUrlByStoreId } from '@/api/inventory';
@@ -509,7 +508,7 @@ export default {
             message: '加载中...',
             message: '加载中...',
             forbidClick: true,
             forbidClick: true,
           });
           });
-          getVisitTasks(params).then((res) => {
+          getStoreGroupTask(params).then((res) => {
             loading2.clear();
             loading2.clear();
             if (res.code == 200) {
             if (res.code == 200) {
               localStorage.setItem('visitId', res.data.visitId);
               localStorage.setItem('visitId', res.data.visitId);
@@ -552,7 +551,7 @@ export default {
             message: '加载中...',
             message: '加载中...',
             forbidClick: true,
             forbidClick: true,
           });
           });
-          getVisitTasks(params).then((res) => {
+          getStoreGroupTask(params).then((res) => {
             loading2.clear();
             loading2.clear();
             if (res.code == 200) {
             if (res.code == 200) {
               localStorage.setItem('visitId', res.data.visitId);
               localStorage.setItem('visitId', res.data.visitId);

+ 9 - 3
src/views/deviceOutside/suishenbangOutstoreVisit.vue

@@ -147,6 +147,7 @@ import {
   stopVisit,
   stopVisit,
   buryingPoint,
   buryingPoint,
   getMaterialHistory,
   getMaterialHistory,
+  getVisitTasks,
 } from '@/api/index';
 } from '@/api/index';
 import axios from 'axios';
 import axios from 'axios';
 import { saveVisitsParams, getOrderUrlByStoreId } from '@/api/inventory';
 import { saveVisitsParams, getOrderUrlByStoreId } from '@/api/inventory';
@@ -240,9 +241,12 @@ export default {
     this.contactName = this.$route.query.contactName + '';
     this.contactName = this.$route.query.contactName + '';
     this.lat = this.$route.query.lat + '';
     this.lat = this.$route.query.lat + '';
     this.lon = this.$route.query.lon + '';
     this.lon = this.$route.query.lon + '';
-    this.list = [];
     this.visitModel = this.$route.query.visitModel + '';
     this.visitModel = this.$route.query.visitModel + '';
     this.uType = localStorage.getItem('uType');
     this.uType = localStorage.getItem('uType');
+    // 是否请求任务列表接口
+    let getRequestFlage = localStorage.getItem('getRequestFlage');
+    if (getRequestFlage != 'true') return;
+    this.list = [];
     if (localStorage.getItem('visitId') != null) {
     if (localStorage.getItem('visitId') != null) {
       this.visitId = localStorage.getItem('visitId');
       this.visitId = localStorage.getItem('visitId');
       setTimeout(() => {
       setTimeout(() => {
@@ -508,7 +512,7 @@ export default {
             message: '加载中...',
             message: '加载中...',
             forbidClick: true,
             forbidClick: true,
           });
           });
-          getStoreGroupTask(params).then((res) => {
+          getVisitTasks(params).then((res) => {
             loading2.clear();
             loading2.clear();
             if (res.code == 200) {
             if (res.code == 200) {
               localStorage.setItem('visitId', res.data.visitId);
               localStorage.setItem('visitId', res.data.visitId);
@@ -551,7 +555,7 @@ export default {
             message: '加载中...',
             message: '加载中...',
             forbidClick: true,
             forbidClick: true,
           });
           });
-          getStoreGroupTask(params).then((res) => {
+          getVisitTasks(params).then((res) => {
             loading2.clear();
             loading2.clear();
             if (res.code == 200) {
             if (res.code == 200) {
               localStorage.setItem('visitId', res.data.visitId);
               localStorage.setItem('visitId', res.data.visitId);
@@ -571,6 +575,7 @@ export default {
       );
       );
     },
     },
     addStoreVisit(val, index) {
     addStoreVisit(val, index) {
+      localStorage.setItem('getRequestFlage', 'false');
       this.$router.push({
       this.$router.push({
         path: '/addStoreVisit',
         path: '/addStoreVisit',
         query: {
         query: {
@@ -594,6 +599,7 @@ export default {
       });
       });
     },
     },
     onClickLeft() {
     onClickLeft() {
+      localStorage.setItem('getRequestFlage', 'true');
       if (this.$route.query.urltype == 1) {
       if (this.$route.query.urltype == 1) {
         window.location.replace(window.location.origin + '/mobile/home');
         window.location.replace(window.location.origin + '/mobile/home');
       } else {
       } else {

+ 2 - 0
src/views/deviceWithin/addStoreVisit.vue

@@ -3211,6 +3211,7 @@ export default {
             taskId: that.$route.query.taskId,
             taskId: that.$route.query.taskId,
           }).then((res) => {
           }).then((res) => {
             if (res.code == 200) {
             if (res.code == 200) {
+              localStorage.setItem('getRequestFlage', 'true');
               that.$dialog
               that.$dialog
                 .alert({
                 .alert({
                   title: '系统提示',
                   title: '系统提示',
@@ -4794,6 +4795,7 @@ export default {
           }
           }
           addCollectionAnswer(formData).then((res) => {
           addCollectionAnswer(formData).then((res) => {
             if (res.code == 200) {
             if (res.code == 200) {
+              localStorage.setItem('getRequestFlage', 'true');
               this.$router.go(-1);
               this.$router.go(-1);
             } else {
             } else {
               if (res.data) {
               if (res.data) {

+ 12 - 5
src/views/deviceWithin/storeVisit.vue

@@ -161,6 +161,7 @@ import {
   restartProcess,
   restartProcess,
   buryingPoint,
   buryingPoint,
   getMaterialHistory,
   getMaterialHistory,
+  getVisitTasks,
 } from '@/api/index';
 } from '@/api/index';
 import axios from 'axios';
 import axios from 'axios';
 import sp from './../../assets/sp.png';
 import sp from './../../assets/sp.png';
@@ -249,8 +250,12 @@ export default {
     this.visitModel = this.$route.query.visitModel + '';
     this.visitModel = this.$route.query.visitModel + '';
     this.lat = this.$route.query.lat + '';
     this.lat = this.$route.query.lat + '';
     this.lon = this.$route.query.lon + '';
     this.lon = this.$route.query.lon + '';
-    this.list = [];
+    // this.list = [];
     this.uType = localStorage.getItem('uType');
     this.uType = localStorage.getItem('uType');
+    // 是否请求任务列表接口
+    let getRequestFlage = localStorage.getItem('getRequestFlage');
+    if (getRequestFlage != 'true') return;
+    this.list = [];
     if (this.$route.query.type != 'edit') {
     if (this.$route.query.type != 'edit') {
       this.timeShow = true;
       this.timeShow = true;
       if (localStorage.getItem('visitId') != null) {
       if (localStorage.getItem('visitId') != null) {
@@ -443,7 +448,7 @@ export default {
               forbidClick: true,
               forbidClick: true,
             });
             });
             that.list = [];
             that.list = [];
-            getStoreGroupTask(params).then((res) => {
+            getVisitTasks(params).then((res) => {
               loading2.clear();
               loading2.clear();
               if (res.code == 200) {
               if (res.code == 200) {
                 that.notes = res.data.notes;
                 that.notes = res.data.notes;
@@ -491,7 +496,7 @@ export default {
               forbidClick: true,
               forbidClick: true,
             });
             });
             that.list = [];
             that.list = [];
-            getStoreGroupTask(params).then((res) => {
+            getVisitTasks(params).then((res) => {
               loading2.clear();
               loading2.clear();
               if (res.code == 200) {
               if (res.code == 200) {
                 that.notes = res.data.notes;
                 that.notes = res.data.notes;
@@ -541,7 +546,7 @@ export default {
               forbidClick: true,
               forbidClick: true,
             });
             });
             that.list = [];
             that.list = [];
-            getStoreGroupTask(params).then((res) => {
+            getVisitTasks(params).then((res) => {
               loading2.clear();
               loading2.clear();
               if (res.code == 200) {
               if (res.code == 200) {
                 that.notes = res.data.notes;
                 that.notes = res.data.notes;
@@ -588,7 +593,7 @@ export default {
               forbidClick: true,
               forbidClick: true,
             });
             });
             that.list = [];
             that.list = [];
-            getStoreGroupTask(params).then((res) => {
+            getVisitTasks(params).then((res) => {
               loading2.clear();
               loading2.clear();
               if (res.code == 200) {
               if (res.code == 200) {
                 that.notes = res.data.notes;
                 that.notes = res.data.notes;
@@ -701,6 +706,7 @@ export default {
         this.timer = setTimeout(() => {
         this.timer = setTimeout(() => {
           this.flag = true;
           this.flag = true;
         }, 2000);
         }, 2000);
+        localStorage.setItem('getRequestFlage', 'false');
         this.$router.push({
         this.$router.push({
           path: '/addStoreVisit',
           path: '/addStoreVisit',
           query: {
           query: {
@@ -731,6 +737,7 @@ export default {
       // localStorage.setItem('collectionItemList', JSON.stringify(val.collectionItemList));
       // localStorage.setItem('collectionItemList', JSON.stringify(val.collectionItemList));
     },
     },
     onClickLeft() {
     onClickLeft() {
+      localStorage.setItem('getRequestFlage', 'true');
       if (this.$route.query.urltype == 2) {
       if (this.$route.query.urltype == 2) {
         window.location.replace(window.location.origin + '/mobile/home');
         window.location.replace(window.location.origin + '/mobile/home');
       } else {
       } else {