coursePlan.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  1. <template>
  2. <div class='father-Wrap'>
  3. <div class='course-container'>
  4. <div class="left">
  5. <el-form :model="leftFrom"
  6. ref='leftFrom'
  7. :rules="leftRules"
  8. :inline="true">
  9. <el-form-item label="合奏班"
  10. prop='all'>
  11. <el-select v-model="leftFrom.all"
  12. @change="changeMixClass">
  13. <el-option v-for="(item,index) in maxClassList"
  14. :key='index'
  15. :value="item.id"
  16. :label="item.name"></el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="排课时间"
  20. prop="time">
  21. <!-- value-format="yyyy-MM-dd" -->
  22. <el-date-picker v-model="leftFrom.time"
  23. style="width:180px;"
  24. align="right"
  25. type="date"
  26. placeholder="选择日期">
  27. </el-date-picker>
  28. </el-form-item>
  29. <el-form-item label="排课次数"
  30. prop="num">
  31. <el-input type="number"
  32. v-model="leftFrom.num"></el-input>
  33. </el-form-item>
  34. </el-form>
  35. <p>周次循环<span style="margin-left:10px;">
  36. <el-button type="text"
  37. @click="addWeekDay">添加</el-button>
  38. </span></p>
  39. <div class="checkWrap">
  40. <el-checkbox-group v-model="checkList">
  41. <div class="chioseday"
  42. v-for="(item,index) in week"
  43. :key="index">
  44. <!-- <el-checkbox :label="index"
  45. v-model="item.isCheck">{{item.name}}</el-checkbox> -->
  46. <el-select class='weekSelect'
  47. style="width:100px!important"
  48. placeholder="星期几"
  49. v-model="item.weekNum">
  50. <el-option v-for='(item,index) in weekList'
  51. :key="index"
  52. :label="item.label"
  53. :value="item.value"></el-option>
  54. </el-select>
  55. <el-time-select placeholder="起始"
  56. v-model="item.startTime"
  57. :picker-options="{
  58. start: '06:30',
  59. step: '00:05',
  60. end: '23:30'
  61. }">
  62. </el-time-select>
  63. <el-time-select placeholder="结束"
  64. v-model="item.endTime"
  65. :picker-options="{
  66. start: '06:30',
  67. step: '00:15',
  68. end: '23:30',
  69. minTime: item.startTime
  70. }">
  71. </el-time-select>
  72. <el-button style="margin-left:10px;"
  73. type="text"
  74. @click="removeWeek(item)">删除</el-button>
  75. </div>
  76. </el-checkbox-group>
  77. <div class="holidayWrap">
  78. <el-checkbox v-model="isholiday">跳过节假日</el-checkbox>
  79. <div class="quickBtn"
  80. @click="classCard">一键排课</div>
  81. </div>
  82. <!-- <div class="btnWrap">
  83. <div class="closeBtn"
  84. @click='resetaLL'>取消排课</div>
  85. <div class="okBtn"
  86. @click="classCard">一键排课</div>
  87. </div> -->
  88. </div>
  89. </div>
  90. <div class="right">
  91. <el-table :data='tableList'
  92. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  93. <el-table-column label="课次"
  94. width="180">
  95. <template slot-scope="scope">
  96. <div>
  97. {{ scope.$index+1 }}
  98. </div>
  99. </template>
  100. </el-table-column>
  101. <el-table-column prop="classDate"
  102. label="日期"
  103. width="180">
  104. </el-table-column>
  105. <el-table-column prop="week"
  106. label="星期"
  107. width="180">
  108. </el-table-column>
  109. <el-table-column label="课程类型"
  110. width="180">
  111. <template slot-scope="scope">
  112. <div>
  113. {{scope.row.type |coursesType }}
  114. </div>
  115. </template>
  116. </el-table-column>
  117. <el-table-column prop="name"
  118. label="课程名称"
  119. width="180">
  120. </el-table-column>
  121. <!-- <el-table-column prop="classTime"
  122. label="上课时间"
  123. width="180">
  124. </el-table-column> -->
  125. <el-table-column label="操作"
  126. width="180">
  127. <template slot-scope="scope">
  128. <div>
  129. <el-button type="text"
  130. @click="OpenSign(scope.row)">查看</el-button>
  131. <el-button type="text"
  132. @click='resetMixCourse(scope.row)'>变更</el-button>
  133. <el-button type="text"
  134. @click='skipClass(scope.row)'>跳过此天</el-button>
  135. </div>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <div class="btnWrap"
  140. style="margin-top:40px;">
  141. <div class="nextBtn"
  142. @click="resetaLL">取消排课</div>
  143. <div class="okBtn"
  144. @click='submitInfo'>确定排课</div>
  145. </div>
  146. </div>
  147. <el-dialog :visible.sync="resetAllClassVisible"
  148. width="450px">
  149. <p style='margin-bottom:20px'>{{resetAllTitle}}</p>
  150. <div class="resetWrap">
  151. <el-select v-model="chioseType">
  152. <el-option v-for='(item,index) in courseTypeList'
  153. :key="index"
  154. :label="item.name"
  155. :value="item.value"></el-option>
  156. </el-select>
  157. <!-- signBtnActive: false,
  158. skipBtnActive: false -->
  159. <!-- <div class="restBtn"
  160. :class="signBtnActive?'active':''"
  161. v-if='buttonType == "SINGLE"'
  162. @click="resetClass">修改为合奏课</div>
  163. <div class="restBtn"
  164. v-if='buttonType == "MIX"'
  165. :class="signBtnActive?'active':''"
  166. @click="resetClass">修改为单技课</div> -->
  167. <!-- <div class="restBtn"
  168. @click='skipClass'
  169. :class="skipBtnActive?'active':''">跳过此天</div> -->
  170. </div>
  171. <span slot="footer"
  172. class="dialog-footer">
  173. <div class="okBtns"
  174. @click="resetMix">确定</div>
  175. </span>
  176. </el-dialog>
  177. <el-dialog :visible.sync="openSignListVisible"
  178. width="450px">
  179. <el-table :data='SignList'>
  180. <el-table-column prop="name"
  181. label="班级">
  182. </el-table-column>
  183. <el-table-column prop="startClassTimeStr"
  184. label="开始时间">
  185. <!-- <template slot-scope="scope">
  186. <div>
  187. <p v-if="scope.row.option == 1">{{scope.row.startClassTimeStr}}</p>
  188. <el-input v-if="scope.row.option == 2"
  189. v-model="scope.row.startClassTimeStr"></el-input>
  190. </div>
  191. </template> -->
  192. </el-table-column>
  193. <el-table-column prop="endClassTimeStr"
  194. label="结束时间">
  195. <!-- <template slot-scope="scope">
  196. <div>
  197. <p v-if="scope.row.option == 1">{{scope.row.endClassTimeStr}}</p>
  198. <el-input v-if="scope.row.option == 2"
  199. v-model="scope.row.endClassTimeStr"></el-input>
  200. </div>
  201. </template> -->
  202. </el-table-column>
  203. <!-- <el-table-column prop="date"
  204. label="操作">
  205. <template slot-scope="scope">
  206. <div>
  207. <el-button type="text"
  208. v-if="scope.row.option == 2"
  209. @click="savecolumn(scope.row)">保存</el-button>
  210. <el-button type="text"
  211. v-if="scope.row.option == 1"
  212. @click="savecolumn(scope.row)">修改</el-button>
  213. </div>
  214. </template>
  215. </el-table-column> -->
  216. </el-table>
  217. <span slot="footer"
  218. class="dialog-footer">
  219. <div class="okBtns"
  220. @click="resetSiginClass">确定</div>
  221. </span>
  222. </el-dialog>
  223. </div>
  224. <div class="btnWrap"
  225. style="margin-top:20px;">
  226. <div class="nextBtn"
  227. @click="goback">返回</div>
  228. <!-- <div class="okBtn"
  229. style="margin-right:30px;"
  230. @click="gotoNext">确定</div> -->
  231. </div>
  232. </div>
  233. </template>
  234. <script>
  235. import { Loading } from 'element-ui';
  236. import { getAllClass, getAllSignClass, workOut, checkCourse } from '@/api/buildTeam'
  237. import axios from 'axios'
  238. import qs from 'qs'
  239. export default {
  240. // props: {
  241. // teamid: {
  242. // type: String,
  243. // required: true
  244. // }
  245. // },
  246. data () {
  247. return {
  248. resetAllClassVisible: false, //修改合奏课弹窗
  249. openSignListVisible: false, // 修改单个单技课的弹窗
  250. first: true,
  251. leftFrom: {
  252. all: '',
  253. time: '',
  254. num: ''
  255. },
  256. tableList: [],
  257. checkList: [], // 选中的周几
  258. week: [
  259. {
  260. startTime: '',
  261. endTime: '',
  262. weekNum: '',
  263. id: new Date().getTime()
  264. }
  265. ],
  266. weekList: [
  267. {
  268. label: '星期日',
  269. value: 0
  270. },
  271. {
  272. label: '星期一',
  273. value: 1
  274. },
  275. {
  276. label: '星期二',
  277. value: 2
  278. },
  279. {
  280. label: '星期三',
  281. value: 3
  282. },
  283. {
  284. label: '星期四',
  285. value: 4
  286. },
  287. {
  288. label: '星期五',
  289. value: 5
  290. },
  291. {
  292. label: '星期六',
  293. value: 6
  294. },
  295. ],
  296. weekDay: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
  297. maxClassList: [], // 所有的合奏班
  298. activeSingleList: [], // 合奏班下的所有单技班
  299. isholiday: false,
  300. classCardList: [], //这个是传给后台的真正数据集合
  301. allChioseDate: [], // 记录所有准备排课的日期
  302. holidayList: [],
  303. leftRules: {
  304. all: [{ required: true, message: '请输选择合奏班', trigger: 'blur' }],
  305. time: [{ required: true, message: '请选择排课时间', trigger: 'blur' }],
  306. num: [{ required: true, message: '请输入排课次数', trigger: 'blur' }]
  307. },
  308. resetAllTitle: '', // 弹窗名
  309. buttonType: '',
  310. activeTime: '', // 选中的当前时间课
  311. signBtnActive: false,
  312. skipBtnActive: false,
  313. SignList: [], // 存储当前合奏课里当天的所有单机课
  314. courseTypeList: [
  315. { name: '单技课', value: 'SINGLE' },
  316. { name: '集训单技课', value: 'TRAINING_SINGLE' },
  317. { name: '合奏课', value: 'MIX' },
  318. { name: '集训合奏课', value: 'TRAINING_MIX' },
  319. { name: '课堂课', value: 'CLASSROOM' },
  320. ],
  321. chioseType: '',
  322. tableActive: null, // 当前操作的行
  323. startClassTimeStr: '',
  324. endClassTimeStr: '',
  325. teamid: ''
  326. }
  327. },
  328. created () {
  329. this.teamid = this.$route.query.id;
  330. sessionStorage.setItem('resetCode', 3)
  331. sessionStorage.setItem('setStep', 2)
  332. },
  333. mounted () {
  334. // 根据乐团id 查询 此乐团所有的合奏班
  335. getAllClass({ musicGroupId: this.teamid }).then(res => {
  336. if (res.code == 200) {
  337. this.maxClassList = res.data;
  338. }
  339. })
  340. let year = new Date().getFullYear();
  341. axios.post('/jiari/', qs.stringify({ d: year })).then(res => {
  342. if (res) {
  343. this.holidayList = Object.keys(res.data[year])
  344. }
  345. })
  346. },
  347. methods: {
  348. // 确定排课
  349. submitInfo () {
  350. this.$confirm('课表无误,确定排课', '提示', {
  351. confirmButtonText: '确定',
  352. cancelButtonText: '取消',
  353. type: 'warning'
  354. }).then(() => {
  355. workOut({ musicGroupID: this.teamid, courseSchedules: this.classCardList }).then(res => {
  356. if (res.code == 200) {
  357. this.$message.success('恭喜您排课成功')
  358. this.classCardList = [];
  359. }
  360. }).catch(res => {
  361. // this.tableList = [];
  362. this.classCardList = [];
  363. })
  364. }).catch(() => {
  365. });
  366. },
  367. // 一键排课
  368. classCard () {
  369. // 验证合奏班里等数据是否填写
  370. let flag = false
  371. this.$refs['leftFrom'].validate(val => {
  372. if (val) {
  373. flag = true
  374. }
  375. })
  376. if (!flag) {
  377. this.$message.error('请填写必要参数在进行排课')
  378. return;
  379. }
  380. // 验证周次循环里数据是否完成与有效
  381. // this.checkTime();
  382. let classCount = parseInt(this.leftFrom.num);
  383. let date = this.leftFrom.time;
  384. // 1 排课时间 2.排课次数 3.排课周期集合 4.排课合奏班的信息
  385. this.workOut(date, classCount, this.week, this.leftFrom.all)
  386. this.$refs['leftFrom'].resetFields();
  387. this.week = this.$options.data().week;
  388. this.checkList = [];
  389. },
  390. chioseWeek (val) {
  391. },
  392. getThinkDate (date, num, type = 1) {
  393. let Stamp = new Date(date.getTime());
  394. Stamp.setDate(Stamp.getDate() + parseInt(num)) // 获取当前月数的第几天
  395. var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
  396. var month = Stamp.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  397. var mvar = '';
  398. if (month < 10) {
  399. mvar = '0' + month;
  400. } else {
  401. mvar = month + '';
  402. }
  403. var day = Stamp.getDate();
  404. var dvar = '';
  405. if (day < 10) {
  406. dvar = '0' + day;
  407. } else {
  408. dvar = day + '';
  409. }
  410. if (type == 2) {
  411. return mvar + dvar;
  412. } else {
  413. return year + "-" + mvar + '-' + dvar;
  414. }
  415. },
  416. changeMixClass (val) {
  417. // 根据合奏班id获取合奏班下的所有单技班
  418. console.log(this.first);
  419. let activeVal = val;
  420. if (!this.first) {
  421. Object.assign(this.$data, this.$options.data());
  422. getAllClass({ musicGroupId: this.teamid }).then(res => {
  423. if (res.code == 200) {
  424. this.maxClassList = res.data;
  425. }
  426. })
  427. this.leftFrom.all = activeVal
  428. }
  429. this.first = false;
  430. this.activeSingleList = [];
  431. getAllSignClass({ musicGroupId: this.teamid, mixClassGroupId: val }).then(res => {
  432. if (res.code == 200) {
  433. this.activeSingleList = res.data.map(item => {
  434. item.mixid = val
  435. return item;
  436. });
  437. }
  438. })
  439. },
  440. // 修改
  441. resetMixCourse (row) {
  442. // console.log(row);
  443. this.resetAllClassVisible = true;
  444. this.resetAllTitle = `将${row.classDate} ,${row.week}修改`;
  445. this.buttonType = row.type;
  446. this.activeTime = row.classDate; // 选中那一行的日期
  447. this.startClassTimeStr = row.startClassTimeStr
  448. this.endClassTimeStr = row.endClassTimeStr;
  449. // 选中那一行的开始时间
  450. // 选中那一行的结束时间
  451. this.chioseType = row.type;
  452. this.tableActive = row;
  453. },
  454. resetClass () {
  455. this.signBtnActive = !this.signBtnActive;
  456. },
  457. skipClass (row) {
  458. // 这里是跳过此天
  459. let loadingInstance = Loading.service({
  460. lock: true,
  461. text: '加载中……',
  462. background: 'rgba(0, 0, 0, 0.7)'
  463. });
  464. setTimeout(res => {
  465. loadingInstance.close();
  466. }, 1000)
  467. let lastTime = this.tableList[this.tableList.length - 1].classDate;
  468. let id = this.tableList[this.tableList.length - 1].id;
  469. let startClassTime;
  470. let endClassTime;
  471. let weekNum;
  472. for (let i in this.tableList) {
  473. if (row.classDate == this.tableList[i].classDate && row.startClassTimeStr == this.tableList[i].startClassTimeStr && row.endClassTimeStr == this.tableList[i].endClassTimeStr) {
  474. weekNum = this.tableList[i].weekNum;
  475. startClassTime = this.tableList[i].startClassTimeStr;
  476. endClassTime = this.tableList[i].endClassTimeStr;
  477. this.tableList.splice(i, 1);
  478. }
  479. }
  480. for (let j = 0; j < this.classCardList.length; j++) {
  481. if (this.classCardList[j].classDate == row.classDate && row.startClassTimeStr == this.classCardList[j].startClassTimeStr && row.endClassTimeStr == this.classCardList[j].endClassTimeStr) {
  482. this.classCardList.splice(j, 1);
  483. j--;
  484. }
  485. }
  486. // console.log(lastTime, weekNum, id);
  487. // 这里要往后面排一天
  488. let obj = {
  489. startTime: endClassTime,
  490. endTime: startClassTime,
  491. weekNum: weekNum,
  492. id: new Date().getTime()
  493. }
  494. lastTime = lastTime.replace(/-/g, '/')
  495. var newdate = new Date(lastTime);
  496. newdate.setDate(newdate.getDate() + 1);
  497. // console.log(newdate);
  498. // 最后一堂课加一天
  499. // newdate.setDate(newdate.getDate() + 7);
  500. this.workOut(newdate, 1, [obj], id, 2, startClassTime, endClassTime);
  501. // this.$message.success('修改成功');
  502. },
  503. resetMix () {
  504. // 当前行的课程类型
  505. let activeTpye = this.tableActive.type;
  506. let startClassTime;
  507. let endClassTime;
  508. if (this.chioseType.indexOf('MIX') != -1) {
  509. // 改合奏
  510. // 删除真实课表里的所有相关单技课
  511. for (let i = 0; i < this.classCardList.length; i++) {
  512. if (this.activeTime == this.classCardList[i].classDate && this.startClassTimeStr == this.classCardList[i].startClassTimeStr && this.endClassTimeStr == this.classCardList[i].endClassTimeStr) {
  513. this.classCardList.splice(i, 1);
  514. i--;
  515. }
  516. }
  517. // 修改提交表里的时间
  518. // 单技改合奏
  519. console.log(this.tableList)
  520. for (let i in this.tableList) {
  521. if (this.activeTime == this.tableList[i].classDate && this.startClassTimeStr == this.tableList[i].startClassTimeStr && this.endClassTimeStr == this.tableList[i].endClassTimeStr) {
  522. console.log('修改合奏课的类型')
  523. this.tableList[i].type = this.chioseType;
  524. startClassTime = this.tableList[i].startClassTime;
  525. endClassTime = this.tableList[i].endClassTime;
  526. // this.tableList[i].classGroupId = this.tableList[i].id;
  527. this.classCardList.push(this.tableList[i]);
  528. }
  529. }
  530. //
  531. } else if (this.chioseType.indexOf('SINGLE') != -1 || this.chioseType.indexOf('CLASSROOM') != -1) {
  532. // 合奏改单技
  533. for (let i in this.tableList) {
  534. if (this.activeTime == this.tableList[i].classDate && this.startClassTimeStr == this.tableList[i].startClassTimeStr && this.endClassTimeStr == this.tableList[i].endClassTimeStr) {
  535. this.tableList[i].type = this.chioseType;
  536. startClassTime = this.tableList[i].startClassTime;
  537. endClassTime = this.tableList[i].endClassTime;
  538. }
  539. }
  540. let activeTableItem = {};
  541. console.log(this.activeTime);
  542. // 修改提交表里的状态
  543. for (let j = 0; j < this.classCardList.length; j++) {
  544. for (let i in this.tableList) {
  545. if (this.activeTime == this.classCardList[j].classDate && this.startClassTimeStr == this.classCardList[j].startClassTimeStr && this.endClassTimeStr == this.classCardList[j].endClassTimeStr) {
  546. this.classCardList.splice(j, 1);
  547. j--
  548. }
  549. if (this.activeTime == this.tableList[i].classDate && this.startClassTimeStr == this.tableList[i].startClassTimeStr && this.endClassTimeStr == this.tableList[i].endClassTimeStr) {
  550. activeTableItem = this.tableList[i];
  551. }
  552. }
  553. }
  554. //添加单机班课
  555. for (let z in this.activeSingleList) {
  556. let obj = {
  557. 'classDate': activeTableItem.classDate,
  558. 'week': activeTableItem.week,
  559. 'type': this.chioseType,
  560. 'mixid': activeTableItem.mixid,
  561. 'id': this.activeSingleList[z].id,
  562. 'name': this.activeSingleList[z].name,
  563. 'classTime': activeTableItem.classTime,
  564. 'startClassTimeStr': activeTableItem.startClassTimeStr,
  565. 'endClassTimeStr': activeTableItem.endClassTimeStr,
  566. 'weekNum': activeTableItem.weekNum,
  567. 'classGroupId': this.activeSingleList[z].id,
  568. }
  569. this.classCardList.push(obj);
  570. }
  571. }
  572. this.resetAllClassVisible = false;
  573. },
  574. // 排课逻辑
  575. workOut (date, classCount, weekArr, id, type = 1, startTime = '', endTime = '') {
  576. // 这里是一天排一节课 现在要改成一天排多节
  577. while (classCount && classCount > 0) {
  578. for (let i in weekArr) {
  579. let date1 = new Date(date.getTime());
  580. let num; // 下次上课上几天后
  581. // 星期4 - 当前是星期几 =>
  582. weekArr[i].weekNum - date.getDay() >= 0 ? num = weekArr[i].weekNum - date.getDay() : num = weekArr[i].weekNum - date.getDay() + 7
  583. let dataStr = this.getThinkDate(date, num);
  584. let monthDay = this.getThinkDate(date1, num, 2)
  585. if (this.isholiday) {
  586. if (this.holidayList.indexOf(monthDay) != -1) {
  587. // 这里说明有节假日
  588. continue
  589. }
  590. }
  591. let className;
  592. this.maxClassList.map(item => {
  593. if (item.id == id) {
  594. className = item.name;
  595. return item.name
  596. }
  597. })
  598. // 排的是合奏班
  599. if (!startTime) {
  600. // 有这个说明是修改=> 没有说明是添加
  601. if (!this.week[i].startTime || !this.week[i].endTime) {
  602. // 提示 上课时间必填
  603. // console.log('进入时间判断')
  604. this.$message.error('勾选日期的上课时间段必填');
  605. return;
  606. }
  607. }
  608. let nowStartTime = this.week[i].startTime || startTime;
  609. let nowEndTime = this.week[i].endTime || endTime;
  610. // date: this.getNowFormatDate(date),
  611. this.tableList.push({
  612. 'classDate': dataStr,
  613. 'week': this.weekDay[weekArr[i].weekNum],
  614. 'type': 'SINGLE',
  615. 'id': id,
  616. 'mixid': id,
  617. 'name': className,
  618. 'classTime': nowStartTime + '-' + nowEndTime,
  619. 'startClassTimeStr': nowStartTime,
  620. 'endClassTimeStr': nowEndTime,
  621. 'weekNum': weekArr[i].weekNum,
  622. 'classGroupId': id
  623. })
  624. // 这里我排单技课
  625. // date: this.getNowFormatDate(date),
  626. for (let j in this.activeSingleList) {
  627. this.classCardList.push({
  628. 'classDate': dataStr,
  629. 'classGroupId': this.activeSingleList[j].id,
  630. 'startClassTimeStr': nowStartTime,
  631. 'endClassTimeStr': nowEndTime,
  632. 'type': 'SINGLE',
  633. 'mixid': this.activeSingleList[j].mixid,
  634. 'weekNum': weekArr[i].weekNum,
  635. 'name': this.activeSingleList[j].name,
  636. 'option': 1
  637. })
  638. }
  639. classCount--
  640. if (classCount == 0) break
  641. }
  642. date.setDate(date.getDate() + 7);
  643. }
  644. // 请求排课
  645. },
  646. resetaLL () {
  647. Object.assign(this.$data, this.$options.data());
  648. this.teamid = this.$route.query.id;
  649. getAllClass({ musicGroupId: this.teamid }).then(res => {
  650. if (res.code == 200) {
  651. this.maxClassList = res.data;
  652. }
  653. })
  654. let year = new Date().getFullYear();
  655. axios.post('/jiari/', qs.stringify({ d: year })).then(res => {
  656. this.holidayList = Object.keys(res.data[year])
  657. })
  658. },
  659. // 点击查看
  660. OpenSign (row) {
  661. this.SignList = [];
  662. for (let i in this.classCardList) {
  663. if (this.classCardList[i].mixid == row.mixid && this.classCardList[i].classDate == row.classDate && row.startClassTimeStr == this.classCardList[i].startClassTimeStr && row.endClassTimeStr == this.classCardList[i].endClassTimeStr) {
  664. this.SignList.push(this.classCardList[i])
  665. }
  666. }
  667. console.log(this.SignList);
  668. this.openSignListVisible = true;
  669. },
  670. savecolumn (row) {
  671. // console.log(row);
  672. row.option == 1 ? row.option = 2 : row.option = 1
  673. // console.log(this.SignList);
  674. },
  675. // 重置单技课
  676. resetSiginClass () {
  677. this.openSignListVisible = false;
  678. // for (let i in this.classCardList) {
  679. // for (let j in this.SignList) {
  680. // if (this.SignList[j].classDate == this.classCardList[i].classDate && this.SignList[j].classGroupId == this.classCardList[i].classGroupId) {
  681. // this.classCardList[i] = this.SignList[j];
  682. // this.$message.success('修改成功');
  683. // }
  684. // }
  685. // }
  686. },
  687. submitCardList () {
  688. },
  689. gotoNext () {
  690. checkCourse({ musicGroupId: this.teamid }).then(res => {
  691. if (res.code == 200) {
  692. // ...跳转
  693. }
  694. }).catch(res => {
  695. this.$message.error(res.msg)
  696. })
  697. },
  698. addWeekDay () {
  699. // 添加
  700. this.week.push({
  701. startTime: '',
  702. endTime: '',
  703. weekNum: '',
  704. id: new Date().getTime()
  705. })
  706. },
  707. //删除
  708. removeWeek (item) {
  709. for (let i in this.week) {
  710. if (item.id == this.week[i].id) {
  711. this.week.splice(i, 1);
  712. }
  713. }
  714. },
  715. // 判断时间是否在时间段内
  716. timeIsrange (beginTime, endTime, nowTime) {
  717. var strb = beginTime.split(":");
  718. if (strb.length != 2) {
  719. return false;
  720. }
  721. var stre = endTime.split(":");
  722. if (stre.length != 2) {
  723. return false;
  724. }
  725. var strn = nowTime.split(":");
  726. if (stre.length != 2) {
  727. return false;
  728. }
  729. var b = new Date();
  730. var e = new Date();
  731. var n = new Date();
  732. b.setHours(strb[0]);
  733. b.setMinutes(strb[1]);
  734. e.setHours(stre[0]);
  735. e.setMinutes(stre[1]);
  736. n.setHours(strn[0]);
  737. n.setMinutes(strn[1]);
  738. if (n.getTime() - b.getTime() >= 0 && n.getTime() - e.getTime() <= 0) {
  739. // 在时间范围内
  740. return true;
  741. } else {
  742. // 不在时间范围内
  743. return false;
  744. }
  745. },
  746. checkTime () {
  747. if (this.week.length <= 0) {
  748. this.$message.error('至少填写一个排课周期')
  749. return false;
  750. }
  751. for (let i in this.week) {
  752. if (!this.week[i].startTime || !this.week[i].endTime || !this.week[i].weekNum) {
  753. this.$message.error('请填写完整的排课周期')
  754. return false;
  755. }
  756. }
  757. },
  758. getNowFormatDate (date) {
  759. var seperator1 = "-";
  760. var year = date.getFullYear();
  761. var month = date.getMonth() + 1;
  762. var strDate = date.getDate();
  763. if (month >= 1 && month <= 9) {
  764. month = "0" + month;
  765. }
  766. if (strDate >= 0 && strDate <= 9) {
  767. strDate = "0" + strDate;
  768. }
  769. var currentdate = year + seperator1 + month + seperator1 + strDate;
  770. return currentdate;
  771. },
  772. goback () {
  773. this.$router.go(-1);
  774. }
  775. },
  776. watch: {
  777. resetAllClassVisible (val) {
  778. if (!val) {
  779. this.signBtnActive = false;
  780. this.skipBtnActive = false;
  781. }
  782. }
  783. }
  784. }
  785. </script>
  786. <style lang="scss" scoped>
  787. .father-Wrap {
  788. padding: 47px 30px;
  789. background-color: #fff;
  790. }
  791. .course-container {
  792. border-bottom: 1px solid #ccc;
  793. height: 600px;
  794. overflow-y: auto;
  795. background-color: #fff;
  796. display: flex;
  797. flex-direction: row;
  798. justify-content: flex-start;
  799. .left {
  800. border-right: 1px solid #ccc;
  801. width: 380px;
  802. min-width: 380px;
  803. margin-right: 40px;
  804. .chioseday {
  805. margin-top: 20px;
  806. .el-date-editor.el-input,
  807. .el-date-editor.el-input__inner {
  808. width: 100px;
  809. margin-left: 10px;
  810. }
  811. }
  812. .holidayWrap {
  813. margin-top: 34px;
  814. margin-bottom: 40px;
  815. display: flex;
  816. flex-direction: row;
  817. justify-content: space-between;
  818. align-items: center;
  819. .quickBtn {
  820. font-size: 16px;
  821. color: #f85043;
  822. text-decoration: underline;
  823. padding-right: 25px;
  824. cursor: pointer;
  825. }
  826. }
  827. .btnWrap {
  828. display: flex;
  829. flex-direction: row;
  830. justify-content: space-around;
  831. div {
  832. width: 120px;
  833. height: 40px;
  834. border-radius: 4px;
  835. text-align: center;
  836. line-height: 40px;
  837. cursor: pointer;
  838. color: #fff;
  839. }
  840. .closeBtn {
  841. background-color: #777;
  842. }
  843. }
  844. }
  845. .right {
  846. width: 1160px;
  847. .is-selected {
  848. color: #1989fa;
  849. }
  850. .el-calendar {
  851. max-width: 950px;
  852. }
  853. .btnWrap {
  854. display: flex;
  855. flex-direction: row;
  856. justify-content: flex-end;
  857. div {
  858. width: 120px;
  859. height: 40px;
  860. line-height: 40px;
  861. text-align: center;
  862. color: #fff;
  863. border-radius: 4px;
  864. margin-right: 20px;
  865. cursor: pointer;
  866. }
  867. .nextBtn {
  868. background-color: #444;
  869. }
  870. .okBtn {
  871. background-color: #f97215;
  872. }
  873. }
  874. }
  875. .resetWrap {
  876. display: flex;
  877. flex-direction: row;
  878. justify-content: space-around;
  879. .restBtn {
  880. width: 150px;
  881. height: 40px;
  882. background: rgba(255, 255, 255, 1);
  883. border-radius: 5px;
  884. border: 1px solid rgba(20, 146, 138, 1);
  885. text-align: center;
  886. cursor: pointer;
  887. line-height: 40px;
  888. color: #14928a;
  889. }
  890. .restBtn.active {
  891. background-color: #14928a;
  892. color: #fff;
  893. }
  894. }
  895. .okBtns {
  896. background-color: #f97215;
  897. width: 120px;
  898. height: 40px;
  899. line-height: 40px;
  900. text-align: center;
  901. color: #fff;
  902. border-radius: 4px;
  903. margin-right: 20px;
  904. cursor: pointer;
  905. margin: 0 auto;
  906. }
  907. }
  908. </style>