1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-31b748f3"],{"2ddb":function(t,e,s){"use strict";s("e79c")},bd11:function(t,e,s){"use strict";s.r(e);var i=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"father-Wrap"},[s("div",{staticClass:"topWrap"},["resetTeam"!=t.type?s("el-page-header",{staticStyle:{"padding-bottom":"30px"},attrs:{content:"批量排课"},on:{back:t.goback}}):t._e()],1),t._v(" "),s("div",{staticClass:"course-container"},[s("div",{staticClass:"left"},[s("el-form",{ref:"leftFrom",attrs:{model:t.leftFrom,rules:t.leftRules,inline:!0}},[s("el-form-item",{attrs:{label:"合奏班",prop:"all"}},[s("el-select",{attrs:{filterable:"",clearable:""},on:{change:t.changeMixClass},model:{value:t.leftFrom.all,callback:function(e){t.$set(t.leftFrom,"all","string"===typeof e?e.trim():e)},expression:"leftFrom.all"}},t._l(t.maxClassList,(function(t,e){return s("el-option",{key:e,attrs:{value:t.id,label:t.name}})})),1)],1),t._v(" "),s("el-form-item",{attrs:{label:"排课时间",prop:"time"}},[s("el-date-picker",{staticStyle:{width:"180px"},attrs:{align:"right",type:"date","picker-options":{firstDayOfWeek:1},placeholder:"选择日期"},model:{value:t.leftFrom.time,callback:function(e){t.$set(t.leftFrom,"time","string"===typeof e?e.trim():e)},expression:"leftFrom.time"}})],1),t._v(" "),s("el-form-item",{attrs:{label:"排课次数",prop:"num"}},[s("el-input",{attrs:{type:"number"},nativeOn:{mousewheel:function(t){t.preventDefault()}},model:{value:t.leftFrom.num,callback:function(e){t.$set(t.leftFrom,"num","string"===typeof e?e.trim():e)},expression:"leftFrom.num"}})],1)],1),t._v(" "),s("p",[t._v("周次循环"),s("span",{staticStyle:{"margin-left":"10px"}},[s("el-button",{attrs:{type:"text"},on:{click:t.addWeekDay}},[t._v("添加")])],1)]),t._v(" "),s("div",{staticClass:"checkWrap"},[s("el-checkbox-group",{model:{value:t.checkList,callback:function(e){t.checkList="string"===typeof e?e.trim():e},expression:"checkList"}},t._l(t.week,(function(e,i){return s("div",{key:i,staticClass:"chioseday"},[s("el-select",{staticClass:"weekSelect",staticStyle:{width:"100px!important"},attrs:{filterable:"",clearable:"",placeholder:"星期几"},model:{value:e.weekNum,callback:function(s){t.$set(e,"weekNum","string"===typeof s?s.trim():s)},expression:"item.weekNum"}},t._l(t.weekList,(function(t,e){return s("el-option",{key:e,attrs:{label:t.label,value:t.value}})})),1),t._v(" "),s("el-time-select",{attrs:{placeholder:"起始","picker-options":{start:"04:30",step:"00:05",end:"23:30"}},on:{change:function(s){return t.changeTimer(e)}},model:{value:e.startTime,callback:function(s){t.$set(e,"startTime","string"===typeof s?s.trim():s)},expression:"item.startTime"}}),t._v(" "),s("el-time-select",{attrs:{placeholder:"结束","picker-options":{start:"04:30",step:"00:05",end:"23:30",minTime:e.startTime}},model:{value:e.endTime,callback:function(s){t.$set(e,"endTime","string"===typeof s?s.trim():s)},expression:"item.endTime"}}),t._v(" "),s("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"text"},on:{click:function(s){return t.removeWeek(e)}}},[t._v("删除")])],1)})),0),t._v(" "),s("div",{staticClass:"holidayWrap"},[s("el-checkbox",{model:{value:t.isholiday,callback:function(e){t.isholiday="string"===typeof e?e.trim():e},expression:"isholiday"}},[t._v("跳过节假日")]),t._v(" "),s("div",{staticClass:"quickBtn",on:{click:t.classCard}},[t._v("一键排课")])],1)],1)],1),t._v(" "),s("div",{staticClass:"right"},[s("div",{staticClass:"newBand",staticStyle:{float:"left"},on:{click:t.multipleReset}},[t._v("批量修改")]),t._v(" "),s("el-table",{staticStyle:{width:"1060px"},attrs:{data:t.tableList,"header-cell-style":{background:"#EDEEF0",color:"#444"}},on:{"selection-change":t.handleSelectionChange}},[s("el-table-column",{attrs:{type:"selection",width:"55"}}),t._v(" "),s("el-table-column",{attrs:{label:"课次",width:"55"},scopedSlots:t._u([{key:"default",fn:function(e){return[s("div",[t._v("\n "+t._s(e.$index+1)+"\n ")])]}}])}),t._v(" "),s("el-table-column",{attrs:{prop:"classDate",align:"center",label:"日期"}}),t._v(" "),s("el-table-column",{attrs:{prop:"week",align:"center",label:"星期"}}),t._v(" "),s("el-table-column",{attrs:{label:"课程类型",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[s("div",[t._v("\n "+t._s(t._f("coursesType")(e.row.type))+"\n ")])]}}])}),t._v(" "),s("el-table-column",{attrs:{prop:"name",align:"center",label:"合奏班名称"}}),t._v(" "),s("el-table-column",{attrs:{label:"操作",width:"310"},scopedSlots:t._u([{key:"default",fn:function(e){return[s("div",[s("el-button",{attrs:{type:"text"},on:{click:function(s){return t.OpenSign(e.row)}}},[t._v("查看")]),t._v(" "),s("el-button",{attrs:{type:"text"},on:{click:function(s){return t.resetMixCourse(e.row)}}},[t._v("变更")]),t._v(" "),s("el-button",{attrs:{type:"text"},on:{click:function(s){return t.skipClass(e.row)}}},[t._v("跳过此天")])],1)]}}])})],1),t._v(" "),s("div",{staticClass:"btnWrap",staticStyle:{"margin-top":"40px"}},[s("div",{staticClass:"nextBtn",on:{click:t.resetaLL}},[t._v("取消排课")]),t._v(" "),s("div",{staticClass:"okBtn",on:{click:t.submitInfo}},[t._v("确定排课")])])],1),t._v(" "),s("el-dialog",{attrs:{visible:t.resetAllClassVisible,width:"450px"},on:{"update:visible":function(e){t.resetAllClassVisible=e}}},[s("p",{staticStyle:{"margin-bottom":"20px"}},[t._v(t._s(t.resetAllTitle))]),t._v(" "),s("div",{staticClass:"resetWrap"},[s("el-select",{attrs:{clearable:"",filterable:""},on:{change:t.changeCheckCard},model:{value:t.chioseType,callback:function(e){t.chioseType="string"===typeof e?e.trim():e},expression:"chioseType"}},t._l(t.courseTypeList,(function(t,e){return s("el-option",{key:e,attrs:{label:t.name,value:t.value}})})),1)],1),t._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t.isMultiple?t._e():s("div",{staticClass:"okBtns",on:{click:function(e){return t.resetMix(t.tableActive)}}},[t._v("确定")]),t._v(" "),t.isMultiple?s("div",{staticClass:"okBtns",on:{click:t.multipleResetMix}},[t._v("确定")]):t._e()])]),t._v(" "),s("el-dialog",{attrs:{visible:t.openSignListVisible,width:"450px"},on:{"update:visible":function(e){t.openSignListVisible=e}}},[s("el-table",{attrs:{data:t.SignList}},[s("el-table-column",{attrs:{prop:"name",label:"班级"}}),t._v(" "),s("el-table-column",{attrs:{prop:"startClassTimeStr",label:"开始时间"}}),t._v(" "),s("el-table-column",{attrs:{prop:"endClassTimeStr",label:"结束时间"}})],1),t._v(" "),s("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("div",{staticClass:"okBtns",on:{click:t.resetSiginClass}},[t._v("确定")])])],1)],1)])},a=[],l=(s("28a5"),s("7f7f"),s("a481"),s("ac6a"),s("456d"),s("5c96")),r=s("1cc7"),n=s("bc3a"),c=s.n(n),o=s("4328"),h=s.n(o),m={name:"coursePlan",data:function(){return{resetAllClassVisible:!1,openSignListVisible:!1,first:!0,leftFrom:{all:"",time:"",num:""},tableList:[],checkList:[],week:[{startTime:"",endTime:"",weekNum:"",id:(new Date).getTime()}],weekList:[{label:"星期日",value:0},{label:"星期一",value:1},{label:"星期二",value:2},{label:"星期三",value:3},{label:"星期四",value:4},{label:"星期五",value:5},{label:"星期六",value:6}],weekDay:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],maxClassList:[],activeSingleList:[],isholiday:!1,classCardList:[],allChioseDate:[],holidayList:[],leftRules:{all:[{required:!0,message:"请输选择合奏班",trigger:"blur"}],time:[{required:!0,message:"请选择排课时间",trigger:"blur"}],num:[{required:!0,message:"请输入排课次数",trigger:"blur"}]},resetAllTitle:"",buttonType:"",activeTime:"",signBtnActive:!1,skipBtnActive:!1,SignList:[],courseTypeList:[{name:"声部课",value:"SINGLE"},{name:"集训声部课",value:"TRAINING_SINGLE"},{name:"合奏课",value:"MIX"},{name:"集训合奏课",value:"TRAINING_MIX"},{name:"课堂课",value:"CLASSROOM"}],chioseType:"",tableActive:null,startClassTimeStr:"",endClassTimeStr:"",teamid:"",activeList:[],isMultiple:!1,type:""}},created:function(){},mounted:function(){this.init()},activated:function(){this.init()},methods:{init:function(){var t=this;this.teamid=this.$route.query.id,localStorage.setItem("resetCode",3),localStorage.setItem("setStep",2),this.type=this.$route.query.type||"",Object(r["S"])({musicGroupId:this.teamid}).then((function(e){200==e.code&&(t.maxClassList=e.data)}));var e=(new Date).getFullYear();Object(r["lb"])({year:e}).then((function(s){if(200==s.code){var i=JSON.parse(s.data);t.holidayList=Object.keys(i[e])}}))},changeCheckCard:function(t){},changeTimer:function(t){t.endTime=""},handleSelectionChange:function(t){this.activeList=t},submitInfo:function(){var t=this;this.classCardList.length<=0?this.$message.error("请先点击一键排课,再确认排课"):this.$confirm("课表无误,确定排课","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(r["bd"])({musicGroupID:t.teamid,courseSchedules:t.classCardList}).then((function(e){200==e.code&&(t.$message.success("恭喜您排课成功"),t.classCardList=[],t.SignList=[],t.tableList=[],t.$router.go(-1))})).catch((function(e){t.classCardList=[],t.SignList=[],t.tableList=[]}))})).catch((function(){}))},classCard:function(){var t=!1;if(this.$refs["leftFrom"].validate((function(e){e&&(t=!0)})),t){var e=parseInt(this.leftFrom.num),s=this.leftFrom.time;this.workOut(s,e,this.week,this.leftFrom.all),this.$refs["leftFrom"].resetFields(),this.week=this.$options.data().week,this.checkList=[]}else this.$message.error("请填写必要参数在进行排课")},chioseWeek:function(t){},getThinkDate:function(t,e){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=new Date(t.getTime());i.setDate(i.getDate()+parseInt(e));var a=i.getFullYear(),l=i.getMonth()+1,r="";r=l<10?"0"+l:l+"";var n=i.getDate(),c="";return c=n<10?"0"+n:n+"",2==s?r+c:a+"-"+r+"-"+c},changeMixClass:function(t){var e=this,s=t;this.first||(this.classCardList=[],this.SignList=[],this.tableList=[],this.leftFrom.all=s),this.first=!1,this.activeSingleList=[],Object(r["T"])({musicGroupId:this.teamid,mixClassGroupId:t}).then((function(s){200==s.code&&(e.activeSingleList=s.data.map((function(e){return e.mixid=t,e})))}))},resetMixCourse:function(t){this.resetAllClassVisible=!0,this.resetAllTitle="将".concat(t.classDate," ,").concat(t.week,"修改"),this.buttonType=t.type,this.activeTime=t.classDate,this.startClassTimeStr=t.startClassTimeStr,this.endClassTimeStr=t.endClassTimeStr,this.chioseType=t.type,this.tableActive=t,console.log(this.classCardList)},resetClass:function(){this.signBtnActive=!this.signBtnActive},multipleReset:function(){this.activeList.length<1?this.$message.error("请至少选择一节已上课时"):(this.isMultiple=!0,this.resetAllClassVisible=!0,this.resetAllTitle="批量修改")},skipClass:function(t){this.chioseType=t.type;var e=l["Loading"].service({lock:!0,text:"加载中……",background:"rgba(0, 0, 0, 0.7)"});setTimeout((function(t){e.close()}),1e3);var s,i,a,r=this.tableList[this.tableList.length-1].classDate,n=this.tableList[this.tableList.length-1].id;for(var c in this.tableList)t.classDate==this.tableList[c].classDate&&t.startClassTimeStr==this.tableList[c].startClassTimeStr&&t.endClassTimeStr==this.tableList[c].endClassTimeStr&&(a=this.tableList[c].weekNum,s=this.tableList[c].startClassTimeStr,i=this.tableList[c].endClassTimeStr,this.tableList.splice(c,1));for(var o=0;o<this.classCardList.length;o++)this.classCardList[o].classDate==t.classDate&&t.startClassTimeStr==this.classCardList[o].startClassTimeStr&&t.endClassTimeStr==this.classCardList[o].endClassTimeStr&&(this.classCardList.splice(o,1),o--);var h={startTime:i,endTime:s,weekNum:a,id:(new Date).getTime()};r=r.replace(/-/g,"/");var m=new Date(r);m.setDate(m.getDate()+1),this.workOut(m,1,[h],n,2,s,i)},multipleResetMix:function(){for(var t in console.log("批量调整"),this.isMultiple=!1,this.activeList)this.resetMix(this.activeList[t])},resetMix:function(t){if(this.activeTime=t.classDate,this.startClassTimeStr=t.startClassTimeStr,this.endClassTimeStr=t.endClassTimeStr,-1!=this.chioseType.indexOf("MIX")){for(var e=0;e<this.classCardList.length;e++)t.classDate==this.classCardList[e].classDate&&this.startClassTimeStr==this.classCardList[e].startClassTimeStr&&this.endClassTimeStr==this.classCardList[e].endClassTimeStr&&(this.classCardList.splice(e,1),e--);for(var s in this.tableList)t.classDate==this.tableList[s].classDate&&this.startClassTimeStr==this.tableList[s].startClassTimeStr&&this.endClassTimeStr==this.tableList[s].endClassTimeStr&&(this.tableList[s].type=this.chioseType,this.tableList[s].startClassTime,this.tableList[s].endClassTime,this.classCardList.push(this.tableList[s]))}else if(-1!=this.chioseType.indexOf("SINGLE")||-1!=this.chioseType.indexOf("CLASSROOM")){for(var i in this.tableList)t.classDate==this.tableList[i].classDate&&this.startClassTimeStr==this.tableList[i].startClassTimeStr&&this.endClassTimeStr==this.tableList[i].endClassTimeStr&&(this.tableList[i].type=this.chioseType,this.tableList[i].startClassTime,this.tableList[i].endClassTime);for(var a={},l=0;l<this.classCardList.length;l++)for(var r=0;r<this.tableList.length;r++)t.classDate==this.tableList[r].classDate&&this.startClassTimeStr==this.tableList[r].startClassTimeStr&&this.endClassTimeStr==this.tableList[r].endClassTimeStr&&(a=this.tableList[r]),t.classDate==this.classCardList[l].classDate&&this.startClassTimeStr==this.classCardList[l].startClassTimeStr&&this.endClassTimeStr==this.classCardList[l].endClassTimeStr&&(this.classCardList.splice(l,1),l--,r--,l<0&&(l=0),r<0&&(r=0));for(var n in this.activeSingleList){var c={classDate:a.classDate,week:a.week,type:this.chioseType,mixid:a.mixid,id:this.activeSingleList[n].id,name:this.activeSingleList[n].name,classTime:a.classTime,startClassTimeStr:a.startClassTimeStr,endClassTimeStr:a.endClassTimeStr,weekNum:a.weekNum,classGroupId:this.activeSingleList[n].id};this.classCardList.push(c)}}this.resetAllClassVisible=!1},workOut:function(t,e,s,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"";while(e&&e>0){for(var r in s){var n=new Date(t.getTime()),c=void 0;c=s[r].weekNum-t.getDay()>=0?s[r].weekNum-t.getDay():s[r].weekNum-t.getDay()+7;var o=this.getThinkDate(t,c),h=this.getThinkDate(n,c,2);if(!this.isholiday||-1==this.holidayList.indexOf(h)){var m=void 0;if(this.maxClassList.map((function(t){if(t.id==i)return m=t.name,t.name})),!a&&(!this.week[r].startTime||!this.week[r].endTime))return void this.$message.error("勾选日期的上课时间段必填");var u=this.week[r].startTime||a,d=this.week[r].endTime||l,p=void 0;for(var v in p="SINGLE",this.tableList.push({classDate:o,week:this.weekDay[s[r].weekNum],type:p,id:i,mixid:i,name:m,classTime:u+"-"+d,startClassTimeStr:u,endClassTimeStr:d,weekNum:s[r].weekNum,classGroupId:i}),this.activeSingleList)this.classCardList.push({classDate:o,classGroupId:this.activeSingleList[v].id,startClassTimeStr:u,endClassTimeStr:d,type:p,mixid:this.activeSingleList[v].mixid,weekNum:s[r].weekNum,name:this.activeSingleList[v].name,option:1});if(e--,0==e)break}}t.setDate(t.getDate()+7)}console.log(this.classCardList)},resetaLL:function(){var t=this;this.classCardList=[],this.SignList=[],this.tableList=[],this.teamid=this.$route.query.id,Object(r["S"])({musicGroupId:this.teamid}).then((function(e){200==e.code&&(t.maxClassList=e.data)}));var e=(new Date).getFullYear();c.a.post("/jiari/",h.a.stringify({d:e})).then((function(s){t.holidayList=Object.keys(s.data[e])}))},OpenSign:function(t){for(var e in this.SignList=[],this.classCardList)this.classCardList[e].mixid==t.mixid&&this.classCardList[e].classDate==t.classDate&&t.startClassTimeStr==this.classCardList[e].startClassTimeStr&&t.endClassTimeStr==this.classCardList[e].endClassTimeStr&&this.SignList.push(this.classCardList[e]);this.openSignListVisible=!0},savecolumn:function(t){1==t.option?t.option=2:t.option=1},resetSiginClass:function(){this.openSignListVisible=!1},submitCardList:function(){},gotoNext:function(){var t=this;Object(r["r"])({musicGroupId:this.teamid}).then((function(t){t.code})).catch((function(e){t.$message.error(e.msg)}))},addWeekDay:function(){this.week.push({startTime:"",endTime:"",weekNum:"",id:(new Date).getTime()})},removeWeek:function(t){for(var e in this.week)t.id==this.week[e].id&&this.week.splice(e,1)},timeIsrange:function(t,e,s){var i=t.split(":");if(2!=i.length)return!1;var a=e.split(":");if(2!=a.length)return!1;var l=s.split(":");if(2!=a.length)return!1;var r=new Date,n=new Date,c=new Date;return r.setHours(i[0]),r.setMinutes(i[1]),n.setHours(a[0]),n.setMinutes(a[1]),c.setHours(l[0]),c.setMinutes(l[1]),c.getTime()-r.getTime()>=0&&c.getTime()-n.getTime()<=0},checkTime:function(){if(this.week.length<=0)return this.$message.error("至少填写一个排课周期"),!1;for(var t in this.week)if(!this.week[t].startTime||!this.week[t].endTime||!this.week[t].weekNum)return this.$message.error("请填写完整的排课周期"),!1},getNowFormatDate:function(t){var e="-",s=t.getFullYear(),i=t.getMonth()+1,a=t.getDate();i>=1&&i<=9&&(i="0"+i),a>=0&&a<=9&&(a="0"+a);var l=s+e+i+e+a;return l},goback:function(){this.$router.go(-1)}},watch:{resetAllClassVisible:function(t){t||(this.signBtnActive=!1,this.skipBtnActive=!1)}}},u=m,d=(s("2ddb"),s("2877")),p=Object(d["a"])(u,i,a,!1,null,"c612eb1e",null);e["default"]=p.exports},e79c:function(t,e,s){}}]);
|