|  | @@ -29,7 +29,7 @@
 | 
	
		
			
				|  |  |      >
 | 
	
		
			
				|  |  |        <el-form-item prop="year" label="年份">
 | 
	
		
			
				|  |  |          <el-date-picker
 | 
	
		
			
				|  |  | -           style="width: 180px!important"
 | 
	
		
			
				|  |  | +          style="width: 180px !important"
 | 
	
		
			
				|  |  |            v-model="searchForm.year"
 | 
	
		
			
				|  |  |            type="year"
 | 
	
		
			
				|  |  |            value-format="yyyy"
 | 
	
	
		
			
				|  | @@ -79,9 +79,9 @@
 | 
	
		
			
				|  |  |            :disabled="
 | 
	
		
			
				|  |  |              !searchForm.term || !searchForm.year || !searchForm.classGroupId
 | 
	
		
			
				|  |  |            "
 | 
	
		
			
				|  |  | -           style="width: 180px !important"
 | 
	
		
			
				|  |  | +          style="width: 180px !important"
 | 
	
		
			
				|  |  |            class="multiple"
 | 
	
		
			
				|  |  | -          v-model.trim="searchForm.courseType"
 | 
	
		
			
				|  |  | +          v-model.trim="searchForm.courseScheduleType"
 | 
	
		
			
				|  |  |            filterable
 | 
	
		
			
				|  |  |            placeholder="课程类型"
 | 
	
		
			
				|  |  |          >
 | 
	
	
		
			
				|  | @@ -93,41 +93,75 @@
 | 
	
		
			
				|  |  |            ></el-option>
 | 
	
		
			
				|  |  |          </el-select>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      </save-form>
 | 
	
		
			
				|  |  |      <div class="timerWrap">
 | 
	
		
			
				|  |  |        <div class="timerList">
 | 
	
		
			
				|  |  |          <el-timeline>
 | 
	
		
			
				|  |  |            <!--   timestamp="2018/4/12"  :timestamp="item.timestamp" -->
 | 
	
		
			
				|  |  |            <!-- {timer:time,index:`第${index+1}次训练`,courseType:filterCourseType[val],timestamp:timestamp} -->
 | 
	
		
			
				|  |  | -          <el-timeline-item v-for="item in planList"
 | 
	
		
			
				|  |  | +          <el-timeline-item
 | 
	
		
			
				|  |  | +            v-for="item in planList"
 | 
	
		
			
				|  |  |              :key="item.timestamp"
 | 
	
		
			
				|  |  |              placement="top"
 | 
	
		
			
				|  |  |              :hide-timestamp="true"
 | 
	
		
			
				|  |  |            >
 | 
	
		
			
				|  |  | -            {{item.index}}
 | 
	
		
			
				|  |  | +            {{ item.index }}
 | 
	
		
			
				|  |  |              <div class="timeline">
 | 
	
		
			
				|  |  | -              <h4 class="time">{{item.timer}}</h4>
 | 
	
		
			
				|  |  | -              <p class="cuorseType">{{item.courseType}}</p>
 | 
	
		
			
				|  |  | -              <p class="concat">{{item.plan}}</p>
 | 
	
		
			
				|  |  | -              <el-button class="button" :disabled='!item.plan' type="text">修改</el-button>
 | 
	
		
			
				|  |  | +              <h4 class="time">{{ item.timer|| '暂无课程时间' }}</h4>
 | 
	
		
			
				|  |  | +              <p class="cuorseType">{{ item.courseType }}</p>
 | 
	
		
			
				|  |  | +              <p class="concat"> <Tooltip :content="item.plan.value || '暂无规划'" /></p>
 | 
	
		
			
				|  |  | +              <el-button
 | 
	
		
			
				|  |  | +                class="button"
 | 
	
		
			
				|  |  | +                :disabled="!item.plan.value || !item.timer"
 | 
	
		
			
				|  |  | +                type="text"
 | 
	
		
			
				|  |  | +                @click="resetPlan(item)"
 | 
	
		
			
				|  |  | +                >修改</el-button
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  | +              <el-button
 | 
	
		
			
				|  |  | +                class="button"
 | 
	
		
			
				|  |  | +                :disabled="Boolean(item.timer)"
 | 
	
		
			
				|  |  | +                type="text"
 | 
	
		
			
				|  |  | +                @click="detelePlan(item)"
 | 
	
		
			
				|  |  | +                >删除</el-button
 | 
	
		
			
				|  |  | +              >
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |            </el-timeline-item>
 | 
	
		
			
				|  |  |          </el-timeline>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  | -          <el-dialog :title="planTitle" :visible.sync="planVisible" width="1100px" v-if="planVisible">
 | 
	
		
			
				|  |  | -            <addplan :form="{...searchForm}" :courseTypeList='courseTypeList' :classList="classList"/>
 | 
	
		
			
				|  |  | -        </el-dialog>
 | 
	
		
			
				|  |  | +    <el-dialog
 | 
	
		
			
				|  |  | +      :title="planTitle"
 | 
	
		
			
				|  |  | +      :visible.sync="planVisible"
 | 
	
		
			
				|  |  | +      width="1100px"
 | 
	
		
			
				|  |  | +      v-if="planVisible"
 | 
	
		
			
				|  |  | +    >
 | 
	
		
			
				|  |  | +      <addplan
 | 
	
		
			
				|  |  | +        ref="addPlan"
 | 
	
		
			
				|  |  | +        :form="searchForm"
 | 
	
		
			
				|  |  | +        :planList="planList"
 | 
	
		
			
				|  |  | +        :currentIndex="currentIndex"
 | 
	
		
			
				|  |  | +        :maxPlansNum="maxPlansNum"
 | 
	
		
			
				|  |  | +        :courseTypeList="courseTypeList"
 | 
	
		
			
				|  |  | +        :classList="classList"
 | 
	
		
			
				|  |  | +        :isAdd="isAdd"
 | 
	
		
			
				|  |  | +        :activeItem="activeItem"
 | 
	
		
			
				|  |  | +        @close="close"
 | 
	
		
			
				|  |  | +      />
 | 
	
		
			
				|  |  | +      <span slot="footer" class="dialog-footer">
 | 
	
		
			
				|  |  | +        <el-button @click="planVisible = false">取 消</el-button>
 | 
	
		
			
				|  |  | +        <el-button type="primary" @click="submitPlan">确 定</el-button>
 | 
	
		
			
				|  |  | +      </span>
 | 
	
		
			
				|  |  | +    </el-dialog>
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  |  import { getMusicGroupAllClass } from "@/api/buildTeam";
 | 
	
		
			
				|  |  | -import { getCourseType, getPlanCourseNum,getMusicGroupTrainPlan } from "./api";
 | 
	
		
			
				|  |  | +import { getCourseType, getPlanCourseNum, getMusicGroupTrainPlan,deteleMusicGroupTrainPlan } from "./api";
 | 
	
		
			
				|  |  |  import { filterCourseType } from "@/constant/index";
 | 
	
		
			
				|  |  | -import addplan from './modals/addPlan'
 | 
	
		
			
				|  |  | +import addplan from "./modals/addPlan";
 | 
	
		
			
				|  |  | +import Tooltip from '@/components/Tooltip/index'
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  | -  components:{addplan},
 | 
	
		
			
				|  |  | +  components: { addplan ,Tooltip},
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  |        searchForm: {
 | 
	
	
		
			
				|  | @@ -136,13 +170,18 @@ export default {
 | 
	
		
			
				|  |  |          term: "",
 | 
	
		
			
				|  |  |          courseScheduleType: "",
 | 
	
		
			
				|  |  |          musicGroupId: "",
 | 
	
		
			
				|  |  | -        courseType: "",
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |        classList: [],
 | 
	
		
			
				|  |  |        courseTypeList: [],
 | 
	
		
			
				|  |  | -      planList:[],
 | 
	
		
			
				|  |  | -      planTitle:'',
 | 
	
		
			
				|  |  | -      planVisible:false
 | 
	
		
			
				|  |  | +      planList: [],
 | 
	
		
			
				|  |  | +      planTitle: "",
 | 
	
		
			
				|  |  | +      planVisible: false,
 | 
	
		
			
				|  |  | +      currentIndex: 0,
 | 
	
		
			
				|  |  | +      addIndex:0,
 | 
	
		
			
				|  |  | +      resetIndex:0,
 | 
	
		
			
				|  |  | +      maxPlansNum: 0,
 | 
	
		
			
				|  |  | +      isAdd: false,
 | 
	
		
			
				|  |  | +      activeItem:null
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    created() {
 | 
	
	
		
			
				|  | @@ -177,7 +216,7 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      async getCourseList(obj) {
 | 
	
		
			
				|  |  |        try {
 | 
	
		
			
				|  |  | -        this.searchForm.courseType = "";
 | 
	
		
			
				|  |  | +        this.searchForm.courseScheduleType = "";
 | 
	
		
			
				|  |  |          const res = await getCourseType(obj);
 | 
	
		
			
				|  |  |          if (!res.data || res.data.length <= 0) {
 | 
	
		
			
				|  |  |            this.$message.error("当前学期暂无课程类型");
 | 
	
	
		
			
				|  | @@ -191,7 +230,7 @@ export default {
 | 
	
		
			
				|  |  |                });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |            });
 | 
	
		
			
				|  |  | -          this.searchForm.courseType = this.courseTypeList[0].value;
 | 
	
		
			
				|  |  | +          this.searchForm.courseScheduleType = this.courseTypeList[0].value;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        } catch (e) {
 | 
	
		
			
				|  |  |          console.log(e);
 | 
	
	
		
			
				|  | @@ -209,7 +248,7 @@ export default {
 | 
	
		
			
				|  |  |            this.getCourseList(obj);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  | -        this.searchForm.courseType = "";
 | 
	
		
			
				|  |  | +        this.searchForm.courseScheduleType = "";
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      changeTerm(val) {
 | 
	
	
		
			
				|  | @@ -224,12 +263,129 @@ export default {
 | 
	
		
			
				|  |  |            this.getCourseList(obj);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  | -        this.searchForm.courseType = "";
 | 
	
		
			
				|  |  | +        this.searchForm.courseScheduleType = "";
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    addPlan() {
 | 
	
		
			
				|  |  | +      if (this.maxPlansNum > 0) {
 | 
	
		
			
				|  |  | +        this.planTitle = "新增训练规划";
 | 
	
		
			
				|  |  | +        this.isAdd = true;
 | 
	
		
			
				|  |  | +        this.activeItem = null;
 | 
	
		
			
				|  |  | +        this.planVisible = true;
 | 
	
		
			
				|  |  | +        this.currentIndex = this.addIndex;
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        this.$message.error("已添加所有课时规划");
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    submitPlan() {
 | 
	
		
			
				|  |  | +      this.$refs.addPlan.submit();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    close() {
 | 
	
		
			
				|  |  | +      this.planVisible = false;
 | 
	
		
			
				|  |  | +      let obj = {
 | 
	
		
			
				|  |  | +        classGroupId: this.searchForm.classGroupId,
 | 
	
		
			
				|  |  | +        musicGroupId: this.teamid,
 | 
	
		
			
				|  |  | +        term: this.searchForm.term,
 | 
	
		
			
				|  |  | +        year: this.searchForm.year,
 | 
	
		
			
				|  |  | +        courseScheduleType: this.searchForm.courseScheduleType,
 | 
	
		
			
				|  |  | +      };
 | 
	
		
			
				|  |  | +      console.log(obj);
 | 
	
		
			
				|  |  | +      this.getList(obj);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    async getList(obj) {
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        const res2 = await getMusicGroupTrainPlan(obj);
 | 
	
		
			
				|  |  | +        let dayjs = this.$helpers.dayjs;
 | 
	
		
			
				|  |  | +        let timestamp;
 | 
	
		
			
				|  |  | +        // 判断 是规划多 还是课多
 | 
	
		
			
				|  |  | +        let classDates = res2.data.classDates;
 | 
	
		
			
				|  |  | +        let musicGroupTrainPlans = res2.data.musicGroupTrainPlans;
 | 
	
		
			
				|  |  | +        if (classDates.length < 1) {
 | 
	
		
			
				|  |  | +          this.$message.error("当前学期该班级暂无此类型课程");
 | 
	
		
			
				|  |  | +          return;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (classDates.length >= musicGroupTrainPlans.length) {
 | 
	
		
			
				|  |  | +          this.planList = res2.data.classDates.map((time, index) => {
 | 
	
		
			
				|  |  | +            let dayStr = time.substring(0, 19);
 | 
	
		
			
				|  |  | +            timestamp = dayjs(dayStr).valueOf();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            return {
 | 
	
		
			
				|  |  | +              num:index + 1,
 | 
	
		
			
				|  |  | +              timer: time,
 | 
	
		
			
				|  |  | +              index: `第${index + 1}次训练`,
 | 
	
		
			
				|  |  | +              courseType: filterCourseType[this.searchForm.courseScheduleType],
 | 
	
		
			
				|  |  | +              timestamp: timestamp,
 | 
	
		
			
				|  |  | +              plan: null,
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +          this.addIndex = musicGroupTrainPlans.length + 1;
 | 
	
		
			
				|  |  | +          this.maxPlansNum = classDates.length - musicGroupTrainPlans.length;
 | 
	
		
			
				|  |  | +          this.planList.forEach((item, index) => {
 | 
	
		
			
				|  |  | +            item.plan = {
 | 
	
		
			
				|  |  | +              id: res2.data.musicGroupTrainPlans[index]?.id,
 | 
	
		
			
				|  |  | +              value: res2.data.musicGroupTrainPlans[index]?.plan,
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          // 规划多 课少
 | 
	
		
			
				|  |  | +          this.planList = res2.data.musicGroupTrainPlans.map((item, index) => {
 | 
	
		
			
				|  |  | +            return {
 | 
	
		
			
				|  |  | +              num:index + 1,
 | 
	
		
			
				|  |  | +              timer: null,
 | 
	
		
			
				|  |  | +              index: `第${index + 1}次训练`,
 | 
	
		
			
				|  |  | +              courseType: filterCourseType[this.searchForm.courseScheduleType],
 | 
	
		
			
				|  |  | +              timestamp: null,
 | 
	
		
			
				|  |  | +              plan: { id: item.id, value: item.plan },
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          this.planList.forEach((item, index) => {
 | 
	
		
			
				|  |  | +            let time = res2.data?.classDates[index];
 | 
	
		
			
				|  |  | +            let timestamp;
 | 
	
		
			
				|  |  | +            if (time) {
 | 
	
		
			
				|  |  | +              let dayStr = time.substring(0, 19);
 | 
	
		
			
				|  |  | +              timestamp = dayjs(dayStr).valueOf();
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            item.timer = res2.data?.classDates[index];
 | 
	
		
			
				|  |  | +            item.timestamp = timestamp;
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      } catch (e) {
 | 
	
		
			
				|  |  | +        console.log(e);
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    addPlan(){
 | 
	
		
			
				|  |  | -      this.planTitle = '新增训练规划'
 | 
	
		
			
				|  |  | -      this.planVisible = true
 | 
	
		
			
				|  |  | +    // 删除尚未接完
 | 
	
		
			
				|  |  | +    detelePlan(item) {
 | 
	
		
			
				|  |  | +      this.$confirm("确定删除该规划?", "提示", {
 | 
	
		
			
				|  |  | +        confirmButtonText: "确定",
 | 
	
		
			
				|  |  | +        cancelButtonText: "取消",
 | 
	
		
			
				|  |  | +        type: "warning",
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +        .then(async () => {
 | 
	
		
			
				|  |  | +          try{
 | 
	
		
			
				|  |  | +            // const res
 | 
	
		
			
				|  |  | +          }catch(e){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          deteleMusicGroupTrainPlan({ orderId: row.id }).then((res) => {
 | 
	
		
			
				|  |  | +            if (res.code === 200) {
 | 
	
		
			
				|  |  | +              this.$message.success("删除成功");
 | 
	
		
			
				|  |  | +              this.getList();
 | 
	
		
			
				|  |  | +              // this.routeOrderStatus = false;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .catch();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    // 修改
 | 
	
		
			
				|  |  | +    resetPlan(item){
 | 
	
		
			
				|  |  | +        this.planTitle = "修改训练规划";
 | 
	
		
			
				|  |  | +        this.isAdd = false;
 | 
	
		
			
				|  |  | +        this.activeItem = item;
 | 
	
		
			
				|  |  | +        this.currentIndex = item.num;
 | 
	
		
			
				|  |  | +        this.planVisible = true;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    watch: {
 | 
	
	
		
			
				|  | @@ -245,10 +401,10 @@ export default {
 | 
	
		
			
				|  |  |            this.getCourseList(obj);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  | -        this.searchForm.courseType = "";
 | 
	
		
			
				|  |  | +        this.searchForm.courseScheduleType = "";
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    "searchForm.courseType": {
 | 
	
		
			
				|  |  | +    "searchForm.courseScheduleType": {
 | 
	
		
			
				|  |  |        immediate: true,
 | 
	
		
			
				|  |  |        async handler(val) {
 | 
	
		
			
				|  |  |          if (
 | 
	
	
		
			
				|  | @@ -259,33 +415,14 @@ export default {
 | 
	
		
			
				|  |  |            this.searchForm.classGroupId
 | 
	
		
			
				|  |  |          ) {
 | 
	
		
			
				|  |  |            // 请求列表接口
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -          try {
 | 
	
		
			
				|  |  | -            // const res = await getPlanCourseNum({
 | 
	
		
			
				|  |  | -            //   classGroupId: this.searchForm.classGroupId,
 | 
	
		
			
				|  |  | -            //   musicGroupId: this.teamid,
 | 
	
		
			
				|  |  | -            //   term: this.searchForm.term,
 | 
	
		
			
				|  |  | -            //   year: this.searchForm.year,
 | 
	
		
			
				|  |  | -            //   courseScheduleType:val
 | 
	
		
			
				|  |  | -            // });
 | 
	
		
			
				|  |  | -            const res2 = await getMusicGroupTrainPlan({
 | 
	
		
			
				|  |  | -              classGroupId: this.searchForm.classGroupId,
 | 
	
		
			
				|  |  | -              musicGroupId: this.teamid,
 | 
	
		
			
				|  |  | -              term: this.searchForm.term,
 | 
	
		
			
				|  |  | -              year: this.searchForm.year,
 | 
	
		
			
				|  |  | -              courseScheduleType:val
 | 
	
		
			
				|  |  | -            })
 | 
	
		
			
				|  |  | -            let dayjs = this.$helpers.dayjs
 | 
	
		
			
				|  |  | -              let timestamp;
 | 
	
		
			
				|  |  | -            this.planList = res2.data.classDates.map((time,index)=>{
 | 
	
		
			
				|  |  | -                  let dayStr = time.substring(0, 19)
 | 
	
		
			
				|  |  | -                  timestamp = dayjs(dayStr).valueOf()
 | 
	
		
			
				|  |  | -              return {timer:time,index:`第${index+1}次训练`,courseType:filterCourseType[val],timestamp:timestamp}
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -          } catch (e) {
 | 
	
		
			
				|  |  | -            console.log(e);
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | +          let obj = {
 | 
	
		
			
				|  |  | +            classGroupId: this.searchForm.classGroupId,
 | 
	
		
			
				|  |  | +            musicGroupId: this.teamid,
 | 
	
		
			
				|  |  | +            term: this.searchForm.term,
 | 
	
		
			
				|  |  | +            year: this.searchForm.year,
 | 
	
		
			
				|  |  | +            courseScheduleType: val,
 | 
	
		
			
				|  |  | +          };
 | 
	
		
			
				|  |  | +          this.getList(obj);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -340,7 +477,7 @@ export default {
 | 
	
		
			
				|  |  |          white-space: nowrap;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        .button {
 | 
	
		
			
				|  |  | -        width: 100px;
 | 
	
		
			
				|  |  | +        width: 40px;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 |