index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="app-container">
  3. <form-search :searchformShow="searchFormShow" :validateRules="rules" @handleQuery="handleQuery" ref="formSearch">
  4. </form-search>
  5. <mx-table v-loading="loading" :rows="dataList" :propDefines="propDefines">
  6. <template #template-index={$index}>
  7. <span>{{(queryParams.pageNum-1)*queryParams.pageSize+$index+1}}</span>
  8. </template>
  9. <template #template-ranking-adjustment="{value}">
  10. <ranking-adjust :value="value"></ranking-adjust>
  11. </template>
  12. <template #template-action-detail="{row}">
  13. <el-button type="text" icon="el-icon-view" @click="detail(row)">查看详情</el-button>
  14. </template>
  15. </mx-table>
  16. <pagination v-show="false" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" :page-size="50" @pagination="getList" />
  17. </div>
  18. </template>
  19. <script>
  20. import {
  21. getStudentHistory,
  22. getClassHistory
  23. } from "@/api/webApi/front";
  24. import RankingAdjust from "@/components/RankingAdjust";
  25. import {
  26. mapGetters
  27. } from "vuex";
  28. export default {
  29. components: {
  30. RankingAdjust
  31. },
  32. data() {
  33. return {
  34. total: 0,
  35. // 遮罩层
  36. loading: false,
  37. searchFormShow: {},
  38. rules: {},
  39. // 查询参数
  40. queryParams: {
  41. pageNum: 1,
  42. pageSize: 50,
  43. catalogId: "1",
  44. classId: "",
  45. customerCode: "",
  46. gradeId: "",
  47. subjectId: "",
  48. termId: "",
  49. typeId: "",
  50. },
  51. dataList: [],
  52. propDefines: {}
  53. };
  54. },
  55. computed: {
  56. isSimulateTeacher: function () {
  57. this.queryParams.classId = this.$route.query.classId
  58. return this.$route.query.isSimulateTeacher
  59. },
  60. isGradeMode: function () {
  61. return this.isFrontMaster && this.$route.name.includes('/grade-')
  62. },
  63. ...mapGetters(["isFrontStudent", "isFrontMaster"]),
  64. },
  65. created() {
  66. // 2021.7.20 hht 按需求删除searchFormShow.exam
  67. const prefix = this.isGradeMode ? { studentGradeId: '' }
  68. : !this.isFrontStudent && !this.isSimulateTeacher ? { class: "", clbum: "" } : {}
  69. this.searchFormShow = {
  70. ...prefix,
  71. userSubject: "",
  72. gradeid: "",
  73. semester: ""
  74. };
  75. // reset rules
  76. this.rules = {}
  77. const excludeKeys = ['class']
  78. Object.keys(this.searchFormShow).forEach(key => {
  79. if (!excludeKeys.includes(key))
  80. this.rules[key] = [{
  81. required: true,
  82. message: " ",
  83. trigger: "blur"
  84. }]
  85. })
  86. this.propDefines = this.isFrontStudent ? {
  87. index: {
  88. label: "序号",
  89. slot: "template-index"
  90. },
  91. evaluationName: {
  92. label: "考试名称"
  93. },
  94. gradeScoreRate: {
  95. label: "年级平均得分率"
  96. },
  97. classScoreRate: {
  98. label: "班级平均得分率"
  99. },
  100. scoreRate: {
  101. label: "个人得分率"
  102. },
  103. gradeRanking: {
  104. label: "年级排名"
  105. },
  106. ranking: {
  107. label: "班级排名"
  108. },
  109. rankingAdjust: {
  110. label: "浮动情况",
  111. slot: "template-ranking-adjustment"
  112. },
  113. actions: {
  114. label: "操作",
  115. slot: "template-action-detail"
  116. }
  117. } : {
  118. index: {
  119. label: "序号",
  120. slot: "template-index"
  121. },
  122. evaluationName: {
  123. label: "考试名称"
  124. },
  125. gradeScoreRate: {
  126. label: "年级平均得分率"
  127. },
  128. classScoreRate: {
  129. label: "班级平均得分率"
  130. },
  131. belowRate: {
  132. label: "低分率"
  133. },
  134. passRate: {
  135. label: "合格率"
  136. },
  137. aboveRate: {
  138. label: "优秀率"
  139. },
  140. gradeRanking: {
  141. label: "年级排名",
  142. },
  143. rankingAdjust: {
  144. label: "浮动情况",
  145. slot: "template-ranking-adjustment"
  146. },
  147. actions: {
  148. label: "操作",
  149. slot: "template-action-detail"
  150. }
  151. }
  152. this.$nextTick(() => {
  153. this.$refs.formSearch.validate((valid) => {
  154. if (valid) this.handleQuery();
  155. });
  156. });
  157. },
  158. methods: {
  159. detail(nextItem) {
  160. if (this.isGradeMode) {
  161. const transferParams = {
  162. catalogId: this.queryParams.catalogId,
  163. evaluationId: nextItem.evaluationId,
  164. evaluationName: nextItem.evaluationName,
  165. };
  166. this.$router.push({
  167. path: "/idc/reviewHistory/classList",
  168. query: transferParams,
  169. });
  170. return
  171. }
  172. const nextParams = {
  173. evaluationId: nextItem.evaluationId,
  174. evaluationClassId: nextItem.evaluationClassId,
  175. evaluationName: nextItem.evaluationName,
  176. };
  177. this.$router.push({
  178. path: "/idc/reviewHistory/userList",
  179. query: nextParams,
  180. });
  181. },
  182. // 选择图标
  183. selected(name) {
  184. this.form.icon = name;
  185. },
  186. /** 查询菜单列表 */
  187. getList() {
  188. this.loading = true;
  189. var method = this.isFrontStudent ? getStudentHistory : getClassHistory;
  190. var methodName = this.isFrontStudent ?
  191. "getStudentHistory" :
  192. "getClassHistory";
  193. method(this.queryParams).then((rep) => {
  194. console.log(methodName + " rep=", rep);
  195. if (rep.code == 200 || rep.code == 0) {
  196. this.dataList = rep.rows || rep.data;
  197. this.total = rep.total || 0;
  198. } else {
  199. this.msgError(rep.msg || methodName + "请求异常");
  200. }
  201. this.loading = false;
  202. });
  203. },
  204. // 表单重置
  205. reset() {
  206. this.form = {};
  207. this.resetForm("form");
  208. },
  209. /** 搜索按钮操作 */
  210. handleQuery(ctrlParams = {}) {
  211. this.queryParams.pageNum = 1;
  212. this.queryParams.isSimulateTeacher = this.isSimulateTeacher;
  213. this.queryParams.studentGradeId = ctrlParams.studentGradeId;
  214. this.queryParams.termId = ctrlParams.semester || this.searchFormShow.semester || "";
  215. this.queryParams.typeId = ctrlParams.exam || this.searchFormShow.exam || "";
  216. this.queryParams.gradeId = ctrlParams.gradeid || this.searchFormShow.gradeid || "";
  217. this.queryParams.subjectId = ctrlParams.userSubject || this.searchFormShow.userSubject || "";
  218. this.queryParams.classId = this.queryParams.classId || ctrlParams.clbum || this.searchFormShow.clbum || "";
  219. this.getList();
  220. },
  221. handleSizeChange(val) {
  222. console.log(`每页 ${val} 条`);
  223. },
  224. handleCurrentChange(val) {
  225. console.log(`当前页: ${val}`);
  226. },
  227. /** 重置按钮操作 */
  228. resetQuery() {
  229. this.resetForm("queryForm");
  230. this.handleQuery();
  231. },
  232. },
  233. };
  234. </script>