liveClassManager.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <!-- -->
  2. <template>
  3. <div>
  4. <auth auths="vipGroupManage/vipGroupApply">
  5. <el-button @click="newLiveClass" type="primary" style="margin-bottom: 20px">新建直播课</el-button>
  6. </auth>
  7. <save-form :inline="true" :model="searchForm" @submit="search" @reset="onReSet" ref="searchForm">
  8. <el-form-item prop="search">
  9. <el-input v-model.trim="searchForm.search" clearable @keyup.enter.native="e => {
  10. e.target.blur();
  11. $refs.searchForm.save();
  12. search();
  13. }
  14. " placeholder="课程组名称"></el-input>
  15. </el-form-item>
  16. <el-form-item props="teacherId">
  17. <remote-search :commit="'setTeachers'" v-model="searchForm.teacherId" :isForzenWithQueryCondition="true" />
  18. </el-form-item>
  19. <el-form-item prop="subjectId">
  20. <el-select placeholder="课程组类型" v-model="searchForm.subjectId" clearable>
  21. <el-option v-for="(item, index) in subjectList" :key="index" :value="item.id" :label="item.name" />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item prop="status">
  25. <el-select v-model.trim="searchForm.status" filterable clearable placeholder="请选课程组状态">
  26. <el-option v-for="(item, index) in statusList" :key="index" :label="item.lable" :value="item.value"></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button native-type="submit" type="primary">搜索</el-button>
  31. <el-button native-type="reset" type="danger">重置</el-button>
  32. </el-form-item>
  33. </save-form>
  34. <div class="tableWrap">
  35. <el-table style="width: 100%" :header-cell-style="{ background: '#EDEEF0', color: '#444' }" :data="tableList">
  36. <el-table-column align="center" prop="id" label="课程组编号"></el-table-column>
  37. <el-table-column align="center" prop="name" label="课程组名称"></el-table-column>
  38. <el-table-column align="center" prop="subjectName" label="课程组类型"></el-table-column>
  39. <el-table-column align="center" label="课程组状态">
  40. <template slot-scope="scope">
  41. <div>{{ scope.row.status | formatterStatus }}</div>
  42. </template>
  43. </el-table-column>
  44. <el-table-column align="center" prop="userName" label="指导老师"></el-table-column>
  45. <el-table-column align="center" prop="educationalTeacherName" label="乐员主管"></el-table-column>
  46. <el-table-column align="center" prop="studentNum" label="报名人数"></el-table-column>
  47. <el-table-column align="center" prop="onlineClassesNum" label="课时数"></el-table-column>
  48. <el-table-column align="center" label="分部">
  49. <template slot-scope="scope">
  50. <copy-text>{{ scope.row.organName }}</copy-text>
  51. </template>
  52. </el-table-column>
  53. <el-table-column align="center" prop="liveStartTime" label="开课时间">
  54. <template slot-scope="scope">
  55. <div>
  56. <p>{{ scope.row.courseStartDate | formatterTime }}</p>
  57. </div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column align="center" prop="studentId" label="操作">
  61. <template slot-scope="scope">
  62. <div>
  63. <auth auths="vipGroupManage/stopVipGroup">
  64. <el-button type="text" @click="onDetail(scope.row)">详情</el-button>
  65. </auth>
  66. <el-popover placement="top" width="160" v-if="scope.row.status <= 3" :ref="scope.$index">
  67. <p style="margin-bottom: 10px">确定关闭该直播课?</p>
  68. <el-input v-model.trim="stopReason" placeholder="请输入关闭原因"></el-input>
  69. <div style="text-align: right; margin-top: 20px">
  70. <el-button type="text" @click="onCancelVip(scope)">取消</el-button>
  71. <el-button type="primary" @click="onCloseVip(scope)">确定</el-button>
  72. </div>
  73. <el-button type="text" slot="reference">关闭</el-button>
  74. </el-popover>
  75. <auth auths="vipGroupManage/updateLiveGroup" v-if="[0, 1, 2].includes(scope.row.status)">
  76. <el-button type="text" @click="onUpdate(scope.row)">修改</el-button>
  77. </auth>
  78. <auth auths="vipGroupManage/delLiveGroup" v-if="scope.row.status == 3">
  79. <el-button type="text" @click="onDelete(scope.row)">删除</el-button>
  80. </auth>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <pagination sync :total.sync="rules.total" :page.sync="rules.page" :limit.sync="rules.limit"
  86. :page-sizes="rules.page_size" @pagination="getList" />
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import pagination from "@/components/Pagination/index";
  92. import { getVipList, closeVip } from "@/api/vipSeting";
  93. import { getSubject } from "@/api/buildTeam";
  94. import { delLiveGroup } from './api'
  95. export default {
  96. components: {
  97. pagination
  98. },
  99. data() {
  100. return {
  101. searchForm: {
  102. search: null,
  103. teacherId: null,
  104. subjectId: null,
  105. status: null
  106. },
  107. tableList: [],
  108. rules: {
  109. // 分页规则
  110. limit: 10, // 限制显示条数
  111. page: 1, // 当前页
  112. total: 0, // 总条数
  113. page_size: [10, 20, 40, 50] // 选择限制显示条数
  114. },
  115. statusList: [
  116. { lable: "未开始", value: "0" },
  117. { lable: "报名中", value: "1" },
  118. // { lable: "报名结束", value: "5" },
  119. { lable: "进行中", value: "2" },
  120. { lable: "已结束", value: "4" },
  121. { lable: "取消", value: "3" },
  122. // { lable: "暂停", value: "6" },
  123. ],
  124. stopReason: "",
  125. subjectList: []
  126. };
  127. },
  128. async mounted() {
  129. try {
  130. // 获取 指导老师列表
  131. await getSubject({
  132. tenantId: 1
  133. }).then(res => {
  134. if (res.code == 200) {
  135. this.subjectList = [
  136. {
  137. id: -1,
  138. name: "乐理"
  139. },
  140. ...res.data
  141. ];
  142. }
  143. });
  144. } catch {
  145. }
  146. this.getList();
  147. },
  148. methods: {
  149. async onDelete(row) {
  150. this.$confirm(`是否确认删除?`, "提示", {
  151. confirmButtonText: "确定",
  152. cancelButtonText: "取消",
  153. dangerouslyUseHTMLString: true,
  154. type: "warning"
  155. })
  156. .then(async () => {
  157. try {
  158. await delLiveGroup({ id: row.id })
  159. this.$message.success('删除成功')
  160. this.getList()
  161. } catch { }
  162. })
  163. .catch(() => { });
  164. },
  165. newLiveClass() {
  166. let params = {
  167. path: "/business/createLiveCourse"
  168. };
  169. this.$router.push(params, route => {
  170. route.meta.title = "新建直播课";
  171. });
  172. },
  173. onDetail(row) {
  174. this.$router.push({
  175. path: "/business/liveCourseDetail",
  176. query: {
  177. name: row.name,
  178. id: row.id
  179. }
  180. });
  181. },
  182. onUpdate(row) {
  183. this.$router.push({
  184. path: '/business/createLiveCourse',
  185. query: {
  186. type: 'update',
  187. id: row.id
  188. }
  189. }, (route) => {
  190. route.meta.title = '修改直播课'
  191. })
  192. },
  193. onCancelVip(scope) {
  194. this.stopReason = null;
  195. scope._self.$refs[scope.$index].doClose();
  196. },
  197. onCloseVip(scope) {
  198. let id = scope.row.id;
  199. closeVip({ vipGroupId: id, stopReason: this.stopReason }).then(res => {
  200. if (res.code == 200) {
  201. this.$message.success("停止课程组成功");
  202. scope._self.$refs[scope.$index].doClose();
  203. this.stopReason = "";
  204. this.getList();
  205. }
  206. });
  207. },
  208. async getList() {
  209. await getVipList({
  210. ...this.searchForm,
  211. groupType: "LIVE",
  212. page: this.rules.page,
  213. rows: this.rules.limit
  214. }).then(res => {
  215. if (res.code == 200) {
  216. this.tableList = res.data.rows;
  217. this.rules.total = res.data.total;
  218. }
  219. });
  220. },
  221. search() {
  222. this.rules.page = 1;
  223. this.getList();
  224. },
  225. onReSet() {
  226. this.searchForm.teacherId = "";
  227. this.$refs.searchForm.resetFields();
  228. this.search();
  229. }
  230. },
  231. filters: {
  232. formatterTime(val) {
  233. let result;
  234. if (val) {
  235. result = val.split(" ")[0];
  236. } else {
  237. result = "";
  238. }
  239. return result;
  240. },
  241. formatterStatus(val) {
  242. let arr = [
  243. "未开始",
  244. "报名中",
  245. "进行中",
  246. "取消",
  247. "已结束",
  248. "报名结束",
  249. "暂停"
  250. ];
  251. return arr[val];
  252. }
  253. }
  254. };
  255. </script>
  256. <style lang="scss" scoped>
  257. ::v-deep .el-dropdown-link::v-deep .el-dropdown-link {
  258. cursor: pointer;
  259. color: var(--color-primary);
  260. }
  261. ::v-deep .el-icon-arrow-down {
  262. font-size: 12px;
  263. }