ソースを参照

提示类-色卡开放大区及以上级别权限

zhujindu 11 ヶ月 前
コミット
4b2c5f61b5
1 ファイル変更12 行追加3 行削除
  1. 12 3
      src/views/home/hintTabPage/hintDetail.vue

+ 12 - 3
src/views/home/hintTabPage/hintDetail.vue

@@ -246,6 +246,7 @@ export default {
       ],
       materialCode: null, //色卡物料来源
       maskShow: true,
+      controller: null, //取消请求
     };
   },
   watch: {
@@ -272,6 +273,7 @@ export default {
     this.deptId = this.userInfo.deptId; // 当前用户部门id
     this.activaPantoneName = this.$route.query.pantoneName; //当前色卡
     this.materialCode = this.$route.query.materialCode; // 色卡code
+    this.controller = new AbortController(); //取消请求
     this.initData();
   },
   methods: {
@@ -333,6 +335,10 @@ export default {
       this.tableList = []; // 清楚tab数
       this.tabsItemPantone = {}; // 清楚色卡tab数据
       this.fromType = val;
+      if (this.controller) {
+        this.controller.abort();
+      }
+      this.controller = new AbortController(); //取消请求
       this.initData();
     },
     tabChangePantone(val) {
@@ -350,7 +356,7 @@ export default {
     },
     // 未拜访
     selectNoVisitsInfoFun(resolve) {
-      selectNoVisitsInfo({ deptId: this.deptId }).then((res) => {
+      selectNoVisitsInfo({ deptId: this.deptId }, this.controller.signal).then((res) => {
         this.maskShow = false;
         if (res.code == 200) {
           res.data.forEach((val) => {
@@ -372,7 +378,7 @@ export default {
     },
     // 建店
     selectPendingCasesInfoFun(resolve) {
-      selectPendingCasesInfo({ deptId: this.deptId }).then((res) => {
+      selectPendingCasesInfo({ deptId: this.deptId }, this.controller.signal).then((res) => {
         this.maskShow = false;
         if (res.code == 200) {
           res.data.forEach((val) => {
@@ -414,7 +420,10 @@ export default {
     // 色卡详情
     getReportMaterialTypeFun(resolve, deptId) {
       // deptId 第一次传 null 获取当前等级下的数据(不需要当前层级)
-      getReportMaterialType({ materialCode: this.materialCode, deptId: deptId }).then((res) => {
+      getReportMaterialType(
+        { materialCode: this.materialCode, deptId: deptId },
+        this.controller.signal
+      ).then((res) => {
         this.maskShow = false;
         if (res.code == 200) {
           res.data.colorCardList.forEach((val) => {