teacher.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div class="curricula-teacher">
  3. <main-menu cur-tab="CurriculaList" />
  4. <!-- 查询条件 -->
  5. <div class="curricula-teacher-search">
  6. <div class="curricula-teacher-search-condition">
  7. <el-input v-model="search" prefix-icon="el-icon-search" @change="queryMyCourseList">
  8. <el-button slot="append" @click="queryMyCourseList">
  9. {{ $t('Key131') }}
  10. </el-button>
  11. </el-input>
  12. </div>
  13. <div class="curricula-teacher-search-button">
  14. <el-select v-model="finish_status">
  15. <el-option :label="`-${$t('Key295')}-`" :value="-1" />
  16. <el-option
  17. v-for="item in finish_status_list"
  18. :key="item.finish_status"
  19. :label="item.name"
  20. :value="item.finish_status"
  21. />
  22. </el-select>
  23. <el-button type="primary" @click="queryMyCourseList">
  24. {{ $t('Key168') }}
  25. </el-button>
  26. </div>
  27. </div>
  28. <!-- 课程列表 -->
  29. <div class="curricula-teacher-container">
  30. <div class="curricula-teacher-container-title">
  31. <span class="title">{{ $t('Key279') }}</span>
  32. <div>
  33. <el-button class="create" @click="$router.push('/create_course')">
  34. <svg-icon icon-class="create" /><span>{{ $t('Key285') }}</span>
  35. </el-button>
  36. </div>
  37. </div>
  38. <div class="curricula-teacher-container-list">
  39. <el-table :data="courseList">
  40. <el-table-column prop="name" :label="$t('Key134')" width="320" />
  41. <el-table-column :label="$t('Key250')" width="210">
  42. <template slot-scope="{ row }">
  43. <i class="el-icon-date" /> {{ row.begin_date }} - {{ row.end_date }}
  44. </template>
  45. </el-table-column>
  46. <el-table-column :label="$t('Key129')" width="90">
  47. <template slot-scope="{ row }">
  48. {{ row.is_release === 'true' ? '√' : '' }}
  49. </template>
  50. </el-table-column>
  51. <el-table-column :label="$t('Key136')" width="280" prop="org_name" />
  52. <el-table-column :label="$t('Key280')" prop="creator_name" />
  53. <el-table-column fixed="right" width="80">
  54. <template slot-scope="{ row }">
  55. <el-dropdown trigger="click">
  56. <span class="el-dropdown-link">
  57. <svg-icon icon-class="more" />
  58. </span>
  59. <el-dropdown-menu slot="dropdown">
  60. <el-dropdown-item @click.native="edit(row.id)">
  61. <svg-icon icon-class="edit" /> {{ $t('Key123') }}
  62. </el-dropdown-item>
  63. <el-dropdown-item @click.native="view(row.id)">
  64. <svg-icon icon-class="view" /> {{ $t('Key169') }}
  65. </el-dropdown-item>
  66. <el-dropdown-item v-if="row.is_release === 'false'" @click.native="releaseCourse(row.id, true)">
  67. <svg-icon icon-class="publish" /> {{ $t('Key173') }}
  68. </el-dropdown-item>
  69. <el-dropdown-item v-else @click.native="releaseCourse(row.id, false)">
  70. <svg-icon icon-class="undo" /> {{ $t('Key171') }}
  71. </el-dropdown-item>
  72. <el-dropdown-item @click.native="deleteCourse(row.id)">
  73. <svg-icon icon-class="delete" /> {{ $t('Key172') }}
  74. </el-dropdown-item>
  75. <el-dropdown-item @click.native="studentList(row.id)">
  76. <svg-icon icon-class="students" /> {{ $t('Key296') }}
  77. </el-dropdown-item>
  78. </el-dropdown-menu>
  79. </el-dropdown>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. </div>
  84. </div>
  85. <el-pagination
  86. background
  87. :page-sizes="[10, 20, 30, 40, 50]"
  88. :page-size="page_capacity"
  89. layout="prev, pager, next, total, sizes, jumper"
  90. :total="total_count"
  91. :current-page="cur_page"
  92. @prev-click="changePage"
  93. @next-click="changePage"
  94. @current-change="changePage"
  95. @size-change="changePageSize"
  96. />
  97. </div>
  98. </template>
  99. <script>
  100. import MainMenu from '../components/MainMenu.vue';
  101. import { PageQueryMyCourseList } from '@/api/table';
  102. import { GetFinishStatusList_Course } from '@/api/select';
  103. import { ReleaseCourse, DeleteCourse } from '@/api/course';
  104. export default {
  105. components: {
  106. MainMenu
  107. },
  108. data() {
  109. return {
  110. search: '',
  111. finish_status_list: [],
  112. teacher_list: [],
  113. finish_status: -1,
  114. page_capacity: 10,
  115. cur_page: 1,
  116. total_count: 0,
  117. courseList: []
  118. };
  119. },
  120. created() {
  121. this.queryMyCourseList();
  122. this.getFinishStatusList_Course();
  123. },
  124. methods: {
  125. getFinishStatusList_Course() {
  126. GetFinishStatusList_Course().then(({ finish_status_list }) => {
  127. this.finish_status_list = finish_status_list;
  128. });
  129. },
  130. changePage(newPage) {
  131. this.cur_page = newPage;
  132. this.queryMyCourseList();
  133. },
  134. changePageSize(pageSize) {
  135. this.page_capacity = pageSize;
  136. this.queryMyCourseList();
  137. },
  138. queryMyCourseList() {
  139. PageQueryMyCourseList({
  140. finish_status: this.finish_status,
  141. name: this.search,
  142. page_capacity: this.page_capacity,
  143. release_status: -1,
  144. cur_page: this.cur_page
  145. }).then(({ course_list, total_count }) => {
  146. this.courseList = course_list;
  147. this.total_count = total_count;
  148. });
  149. },
  150. statusColor(val) {
  151. if (val === 0) return '#68CEFA';
  152. if (val === 1) return '#2ECE5B';
  153. if (val === 3) return '#f90';
  154. if (val === 4) return '#4F8EEC';
  155. },
  156. studentList(id) {
  157. this.$router.push(`/student_list/index/${id}`);
  158. },
  159. edit(id) {
  160. this.$router.push(`/create_course_step_table/course_info?id=${id}`);
  161. },
  162. view(id) {
  163. this.$router.push(`/GoodsDetail?goods_id=${id}&goods_type=201&readonly=true`);
  164. },
  165. releaseCourse(course_id, is_release) {
  166. ReleaseCourse({ course_id, is_release }).then(() => {
  167. this.queryMyCourseList();
  168. this.$message.success(is_release ? this.$i18n.t('Key621') : this.$i18n.t('Key622'));
  169. });
  170. },
  171. deleteCourse(id) {
  172. this.$confirm(this.$i18n.t('Key639'), this.$i18n.t('Key361'), {
  173. confirmButtonText: this.$i18n.t('Key94'),
  174. cancelButtonText: this.$i18n.t('Key83'),
  175. type: 'warning'
  176. }).then(() => {
  177. DeleteCourse({ id }).then(() => {
  178. this.$message.success(this.$i18n.t('Key638'));
  179. this.queryMyCourseList();
  180. });
  181. });
  182. },
  183. changeTab(tab) {
  184. this.$emit('changeTab', tab);
  185. }
  186. }
  187. };
  188. </script>
  189. <style lang="scss">
  190. @import '~@/styles/mixin';
  191. .curricula-teacher {
  192. @include pagination;
  193. &-search {
  194. display: flex;
  195. justify-content: space-between;
  196. &-condition {
  197. > .el-input {
  198. width: 528px;
  199. }
  200. }
  201. &-button {
  202. .el-button {
  203. width: 114px;
  204. }
  205. .el-select {
  206. width: 225px;
  207. margin-right: 12px;
  208. }
  209. }
  210. }
  211. &-container {
  212. width: 100%;
  213. min-height: calc(100vh - 300px);
  214. margin-top: 16px;
  215. background-color: #fff;
  216. border-radius: 8px;
  217. &-title {
  218. display: flex;
  219. align-items: center;
  220. justify-content: space-between;
  221. height: 88px;
  222. padding: 24px 32px;
  223. .title {
  224. font-size: 20px;
  225. font-weight: 700;
  226. }
  227. .create {
  228. min-width: 138px;
  229. .svg-icon {
  230. margin-right: 12px;
  231. }
  232. }
  233. }
  234. &-list {
  235. @include list;
  236. margin-top: 0;
  237. .el-dropdown {
  238. cursor: pointer;
  239. .svg-icon {
  240. font-size: 19px;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. </style>
  247. <style scoped>
  248. .el-dropdown-menu .svg-icon {
  249. margin-right: 8px;
  250. }
  251. </style>