works.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="pb_content">
  3. <div class="pb_head">
  4. <span>评价管理</span>
  5. <!-- <span>备注:教师可以根据课程、班级条件筛选学生并查看该学生信息</span> -->
  6. </div>
  7. <div class="pb_content_body">
  8. <div class="student_head">
  9. <div class="student_search">
  10. <div>项目筛选</div>
  11. <el-select v-model="groupA" @change="search">
  12. <el-option value="0" label="我的课程"></el-option>
  13. <el-option value="1" label="他人课程"></el-option>
  14. </el-select>
  15. <el-input
  16. v-model="cn"
  17. placeholder="筛选项目名称"
  18. @input="search"
  19. ></el-input>
  20. </div>
  21. </div>
  22. <div class="student_table">
  23. <el-table
  24. ref="table"
  25. :data="tableData1"
  26. border
  27. :height="tableHeight"
  28. :fit="true"
  29. v-loading="isLoading"
  30. style="width: 100%"
  31. :header-cell-style="{ background: '#f1f1f1' }"
  32. :row-class-name="tableRowClassName"
  33. stripe
  34. >
  35. <el-table-column
  36. prop="title"
  37. label="项目"
  38. min-width="30"
  39. align="center"
  40. ></el-table-column>
  41. <el-table-column
  42. prop="uname"
  43. label="创建人"
  44. min-width="30"
  45. align="center"
  46. ></el-table-column>
  47. <el-table-column
  48. prop="time"
  49. label="时间"
  50. min-width="20"
  51. align="center"
  52. ></el-table-column>
  53. <el-table-column label="操作" min-width="30">
  54. <template slot-scope="scope">
  55. <el-button
  56. type="primary"
  57. size="small"
  58. @click="goTo('/worksDetail?cid=' + scope.row.courseId)"
  59. >查看学生</el-button
  60. >
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. </div>
  65. <div class="student_page">
  66. <el-pagination
  67. background
  68. layout="prev, pager, next"
  69. :page-size="10"
  70. :total="total"
  71. v-if="!isLoading && page"
  72. @current-change="handleCurrentChange"
  73. >
  74. </el-pagination>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. export default {
  81. data() {
  82. return {
  83. tableHeight: "500px",
  84. isLoading: false,
  85. formLabelWidth: "100px",
  86. tableData1: [],
  87. subject: "",
  88. sClass: "",
  89. subjectJuri: [],
  90. projectJuri: [],
  91. grade: [],
  92. projectchoose: "",
  93. page: 1,
  94. total: 0,
  95. groupA: "0",
  96. cn: "",
  97. };
  98. },
  99. mounted() {
  100. this.$nextTick(function () {
  101. this.tableHeight =
  102. window.innerHeight - this.$refs.table.$el.offsetTop - 200;
  103. if (this.tableHeight <= 530) {
  104. this.tableHeight = 530;
  105. }
  106. // 监听窗口大小变化
  107. let self = this;
  108. window.onresize = function () {
  109. self.tableHeight =
  110. window.innerHeight - self.$refs.table.$el.offsetTop - 200;
  111. if (self.tableHeight <= 530) {
  112. self.tableHeight = 530;
  113. }
  114. };
  115. });
  116. },
  117. methods: {
  118. goTo(path) {
  119. this.$router.push(path);
  120. },
  121. tableRowClassName({ row, rowIndex }) {
  122. if ((rowIndex + 1) % 2 === 0) {
  123. return "even_row";
  124. } else {
  125. return "";
  126. }
  127. },
  128. handleClose(done) {
  129. done();
  130. },
  131. tableRowClassName({ row, rowIndex }) {
  132. if ((rowIndex + 1) % 2 === 0) {
  133. return "even_row";
  134. } else {
  135. return "";
  136. }
  137. },
  138. handleCurrentChange(val) {
  139. this.page = val;
  140. },
  141. //获取班级列表
  142. getClass() {
  143. this.isLoading = true;
  144. let params = {
  145. cu: "",
  146. cn: this.sClass,
  147. page: this.page,
  148. };
  149. this.ajax
  150. .get(this.$store.state.api + "selectClass", params)
  151. .then((res) => {
  152. this.isLoading = false;
  153. this.grade = res.data[0];
  154. })
  155. .catch((err) => {
  156. this.isLoading = false;
  157. console.error(err);
  158. });
  159. },
  160. getProject() {
  161. this.isLoading = true;
  162. let params = {
  163. type: this.groupA,
  164. uid: this.$store.state.userInfo.userid,
  165. oid: this.$store.state.userInfo.organizeid,
  166. cn: this.cn,
  167. page: this.page,
  168. };
  169. this.ajax
  170. .get(this.$store.state.api + "getProject", params)
  171. .then((res) => {
  172. this.isLoading = false;
  173. this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
  174. this.tableData1 = res.data[0];
  175. })
  176. .catch((err) => {
  177. this.isLoading = false;
  178. console.error(err);
  179. });
  180. },
  181. search() {
  182. this.page = 1;
  183. this.getProject();
  184. },
  185. },
  186. created() {
  187. this.page = 1;
  188. // this.getClass();
  189. // this.getGroup();
  190. this.getProject();
  191. },
  192. };
  193. </script>
  194. <style scoped>
  195. .pb_head > span:nth-child(2) {
  196. font-size: 16px;
  197. margin-left: 80px;
  198. color: #ab582f;
  199. }
  200. .student_head {
  201. margin-bottom: 20px;
  202. }
  203. .student_search {
  204. display: flex;
  205. }
  206. .student_search > div:nth-child(1) {
  207. line-height: 35px;
  208. font-size: 14px;
  209. min-width: 60px;
  210. }
  211. .student_search >>> .el-input__inner {
  212. width: 190px;
  213. height: 35px;
  214. margin-left: 10px;
  215. }
  216. .student_table >>> .el-table--border td {
  217. border-right: 0px !important;
  218. }
  219. .student_page {
  220. margin-top: 10px;
  221. }
  222. </style>