vipReset.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173
  1. <template>
  2. <div class="m-container">
  3. <div class="titlewrap">
  4. <h2>
  5. <el-page-header @back="goBack"
  6. :content="name"></el-page-header>
  7. </h2>
  8. <!-- <p style="margin-bottom:10px; margin-left:30px;">课程有效期:{{ startClassTime|dayjsFormat }} ~ {{endTime |dayjsFormat}}</p> -->
  9. </div>
  10. <div class="vipwrap">
  11. <!-- <div class="newBand"
  12. v-permission="'vipGroupManage/appendVipGroupCourseSchedules'"
  13. @click="addCourse">VIP加课</div> -->
  14. <div class="newBand"
  15. v-permission="'courseSchedule/vipCourseAdjust'"
  16. @click="adjustment">批量调整</div>
  17. <div class="newBand"
  18. v-permission="'vipGroupManage/updateVipBaseInfo'"
  19. @click="addrVisible = true">修改教学点</div>
  20. <div class="newBand"
  21. v-permission="{parent:'/vipReset',child:'employee/findEducationUsers'}"
  22. @click="educationalVisible = true">课程信息</div>
  23. <!-- <div class="newBand"
  24. v-permission="'vipGroupManage/update'"
  25. @click="expireVisible = true">有效期调整</div> -->
  26. </div>
  27. <div class="tableWrap">
  28. <el-table :data="tableList"
  29. ref="tableList"
  30. @selection-change="handleSelectionChange"
  31. :header-cell-style="{background:'#EDEEF0',color:'#444'}">
  32. <el-table-column type="selection"
  33. :selectable="isDisabled"
  34. width="55"></el-table-column>
  35. <el-table-column label="课程名称"
  36. align="center"
  37. prop="name"></el-table-column>
  38. <el-table-column label="课程编号"
  39. align="center"
  40. prop="id">
  41. </el-table-column>
  42. <el-table-column label="上课日期"
  43. align="center"
  44. prop="classDate">
  45. <template slot-scope="scope">
  46. <div>{{ scope.row.classDate | formatTimer}}</div>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="课程状态"
  50. align="center"
  51. prop="status">
  52. <template slot-scope="scope">
  53. <div>{{ scope.row.status | coursesStatus }}</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="是否点名"
  57. align="center">
  58. <template slot-scope="scope">
  59. <div>{{scope.row.isCallNames?'已点名':'未点名'}}</div>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="结算状态"
  63. align="center">
  64. <template slot-scope="scope">
  65. <div>{{scope.row.isSettlement?'已结算':'未结算'}}</div>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="开始时间"
  69. align="center"
  70. prop="startClassTimeStr">
  71. <template slot-scope="scope">
  72. <div>{{ scope.row.startClassTimeStr | timerForMinFormat }}</div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="结束时间"
  76. align="center"
  77. prop="endClassTimeStr">
  78. <template slot-scope="scope">
  79. <div>{{ scope.row.endClassTimeStr | timerForMinFormat }}</div>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="课程类型"
  83. align="center">
  84. <template slot-scope="scope">
  85. <div>{{ scope.row.teachMode | teachMode }}</div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="教学点"
  89. align="center"
  90. prop="schoolName">
  91. <template slot-scope="scope">
  92. <div>{{scope.row.schoolName?scope.row.schoolName:'网络教室'}}</div>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="操作"
  96. width="180"
  97. align="center">
  98. <template slot-scope="scope">
  99. <div>
  100. <el-button type="text"
  101. v-permission="{parent:'/vipReset',child:'courseSchedule/classStartDateAdjust'}"
  102. v-if="!scope.row.isSettlement"
  103. @click="resetClass(scope.row)">调整</el-button>
  104. <el-button type="text"
  105. v-permission="{parent:'/vipReset',child:'courseSchedule/batchDelete'}"
  106. v-if="!scope.row.isSettlement&&scope.row.status != 'OVER'"
  107. @click="removeClass(scope.row)">删除</el-button>
  108. <!-- -->
  109. <el-button type="text"
  110. v-permission="{parent:'/vipReset',child:'vip/cleanAttendance'}"
  111. v-if="!scope.row.isSettlement"
  112. @click="clearAttend(scope.row)">清除考勤</el-button>
  113. </div>
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <pagination sync :total.sync="rules.total"
  118. :page.sync="rules.page"
  119. :limit.sync="rules.limit"
  120. :page-sizes="rules.page_size"
  121. @pagination="getList" />
  122. </div>
  123. <el-dialog title="课程调整"
  124. width="400px"
  125. :before-close="handleClose"
  126. :visible.sync="courseVisible">
  127. <el-form :model="maskForm"
  128. class="maskForm"
  129. ref="maskForm"
  130. :rules="maskRules"
  131. label-position="right"
  132. label-width="80px"
  133. :inline="true">
  134. <el-form-item label="上课日期"
  135. prop="date">
  136. <el-date-picker v-model.trim="maskForm.date"
  137. type="date"
  138. :picker-options="coursesDate()"
  139. value-format="yyyy-MM-dd"
  140. placeholder="选择日期"></el-date-picker>
  141. </el-form-item>
  142. <el-form-item label="开始时间"
  143. prop="startTime">
  144. <el-time-picker placeholder="起始时间"
  145. v-model.trim="startTime"
  146. @change="changeStartTime"
  147. format='HH:mm'
  148. value-format='HH:mm'
  149. :picker-options="{
  150. selectableRange: `${nowTime} - 23:30:00`
  151. }"></el-time-picker>
  152. </el-form-item>
  153. <el-form-item label="结束时间"
  154. prop="endTime">
  155. <el-time-picker placeholder="结束时间"
  156. format='HH:mm'
  157. value-format='HH:mm'
  158. v-model="maskForm.endTime"
  159. disabled>
  160. </el-time-picker>
  161. </el-form-item>
  162. <!--v-if="maskForm.teachMode=='OFFLINE'"-->
  163. <el-form-item label="课程类型"
  164. prop="courseType">
  165. <el-select clearable
  166. v-model.trim="maskForm.teachMode">
  167. <el-option label="线上课"
  168. value="ONLINE"></el-option>
  169. <el-option label="线下课"
  170. value="OFFLINE"></el-option>
  171. </el-select>
  172. </el-form-item>
  173. <el-form-item label="教学地点"
  174. v-if="maskForm.teachMode == 'OFFLINE'">
  175. <el-select v-model.trim="maskForm.address"
  176. filterable
  177. clearable>
  178. <el-option v-for="(item,index) in schoolList"
  179. :key="index"
  180. :value="item.id"
  181. :label="item.name"></el-option>
  182. </el-select>
  183. </el-form-item>
  184. </el-form>
  185. <div slot="footer"
  186. class="dialog-footer">
  187. <el-button @click="courseVisible = false">取 消</el-button>
  188. <el-button type="primary"
  189. @click="submitResetClass">确 定</el-button>
  190. </div>
  191. </el-dialog>
  192. <!-- <el-dialog title="vip加课"
  193. width="1000px"
  194. :visible.sync="addCourseVisible">
  195. <el-button type="text"
  196. @click="addOneChiose">添加</el-button>
  197. <el-table :data='addTable'>
  198. <el-table-column label="上课日期"
  199. align="center"
  200. prop="name">
  201. <template slot-scope="scope">
  202. <div>
  203. <el-date-picker v-model.trim="scope.row.classDate"
  204. style="width:200px!important"
  205. type="date"
  206. placeholder="选择日期">
  207. </el-date-picker>
  208. </div>
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="课程开始时间"
  212. align="center"
  213. prop="startClassTimeStr">
  214. <template slot-scope="scope">
  215. <div>
  216. <el-time-select v-model.trim="scope.row.startClassTimeStr"
  217. style="width:150px!important"
  218. :picker-options="{
  219. start: '04:30',
  220. step: '00:05',
  221. end: '23:30'
  222. }"
  223. placeholder="选择时间">
  224. </el-time-select>
  225. </div>
  226. </template>
  227. </el-table-column>
  228. <el-table-column label="课程形态"
  229. align="center"
  230. prop="name">
  231. <template slot-scope="scope">
  232. <div>
  233. <el-select v-model.trim="scope.row.teachMode">
  234. <el-option label="线上课"
  235. value="ONLINE"></el-option>
  236. <el-option label="线下课"
  237. value="OFFLINE"></el-option>
  238. </el-select>
  239. </div>
  240. </template>
  241. </el-table-column>
  242. <el-table-column label="操作"
  243. align="center">
  244. <template slot-scope="scope">
  245. <div>
  246. <el-button type="text"
  247. @click="removeMarkCourse(scope.row)">删除</el-button>
  248. </div>
  249. </template>
  250. </el-table-column>
  251. </el-table>
  252. <span slot="footer"
  253. class="dialog-footer">
  254. <el-button @click="addCourseVisible = false">取 消</el-button>
  255. <el-button type="primary"
  256. @click="submitAdd">确 定</el-button>
  257. </span>
  258. </el-dialog>-->
  259. <el-dialog :title="adjustmentName"
  260. width="800px"
  261. :visible.sync="adjustmentVisible">
  262. <el-form :model="adjustmentForm"
  263. label-position="right"
  264. label-width="120px"
  265. ref="adjustmentForm"
  266. :rules="adjustmentRules"
  267. :inline="true">
  268. <el-form-item label="已选择课时数"
  269. v-if="!isaddCourse">
  270. <el-input disabled
  271. v-model.trim="adjustmentForm.count"></el-input>
  272. </el-form-item>
  273. <el-form-item label="添加课时数"
  274. prop="addCount"
  275. v-if="isaddCourse">
  276. <el-input type="number"
  277. @mousewheel.native.prevent
  278. v-model.trim="adjustmentForm.addCount"></el-input>
  279. </el-form-item>
  280. <br />
  281. <el-form-item label="单课费用"
  282. prop="fee"
  283. v-if="isaddCourse">
  284. <el-input v-model.trim="adjustmentForm.fee"></el-input>
  285. </el-form-item>
  286. <!-- v-if='isaddCourse' v-if="adjustmentForm.courseType=='OFFLINE'" -->
  287. <el-form-item label="课程类型"
  288. prop="courseType">
  289. <el-select clearable
  290. v-model.trim="adjustmentForm.courseType">
  291. <el-option label="线上课"
  292. value="ONLINE"></el-option>
  293. <el-option label="线下课"
  294. value="OFFLINE"></el-option>
  295. </el-select>
  296. </el-form-item>
  297. <el-form-item label="教学地点"
  298. v-if="adjustmentForm.courseType == 'OFFLINE'">
  299. <el-select v-model.trim="adjustmentForm.address"
  300. filterable
  301. clearable>
  302. <el-option v-for="(item,index) in schoolList"
  303. :key="index"
  304. :value="item.id"
  305. :label="item.name"></el-option>
  306. </el-select>
  307. </el-form-item>
  308. <br />
  309. <el-form-item label="排课起始时间"
  310. prop="courseTime">
  311. <el-date-picker v-model.trim="adjustmentForm.courseTime"
  312. :picker-options="pickerOptions()"
  313. style="width:200px!important;"
  314. type="date"
  315. value-format="yyyy-MM-dd"
  316. placeholder="选择日期"></el-date-picker>
  317. <el-checkbox style="margin-left:10px;"
  318. v-model.trim="adjustmentForm.checked">是否跳过节假日</el-checkbox>
  319. </el-form-item>
  320. </el-form>
  321. <div class="WeekWrap">
  322. <h3 style="margin-bottom:20px;">
  323. 循环次数
  324. <el-button type="text"
  325. style="margin-left:10px;"
  326. @click="addWeek">添加</el-button>
  327. </h3>
  328. <div class="countWrap"
  329. style="margin-bottom:10px;">
  330. <div class="countItem"
  331. style="margin-bottom:20px;"
  332. v-for="(item,index) in weekList"
  333. :key="index">
  334. <span>循环周期:</span>
  335. <el-select v-model.trim="item.dayOfWeek"
  336. filterable
  337. clearable>
  338. <el-option v-for="(item,index) in weekDateList"
  339. :key="index"
  340. :label="item.label"
  341. :value="item.value"></el-option>
  342. </el-select>
  343. <span style="margin-left:10px;">开始时间</span>
  344. <el-time-picker style="margin-left:10px;"
  345. placeholder
  346. v-model.trim="item.startClassTime"
  347. @change="(val)=>{changeStartTimes(val,item)}"
  348. format='HH:mm'
  349. value-format='HH:mm'
  350. :picker-options="{
  351. selectableRange: '04:30:00 - 23:30:00'
  352. }"></el-time-picker>
  353. <span style="margin-left:10px;">结束时间</span>
  354. <el-time-picker style="margin-left:10px;"
  355. placeholder
  356. v-model.trim="item.endClassTime"
  357. format='HH:mm'
  358. value-format='HH:mm'
  359. disabled
  360. :picker-options="{
  361. selectableRange: '04:30:00 - 23:30:00'
  362. }"></el-time-picker>
  363. <el-button style="margin-left:10px;"
  364. type="danger"
  365. @click="removeWeek(item)"
  366. icon="el-icon-delete"
  367. circle></el-button>
  368. </div>
  369. </div>
  370. </div>
  371. <div slot="footer"
  372. class="dialog-footer">
  373. <el-button @click="adjustmentVisible = false">取 消</el-button>
  374. <el-button type="primary"
  375. v-if="!isaddCourse"
  376. @click="submitAdjustment">确 定</el-button>
  377. <el-button type="primary"
  378. v-if="isaddCourse"
  379. @click="addCourseSubmit">确 定</el-button>
  380. </div>
  381. </el-dialog>
  382. <!-- 批量修改教学点 -->
  383. <el-dialog title="教学点"
  384. width="400px"
  385. :visible.sync="addrVisible">
  386. <el-form :model="addrForm">
  387. <el-form-item label="教学点">
  388. <el-select v-model.trim="addrForm.address"
  389. clearable
  390. filterable>
  391. <el-option v-for="(item,index) in schoolList"
  392. :key="index"
  393. :value="item.id"
  394. :label="item.name"></el-option>
  395. </el-select>
  396. </el-form-item>
  397. </el-form>
  398. <span slot="footer"
  399. class="dialog-footer">
  400. <el-button @click="addrVisible = false">取 消</el-button>
  401. <el-button type="primary"
  402. @click="resetAddrSubmit">确 定</el-button>
  403. </span>
  404. </el-dialog>
  405. <!-- 课程信息老师 -->
  406. <el-dialog title="课程信息"
  407. width="400px"
  408. :visible.sync="educationalVisible">
  409. <el-form :model="addrForm"
  410. label-width="120px">
  411. <el-form-item label="课程分部"
  412. prop="organId">
  413. <el-select v-model.trim="addrForm.organId"
  414. filterable
  415. @change="onEduTeacher('on')"
  416. clearable>
  417. <el-option v-for="(item,index) in organList"
  418. :key="index"
  419. :label="item.name"
  420. :value="item.id" />
  421. </el-select>
  422. </el-form-item>
  423. <el-form-item label="乐团主管"
  424. prop="educationalTeacherId">
  425. <el-select v-model.trim="addrForm.educationalTeacherId"
  426. filterable
  427. :disabled="!addrForm.organId"
  428. clearable>
  429. <el-option v-for="(item,index) in educationList"
  430. :key="index"
  431. :label="item.realName"
  432. :value="item.id" />
  433. </el-select>
  434. </el-form-item>
  435. </el-form>
  436. <span slot="footer"
  437. class="dialog-footer">
  438. <el-button @click="educationalVisible = false">取 消</el-button>
  439. <el-button type="primary"
  440. @click="resetEducationalVisible">确 定</el-button>
  441. </span>
  442. </el-dialog>
  443. <el-dialog title="有效期调整"
  444. width="400px"
  445. :visible.sync="expireVisible">
  446. <el-form :model="expireForm"
  447. ref="expireForm"
  448. :rules="expireRules"
  449. label-position="right"
  450. label-width="80px;"
  451. :inline="true">
  452. <el-form-item label="课程结束时间"
  453. prop="coursesExpireDate">
  454. <el-date-picker v-model.trim="expireForm.coursesExpireDate"
  455. style="width:200px!important;"
  456. type="date"
  457. :picker-options="bigin"
  458. value-format="yyyy-MM-dd"
  459. placeholder="选择日期"></el-date-picker>
  460. </el-form-item>
  461. <!-- <div style="padding-left: 15px; color: red;">课程结束时间不得晚于,{{ expireForm.tempCoursesExpireDate }}</div> -->
  462. </el-form>
  463. <div slot="footer"
  464. class="dialog-footer">
  465. <el-button @click="expireVisible = false">取 消</el-button>
  466. <el-button type="primary"
  467. @click="submitExpireDate">确 定</el-button>
  468. </div>
  469. </el-dialog>
  470. </div>
  471. </template>
  472. <script>
  473. import {
  474. resetCourse,
  475. cleanAttendance,
  476. getEmployeeOrgan,
  477. } from "@/api/buildTeam";
  478. import { queryEmployByOrganId } from '@/api/systemManage'
  479. // import { getSchool } from '@/api/systemManage'
  480. import pagination from "@/components/Pagination/index";
  481. import {
  482. findVipGroupCourseSchedules,
  483. bathDelete,
  484. appendVipGroupCourseSchedules,
  485. vipCourseAdjust,
  486. updateVipBaseInfo,
  487. batchAppendVipGroupCourses,
  488. vipGroupManageUpdate
  489. } from "@/api/vipSeting";
  490. import { getTeachSchool } from "@/api/teacherManager";
  491. import { diffTimerFormMinute, addTimerFormMinute } from '@/utils/date'
  492. import dayjs from 'dayjs'
  493. let that;
  494. export default {
  495. components: {
  496. pagination
  497. },
  498. data () {
  499. return {
  500. expireVisible: false,
  501. addrVisible: false,
  502. adjustmentVisible: false,
  503. addCourseVisible: false,
  504. courseVisible: false,
  505. educationalVisible: false,
  506. tableList: [],
  507. addTable: [],
  508. educationList: [],
  509. courseTime: "",
  510. vipid: "",
  511. addrForm: {
  512. address: "",
  513. educationalTeacherId: "",
  514. organId: ""
  515. },
  516. maskForm: {
  517. date: "",
  518. startTime: "",
  519. endTime: "",
  520. id: "",
  521. address: "",
  522. teachMode: ""
  523. },
  524. rules: {
  525. // 分页规则
  526. limit: 50, // 限制显示条数
  527. page: 1, // 当前页
  528. total: 0, // 总条数
  529. page_size: [50, 100] // 选择限制显示条数
  530. },
  531. maskRules: {
  532. date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
  533. // startTime: [{ required: true, message: '请选择上课开始时间', trigger: 'blur' },],
  534. // endTime: [
  535. // { required: true, message: "请选择上课结束时间", trigger: "blur" }
  536. // ]
  537. },
  538. schoolList: [],
  539. Frules: null,
  540. FsearchForm: null,
  541. adjustmentForm: {
  542. count: "",
  543. courseTime: "",
  544. checked: false,
  545. addCount: "",
  546. courseType: "",
  547. fee: "",
  548. address: ""
  549. },
  550. adjustmentRules: {
  551. courseTime: [{ required: true, message: "请选择开始时间" }],
  552. addCount: [{ required: true, message: "请输入加课次数" }],
  553. courseType: [{ required: true, message: "请选择课程类型" }],
  554. fee: [{ required: true, message: "请输入费用" }],
  555. address: [{ required: true, message: "请选择教学地点" }]
  556. },
  557. weekDateList: [
  558. { value: "1", label: "星期一" },
  559. { value: "2", label: "星期二" },
  560. { value: "3", label: "星期三" },
  561. { value: "4", label: "星期四" },
  562. { value: "5", label: "星期五" },
  563. { value: "6", label: "星期六" },
  564. { value: "7", label: "星期日" }
  565. ],
  566. weekList: [
  567. {
  568. dayOfWeek: "",
  569. startTime: "",
  570. endTime: "",
  571. moid: new Date().getTime()
  572. }
  573. ],
  574. activeList: [],
  575. // 改版加课
  576. isaddCourse: false,
  577. adjustmentName: "",
  578. startTime: "",
  579. chioseVipList: [],
  580. organList: [],
  581. name: '',
  582. endTime: '',
  583. startClassTime: '',
  584. expireForm: {
  585. coursesExpireDate: null,
  586. tempCoursesExpireDate: null
  587. },
  588. bigin: this.beginDate(),
  589. expireRules: {
  590. coursesExpireDate: [{ required: true, message: "请选择课程结束时间", trigger: "blur" }]
  591. },
  592. };
  593. },
  594. created () {
  595. that = this
  596. },
  597. mounted () {
  598. this.__init();
  599. this.getList();
  600. },
  601. activated () {
  602. this.__init();
  603. this.getList();
  604. },
  605. methods: {
  606. __init () {
  607. this.vipid = this.$route.query.id;
  608. let query = this.$route.query
  609. let addrForm = this.addrForm
  610. this.name = this.$route.query.name;
  611. this.endTime = this.$route.query.endTimeStr
  612. this.expireForm.coursesExpireDate = this.endTime;
  613. this.startClassTime = this.$route.query.startTimeStr
  614. if (query.educationalTeacherId) {
  615. addrForm.educationalTeacherId = Number(query.educationalTeacherId);
  616. } else {
  617. addrForm.educationalTeacherId = null;
  618. }
  619. if (query.organId) {
  620. addrForm.organId = Number(query.organId)
  621. this.onEduTeacher()
  622. } else {
  623. addrForm.organId = null
  624. }
  625. if (query.rules) {
  626. this.Frules = query.rules;
  627. }
  628. if (query.searchForm) {
  629. this.FsearchForm = query.searchForm;
  630. }
  631. // 获取乐团主管
  632. // findEducationUsers().then(res => {
  633. // if (res.code == 200) {
  634. // this.educationList = res.data;
  635. // }
  636. // });
  637. getEmployeeOrgan().then(res => {
  638. if (res.code == 200) {
  639. this.organList = res.data;
  640. }
  641. });
  642. // 取课程组上指导老师,教学点
  643. getTeachSchool({
  644. userId: query.userId
  645. }).then(res => {
  646. if (res.code == 200) {
  647. this.schoolList = res.data;
  648. }
  649. })
  650. },
  651. getList () {
  652. findVipGroupCourseSchedules({
  653. vipGroupId: this.vipid,
  654. rows: this.rules.limit,
  655. page: this.rules.page
  656. }).then(res => {
  657. if (res.code == 200) {
  658. this.tableList = res.data.pageInfo.rows;
  659. this.rules.total = res.data.pageInfo.total;
  660. this.courseTime = res.data.singleClassMinutes;
  661. }
  662. });
  663. },
  664. goBack () {
  665. this.$store.dispatch('delVisitedViews', this.$route)
  666. this.$router.push({
  667. path: "/business/vipList",
  668. });
  669. },
  670. resetClass (row) {
  671. /**
  672. * maskForm.startTime
  673. *
  674. */
  675. this.maskForm.date = row.classDate.split(' ')[0];
  676. this.startTime = row.startClassTimeStr.substring(0, 5)
  677. this.maskForm.endTime = row.endClassTimeStr.substring(0, 5)
  678. // this.maskForm.endTime = row.endClassTimeStr;
  679. this.maskForm.id = row.id;
  680. this.maskForm.address = row.schoolId || null;
  681. this.maskForm.teachMode = row.teachMode;
  682. // 修改课时
  683. this.courseVisible = true;
  684. },
  685. handleClose () {
  686. this.courseVisible = false;
  687. this.startTime = "";
  688. this.maskForm = {
  689. date: "",
  690. startTime: "",
  691. endTime: "",
  692. id: "",
  693. address: "",
  694. teachMode: ""
  695. };
  696. this.$refs["maskForm"].resetFields();
  697. },
  698. submitResetClass () {
  699. // endClassTimeStr: this.maskForm.endTime,
  700. if (!this.startTime) {
  701. this.$message.error("请填写修改时间");
  702. return;
  703. }
  704. let classTime = this.maskForm.date
  705. ? new Date(this.maskForm.date)
  706. : new Date();
  707. let ymd =
  708. classTime.getFullYear() +
  709. "-" +
  710. (classTime.getMonth() + 1) +
  711. "-" +
  712. classTime.getDate();
  713. let tempStartTime = this.startTime
  714. if (this.startTime.length <= 5) {
  715. tempStartTime = tempStartTime + ":00";
  716. }
  717. let obj = {
  718. startClassTime: ymd + " " + this.startTime,
  719. // startClassTimeStr: this.startTime,
  720. id: this.maskForm.id,
  721. classDate: this.maskForm.date,
  722. schoolId: this.maskForm.address || null,
  723. teachMode: this.maskForm.teachMode || null,
  724. groupType: 'VIP'
  725. };
  726. resetCourse(obj).then(res => {
  727. if (res.code == 200) {
  728. this.$message.success("修改成功");
  729. this.courseVisible = false;
  730. this.getList();
  731. } //else {
  732. // this.$message.error(res.msg)
  733. // }
  734. });
  735. },
  736. removeClass (row) {
  737. this.$confirm("是否删除该vip课程?", "提示", {
  738. confirmButtonText: "确定",
  739. cancelButtonText: "取消",
  740. type: "warning"
  741. }).then(() => {
  742. bathDelete({ courseScheduleIds: row.id }).then(res => {
  743. if (res.code == 200) {
  744. this.$message.success("删除成功");
  745. this.getList();
  746. }
  747. });
  748. });
  749. },
  750. // vip 家课
  751. addCourse () {
  752. this.adjustmentName = "vip加课";
  753. this.isaddCourse = true;
  754. this.adjustmentVisible = true;
  755. // this.adjustmentForm.count = 0;
  756. // this.addCourseVisible = true;
  757. },
  758. addOneChiose () {
  759. this.addTable.push({
  760. classDate: "",
  761. startClassTimeStr: "",
  762. endClassTimeStr: "",
  763. teachMode: "",
  764. moid: new Date().getTime()
  765. });
  766. },
  767. removeMarkCourse (row) {
  768. for (let i in this.addTable) {
  769. if (this.addTable[i].moid == row.moid) {
  770. this.addTable.splice(i, 1);
  771. }
  772. }
  773. },
  774. submitAdd () {
  775. let endClassTimeStr = this.MinutesTest(
  776. this.addTable[0].startClassTimeStr,
  777. 90
  778. );
  779. let some = {
  780. vipGroupApplyBaseInfo: {
  781. id: this.vipid
  782. },
  783. courseSchedules: []
  784. };
  785. for (let i in this.addTable) {
  786. let obj = {
  787. classDate: this.addTable[i].classDate,
  788. startClassTimeStr: this.addTable[i].startClassTimeStr,
  789. endClassTimeStr: this.MinutesTest(
  790. this.addTable[i].startClassTimeStr,
  791. this.courseTime
  792. ),
  793. teachMode: this.addTable[i].teachMode
  794. };
  795. some.courseSchedules.push(obj);
  796. }
  797. // 发请求干活
  798. appendVipGroupCourseSchedules(some).then(res => {
  799. if (res.code == 200) {
  800. this.addCourseVisible = false;
  801. this.rules.page = 1;
  802. this.getList();
  803. }
  804. });
  805. },
  806. isDisabled (row, index) {
  807. if (row.isSettlement) {
  808. return false;
  809. } else {
  810. return true;
  811. }
  812. },
  813. // 分钟小时相加减
  814. MinutesTest (str, interval) {
  815. let houer = str.split(":")[0];
  816. let min = str.split(":")[1];
  817. let sdate1 = new Date(1900, 1, 1, houer, min);
  818. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  819. let H = sdate1.getHours();
  820. let M = sdate1.getMinutes();
  821. if (H < 10) H = "0" + H;
  822. if (M < 10) M = "0" + M;
  823. return H + ":" + M;
  824. },
  825. handleSelectionChange (val) {
  826. this.chioseVipList = val
  827. this.adjustmentForm.count = val.length;
  828. this.activeList = val;
  829. },
  830. addWeek () {
  831. // 添加循环周期
  832. this.weekList.push({
  833. dayOfWeek: "",
  834. startClassTime: "",
  835. endClassTime: "",
  836. id: new Date()
  837. });
  838. },
  839. // 删除循环周
  840. removeWeek (item) {
  841. for (let i in this.weekList) {
  842. if (this.weekList[i].id == item.id) {
  843. this.weekList.splice(i, 1);
  844. }
  845. }
  846. },
  847. adjustment () {
  848. this.adjustmentName = "批量调整";
  849. this.isaddCourse = false;
  850. if (this.adjustmentForm.count <= 0) {
  851. this.$message.error("请至少勾选一节课");
  852. } else {
  853. this.adjustmentVisible = true;
  854. }
  855. },
  856. submitAdjustment () {
  857. this.$refs["adjustmentForm"].validate(item => {
  858. if (item) {
  859. let week = this.weekList;
  860. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  861. this.$message.error("至少排一节课");
  862. return;
  863. }
  864. // 开始
  865. let obj = {};
  866. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  867. let idArr = this.activeList.map(item => {
  868. return item.id;
  869. });
  870. // let tempWeekList = []
  871. // this.weekList.forEach(item => {
  872. // let tempTime = item.startClassTime.length <= 5 ? item.startClassTime + ':00' : item.startClassTime
  873. // tempWeekList.push({
  874. // dayOfWeek: item.dayOfWeek,
  875. // startTime: item.startTime,
  876. // endTime: item.endTime,
  877. // moid: item.moid,
  878. // startClassTime: obj.courseCreateStartTime + ' ' + tempTime,
  879. // })
  880. // })
  881. let courseScheduleIds = idArr.join(",");
  882. obj.courseScheduleIds = courseScheduleIds;
  883. obj.courseTimes = this.weekList;
  884. obj.holiday = this.adjustmentForm.checked;
  885. obj.teachMode = this.adjustmentForm.courseType || null;
  886. obj.groupType = "VIP";
  887. obj.vipGroupId = this.vipid;
  888. obj.schoolId = this.adjustmentForm.address || null
  889. vipCourseAdjust(obj).then(res => {
  890. if (res.code == 200) {
  891. this.$message.success("恭喜您修改成功");
  892. this.adjustmentVisible = false;
  893. this.getList();
  894. }
  895. });
  896. }
  897. });
  898. },
  899. addCourseSubmit () {
  900. this.$refs["adjustmentForm"].validate(item => {
  901. if (item) {
  902. let week = this.weekList;
  903. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  904. this.$message.error("至少排一节课");
  905. return;
  906. }
  907. // 开始
  908. let obj = {};
  909. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  910. let idArr = this.activeList.map(item => {
  911. return item.id;
  912. });
  913. let courseScheduleIds = idArr.join(",");
  914. obj.courseScheduleIds = courseScheduleIds;
  915. obj.courseTimes = this.weekList;
  916. obj.holiday = this.adjustmentForm.checked;
  917. obj.vipGroupId = this.vipid;
  918. obj.courseCount = this.adjustmentForm.addCount;
  919. obj.teachMode = this.adjustmentForm.courseType;
  920. obj.singleClassPrice = this.adjustmentForm.fee;
  921. obj.groupType = "VIP";
  922. batchAppendVipGroupCourses(obj).then(res => {
  923. if (res.code == 200) {
  924. this.$message.success("恭喜您添加成功");
  925. this.adjustmentVisible = false;
  926. this.getList();
  927. }
  928. });
  929. }
  930. });
  931. },
  932. resetAddrSubmit () {
  933. if (!this.addrForm.address) {
  934. this.$message.error("请选择一个教学点");
  935. return;
  936. }
  937. // 修改教学点
  938. updateVipBaseInfo({
  939. id: this.vipid,
  940. teacherSchoolId: this.addrForm.address,
  941. educationalTeacherId: this.addrForm.educationalTeacherId
  942. }).then(res => {
  943. if (res.code == 200) {
  944. this.$message.success("修改成功");
  945. this.addrVisible = false;
  946. this.getList();
  947. }
  948. });
  949. },
  950. onEduTeacher (type) {
  951. this.educationList = []
  952. let addrForm = this.addrForm
  953. if (type) { addrForm.educationalTeacherId = null }
  954. queryEmployByOrganId({ organId: addrForm.organId, rows: 10000 }).then(res => {
  955. if (res.code == 200) {
  956. this.educationList = res.data.rows
  957. }
  958. })
  959. },
  960. resetEducationalVisible () {
  961. let addrForm = this.addrForm
  962. if (!addrForm.organId) {
  963. this.$message.error("请选择课程分部");
  964. return;
  965. }
  966. if (!addrForm.educationalTeacherId) {
  967. this.$message.error("请选择乐团主管");
  968. return;
  969. }
  970. // 修改乐团主管
  971. updateVipBaseInfo({
  972. id: this.vipid,
  973. organId: addrForm.organId,
  974. educationalTeacherId: addrForm.educationalTeacherId
  975. }).then(res => {
  976. if (res.code == 200) {
  977. this.$message.success("修改成功");
  978. this.educationalVisible = false;
  979. this.getList();
  980. }
  981. });
  982. },
  983. // 清除考勤
  984. clearAttend (row) {
  985. this.$confirm("是否清除考勤记录?", "提示", {
  986. confirmButtonText: "确定",
  987. cancelButtonText: "取消",
  988. type: "warning"
  989. })
  990. .then(() => {
  991. cleanAttendance({ courseScheduleIds: row.id }).then(res => {
  992. if (res.code == 200) {
  993. this.$message.success("清除成功");
  994. this.getList();
  995. } else {
  996. this.$message.error(res.msg);
  997. }
  998. });
  999. })
  1000. .catch(() => { });
  1001. },
  1002. changeStartTime (val) {
  1003. this.$nextTick(res => {
  1004. if (val) {
  1005. this.$set(this.maskForm, 'endTime', addTimerFormMinute(this.maskForm.date, val, this.courseTime))
  1006. } else {
  1007. this.$set(this.maskForm, 'endTime', '')
  1008. }
  1009. if (!this.maskForm.endTime) {
  1010. this.$set(this, 'startTime', '')
  1011. }
  1012. })
  1013. },
  1014. changeStartTimes (val, item) {
  1015. this.$nextTick(res => {
  1016. if (val) {
  1017. let str = dayjs(new Date()).format('YYYY-MM-DD')
  1018. this.$set(item, 'endClassTime', addTimerFormMinute(str, val, this.courseTime))
  1019. } else {
  1020. this.$set(item, 'endClassTime', '')
  1021. }
  1022. if (!item.endClassTime) {
  1023. console.log(item.startClassTime)
  1024. this.$set(item, 'startClassTime', '')
  1025. }
  1026. })
  1027. },
  1028. coursesDate (dateStr) {
  1029. let self = this;
  1030. return {
  1031. firstDayOfWeek: 1,
  1032. disabledDate: time => {
  1033. return time.getTime() + 86400000 <= new Date().getTime()
  1034. }
  1035. };
  1036. },
  1037. pickerOptions (dateStr) {
  1038. return {
  1039. firstDayOfWeek: 1,
  1040. disabledDate (time) {
  1041. return time.getTime() + 86400000 <= new Date().getTime();
  1042. }
  1043. }
  1044. },
  1045. submitExpireDate () {
  1046. this.$refs.expireForm.validate(some => {
  1047. if (some) {
  1048. vipGroupManageUpdate({
  1049. id: this.vipid,
  1050. coursesExpireDate: this.expireForm.coursesExpireDate
  1051. }).then(res => {
  1052. if (res.code == 200) {
  1053. this.$message.success("有效期修改成功")
  1054. this.expireVisible = false
  1055. let str = this.expireForm.coursesExpireDate + ' 00:00:00'
  1056. this.$router.push({
  1057. query: {
  1058. ...this.$route.query,
  1059. endTimeStr: str
  1060. }
  1061. })
  1062. // this.$route.query.endTimeStr = str;
  1063. this.endTime = str
  1064. console.log(str)
  1065. this.getList();
  1066. } else {
  1067. this.$message.error(res.msg)
  1068. }
  1069. })
  1070. } else {
  1071. return;
  1072. }
  1073. });
  1074. },
  1075. beginDate () {
  1076. let self = this
  1077. return {
  1078. firstDayOfWeek: 1,
  1079. disabledDate (time) {
  1080. // if (self.expireForm.tempCoursesExpireDate) {
  1081. // return new Date(self.expireForm.tempCoursesExpireDate).getTime() > time.getTime()
  1082. // } else {
  1083. return time.getTime() <= Date.now()
  1084. //开始时间不选时,结束时间最大值小于等于当天
  1085. // }
  1086. }
  1087. }
  1088. }
  1089. },
  1090. watch: {
  1091. adjustmentVisible (val) {
  1092. if (!val) {
  1093. this.adjustmentForm = {
  1094. count: "",
  1095. courseTime: "",
  1096. checked: false,
  1097. addCount: "",
  1098. courseType: "",
  1099. fee: "",
  1100. address: ""
  1101. }
  1102. this.weekList = [];
  1103. this.$refs['tableList'].clearSelection();
  1104. this.$refs.adjustmentForm.resetFields();
  1105. this.addWeek();
  1106. }
  1107. },
  1108. addrVisible (val) {
  1109. if (!val) {
  1110. this.addrForm.address = "";
  1111. }
  1112. },
  1113. },
  1114. computed:{
  1115. nowTime(){
  1116. // console.log(that.maskForm.date)
  1117. let str = '04:30:00'
  1118. if(that.maskForm.date == dayjs(new Date).format('YYYY-MM-DD')){
  1119. str = dayjs(new Date).format('HH:mm:ss')
  1120. }
  1121. return str
  1122. }
  1123. }
  1124. };
  1125. </script>
  1126. <style lang="scss" scoped>
  1127. .vipwrap {
  1128. display: flex;
  1129. flex-direction: row;
  1130. justify-content: flex-start;
  1131. .newBand {
  1132. margin-right: 20px;
  1133. }
  1134. }
  1135. .resetClassForm {
  1136. /deep/.el-date-editor.el-input,
  1137. /deep/.el-date-editor.el-input__inner {
  1138. width: 180px !important;
  1139. }
  1140. }
  1141. .countWrap {
  1142. /deep/.el-date-editor.el-input,
  1143. /deep/.el-date-editor.el-input__inner {
  1144. width: 100px !important;
  1145. }
  1146. }
  1147. .maskForm {
  1148. /deep/.el-input {
  1149. width: 220px !important;
  1150. }
  1151. }
  1152. .titlewrap {
  1153. display: flex;
  1154. flex-direction: row;
  1155. justify-content: flex-start;
  1156. align-items: center;
  1157. }
  1158. </style>