فهرست منبع

主管任务审批

zhujindu 6 ماه پیش
والد
کامیت
030c14526c
1فایلهای تغییر یافته به همراه62 افزوده شده و 58 حذف شده
  1. 62 58
      src/views/week/componVisitSummary.vue

+ 62 - 58
src/views/week/componVisitSummary.vue

@@ -315,6 +315,7 @@ export default {
       collectionAnswerlisd: [],
       flagclick: true,
       index: '',
+      activaFlag: true,
     };
   },
   created() {
@@ -445,9 +446,29 @@ export default {
       for (var q = 0; q < this.collectionItemList.length; q++) {
         this.collectionItemList[q].answerName = undefined;
         // 公司
-        // if (this.collectionItemList[q].answerType == 'gs') {
-        //   this.getDeptInfo('dept', 'gs', this.collectionItemList[q].answerValue);
-        // }
+        if (
+          (this.collectionItemList[q].answerType == 'gs' ||
+            this.collectionItemList[q].answerType == 'dq' ||
+            this.collectionItemList[q].answerType == 'xsb') &&
+          this.activaFlag
+        ) {
+          debugger;
+          this.activaFlag = false;
+          if (this.collectionItemList[q].answerType == 'xsb') {
+            this.getDeptsBy(this.collectionItemList[q].answerValue);
+            this.getDeptInfo(
+              'dept',
+              this.collectionItemList[q].answerType,
+              this.collectionItemList[q].answerValue
+            );
+          } else {
+            this.getDeptInfo(
+              'dept',
+              this.collectionItemList[q].answerType,
+              this.collectionItemList[q].answerValue
+            );
+          }
+        }
         // 单选
         if (this.collectionItemList[q].answerType == 'dx') {
           let findCustom = this.collectionItemList[q].customOptionList.find((item) => item.checked);
@@ -546,9 +567,9 @@ export default {
     },
     getDeptInfo(type, grade, answerValue) {
       this.deptForm.type = type;
-      if (grade == '1') {
+      if (grade == 'dq') {
         this.deptForm.parentId = this.companyCode;
-      } else if (grade == '2') {
+      } else if (grade == 'xsb') {
         this.deptForm.parentId = this.regionCode;
       } else {
         this.deptForm.type = '';
@@ -559,8 +580,8 @@ export default {
           if (res.data.region != null) {
             this.regionList = res.data.region;
             if (answerValue) {
-              let findCompany = this.regionList.find((item) => item.deptCode == answerValue);
-              this.onSalesRegionConfirm(findCompany);
+              let findCompany = this.companyList.find((item) => item.deptName == answerValue);
+              // this.onSalesRegionConfirm(findCompany);
             } else {
               this.onSalesRegionConfirm(this.regionList[0]);
             }
@@ -569,8 +590,8 @@ export default {
           if (res.data.dept != null) {
             this.deptList = res.data.dept;
             if (answerValue) {
-              let findCompany = this.deptList.find((item) => item.deptCode == answerValue);
-              this.onSalesDepartmentConfirm(findCompany);
+              let findCompany = this.regionList.find((item) => item.deptName == answerValue);
+              // this.onSalesDepartmentConfirm(findCompany);
             } else {
               this.onSalesDepartmentConfirm(this.deptList[0]);
             }
@@ -578,8 +599,8 @@ export default {
         } else if (grade == 'gs') {
           this.companyList = res.data.company;
           if (answerValue) {
-            let findCompany = this.companyList.find((item) => item.deptCode == answerValue);
-            this.onregionConfirm(findCompany);
+            let findCompany = this.companyList.find((item) => item.deptName == answerValue);
+            // this.onregionConfirm(findCompany);
           } else {
             this.onregionConfirm(this.companyList[0]);
           }
@@ -645,64 +666,47 @@ export default {
     onSalesRegionConfirm(val) {
       this.SalesRegionShow = false;
       this.regionCode = val.deptId;
-      if (this.index != '') {
-        this.collectionItemList[this.index].answerName = val.deptName;
-        this.collectionItemList[this.index].answerValue = val.deptCode;
-      } else {
-        for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
-          if (this.collectionItemList[k1].answerType == 'xsb') {
-            this.collectionItemList[k1].answerName = '';
-            this.collectionItemList[k1].answerValue = '';
-          }
-          if (this.collectionItemList[k1].answerType == 'dq') {
-            this.collectionItemList[k1].answerName = val.deptName;
-            this.collectionItemList[k1].answerValue = val.deptCode;
-          }
-          if (this.collectionItemList[k1].answerType == 'xsb' && val.deptId != '') {
-            this.getDeptInfo('dept', 'xsb', this.collectionItemList[k1].answerValue);
-          }
+      for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
+        if (this.collectionItemList[k1].answerType == 'xsb') {
+          this.collectionItemList[k1].answerName = '';
+          this.collectionItemList[k1].answerValue = '';
+        }
+        if (this.collectionItemList[k1].answerType == 'dq') {
+          this.collectionItemList[k1].answerName = val.deptName;
+          this.collectionItemList[k1].answerValue = val.deptCode;
+        }
+        if (this.collectionItemList[k1].answerType == 'xsb' && val.deptId != '') {
+          this.getDeptInfo('dept', 'xsb');
         }
       }
-      // if (val.deptId != '') {
-      //   this.getDeptInfo('dept', 'xsb');
-      // }
     },
     onregionConfirm(val) {
       this.RegionShow = false;
       this.companyCode = val.deptId;
-      if (this.index != '') {
-        this.collectionItemList[this.index].answerName = val.deptName;
-        this.collectionItemList[this.index].answerValue = val.deptCode;
-      } else {
-        for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
-          if (
-            this.collectionItemList[k1].answerType == 'xsb' ||
-            this.collectionItemList[k1].answerType == 'dq'
-          ) {
-            this.collectionItemList[k1].answerName = '';
-            this.collectionItemList[k1].answerValue = '';
-          }
-          if (this.collectionItemList[k1].answerType == 'gs') {
-            this.collectionItemList[k1].answerName = val.deptName;
-            this.collectionItemList[k1].answerValue = val.deptCode;
-          }
-          if (this.collectionItemList[k1].answerType == 'dq') {
-            this.getDeptInfo('dept', 'dq', this.collectionItemList[k1].answerValue);
-          }
+      for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
+        if (this.collectionItemList[k1].answerType == 'xsb') {
+          this.collectionItemList[k1].answerName = '';
+          this.collectionItemList[k1].answerValue = '';
+        }
+        if (this.collectionItemList[k1].answerType == 'xsb') {
+          this.collectionItemList[k1].answerName = '';
+          this.collectionItemList[k1].answerValue = '';
+        }
+        if (this.collectionItemList[k1].answerType == 'gs') {
+          this.collectionItemList[k1].answerName = val.deptName;
+          this.collectionItemList[k1].answerValue = val.deptCode;
+        }
+        if (this.collectionItemList[k1].answerType == 'dq') {
+          this.getDeptInfo('dept', 'dq');
         }
       }
     },
     onSalesDepartmentConfirm(val) {
       this.SalesDepartmentShow = false;
-      if (this.index != '') {
-        this.collectionItemList[this.index].answerName = val.deptName;
-        this.collectionItemList[this.index].answerValue = val.deptCode;
-      } else {
-        for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
-          if (this.collectionItemList[k1].answerType == 'xsb') {
-            this.collectionItemList[k1].answerName = val.deptName;
-            this.collectionItemList[k1].answerValue = val.deptCode;
-          }
+      for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
+        if (this.collectionItemList[k1].answerType == 'xsb') {
+          this.collectionItemList[k1].answerName = val.deptName;
+          this.collectionItemList[k1].answerValue = val.deptCode;
         }
       }
     },