vipReset.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160
  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 :total="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: '04:30:00 - 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. findEducationUsers,
  477. getEmployeeOrgan,
  478. } from "@/api/buildTeam";
  479. import { queryEmployByOrganId } from '@/api/systemManage'
  480. // import { getSchool } from '@/api/systemManage'
  481. import pagination from "@/components/Pagination/index";
  482. import {
  483. findVipGroupCourseSchedules,
  484. bathDelete,
  485. appendVipGroupCourseSchedules,
  486. vipCourseAdjust,
  487. updateVipBaseInfo,
  488. batchAppendVipGroupCourses,
  489. vipGroupManageUpdate
  490. } from "@/api/vipSeting";
  491. import { getTeachSchool } from "@/api/teacherManager";
  492. import { diffTimerFormMinute, addTimerFormMinute } from '@/utils/date'
  493. import dayjs from 'dayjs'
  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. mounted () {
  596. this.__init();
  597. this.getList();
  598. },
  599. activated () {
  600. this.__init();
  601. this.getList();
  602. },
  603. methods: {
  604. __init () {
  605. this.vipid = this.$route.query.id;
  606. let query = this.$route.query
  607. let addrForm = this.addrForm
  608. this.name = this.$route.query.name;
  609. this.endTime = this.$route.query.endTimeStr
  610. this.expireForm.coursesExpireDate = this.endTime;
  611. this.startClassTime = this.$route.query.startTimeStr
  612. if (query.educationalTeacherId) {
  613. addrForm.educationalTeacherId = Number(query.educationalTeacherId);
  614. } else {
  615. addrForm.educationalTeacherId = null;
  616. }
  617. if (query.organId) {
  618. addrForm.organId = Number(query.organId)
  619. this.onEduTeacher()
  620. } else {
  621. addrForm.organId = null
  622. }
  623. if (query.rules) {
  624. this.Frules = query.rules;
  625. }
  626. if (query.searchForm) {
  627. this.FsearchForm = query.searchForm;
  628. }
  629. // 获取教务老师
  630. // findEducationUsers().then(res => {
  631. // if (res.code == 200) {
  632. // this.educationList = res.data;
  633. // }
  634. // });
  635. getEmployeeOrgan().then(res => {
  636. if (res.code == 200) {
  637. this.organList = res.data;
  638. }
  639. });
  640. // 取课程组上指导老师,教学点
  641. getTeachSchool({
  642. userId: query.userId
  643. }).then(res => {
  644. if (res.code == 200) {
  645. this.schoolList = res.data;
  646. }
  647. })
  648. },
  649. getList () {
  650. findVipGroupCourseSchedules({
  651. vipGroupId: this.vipid,
  652. rows: this.rules.limit,
  653. page: this.rules.page
  654. }).then(res => {
  655. if (res.code == 200) {
  656. this.tableList = res.data.pageInfo.rows;
  657. this.rules.total = res.data.pageInfo.total;
  658. this.courseTime = res.data.singleClassMinutes;
  659. }
  660. });
  661. },
  662. goBack () {
  663. this.$router.push({
  664. path: "/business/vipList",
  665. query: { rules: this.Frules, searchForm: this.FsearchForm }
  666. });
  667. },
  668. resetClass (row) {
  669. /**
  670. * maskForm.startTime
  671. *
  672. */
  673. this.maskForm.date = row.classDate.split(' ')[0];
  674. this.startTime = row.startClassTimeStr.substring(0, 5)
  675. this.maskForm.endTime = row.endClassTimeStr.substring(0, 5)
  676. // this.maskForm.endTime = row.endClassTimeStr;
  677. this.maskForm.id = row.id;
  678. this.maskForm.address = row.schoolId || null;
  679. this.maskForm.teachMode = row.teachMode;
  680. // 修改课时
  681. this.courseVisible = true;
  682. },
  683. handleClose () {
  684. this.courseVisible = false;
  685. this.startTime = "";
  686. this.maskForm = {
  687. date: "",
  688. startTime: "",
  689. endTime: "",
  690. id: "",
  691. address: "",
  692. teachMode: ""
  693. };
  694. this.$refs["maskForm"].resetFields();
  695. },
  696. submitResetClass () {
  697. // endClassTimeStr: this.maskForm.endTime,
  698. if (!this.startTime) {
  699. this.$message.error("请填写修改时间");
  700. return;
  701. }
  702. let classTime = this.maskForm.date
  703. ? new Date(this.maskForm.date)
  704. : new Date();
  705. let ymd =
  706. classTime.getFullYear() +
  707. "-" +
  708. (classTime.getMonth() + 1) +
  709. "-" +
  710. classTime.getDate();
  711. let tempStartTime = this.startTime
  712. if (this.startTime.length <= 5) {
  713. tempStartTime = tempStartTime + ":00";
  714. }
  715. let obj = {
  716. startClassTime: ymd + " " + this.startTime,
  717. // startClassTimeStr: this.startTime,
  718. id: this.maskForm.id,
  719. classDate: this.maskForm.date,
  720. schoolId: this.maskForm.address || null,
  721. teachMode: this.maskForm.teachMode || null,
  722. groupType: 'VIP'
  723. };
  724. resetCourse(obj).then(res => {
  725. if (res.code == 200) {
  726. this.$message.success("修改成功");
  727. this.courseVisible = false;
  728. this.getList();
  729. } //else {
  730. // this.$message.error(res.msg)
  731. // }
  732. });
  733. },
  734. removeClass (row) {
  735. this.$confirm("是否删除该vip课程?", "提示", {
  736. confirmButtonText: "确定",
  737. cancelButtonText: "取消",
  738. type: "warning"
  739. }).then(() => {
  740. bathDelete({ courseScheduleIds: row.id }).then(res => {
  741. if (res.code == 200) {
  742. this.$message.success("删除成功");
  743. this.getList();
  744. }
  745. });
  746. });
  747. },
  748. // vip 家课
  749. addCourse () {
  750. this.adjustmentName = "vip加课";
  751. this.isaddCourse = true;
  752. this.adjustmentVisible = true;
  753. // this.adjustmentForm.count = 0;
  754. // this.addCourseVisible = true;
  755. },
  756. addOneChiose () {
  757. this.addTable.push({
  758. classDate: "",
  759. startClassTimeStr: "",
  760. endClassTimeStr: "",
  761. teachMode: "",
  762. moid: new Date().getTime()
  763. });
  764. },
  765. removeMarkCourse (row) {
  766. for (let i in this.addTable) {
  767. if (this.addTable[i].moid == row.moid) {
  768. this.addTable.splice(i, 1);
  769. }
  770. }
  771. },
  772. submitAdd () {
  773. let endClassTimeStr = this.MinutesTest(
  774. this.addTable[0].startClassTimeStr,
  775. 90
  776. );
  777. let some = {
  778. vipGroupApplyBaseInfo: {
  779. id: this.vipid
  780. },
  781. courseSchedules: []
  782. };
  783. for (let i in this.addTable) {
  784. let obj = {
  785. classDate: this.addTable[i].classDate,
  786. startClassTimeStr: this.addTable[i].startClassTimeStr,
  787. endClassTimeStr: this.MinutesTest(
  788. this.addTable[i].startClassTimeStr,
  789. this.courseTime
  790. ),
  791. teachMode: this.addTable[i].teachMode
  792. };
  793. some.courseSchedules.push(obj);
  794. }
  795. // 发请求干活
  796. appendVipGroupCourseSchedules(some).then(res => {
  797. if (res.code == 200) {
  798. this.addCourseVisible = false;
  799. this.rules.page = 1;
  800. this.getList();
  801. }
  802. });
  803. },
  804. isDisabled (row, index) {
  805. if (row.isSettlement) {
  806. return false;
  807. } else {
  808. return true;
  809. }
  810. },
  811. // 分钟小时相加减
  812. MinutesTest (str, interval) {
  813. let houer = str.split(":")[0];
  814. let min = str.split(":")[1];
  815. let sdate1 = new Date(1900, 1, 1, houer, min);
  816. sdate1.setMinutes(sdate1.getMinutes() + parseInt(interval));
  817. let H = sdate1.getHours();
  818. let M = sdate1.getMinutes();
  819. if (H < 10) H = "0" + H;
  820. if (M < 10) M = "0" + M;
  821. return H + ":" + M;
  822. },
  823. handleSelectionChange (val) {
  824. this.chioseVipList = val
  825. this.adjustmentForm.count = val.length;
  826. this.activeList = val;
  827. },
  828. addWeek () {
  829. // 添加循环周期
  830. this.weekList.push({
  831. dayOfWeek: "",
  832. startClassTime: "",
  833. endClassTime: "",
  834. id: new Date()
  835. });
  836. },
  837. // 删除循环周
  838. removeWeek (item) {
  839. for (let i in this.weekList) {
  840. if (this.weekList[i].id == item.id) {
  841. this.weekList.splice(i, 1);
  842. }
  843. }
  844. },
  845. adjustment () {
  846. this.adjustmentName = "批量调整";
  847. this.isaddCourse = false;
  848. if (this.adjustmentForm.count <= 0) {
  849. this.$message.error("请至少勾选一节课");
  850. } else {
  851. this.adjustmentVisible = true;
  852. }
  853. },
  854. submitAdjustment () {
  855. this.$refs["adjustmentForm"].validate(item => {
  856. if (item) {
  857. let week = this.weekList;
  858. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  859. this.$message.error("至少排一节课");
  860. return;
  861. }
  862. // 开始
  863. let obj = {};
  864. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  865. let idArr = this.activeList.map(item => {
  866. return item.id;
  867. });
  868. // let tempWeekList = []
  869. // this.weekList.forEach(item => {
  870. // let tempTime = item.startClassTime.length <= 5 ? item.startClassTime + ':00' : item.startClassTime
  871. // tempWeekList.push({
  872. // dayOfWeek: item.dayOfWeek,
  873. // startTime: item.startTime,
  874. // endTime: item.endTime,
  875. // moid: item.moid,
  876. // startClassTime: obj.courseCreateStartTime + ' ' + tempTime,
  877. // })
  878. // })
  879. let courseScheduleIds = idArr.join(",");
  880. obj.courseScheduleIds = courseScheduleIds;
  881. obj.courseTimes = this.weekList;
  882. obj.holiday = this.adjustmentForm.checked;
  883. obj.teachMode = this.adjustmentForm.courseType || null;
  884. obj.groupType = "VIP";
  885. obj.vipGroupId = this.vipid;
  886. obj.schoolId = this.adjustmentForm.address || null
  887. vipCourseAdjust(obj).then(res => {
  888. if (res.code == 200) {
  889. this.$message.success("恭喜您修改成功");
  890. this.adjustmentVisible = false;
  891. this.getList();
  892. }
  893. });
  894. }
  895. });
  896. },
  897. addCourseSubmit () {
  898. this.$refs["adjustmentForm"].validate(item => {
  899. if (item) {
  900. let week = this.weekList;
  901. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  902. this.$message.error("至少排一节课");
  903. return;
  904. }
  905. // 开始
  906. let obj = {};
  907. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  908. let idArr = this.activeList.map(item => {
  909. return item.id;
  910. });
  911. let courseScheduleIds = idArr.join(",");
  912. obj.courseScheduleIds = courseScheduleIds;
  913. obj.courseTimes = this.weekList;
  914. obj.holiday = this.adjustmentForm.checked;
  915. obj.vipGroupId = this.vipid;
  916. obj.courseCount = this.adjustmentForm.addCount;
  917. obj.teachMode = this.adjustmentForm.courseType;
  918. obj.singleClassPrice = this.adjustmentForm.fee;
  919. obj.groupType = "VIP";
  920. batchAppendVipGroupCourses(obj).then(res => {
  921. if (res.code == 200) {
  922. this.$message.success("恭喜您添加成功");
  923. this.adjustmentVisible = false;
  924. this.getList();
  925. }
  926. });
  927. }
  928. });
  929. },
  930. resetAddrSubmit () {
  931. if (!this.addrForm.address) {
  932. this.$message.error("请选择一个教学点");
  933. return;
  934. }
  935. // 修改教学点
  936. updateVipBaseInfo({
  937. id: this.vipid,
  938. teacherSchoolId: this.addrForm.address,
  939. educationalTeacherId: this.addrForm.educationalTeacherId
  940. }).then(res => {
  941. if (res.code == 200) {
  942. this.$message.success("修改成功");
  943. this.addrVisible = false;
  944. this.getList();
  945. }
  946. });
  947. },
  948. onEduTeacher (type) {
  949. this.educationList = []
  950. let addrForm = this.addrForm
  951. if (type) { addrForm.educationalTeacherId = null }
  952. queryEmployByOrganId({ organId: addrForm.organId, rows: 10000 }).then(res => {
  953. if (res.code == 200) {
  954. this.educationList = res.data.rows
  955. }
  956. })
  957. },
  958. resetEducationalVisible () {
  959. let addrForm = this.addrForm
  960. if (!addrForm.organId) {
  961. this.$message.error("请选择课程分部");
  962. return;
  963. }
  964. if (!addrForm.educationalTeacherId) {
  965. this.$message.error("请选择教务老师");
  966. return;
  967. }
  968. // 修改教务老师
  969. updateVipBaseInfo({
  970. id: this.vipid,
  971. organId: addrForm.organId,
  972. educationalTeacherId: addrForm.educationalTeacherId
  973. }).then(res => {
  974. if (res.code == 200) {
  975. this.$message.success("修改成功");
  976. this.educationalVisible = false;
  977. this.getList();
  978. }
  979. });
  980. },
  981. // 清除考勤
  982. clearAttend (row) {
  983. this.$confirm("是否清除考勤记录?", "提示", {
  984. confirmButtonText: "确定",
  985. cancelButtonText: "取消",
  986. type: "warning"
  987. })
  988. .then(() => {
  989. cleanAttendance({ courseScheduleIds: row.id }).then(res => {
  990. if (res.code == 200) {
  991. this.$message.success("清除成功");
  992. this.getList();
  993. } else {
  994. this.$message.error(res.msg);
  995. }
  996. });
  997. })
  998. .catch(() => { });
  999. },
  1000. changeStartTime (val) {
  1001. this.$nextTick(res => {
  1002. if (val) {
  1003. this.$set(this.maskForm, 'endTime', addTimerFormMinute(this.maskForm.date, val, this.courseTime))
  1004. } else {
  1005. this.$set(this.maskForm, 'endTime', '')
  1006. }
  1007. if (!this.maskForm.endTime) {
  1008. this.$set(this, 'startTime', '')
  1009. }
  1010. })
  1011. },
  1012. changeStartTimes (val, item) {
  1013. this.$nextTick(res => {
  1014. if (val) {
  1015. let str = dayjs(new Date()).format('YYYY-MM-DD')
  1016. this.$set(item, 'endClassTime', addTimerFormMinute(str, val, this.courseTime))
  1017. } else {
  1018. this.$set(item, 'endClassTime', '')
  1019. }
  1020. if (!item.endClassTime) {
  1021. console.log(item.startClassTime)
  1022. this.$set(item, 'startClassTime', '')
  1023. }
  1024. })
  1025. },
  1026. coursesDate (dateStr) {
  1027. let self = this;
  1028. return {
  1029. firstDayOfWeek: 1,
  1030. disabledDate: time => {
  1031. return time.getTime() + 86400000 <= new Date().getTime()
  1032. }
  1033. };
  1034. },
  1035. pickerOptions (dateStr) {
  1036. return {
  1037. firstDayOfWeek: 1,
  1038. disabledDate (time) {
  1039. return time.getTime() + 86400000 <= new Date().getTime();
  1040. }
  1041. }
  1042. },
  1043. submitExpireDate () {
  1044. this.$refs.expireForm.validate(some => {
  1045. if (some) {
  1046. vipGroupManageUpdate({
  1047. id: this.vipid,
  1048. coursesExpireDate: this.expireForm.coursesExpireDate
  1049. }).then(res => {
  1050. if (res.code == 200) {
  1051. this.$message.success("有效期修改成功")
  1052. this.expireVisible = false
  1053. let str = this.expireForm.coursesExpireDate + ' 00:00:00'
  1054. this.$router.push({
  1055. query: {
  1056. ...this.$route.query,
  1057. endTimeStr: str
  1058. }
  1059. })
  1060. // this.$route.query.endTimeStr = str;
  1061. this.endTime = str
  1062. console.log(str)
  1063. this.getList();
  1064. } else {
  1065. this.$message.error(res.msg)
  1066. }
  1067. })
  1068. } else {
  1069. return;
  1070. }
  1071. });
  1072. },
  1073. beginDate () {
  1074. let self = this
  1075. return {
  1076. firstDayOfWeek: 1,
  1077. disabledDate (time) {
  1078. // if (self.expireForm.tempCoursesExpireDate) {
  1079. // return new Date(self.expireForm.tempCoursesExpireDate).getTime() > time.getTime()
  1080. // } else {
  1081. return time.getTime() <= Date.now()
  1082. //开始时间不选时,结束时间最大值小于等于当天
  1083. // }
  1084. }
  1085. }
  1086. }
  1087. },
  1088. watch: {
  1089. adjustmentVisible (val) {
  1090. if (!val) {
  1091. this.adjustmentForm = {
  1092. count: "",
  1093. courseTime: "",
  1094. checked: false,
  1095. addCount: "",
  1096. courseType: "",
  1097. fee: "",
  1098. address: ""
  1099. }
  1100. this.weekList = [];
  1101. this.$refs['tableList'].clearSelection();
  1102. this.$refs.adjustmentForm.resetFields();
  1103. this.addWeek();
  1104. }
  1105. },
  1106. addrVisible (val) {
  1107. if (!val) {
  1108. this.addrForm.address = "";
  1109. }
  1110. },
  1111. }
  1112. };
  1113. </script>
  1114. <style lang="scss" scoped>
  1115. .vipwrap {
  1116. display: flex;
  1117. flex-direction: row;
  1118. justify-content: flex-start;
  1119. .newBand {
  1120. margin-right: 20px;
  1121. }
  1122. }
  1123. .resetClassForm {
  1124. /deep/.el-date-editor.el-input,
  1125. /deep/.el-date-editor.el-input__inner {
  1126. width: 180px !important;
  1127. }
  1128. }
  1129. .countWrap {
  1130. /deep/.el-date-editor.el-input,
  1131. /deep/.el-date-editor.el-input__inner {
  1132. width: 100px !important;
  1133. }
  1134. }
  1135. .maskForm {
  1136. /deep/.el-input {
  1137. width: 220px !important;
  1138. }
  1139. }
  1140. .titlewrap {
  1141. display: flex;
  1142. flex-direction: row;
  1143. justify-content: flex-start;
  1144. align-items: center;
  1145. }
  1146. </style>