SelectSimpleCourse.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div class="select-class-student">
  3. <el-form ref="FilterForm" label-position="left" inline label-width="0px">
  4. <el-form-item>
  5. <org-select
  6. v-model="filter.belongOrgId"
  7. placeholder="开课部门"
  8. ></org-select>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-button type="primary" :disabled="!canSearch" @click="toPage(1)"
  12. >查询</el-button
  13. >
  14. </el-form-item>
  15. </el-form>
  16. <div class="box-justify mb-2">
  17. <p>
  18. 全部共<span class="mlr-1">{{ dataList.length }}</span
  19. >人
  20. </p>
  21. <p>
  22. 已选<span class="mlr-1">{{ multipleSelection.length }}</span
  23. >人
  24. </p>
  25. </div>
  26. <el-table
  27. ref="TableList"
  28. :data="dataList"
  29. border
  30. max-height="440px"
  31. @selection-change="handleSelectionChange"
  32. >
  33. <el-table-column
  34. type="selection"
  35. width="55"
  36. align="center"
  37. ></el-table-column>
  38. <el-table-column
  39. type="index"
  40. label="序号"
  41. width="70"
  42. :index="indexMethod"
  43. ></el-table-column>
  44. <el-table-column
  45. prop="courseName"
  46. label="课程名称"
  47. min-width="120"
  48. ></el-table-column>
  49. <el-table-column
  50. prop="courseCode"
  51. label="课程编码"
  52. min-width="120"
  53. ></el-table-column>
  54. <el-table-column
  55. prop="teachingRoomName"
  56. label="开课部门"
  57. min-width="120"
  58. ></el-table-column>
  59. </el-table>
  60. </div>
  61. </template>
  62. <script>
  63. import { courseListPage } from "../../api";
  64. export default {
  65. name: "select-simple-course",
  66. props: {
  67. value: {
  68. type: Array,
  69. default() {
  70. return [];
  71. }
  72. }
  73. },
  74. data() {
  75. return {
  76. filter: {
  77. belongOrgId: "",
  78. enable: true,
  79. pageNumber: 1,
  80. pageSize: 1000
  81. },
  82. dataList: [],
  83. multipleSelection: []
  84. };
  85. },
  86. computed: {
  87. canSearch() {
  88. return this.filter.belongOrgId;
  89. }
  90. },
  91. methods: {
  92. async getList() {
  93. const datas = {
  94. ...this.filter
  95. };
  96. const data = await courseListPage(datas);
  97. this.dataList = data.records || [];
  98. },
  99. toPage(page) {
  100. if (!this.canSearch) return;
  101. this.current = page;
  102. this.getList();
  103. this.multipleSelection = [];
  104. this.emitChange();
  105. },
  106. handleSelectionChange(val) {
  107. this.multipleSelection = val.map(item => item.id);
  108. this.emitChange();
  109. },
  110. emitChange() {
  111. this.$emit("input", this.multipleSelection);
  112. this.$emit("change", this.multipleSelection);
  113. },
  114. clearSelection() {
  115. this.$refs.TableList.clearSelection();
  116. }
  117. }
  118. };
  119. </script>