addCompound.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div class="fixedBox" @click="isLook = true">
  3. <el-card>
  4. <div class="boxWrap">
  5. <p>
  6. 待处理课程列表<span style="color: red">
  7. {{ compoundList.length }}
  8. </span>
  9. </p>
  10. <el-popover placement="top" v-model="isLook" trigger="manual">
  11. <div>
  12. <p class="title">
  13. 待处理课程列表<i
  14. class="el-icon-minus minus"
  15. @click="isLook = false"
  16. ></i>
  17. </p>
  18. <el-divider></el-divider>
  19. </div>
  20. <el-button type="text" style="float: right" @click="clearCom"
  21. >清空列表</el-button
  22. >
  23. <div>
  24. <el-table
  25. :data="dataList"
  26. height="300px"
  27. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  28. >
  29. <el-table-column align="center" label="课程编号" width="110">
  30. <template slot-scope="scope">
  31. <div>{{ scope.row.id }}</div>
  32. </template>
  33. </el-table-column>
  34. <el-table-column
  35. align="center"
  36. width="180px"
  37. label="课程名称"
  38. prop="name"
  39. ></el-table-column>
  40. <el-table-column align="center" label="课程类型">
  41. <template slot-scope="scope">
  42. <div>{{ scope.row.type | coursesType }}</div>
  43. </template>
  44. </el-table-column>
  45. <el-table-column
  46. align="center"
  47. width="180px"
  48. prop="teacherName"
  49. label="指导老师"
  50. >
  51. <template slot-scope="scope">
  52. <div>
  53. {{ scope.row.teacherName }}({{ scope.row.actualTeacherId }})
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column align="center" width="200px" label="上课时间">
  58. <template slot-scope="scope"
  59. >{{
  60. scope.row.startClassTime
  61. ? scope.row.startClassTime.substr(0, 16)
  62. : ""
  63. }}-{{
  64. scope.row.endClassTime
  65. ? scope.row.endClassTime.substr(11, 5)
  66. : ""
  67. }}</template
  68. >
  69. </el-table-column>
  70. <el-table-column align="center" width="100px" label="是否结算">
  71. <template slot-scope="scope">
  72. <div>
  73. {{ scope.row.isSettlement ? "是" : "否" }}
  74. </div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align="center" label="操作">
  78. <template slot-scope="scope">
  79. <el-button type="text" @click="cancleCom(scope.row)"
  80. >取消</el-button
  81. >
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. </div>
  86. <div class="addBtnList">
  87. <el-button
  88. v-permission="'courseSchedule/batchDelete?page=teamCourseList'"
  89. @click="removeCourse"
  90. :disabled="!dataList.length > 0"
  91. type="primary"
  92. >批量删除</el-button
  93. >
  94. <el-button type="primary" @click="resetClass"
  95. v-permission="'courseSchedule/batchCourseAdjust'"
  96. >课程调整</el-button
  97. >
  98. <el-button type="primary" @click="submitClass"
  99. v-permission="'courseSchedule/courseMerge'"
  100. >课程合并</el-button
  101. >
  102. </div>
  103. <i class="el-icon-copy-document" slot="reference"></i>
  104. </el-popover>
  105. </div>
  106. </el-card>
  107. <el-dialog
  108. :visible.sync="show"
  109. v-if="show"
  110. title="临时合课信息"
  111. append-to-body
  112. width="800px"
  113. >
  114. <compoundClass
  115. @closeReset="closeReset"
  116. @cancaleMerge="cancaleMerge"
  117. :isDisabled="true"
  118. @getList="getList"
  119. :idList="idList"
  120. :dataList="dataList"
  121. />
  122. </el-dialog>
  123. <el-dialog
  124. :visible.sync="resetCourseVisible"
  125. v-if="resetCourseVisible"
  126. @closeReset="closeReset"
  127. title="课程调整"
  128. append-to-body
  129. width="800px"
  130. >
  131. <resetCourse
  132. :idList="idList"
  133. :dataList="dataList"
  134. @getList="getList"
  135. @cancaleMerge="cancaleMerge"
  136. @closeReset="closeReset"
  137. />
  138. </el-dialog>
  139. </div>
  140. </template>
  141. <script>
  142. import compoundClass from "./compoundClass";
  143. import resetCourse from "./resetCourse";
  144. export default {
  145. props: ["compoundList"],
  146. components: { compoundClass, resetCourse },
  147. data() {
  148. return {
  149. radio: "",
  150. dataList: this.compoundList,
  151. isLook: false,
  152. show: false,
  153. idList: "",
  154. courseTime: 0,
  155. resetCourseVisible: false,
  156. };
  157. },
  158. methods: {
  159. cancleCom(row) {
  160. this.$emit("cancleCompound", row);
  161. },
  162. clearCom() {
  163. this.$emit("clearCom");
  164. },
  165. submitClass() {
  166. // if (!this.radio) {
  167. // this.$message.error("请选择一节主课");
  168. // return;
  169. // }
  170. let arr = [];
  171. let idList = [];
  172. let isFlage = false;
  173. this.dataList.forEach((com) => {
  174. arr.push(com.type);
  175. idList.push(com.id);
  176. if (
  177. com.groupType != "MUSIC" ||
  178. com.type == "MUSIC_NETWORK" ||
  179. com.type == "HIGH_ONLINE"
  180. ) {
  181. this.$message.error("只有乐团的线下课可以合并");
  182. isFlage = true;
  183. return;
  184. }
  185. if (com.status != "NOT_START") {
  186. this.$message.error("只有未开始的课可以合并");
  187. isFlage = true;
  188. return;
  189. }
  190. if (com.newCourseId > 0 || com.beMerged) {
  191. this.$message.error("已经合并课程不可再次合并");
  192. isFlage = true;
  193. return;
  194. }
  195. if (com.isLock) {
  196. this.$message.error("已锁定的课程不能合并");
  197. isFlage = true;
  198. return;
  199. }
  200. });
  201. if (isFlage) return;
  202. /**
  203. * scope.row.groupType == 'MUSIC' &&
  204. scope.row.type != 'MUSIC_NETWORK' &&
  205. scope.row.type != 'HIGH_ONLINE' &&
  206. scope.row.status == 'NOT_START' &&
  207. scope.row.newCourseId <= 0
  208. !scope.row.beMerged &&
  209. !scope.row.isLock
  210. */
  211. if (arr.indexOf("HIGH") != -1) {
  212. arr = [...new Set(arr)];
  213. if (arr.length != 1) {
  214. this.$message.error("基础技能课只能和基础技能课合并");
  215. return;
  216. }
  217. }
  218. if (this.dataList.length <= 1) {
  219. this.$message.error("请至少选择2节课程");
  220. return;
  221. }
  222. // 做判断
  223. this.idList = idList.join(",");
  224. this.show = true;
  225. // this.isLook = false;
  226. },
  227. getList() {},
  228. closeReset() {
  229. this.clearCom();
  230. this.show = false;
  231. this.isLook = false;
  232. this.resetCourseVisible = false
  233. this.$emit("getList");
  234. },
  235. cancaleMerge() {
  236. this.show = false;
  237. this.resetCourseVisible = false;
  238. this.isLook = true;
  239. },
  240. removeCourse() {
  241. this.$emit("removeCourse");
  242. },
  243. resetClass() {
  244. // 判断条件
  245. if (!this.checkCourseTimer()) {
  246. this.$message.error("请选择相同的课程时长");
  247. return
  248. }
  249. let isNotStart = false;
  250. let idList =[];
  251. this.dataList.forEach((course) => {
  252. idList.push(course.id)
  253. if (course.status != "NOT_START") {
  254. isNotStart = true;
  255. }
  256. });
  257. if (isNotStart) {
  258. this.$message.error("请选择未开始的课程");
  259. return;
  260. }
  261. let isEqual = this.dataList.every(coures=>{
  262. return coures.musicGroupId==this.dataList[0].musicGroupId&&coures.groupType==this.dataList[0].groupType
  263. })
  264. if (!isEqual) {
  265. this.$message.error("请选择相同的课程组");
  266. return;
  267. }
  268. this.idList = idList;
  269. // 开始选择课程
  270. this.resetCourseVisible = true;
  271. },
  272. checkCourseTimer() {
  273. let arr = [];
  274. this.dataList.forEach((course) => {
  275. let dayjs = this.$helpers.dayjs;
  276. arr.push(
  277. Math.abs(
  278. dayjs(course.startClassTime).diff(course.endClassTime, "Minute")
  279. )
  280. );
  281. });
  282. if ((arr = [...new Set(arr)].length != 1)) {
  283. return false;
  284. } else {
  285. this.courseTime = arr[0];
  286. return true;
  287. }
  288. },
  289. },
  290. watch: {
  291. compoundList(val) {
  292. this.dataList = val;
  293. },
  294. },
  295. };
  296. </script>
  297. <style lang="scss" scoped>
  298. .title {
  299. line-height: 44px;
  300. }
  301. .fixedBox {
  302. position: fixed;
  303. bottom: 20px;
  304. right: 10px;
  305. z-index: 100;
  306. width: 200px;
  307. background-color: #fff;
  308. font-size: 14px;
  309. .boxWrap {
  310. display: flex;
  311. flex-direction: row;
  312. justify-content: space-between;
  313. i {
  314. font-size: 18px;
  315. cursor: pointer;
  316. }
  317. }
  318. }
  319. /deep/.el-divider--horizontal {
  320. margin: 0 !important;
  321. }
  322. .minus {
  323. float: right;
  324. line-height: 44px;
  325. padding-right: 20px;
  326. font-size: 20px;
  327. cursor: pointer;
  328. }
  329. .addBtnList {
  330. display: flex;
  331. flex-direction: row;
  332. align-items: center;
  333. justify-content: flex-end;
  334. margin-top: 15px;
  335. padding-bottom: 10px;
  336. }
  337. </style>