Marker.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <div>
  3. <section class="content">
  4. <div class="box box-info">
  5. <div class="box-body">
  6. <el-form
  7. :inline="true"
  8. :model="formSearch"
  9. label-position="right"
  10. label-width="70px"
  11. >
  12. <el-form-item label="评卷名称" class="pull-left">
  13. <el-select
  14. clearable
  15. filterable
  16. class="input"
  17. v-model="formSearch.markId"
  18. placeholder="请选择"
  19. >
  20. <el-option value>请选择</el-option>
  21. <el-option
  22. v-for="item in markWorkSelect"
  23. :label="item.markName"
  24. :value="item.markId"
  25. :key="item.markId"
  26. ></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="登录名" class="pull-left">
  30. <el-input
  31. placeholder="登录名"
  32. v-model="formSearch.userLoginName"
  33. ></el-input>
  34. </el-form-item>
  35. <el-form-item label="姓名" class="pull-left">
  36. <el-input
  37. placeholder="姓名"
  38. v-model="formSearch.userName"
  39. ></el-input>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button
  43. size="small"
  44. type="primary"
  45. icon="el-icon-search"
  46. @click="searchSetting"
  47. >查询</el-button
  48. >
  49. </el-form-item>
  50. </el-form>
  51. <div class="block-seperator"></div>
  52. <!-- 页面列表 -->
  53. <el-table
  54. stripe
  55. v-loading="loading"
  56. element-loading-text="拼命加载中"
  57. :data="tableData"
  58. border
  59. style="width: 100%"
  60. >
  61. <el-table-column label="姓名" width="200" prop="userName" />
  62. <el-table-column
  63. label="登录名"
  64. min-width="100"
  65. prop="userLoginName"
  66. />
  67. <el-table-column
  68. label="分配课程"
  69. min-width="200"
  70. prop="courseCount"
  71. sortable
  72. />
  73. <el-table-column
  74. label="完成课程"
  75. min-width="120"
  76. prop="finishedCount"
  77. sortable
  78. />
  79. <el-table-column
  80. label="完成数量"
  81. min-width="120"
  82. prop="markedCount"
  83. sortable
  84. />
  85. <el-table-column
  86. label="最低分"
  87. min-width="100"
  88. prop="minScore"
  89. sortable
  90. />
  91. <el-table-column
  92. label="最高分"
  93. min-width="100"
  94. prop="maxScore"
  95. sortable
  96. />
  97. <el-table-column
  98. label="平均分"
  99. min-width="100"
  100. prop="avgScore"
  101. sortable
  102. />
  103. <el-table-column
  104. label="标准方差"
  105. min-width="120"
  106. prop="stdDev"
  107. sortable
  108. />
  109. <el-table-column :context="_self" label="操作" fixed="right">
  110. <template slot-scope="scope">
  111. <el-button
  112. @click="markerDetail(scope.row)"
  113. type="primary"
  114. size="mini"
  115. plain
  116. >详情</el-button
  117. >
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <div class="page pull-right">
  122. <el-pagination
  123. background
  124. @current-change="handleSettingCurrentChange"
  125. @size-change="handleSizeChange"
  126. :current-page="currentPage"
  127. :page-size="pageSize"
  128. :page-sizes="[10, 20, 50, 100]"
  129. layout="total, sizes, prev, pager, next, jumper"
  130. :total="total"
  131. ></el-pagination>
  132. </div>
  133. </div>
  134. </div>
  135. </section>
  136. </div>
  137. </template>
  138. <script>
  139. import { DATA_PROCESS_API } from "@/constants/constants";
  140. import { mapState } from "vuex";
  141. export default {
  142. data() {
  143. return {
  144. formSearch: {
  145. userLoginName: "",
  146. userName: ""
  147. },
  148. tableData: [],
  149. oldData: [],
  150. currentPage: 1,
  151. pageSize: 10,
  152. total: 10,
  153. loading: false,
  154. workId: "",
  155. examId: "",
  156. markWorkName: "",
  157. markWorkList: []
  158. };
  159. },
  160. methods: {
  161. handleSettingCurrentChange(val) {
  162. this.currentPage = val;
  163. this.searchSetting();
  164. },
  165. handleSizeChange(val) {
  166. this.pageSize = val;
  167. this.searchSetting();
  168. },
  169. pagingSetting() {
  170. var start = (this.currentPage - 1) * this.pageSize;
  171. var end =
  172. this.currentPage * this.pageSize < this.total
  173. ? this.currentPage * this.pageSize
  174. : this.total;
  175. var tempData = [];
  176. console.log(`当前页: ${this.currentPage},开始:${start},结束:${end}`);
  177. for (let i = start; i < end; i++) {
  178. tempData.push(this.tableData[i]);
  179. }
  180. this.tableData = tempData;
  181. },
  182. searchSetting() {
  183. if (!this.formSearch.markId) {
  184. this.$notify({
  185. title: "警告",
  186. message: "请选择评卷名称",
  187. type: "warning",
  188. duration: 1000
  189. });
  190. return false;
  191. }
  192. let obj = {};
  193. for (let item of this.markWorkList) {
  194. if (item.id === this.formSearch.markId) {
  195. obj = item;
  196. break;
  197. }
  198. }
  199. this.examId = obj.examId;
  200. this.markWorkName = obj.name;
  201. this.workId = this.formSearch.markId;
  202. this.loading = true;
  203. this.$http
  204. .get(
  205. DATA_PROCESS_API +
  206. "/markers/all/" +
  207. (this.currentPage - 1) +
  208. "/" +
  209. this.pageSize +
  210. "?workId=" +
  211. this.workId,
  212. { params: this.formSearch }
  213. )
  214. .then(response => {
  215. console.log(response);
  216. this.tableData = response.data.content;
  217. this.total = response.data.totalElements;
  218. this.loading = false;
  219. this.$router.push({
  220. path:
  221. "/marking/marker?" +
  222. new URLSearchParams(JSON.parse(JSON.stringify(this.formSearch)))
  223. });
  224. });
  225. },
  226. markerDetail(row) {
  227. var url =
  228. "/marking/marker_detail/" +
  229. this.workId +
  230. "/" +
  231. this.examId +
  232. "/" +
  233. this.markWorkName +
  234. "/" +
  235. row.userId +
  236. "/" +
  237. row.userName;
  238. this.$router.push({
  239. path: url
  240. });
  241. },
  242. //获取创建成功的markWork列表
  243. getMarkWorks() {
  244. this.$http.get(DATA_PROCESS_API + "/markWorks?status=1").then(response => {
  245. this.markWorkList = response.data;
  246. });
  247. },
  248. backFill() {
  249. var formData = this.$route.query;
  250. if (formData && formData.markId) {
  251. for (var attr in formData) {
  252. var value = formData[attr];
  253. if (value && value != "null") {
  254. if (!isNaN(value)) {
  255. if (~~value == value) {
  256. value = parseInt(value);
  257. } else {
  258. value = parseFloat(value);
  259. }
  260. }
  261. this.formSearch[attr] = value;
  262. }
  263. }
  264. this.searchSetting();
  265. }
  266. }
  267. },
  268. computed: {
  269. ...mapState({ user: state => state.user }),
  270. markWorkSelect() {
  271. let markWorkNames = [];
  272. for (let markWork of this.markWorkList) {
  273. markWorkNames.push({
  274. markId: markWork.id,
  275. markName: markWork.name,
  276. examId: markWork.examId
  277. });
  278. }
  279. return markWorkNames;
  280. }
  281. },
  282. created() {
  283. this.getMarkWorks();
  284. this.backFill();
  285. }
  286. };
  287. </script>
  288. <style lang="css" scoped>
  289. li {
  290. list-style-type: none;
  291. }
  292. .searchFrame {
  293. margin-right: 10px;
  294. margin-bottom: 10px;
  295. }
  296. .page{
  297. margin-top: 10px;
  298. }
  299. .f_button{
  300. display:block;
  301. width:57px;
  302. height:20px;
  303. border:1px solid #CCC;
  304. background:#FFF;
  305. font-size: small;
  306. }
  307. </style>