index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 排课时长消耗异常
  7. </h2>
  8. <div class="m-core">
  9. <save-form
  10. :inline="true"
  11. :model="searchForm"
  12. @submit="search"
  13. @reset="onReSet"
  14. ref="searchForm"
  15. >
  16. <el-form-item prop="search">
  17. <el-input
  18. v-model.trim="searchForm.search"
  19. clearable
  20. @keyup.enter.native="
  21. (e) => {
  22. e.target.blur();
  23. $refs.searchForm.save();
  24. search();
  25. }
  26. "
  27. placeholder="请输入姓名/编号"
  28. ></el-input>
  29. </el-form-item>
  30. <el-form-item prop="organId">
  31. <el-select
  32. style="width: 180px !important"
  33. class="multiple"
  34. v-model.trim="searchForm.organId"
  35. filterable
  36. clearable
  37. placeholder="请选择分部"
  38. >
  39. <el-option
  40. v-for="(item, index) in selects.branchs"
  41. :key="index"
  42. :label="item.name"
  43. :value="item.id"
  44. ></el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button native-type="submit" type="primary">搜索</el-button>
  49. <el-button native-type="reset" type="danger">重置</el-button>
  50. </el-form-item>
  51. </save-form>
  52. <div class="tableWrap">
  53. <el-table
  54. style="width: 100%"
  55. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  56. :data="tableList"
  57. >
  58. <el-table-column
  59. align="center"
  60. prop="organName"
  61. label="分部"
  62. ></el-table-column>
  63. <el-table-column
  64. align="center"
  65. prop="userId"
  66. label="学员编号"
  67. ></el-table-column>
  68. <el-table-column
  69. align="center"
  70. prop="username"
  71. label="学员名称"
  72. ></el-table-column>
  73. <el-table-column align="center" prop="username" label="课程类型">
  74. <template slot-scope="scope">
  75. <div>
  76. {{ scope.row.courseType | courseTypeFormat }}
  77. </div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. align="center"
  82. prop="totalCourseMinutes"
  83. label="总时长"
  84. >
  85. <template slot-scope="scope">
  86. <div>{{ scope.row.totalCourseMinutes }}分钟</div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column
  90. align="center"
  91. prop="usedCourseMinutes"
  92. label="消耗时长"
  93. >
  94. <template slot-scope="scope">
  95. <div>{{ scope.row.usedCourseMinutes }}分钟</div>
  96. </template></el-table-column
  97. >
  98. <el-table-column
  99. align="center"
  100. prop="freeCourseMinutes"
  101. label="未消耗"
  102. >
  103. <template slot-scope="scope">
  104. <div>{{ scope.row.freeCourseMinutes }}分钟</div>
  105. </template></el-table-column
  106. >
  107. </el-table>
  108. <pagination
  109. sync
  110. :total.sync="rules.total"
  111. :page.sync="rules.page"
  112. :limit.sync="rules.limit"
  113. :page-sizes="rules.page_size"
  114. @pagination="getList"
  115. />
  116. </div>
  117. </div>
  118. </div>
  119. </template>
  120. <script>
  121. import axios from "axios";
  122. import { getToken } from "@/utils/auth";
  123. import pagination from "@/components/Pagination/index";
  124. import load from "@/utils/loading";
  125. import { getHasFreeCourseList } from "../api";
  126. export default {
  127. components: { pagination },
  128. data() {
  129. return {
  130. searchForm: {
  131. search: null,
  132. organId: null,
  133. },
  134. tableList: [],
  135. organList: [],
  136. rules: {
  137. // 分页规则
  138. limit: 10, // 限制显示条数
  139. page: 1, // 当前页
  140. total: 0, // 总条数
  141. page_size: [10, 20, 40, 50], // 选择限制显示条数
  142. },
  143. };
  144. },
  145. //生命周期 - 创建完成(可以访问当前this实例)
  146. created() {},
  147. //生命周期 - 挂载完成(可以访问DOM元素)
  148. mounted() {
  149. // 获取分部
  150. this.$store.dispatch("setBranchs");
  151. this.init();
  152. },
  153. methods: {
  154. init() {
  155. this.getList();
  156. },
  157. async getList() {
  158. try {
  159. const res = await getHasFreeCourseList({
  160. ...this.searchForm,
  161. rows: this.rules.limit,
  162. page: this.rules.page,
  163. });
  164. this.rules.total = res.data.total;
  165. this.tableList = res.data.rows;
  166. } catch (e) {
  167. console.log(e);
  168. }
  169. },
  170. search() {
  171. this.rules.page = 1;
  172. this.getList();
  173. },
  174. onReSet() {
  175. this.searchForm={
  176. search: null,
  177. organId: null,
  178. }
  179. this.search()
  180. },
  181. },
  182. };
  183. </script>
  184. <style lang='scss' scoped>
  185. </style>