addCompound.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. size="mini"
  93. >批量删除</el-button
  94. >
  95. <el-button type="primary" @click="resetClass" size="mini"
  96. v-permission="'courseSchedule/batchCourseAdjust'"
  97. >课程调整</el-button
  98. >
  99. <el-button type="primary" @click="submitClass" size="mini"
  100. v-permission="'courseSchedule/courseMerge'"
  101. >课程合并</el-button
  102. >
  103. </div>
  104. <i class="el-icon-copy-document" slot="reference"></i>
  105. </el-popover>
  106. </div>
  107. </el-card>
  108. <el-dialog
  109. :visible.sync="show"
  110. v-if="show"
  111. title="临时合课信息"
  112. append-to-body
  113. width="800px"
  114. >
  115. <compoundClass
  116. @closeReset="closeReset"
  117. @cancaleMerge="cancaleMerge"
  118. :isDisabled="true"
  119. @getList="getList"
  120. :idList="idList"
  121. :dataList="dataList"
  122. />
  123. </el-dialog>
  124. <el-dialog
  125. :visible.sync="resetCourseVisible"
  126. v-if="resetCourseVisible"
  127. @closeReset="closeReset"
  128. title="课程调整"
  129. append-to-body
  130. width="800px"
  131. >
  132. <resetCourse
  133. :idList="idList"
  134. :dataList="dataList"
  135. @getList="getList"
  136. @cancaleMerge="cancaleMerge"
  137. @closeReset="closeReset"
  138. />
  139. </el-dialog>
  140. </div>
  141. </template>
  142. <script>
  143. import compoundClass from "./compoundClass";
  144. import resetCourse from "./resetCourse";
  145. export default {
  146. props: ["compoundList"],
  147. components: { compoundClass, resetCourse },
  148. data() {
  149. return {
  150. radio: "",
  151. dataList: this.compoundList,
  152. isLook: false,
  153. show: false,
  154. idList: "",
  155. courseTime: 0,
  156. resetCourseVisible: false,
  157. };
  158. },
  159. methods: {
  160. cancleCom(row) {
  161. this.$emit("cancleCompound", row);
  162. },
  163. clearCom() {
  164. this.$emit("clearCom");
  165. },
  166. submitClass() {
  167. // if (!this.radio) {
  168. // this.$message.error("请选择一节主课");
  169. // return;
  170. // }
  171. let arr = [];
  172. let idList = [];
  173. let isFlage = false;
  174. this.dataList.forEach((com) => {
  175. arr.push(com.type);
  176. idList.push(com.id);
  177. if (
  178. com.groupType != "MUSIC" ||
  179. com.type == "MUSIC_NETWORK" ||
  180. com.type == "HIGH_ONLINE"
  181. ) {
  182. this.$message.error("只有乐团课的下线课可以合并");
  183. isFlage = true;
  184. return;
  185. }
  186. if (com.status != "NOT_START") {
  187. this.$message.error("只有未开始的课可以合并");
  188. isFlage = true;
  189. return;
  190. }
  191. if (com.newCourseId > 0 || com.beMerged) {
  192. this.$message.error("已经合并课程不可再次合并");
  193. isFlage = true;
  194. return;
  195. }
  196. if (com.isLock) {
  197. this.$message.error("已锁定的课程不能合并");
  198. isFlage = true;
  199. return;
  200. }
  201. });
  202. if (isFlage) return;
  203. /**
  204. * scope.row.groupType == 'MUSIC' &&
  205. scope.row.type != 'MUSIC_NETWORK' &&
  206. scope.row.type != 'HIGH_ONLINE' &&
  207. scope.row.status == 'NOT_START' &&
  208. scope.row.newCourseId <= 0
  209. !scope.row.beMerged &&
  210. !scope.row.isLock
  211. */
  212. if (arr.indexOf("HIGH") != -1) {
  213. arr = [...new Set(arr)];
  214. if (arr.length != 1) {
  215. this.$message.error("基础技能课只能和基础技能课合并");
  216. return;
  217. }
  218. }
  219. if (this.dataList.length <= 1) {
  220. this.$message.error("请至少选择2节课程");
  221. return;
  222. }
  223. // 做判断
  224. this.idList = idList.join(",");
  225. this.show = true;
  226. // this.isLook = false;
  227. },
  228. getList() {},
  229. closeReset() {
  230. this.clearCom();
  231. this.show = false;
  232. this.isLook = false;
  233. this.resetCourseVisible = false
  234. this.$emit("getList");
  235. },
  236. cancaleMerge() {
  237. this.show = false;
  238. this.resetCourseVisible = false;
  239. this.isLook = true;
  240. },
  241. removeCourse() {
  242. this.$emit("removeCourse");
  243. },
  244. resetClass() {
  245. // 判断条件
  246. if (!this.checkCourseTimer()) {
  247. this.$message.error("请选择相同的课程时长");
  248. return
  249. }
  250. let isclassGroup;
  251. let isNotStart = false;
  252. let arr = [];
  253. let idList =[];
  254. this.dataList.forEach((course) => {
  255. idList.push(course.id)
  256. arr.push(course.musicGroupId);
  257. if (course.status != "NOT_START") {
  258. isNotStart = true;
  259. }
  260. });
  261. if (isNotStart) {
  262. this.$message.error("请选择未开始的课程");
  263. return;
  264. }
  265. if ((arr = [...new Set(arr)].length != 1)) {
  266. this.$message.error("请选择相同的课程组");
  267. return;
  268. }
  269. this.idList = idList;
  270. // 开始选择课程
  271. this.resetCourseVisible = true;
  272. },
  273. checkCourseTimer() {
  274. let arr = [];
  275. this.dataList.forEach((course) => {
  276. let dayjs = this.$helpers.dayjs;
  277. arr.push(
  278. Math.abs(
  279. dayjs(course.startClassTime).diff(course.endClassTime, "Minute")
  280. )
  281. );
  282. });
  283. if ((arr = [...new Set(arr)].length != 1)) {
  284. return false;
  285. } else {
  286. this.courseTime = arr[0];
  287. return true;
  288. }
  289. },
  290. },
  291. watch: {
  292. compoundList(val) {
  293. this.dataList = val;
  294. },
  295. },
  296. };
  297. </script>
  298. <style lang="scss" scoped>
  299. .title {
  300. line-height: 44px;
  301. }
  302. .fixedBox {
  303. position: fixed;
  304. bottom: 20px;
  305. right: 10px;
  306. z-index: 100;
  307. width: 200px;
  308. background-color: #fff;
  309. font-size: 14px;
  310. .boxWrap {
  311. display: flex;
  312. flex-direction: row;
  313. justify-content: space-between;
  314. i {
  315. font-size: 18px;
  316. cursor: pointer;
  317. }
  318. }
  319. }
  320. /deep/.el-divider--horizontal {
  321. margin: 0 !important;
  322. }
  323. .minus {
  324. float: right;
  325. line-height: 44px;
  326. padding-right: 20px;
  327. font-size: 20px;
  328. cursor: pointer;
  329. }
  330. .addBtnList {
  331. display: flex;
  332. flex-direction: row;
  333. align-items: center;
  334. justify-content: flex-end;
  335. margin-top: 15px;
  336. padding-bottom: 10px;
  337. }
  338. </style>