浏览代码

01/08 合并班级

1
mo 4 年之前
父节点
当前提交
d1e9b7242a

+ 1 - 0
debug.log

@@ -14,3 +14,4 @@
 [0105/101053.212:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
 [0106/093923.589:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
 [0107/093708.765:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
+[0108/093931.571:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)

+ 10 - 0
src/api/buildTeam.js

@@ -1470,3 +1470,13 @@ export function getStudentPaymentCalenders(data) {
   })
 }
 
+// 跨团合并班级
+
+export function spanGroupMergeClassSplitClassAffirm(data) {
+  return request2({
+    url: api + `/classGroup/spanGroupMergeClassSplitClassAffirm`,
+    method: 'post',
+    params:{},
+    data:data
+  })
+}

+ 2 - 1
src/views/resetTeaming/modals/payment-cycle.vue

@@ -7,6 +7,7 @@
     label-suffix=": "
   >
     <el-form-item
+    v-if="!hideMoney"
       label="缴费金额(元)"
       prop="paymentAmount"
       :rules="[{required: true, message: '请输入缴费金额', trigger: 'blur'}]"
@@ -72,7 +73,7 @@
 import { paymentPatternType } from '@/constant'
 import { objectToOptions } from '@/utils'
 export default {
-  props: ['form', 'className', 'isUserType', 'isDisabled', 'isCommon', 'hidePaymentPattern'],
+  props: ['form', 'className', 'isUserType', 'isDisabled', 'isCommon', 'hidePaymentPattern','hideMoney'],
   data() {
     return {
       paymentPatternTypeOptions: objectToOptions(paymentPatternType),

+ 231 - 14
src/views/teamDetail/componentClass/calenderStudentList.vue

@@ -1,29 +1,246 @@
 <template>
   <div>
-    <el-collapse v-model="activeNames" >
-      <el-collapse-item title="一致性 Consistency" name="1">
-        <div>
-          与现实生活一致:与现实生活的流程、逻辑保持一致,遵循用户习惯的语言和概念;
-        </div>
-        <div>
-          在界面中一致:所有的元素和结构需保持一致,比如:设计样式、图标和文本、元素的位置等。
-        </div>
+    <!-- <el-collapse v-model="activeNames">
+      <el-collapse-item
+        :name="index"
+        v-for="(key, index) in mergeInfo"
+        :key="index"
+      >
+        <template #title>
+          <div class="header">
+            <span>
+              <span>班级:{{ getCLassName(index) }}</span>
+            </span>
+          </div>
+        </template>
+
+        <studentPayItem  :mergeInfo='mergeInfo' :index='index' :classList="classList" :classGroupStudents='classGroupStudents'/>
       </el-collapse-item>
-    </el-collapse>
+    </el-collapse> -->
+    <paymentCycle
+      ref="cycle"
+      :form="cycle"
+      :isUserType="true"
+      :isCommon="true"
+      :isDisabled="true"
+      :hideMoney="true"
+    />
+    <otherform :form="other" ref="other" />
+    <el-table
+      :data="mergeInfoList"
+      :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+      max-height="300px"
+      height="300px"
+    >
+      <el-table-column
+        prop="userId"
+        align="center"
+        width="120"
+        label="学员编号"
+      ></el-table-column>
+      <el-table-column
+        prop="username"
+        align="center"
+        width="120"
+        label="学员姓名"
+      ></el-table-column>
+      <el-table-column prop="phone" align="center" width="120" label="课程类型">
+        <template slot-scope="scope">
+          <div>
+            {{ scope.row.courseType | coursesType }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column prop="subjectNames" align="center" label="原价">
+        <template slot-scope="scope">
+          <div>
+            <el-input v-model="scope.row.courseOriginalPrice"></el-input>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="现价">
+        <template slot-scope="scope">
+          <div>
+            <el-input v-model="scope.row.courseCurrentPrice"></el-input>
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
   </div>
 </template>
 <script>
+import studentPayItem from "./studentPayItem";
+import paymentCycle from "@/views/resetTeaming/modals/payment-cycle";
+import otherform from "@/views/resetTeaming/modals/other";
+import { getTimes } from "@/utils";
+import { spanGroupMergeClassSplitClassAffirm } from '@/api/buildTeam'
 export default {
-  props:['studentIds', 'masterClassGroupId', 'classGroupStudents'],
+  props: [
+    "studentIds",
+    "masterClassGroupId",
+    "classGroupStudents",
+    "classList",
+    "mergeInfo",
+  ],
+  components: {
+    studentPayItem,
+    paymentCycle,
+    otherform,
+  },
   data() {
     return {
-      activeNames:[]
+      activeNames: [],
+      mergeInfoList: [],
+      cycle: {
+        paymentAmount: null,
+        paymentPattern: null,
+      },
+      other: {},
     };
   },
-  mounted(){
-    console.log(this.studentIds, this.masterClassGroupId, this.classGroupStudents)
-  }
+  mounted() {
+    // console.log(this.studentIds, this.masterClassGroupId, this.classGroupStudents)
+    // for (let item in this.mergeInfo) {
+    //   this.activeNames.push(item);
+    // }
+    this.mergeInfoList = [];
+    for (let merge in this.mergeInfo) {
+      this.mergeInfoList = this.mergeInfoList.concat(this.mergeInfo[merge]);
+    }
+  },
+  methods: {
+    getCLassName(key) {
+      let str = "";
+      this.classList.forEach((classes) => {
+        if (classes.id == key) {
+          str = classes.name;
+        }
+      });
+      return str;
+    },
+   async submit() {
+      console.log("提交");
+      //   this.$refs.form.validate((res) => {
+      //     if (res) {
+      //       let obj = {};
+      //       obj.musicGroupPaymentCalenderDtos.musicGroupPaymentCalenderStudentDetails = this.mergeInfo;
+      //       obj.musicGroupPaymentCalenderDtos.masterClassGroupId = this.masterClassGroupId;
+      //       obj.musicGroupPaymentCalenderDtos.memo = this.form.memo;
+      //       console.log(this.classList)
+      //       return
+      //       obj.classGroupIds = this.classList.map((classes) => {
+      //         return classes.id;
+      //       });
+      //       obj.studentIds = this.studentIds;
+      //     }
+      //   });
+      //   console.log(this.mergeInfo);
+
+      let obj = {}
+      obj.musicGroupPaymentCalenderDtos = [this.getData()]
+
+      obj.classGroupIds = this.classList.map((classes) => {
+
+              return classes.id;
+            });
+      obj.masterClassGroupId = this.masterClassGroupId
+      obj.classGroupStudents = this.classGroupStudents
+            console.log(obj)
+            try{
+              const reset = await spanGroupMergeClassSplitClassAffirm(obj)
+              console.log(reset)
+            }catch(e){
+              console.log(e)
+            }
+    },
+    getForms() {
+      const { $refs: refs } = this;
+      // [refs.base, refs.eclass, refs.cycle, ...(refs.cycles || []), refs.other, refs.payment]
+      return [refs.cycle, refs.other]
+        .filter((item) => !!item)
+        .map((item) => item.$refs.form || item);
+    },
+    getData() {
+      const forms = this.getForms();
+      const valided = [];
+      for (const form of forms) {
+        form.validate((valid) => {
+          if (valid) {
+            valided.push(form);
+          }
+        });
+      }
+      if (valided.length === forms.length) {
+        const { leixing, ...rest } = {
+          ...this.form,
+          ...this.other,
+        };
+
+        if (this.$refs.cycle) {
+          const {
+            paymentDate,
+            paymentValid,
+            paymentPattern,
+            ...other
+          } = this.cycle;
+          rest.paymentPattern = paymentPattern;
+          rest.payUserType = "STUDENT";
+          rest.paymentType = "SPAN_GROUP_CLASS_ADJUST";
+          rest.musicGroupPaymentCalenderStudentDetails = this.mergeInfoList
+          rest.musicGroupPaymentDateRangeList = [
+            {
+              ...other,
+              ...getTimes(paymentDate, [
+                "startPaymentDate",
+                "deadlinePaymentDate",
+              ]),
+              ...getTimes(paymentValid, [
+                "paymentValidStartDate",
+                "paymentValidEndDate",
+              ]),
+            },
+          ];
+        }
+        const data = {
+          ...rest,
+        };
+        return data;
+
+        // 说明验证通过
+      } else {
+        this.$message.error("请填写必要信息");
+        return "error";
+      }
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>
+/deep/ .header {
+  display: flex;
+  align-items: center;
+  width: 100%;
+  justify-content: space-between;
+  // margin-bottom: 10px;
+  > span:first-child {
+    display: flex;
+    &::before {
+      content: "";
+      display: block;
+      width: 5px;
+      background-color: #14928a;
+      margin-right: 10px;
+      border-radius: 2px;
+      height: 48px;
+    }
+  }
+  .icon {
+    font-size: 18px;
+    font-weight: normal;
+    margin-right: 20px;
+  }
+  /deep/.el-collapse-item__wrap {
+    border-bottom: none !important;
+  }
+}
 </style>

+ 87 - 56
src/views/teamDetail/componentClass/classCompound.vue

@@ -49,7 +49,9 @@
                   <!--    -->
                   <template slot-scope="scope">
                     <div>
-                      {{ scope.row.studentList?scope.row.studentList.length:0 }}
+                      {{
+                        scope.row.studentList ? scope.row.studentList.length : 0
+                      }}
                     </div>
                   </template>
                 </el-table-column>
@@ -59,7 +61,10 @@
                     <el-button type="text" @click="cancleCom(scope.row)"
                       >取消</el-button
                     >
-                    <el-button type="text" @click="showStudentList(scope.row)" :disabled="scope.row.id==radio"
+                    <el-button
+                      type="text"
+                      @click="showStudentList(scope.row)"
+                      :disabled="scope.row.id == radio"
                       >添加学生</el-button
                     >
                   </template>
@@ -89,8 +94,8 @@
       width="800px"
     >
       <viewStudentList
-      :classId="activeRow.id"
-      :disabledList='allStudentList'
+        :classId="activeRow.id"
+        :disabledList="allStudentList"
         :list="studentList"
         :chioseList="activeRow.studentList"
         v-if="studentListModalVisible"
@@ -100,29 +105,43 @@
       />
     </el-dialog>
 
-       <el-dialog
+    <el-dialog
       :visible.sync="calenderStudentVisible"
       title="学员缴费列表"
       append-to-body
       width="800px"
     >
-    <!--   studentIds:[],
+      <!--   studentIds:[],
       masterClassGroupId:'',
       classGroupStudents:[] -->
-      <calenderStudentList  v-if="calenderStudentVisible" :studentIds='studentIds' :masterClassGroupId='masterClassGroupId' :classGroupStudents='classGroupStudents'/>
+      <calenderStudentList
+      ref='calenderStudentList'
+        v-if="calenderStudentVisible"
+        :classList="dataList"
+        :studentIds="studentIds"
+        :masterClassGroupId="masterClassGroupId"
+        :classGroupStudents="classGroupStudents"
+        :mergeInfo="mergeInfo"
+      />
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="calenderStudentVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitInfo"
+          >确 定</el-button
+        >
+      </span>
     </el-dialog>
   </div>
 </template>
 <script>
 // import compoundClass from './compoundClass' compoundClass
 import viewStudentList from "./student-list";
-import calenderStudentList from "./calenderStudentList"
+import calenderStudentList from "./calenderStudentList";
 import { getClassAllStudent } from "@/api/studentManager";
-import { getStudentPaymentCalenders } from '@/api/buildTeam'
+import { getStudentPaymentCalenders } from "@/api/buildTeam";
 let that;
 export default {
   props: ["compoundList"],
-  components: { viewStudentList,calenderStudentList },
+  components: { viewStudentList, calenderStudentList },
   data() {
     return {
       radio: "",
@@ -133,15 +152,14 @@ export default {
       studentList: [],
       studentListModalVisible: false,
       activeRow: null,
-      calenderStudentVisible:false,
-      studentIds:[],
-      masterClassGroupId:'',
-      classGroupStudents:[],
-      mergeInfo:{}
-
+      calenderStudentVisible: false,
+      studentIds: [],
+      masterClassGroupId: "",
+      classGroupStudents: [],
+      mergeInfo: {},
     };
   },
-  created(){
+  created() {
     that = this;
   },
   methods: {
@@ -151,7 +169,7 @@ export default {
     clearCom() {
       this.$emit("clearCom");
     },
-   async submitClass() {
+    async submitClass() {
       if (!this.radio) {
         this.$message.error("请选择一个主班");
         return;
@@ -162,15 +180,20 @@ export default {
       // 班级和学生id的键值对
       // 第三个是主班编号 this.radio
       let idList = []; // 所有的班级id
-       this.classGroupStudents= []
-      let flag = false
+      this.classGroupStudents = [];
+      let flag = false;
       this.dataList.forEach((com) => {
         // arr.push(com.type)
-        if(!com.studentList&&com.id!=this.radio || com.studentList?.length<=0&&com.id!=this.radio){
-          flag = true
+        if (
+          (!com.studentList && com.id != this.radio) ||
+          (com.studentList?.length <= 0 && com.id != this.radio)
+        ) {
+          flag = true;
         }
-        if(com.id!=this.radio){
-          this.classGroupStudents.push({[com.id]:com.studentList.map(stu=>stu.userId).join(',')})
+        if (com.id != this.radio) {
+          this.classGroupStudents.push({
+            [com.id]: com.studentList.map((stu) => stu.userId).join(","),
+          });
         }
         idList.push(com.id);
       });
@@ -178,27 +201,30 @@ export default {
         this.$message.error("请至少选择2个班级");
         return;
       }
-      if(flag){
-         this.$message.error("请保证每个班至少勾选一名学员");
-        return
+      if (flag) {
+        this.$message.error("请保证每个班至少勾选一名学员");
+        return;
       }
       // 做判断
       this.show = true;
       this.isLook = false;
-       this.masterClassGroupId = this.radio;
-      this.studentIds = this.allStudentList.map(stu=>{
-        return stu.userId
-      })
+      this.masterClassGroupId = this.radio;
+      this.studentIds = this.allStudentList.map((stu) => {
+        return stu.userId;
+      });
 
-      try{
-        const rest = await getStudentPaymentCalenders({studentIds:this.studentIds,masterClassGroupId:this.masterClassGroupId,classGroupStudents:this.classGroupStudents})
-        this.mergeInfo = rest.data
+      try {
+        const rest = await getStudentPaymentCalenders({
+          studentIds: this.studentIds,
+          masterClassGroupId: this.masterClassGroupId,
+          classGroupStudents: this.classGroupStudents,
+        });
+        this.mergeInfo = rest.data;
         this.calenderStudentVisible = true;
-      }catch(e){
-        console.log(e)
+      } catch (e) {
+        console.log(e);
       }
 
-
       // 试着请求
     },
     getList() {},
@@ -230,13 +256,16 @@ export default {
       this.dataList.splice(1, 0);
       this.studentListModalVisible = false;
     },
-    changeMasterClass(val){
-      this.dataList.forEach(classes=>{
-        if(classes.id == val){
+    changeMasterClass(val) {
+      this.dataList.forEach((classes) => {
+        if (classes.id == val) {
           classes.studentList = null;
-           this.dataList.splice(1, 0);
+          this.dataList.splice(1, 0);
         }
-      })
+      });
+    },
+    submitInfo(){
+      this.$refs.calenderStudentList.submit()
     }
   },
   watch: {
@@ -244,20 +273,22 @@ export default {
       this.dataList = val;
     },
   },
-  computed:{
-      allStudentList(){
-        let arr = []
-        that.dataList.forEach(classes=>{
-          if(classes.studentList){
-            arr = arr.concat(classes.studentList.map(stu=>{
-              stu.classId = classes.id
-              return stu
-            }))
-          }
-        })
-        return arr
-      }
-  }
+  computed: {
+    allStudentList() {
+      let arr = [];
+      that.dataList.forEach((classes) => {
+        if (classes.studentList) {
+          arr = arr.concat(
+            classes.studentList.map((stu) => {
+              stu.classId = classes.id;
+              return stu;
+            })
+          );
+        }
+      });
+      return arr;
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>

+ 155 - 0
src/views/teamDetail/componentClass/studentPayItem.vue

@@ -0,0 +1,155 @@
+
+<template>
+  <div>
+    <!--  v-if="Object.keys(payItem).length > 0" -->
+    <paymentCycle
+      ref="cycle"
+      :form="cycle"
+      :isUserType="true"
+      :isCommon="true"
+      :isDisabled="true"
+      :hideMoney="true"
+    />
+    <!--  v-if="Object.keys(payItem).length > 0" -->
+    <otherform :form="other" ref="other" />
+    <el-table
+      :data="mergeInfo[index]"
+      :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
+      max-height="300px"
+      height="300px"
+    >
+      <el-table-column
+        prop="userId"
+        align="center"
+        width="120"
+        label="学员编号"
+      ></el-table-column>
+      <el-table-column
+        prop="username"
+        align="center"
+        width="120"
+        label="学员姓名"
+      ></el-table-column>
+      <el-table-column prop="phone" align="center" width="120" label="课程类型">
+        <template slot-scope="scope">
+          <div>
+            {{ scope.row.courseType | coursesType }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column prop="subjectNames" align="center" label="原价">
+        <template slot-scope="scope">
+          <div>
+            <el-input v-model="scope.row.courseOriginalPrice"></el-input>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="现价">
+        <template slot-scope="scope">
+          <div>
+            <el-input v-model="scope.row.courseCurrentPrice"></el-input>
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
+</template>
+<script>
+import paymentCycle from "@/views/resetTeaming/modals/payment-cycle";
+import otherform from "@/views/resetTeaming/modals/other";
+import { getTimes } from "@/utils";
+export default {
+  components: { paymentCycle, otherform },
+  props: ["mergeInfo", "index","classList",'classGroupStudents'],
+  data() {
+    return {
+      payItem: {},
+      cycle: {
+        paymentAmount: null,
+        paymentPattern: null,
+      },
+      other: {},
+      musicGroupId:''
+    };
+  },
+  mounted() {
+    console.log(this.classList)
+     this.classList.forEach((classes) => {
+        if (classes.id == this.index) {
+          this.musicGroupId = classes.musicGroupId
+          console.log(this.musicGroupId)
+        }
+      });
+  },
+  methods: {
+    getForms() {
+      const { $refs: refs } = this;
+      // [refs.base, refs.eclass, refs.cycle, ...(refs.cycles || []), refs.other, refs.payment]
+      return [refs.cycle, refs.other]
+        .filter((item) => !!item)
+        .map((item) => item.$refs.form || item);
+    },
+    getData() {
+      const forms = this.getForms();
+      const valided = [];
+      for (const form of forms) {
+        form.validate((valid) => {
+          if (valid) {
+            valided.push(form);
+          }
+        });
+      }
+      // if (this.eclass.length < 1) {
+      //   return this.$message.error("请至少选择一条加课信息");
+      // }
+      console.log(valided.length, forms.length);
+      if (valided.length === forms.length) {
+          const { leixing, ...rest } = {
+            ...this.form,
+            ...this.other,
+            musicGroupPaymentCalenderCourseSettingsList: this.corusePayList,
+          };
+
+          if (this.$refs.cycle) {
+            const {
+              paymentDate,
+              paymentValid,
+              paymentPattern,
+              ...other
+            } = this.cycle;
+            rest.paymentPattern = paymentPattern;
+            rest.payUserType = "STUDENT";
+            rest.paymentType = "SPAN_GROUP_CLASS_ADJUST";
+            rest.musicGroupPaymentCalenderStudentDetails =this.mergeInfo[this.index]
+            rest.studentIds = classGroupStudents[this.index]
+            rest.musicGroupPaymentDateRangeList = [
+              {
+                ...other,
+                ...getTimes(paymentDate, [
+                  "startPaymentDate",
+                  "deadlinePaymentDate",
+                ]),
+                ...getTimes(paymentValid, [
+                  "paymentValidStartDate",
+                  "paymentValidEndDate",
+                ]),
+              },
+            ];
+          }
+          const data = {
+            ...rest,
+            musicGroupId: this.musicGroupId,
+          };
+          return data;
+
+        // 说明验证通过
+      } else {
+        this.$message.error("请填写必要信息");
+        return "error";
+      }
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+</style>