works.vue 5.4 KB

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