Преглед изворни кода

Merge branch 'ol_12_30' into wxl_01_27

lex-xin пре 4 година
родитељ
комит
4a54a665a2
1 измењених фајлова са 61 додато и 29 уклоњено
  1. 61 29
      src/views/teamDetail/teamClassList.vue

+ 61 - 29
src/views/teamDetail/teamClassList.vue

@@ -7,7 +7,7 @@
     </h2>
     <div class="m-core">
       <save-form
-      ref="searchForm"
+        ref="searchForm"
         :inline="true"
         :model="searchForm"
         @submit="search"
@@ -138,7 +138,6 @@
                 @click="addCompound(scope.row)"
                 v-if="
                   scope.row.type != 'MUSIC_NETWORK' &&
-                  scope.row.type != 'HIGH_ONLINE' &&scope.row.type != 'HIGH'&&
                   !isAddCom(scope.row) &&
                   permission('classGroup/spanGroupMergeClassSplitClassAffirm')
                 "
@@ -166,10 +165,13 @@
         />
       </div>
     </div>
-    <classCompound :compoundList='compoundList' v-if="permission('classGroup/spanGroupMergeClassSplitClassAffirm')"
-                 @clearCom='clearCom'
-                 @getList='getList'
-                 @cancleCompound='cancleCompound'/>
+    <classCompound
+      :compoundList="compoundList"
+      v-if="permission('classGroup/spanGroupMergeClassSplitClassAffirm')"
+      @clearCom="clearCom"
+      @getList="getList"
+      @cancleCompound="cancleCompound"
+    />
   </div>
 </template>
 
@@ -181,9 +183,9 @@ import load from "@/utils/loading";
 import { musicClassTypeList } from "@/utils/searchArray";
 import { getClassGroupPage } from "@/api/buildTeam";
 import { permission } from "@/utils/directivePage";
-import classCompound from "./componentClass/classCompound"
+import classCompound from "./componentClass/classCompound";
 export default {
-  components: { pagination,classCompound },
+  components: { pagination, classCompound },
   data() {
     return {
       searchForm: {
@@ -193,7 +195,9 @@ export default {
       },
       musicClassTypeList,
       tableList: [],
-      compoundList:[],
+      compoundList: [],
+      hightCount: 0,
+      hightOnlineCount: 0,
       rules: {
         // 分页规则
         limit: 10, // 限制显示条数
@@ -218,7 +222,7 @@ export default {
     async getList() {
       try {
         let { organIdList, ...result } = this.searchForm;
-        console.log(result)
+        console.log(result);
         let obj = {
           ...result,
           organIdList: this.searchForm.organIdList.join(","),
@@ -237,35 +241,63 @@ export default {
       this.getList();
     },
     onReSet() {
-      this.$refs.searchForm.resetFields()
-      this.search()
+      this.$refs.searchForm.resetFields();
+      this.search();
     },
-       addCompound (row) {
-      this.compoundList.push(row)
-      this.compoundList = [...new Set(this.compoundList)]
+    addCompound(row) {
+      //  scope.row.type != 'HIGH_ONLINE' &&scope.row.type != 'HIGH'&&
+      this.hightOnlineCount = 0;
+      this.hightCount = 0;
+      this.compoundList.push(row);
+      this.compoundList = [...new Set(this.compoundList)];
+
+        this.compoundList.forEach((classes) => {
+          if (classes.type == "HIGH") {
+            this.hightCount++;
+          }
+          if (classes.type == "HIGH_ONLINE") {
+            this.hightOnlineCount++;
+          }
+        });
+      if(this.hightOnlineCount&&this.hightOnlineCount != this.compoundList.length){
+        this.$message.error("线上基础技能班仅能和线上基础技能班合并");
+          this.hightOnlineCount = 0;
+          this.hightCount = 0;
+          this.compoundList = [];
+      }
+      if(this.hightCount&&this.hightCount != this.compoundList.length){
+           this.$message.error("基础技能班仅能和基础技能班合并");
+          this.hightOnlineCount = 0;
+          this.hightCount = 0;
+          this.compoundList = [];
+      }
     },
-    isAddCom (row) {
-      let flag = false
-      this.compoundList.forEach(com => {
+    isAddCom(row) {
+      let flag = false;
+      this.compoundList.forEach((com) => {
         if (com.id == row.id) {
-          flag = true
+          flag = true;
         }
-      })
-      return flag
+      });
+      return flag;
     },
-    cancleCompound (row) {
-      let indexNum = null
+    cancleCompound(row) {
+      let indexNum = null;
       this.compoundList.forEach((com, index) => {
         if (com.id == row.id) {
-          indexNum = index
+          indexNum = index;
+          if (row.type == "HIGH") this.hightCount--;
+          if (row.type == "HIGH_ONLINE") this.hightOnlineCount--;
         }
-      })
-      if (indexNum + '') {
-        this.compoundList.splice(indexNum, 1)
+      });
+      if (indexNum + "") {
+        this.compoundList.splice(indexNum, 1);
       }
     },
-    clearCom () {
-      this.compoundList = []
+    clearCom() {
+      this.compoundList = [];
+      this.hightOnlineCount = 0;
+      this.hightCount = 0;
     },
     permission(str, parent) {
       return permission(str, parent);