scoreStatistics.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <el-container>
  3. <el-main class="el-main-padding">
  4. <commonFormVue :form="form" :get-exam-condition="getExamCondition">
  5. <el-col :span="6">
  6. <el-form-item label="是否缺考">
  7. <el-select
  8. v-model="form.finished"
  9. class="form_search_width"
  10. size="small"
  11. clearable
  12. placeholder="全部"
  13. >
  14. <el-option value="false" label="是"></el-option>
  15. <el-option value="true" label="否"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. </el-col>
  19. </commonFormVue>
  20. <el-row>
  21. <el-col :span="24">
  22. <el-button
  23. size="small"
  24. type="primary"
  25. icon="el-icon-search"
  26. @click="search('clickSelectBtn')"
  27. >查询</el-button
  28. >
  29. <el-button size="small" icon="el-icon-refresh" @click="resetForm"
  30. >重置</el-button
  31. >
  32. </el-col>
  33. </el-row>
  34. <el-row>
  35. <el-col v-show="currentPagePrivileges.SCORE_STATICS_EXPORT" :span="24">
  36. <div class="block-seperator"></div>
  37. <span>操作:</span>
  38. <el-button
  39. v-show="!exportLoading"
  40. type="primary"
  41. size="small"
  42. icon="el-icon-download"
  43. @click="openExportDialog"
  44. >导出</el-button
  45. >
  46. <el-button
  47. v-show="exportLoading"
  48. size="small"
  49. icon="el-icon-download"
  50. :loading="true"
  51. >导出数据中...</el-button
  52. >
  53. </el-col>
  54. </el-row>
  55. <el-row class="margin-top-10">
  56. <el-col :span="24">
  57. <el-table
  58. ref="multipleTable"
  59. v-loading="tableLoading"
  60. element-loading-text="数据加载中"
  61. :data="tableData"
  62. border
  63. @selection-change="handleSelectionChange"
  64. >
  65. <el-table-column
  66. sortable
  67. label="学习中心"
  68. prop="orgName"
  69. width="120"
  70. ></el-table-column>
  71. <el-table-column label="场次" width="120">
  72. <template slot-scope="scope">
  73. <el-popover trigger="hover" placement="left">
  74. <div style="font-size: 18px; font-family: 新宋体">
  75. <tr>
  76. <td style="color: green">场次序号</td>
  77. <td style="color: purple; padding-left: 20px">
  78. {{ scope.row.examStageOrder }}
  79. </td>
  80. </tr>
  81. <tr>
  82. <td style="color: green">开始时间</td>
  83. <td style="color: purple; padding-left: 20px">
  84. {{ scope.row.stageStartTime }}
  85. </td>
  86. </tr>
  87. <tr>
  88. <td style="color: green">结束时间</td>
  89. <td style="color: purple; padding-left: 20px">
  90. {{ scope.row.stageEndTime }}
  91. </td>
  92. </tr>
  93. </div>
  94. <div slot="reference" class="name-wrapper">
  95. <span>{{ scope.row.examStageOrder }}</span>
  96. </div>
  97. </el-popover>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. sortable
  102. label="姓名"
  103. prop="studentName"
  104. width="120"
  105. ></el-table-column>
  106. <el-table-column
  107. sortable
  108. label="身份证号"
  109. prop="identityNumber"
  110. width="120"
  111. ></el-table-column>
  112. <el-table-column
  113. sortable
  114. label="学号"
  115. prop="studentCode"
  116. width="120"
  117. ></el-table-column>
  118. <el-table-column
  119. sortable
  120. label="课程"
  121. prop="courseNameAndCode"
  122. width="120"
  123. ></el-table-column>
  124. <el-table-column
  125. sortable
  126. label="课程层次"
  127. prop="courseLevel"
  128. width="120"
  129. ></el-table-column>
  130. <el-table-column
  131. sortable
  132. label="客观分"
  133. prop="objectiveScore"
  134. width="120"
  135. ></el-table-column>
  136. <el-table-column
  137. sortable
  138. label="主观分"
  139. prop="subjectiveScore"
  140. width="120"
  141. ></el-table-column>
  142. <el-table-column
  143. sortable
  144. label="最终成绩"
  145. prop="finalExamScore"
  146. width="120"
  147. ></el-table-column>
  148. <el-table-column
  149. sortable
  150. :sort-method="sortByDisciplineCount"
  151. label="违纪次数"
  152. prop="disciplineCount"
  153. width="120"
  154. ></el-table-column>
  155. <el-table-column
  156. sortable
  157. :sort-method="sortBySubmitCount"
  158. label="正常交卷次数"
  159. prop="submitCount"
  160. width="150"
  161. ></el-table-column>
  162. <el-table-column
  163. sortable
  164. label="剩余考试次数"
  165. prop="leftExamTimes"
  166. width="150"
  167. ></el-table-column>
  168. <el-table-column
  169. sortable
  170. label="是否缺考"
  171. prop="isAbsent"
  172. width="120"
  173. ></el-table-column>
  174. <el-table-column
  175. sortable
  176. label="年级"
  177. prop="grade"
  178. width="120"
  179. ></el-table-column>
  180. <el-table-column
  181. sortable
  182. label="采集人"
  183. prop="infoCollector"
  184. width="120"
  185. ></el-table-column>
  186. <el-table-column
  187. sortable
  188. label="专业"
  189. prop="specialtyName"
  190. width="120"
  191. ></el-table-column>
  192. <el-table-column
  193. sortable
  194. label="成绩统计时间"
  195. prop="startTime"
  196. width="155"
  197. ></el-table-column>
  198. </el-table>
  199. <div class="block pull-right">
  200. <el-pagination
  201. :current-page.sync="form.pageNo"
  202. :page-sizes="[10, 20, 50, 100, 200, 300]"
  203. :page-size="form.pageSize"
  204. layout="total, sizes, prev, pager, next, jumper"
  205. :total="total"
  206. @size-change="handleSizeChange"
  207. @current-change="handleCurrentChange"
  208. ></el-pagination>
  209. </div>
  210. </el-col>
  211. </el-row>
  212. <el-dialog title="导出方式选择" :visible.sync="dialogExportTypeVisible">
  213. <el-row>
  214. <el-col :span="24">
  215. <el-radio v-model="exportType" label="ALL">全部导出</el-radio>
  216. <el-radio v-model="exportType" label="BATCH">分批导出</el-radio>
  217. </el-col>
  218. </el-row>
  219. <el-row v-show="exportType == 'BATCH'" class="margin-top-10">
  220. <el-col :span="4">导出区间</el-col>
  221. <el-col :span="9">
  222. <el-input
  223. v-model="form.startLimit"
  224. size="small"
  225. placeholder="下限"
  226. ></el-input>
  227. </el-col>
  228. <el-col :span="2" style="text-align: center; color: #c0c4cc"
  229. >——</el-col
  230. >
  231. <el-col :span="9">
  232. <el-input
  233. v-model="form.endLimit"
  234. size="small"
  235. placeholder="上限"
  236. ></el-input>
  237. </el-col>
  238. </el-row>
  239. <el-row class="margin-top-20">
  240. <el-col :span="24">
  241. <el-button type="primary" plain @click="exportData">确定</el-button>
  242. <el-button plain @click="dialogExportTypeVisible = false"
  243. >取消</el-button
  244. >
  245. </el-col>
  246. </el-row>
  247. </el-dialog>
  248. </el-main>
  249. </el-container>
  250. </template>
  251. <script>
  252. import { mapState } from "vuex";
  253. import commonFormVue from "../component/commonForm.vue";
  254. import pagePrivilege from "../mixin/pagePrivilege.js";
  255. export default {
  256. components: { commonFormVue },
  257. mixins: [pagePrivilege],
  258. data() {
  259. return {
  260. total: 0,
  261. tableLoading: false,
  262. dialogExportTypeVisible: false,
  263. exportLoading: false,
  264. form: {
  265. rootOrgId: null,
  266. examRecordDataId: null,
  267. hasStranger: null,
  268. courseId: null,
  269. courseLevel: null,
  270. examId: null,
  271. faceSuccessPercentLower: null,
  272. faceSuccessPercentUpper: null,
  273. livenessSuccessPercentLower: null,
  274. livenessSuccessPercentUpper: null,
  275. identityNumber: null,
  276. orgId: null,
  277. studentCode: null,
  278. studentName: null,
  279. isWarn: null,
  280. pageNo: 1,
  281. pageSize: 10,
  282. finished: "",
  283. startLimit: "",
  284. endLimit: "",
  285. ORG_FIND_ALL: false, //查询所有机构
  286. examStageId: null,
  287. creator: null,
  288. },
  289. getExamCondition: {
  290. params: {
  291. name: "",
  292. examTypes: "ONLINE#OFFLINE#ONLINE_HOMEWORK",
  293. },
  294. filterCondition: "",
  295. },
  296. tableData: [],
  297. exportUrl: "/api/ecs_oe_admin/exam/score/statistic/list/export/async",
  298. exportFileName: "成绩统计",
  299. currentPagePrivileges: {
  300. SCORE_STATICS_EXPORT: false, //导出
  301. },
  302. exportType: "ALL",
  303. };
  304. },
  305. computed: {
  306. ...mapState({ user: (state) => state.user }),
  307. },
  308. created() {
  309. this.form.creator = this.user.userId;
  310. },
  311. methods: {
  312. resetForm() {
  313. this.form = {
  314. examRecordDataId: null,
  315. hasStranger: null,
  316. courseId: null,
  317. courseLevel: null,
  318. examId: null,
  319. faceSuccessPercentLower: null,
  320. faceSuccessPercentUpper: null,
  321. livenessSuccessPercentLower: null,
  322. livenessSuccessPercentUpper: null,
  323. identityNumber: null,
  324. orgId: this.form.ORG_FIND_ALL ? null : this.form.orgId,
  325. studentCode: null,
  326. studentName: null,
  327. isWarn: null,
  328. pageNo: 1,
  329. pageSize: 10,
  330. finished: "",
  331. startLimit: "",
  332. endLimit: "",
  333. ORG_FIND_ALL: this.form.ORG_FIND_ALL,
  334. examStageId: null,
  335. };
  336. },
  337. search(type) {
  338. if (!this.form.examId) {
  339. this.$notify({
  340. title: "警告",
  341. message: "请选择考试",
  342. type: "warning",
  343. duration: 1000,
  344. });
  345. return false;
  346. }
  347. if (type && type == "clickSelectBtn") {
  348. this.form.pageNo = 1;
  349. }
  350. this.tableLoading = true;
  351. this.$http
  352. .post("/api/ecs_oe_admin/exam/score/statistic/list", this.form)
  353. .then((response) => {
  354. if (response.data) {
  355. this.tableData = response.data.content;
  356. this.total = response.data.totalElements;
  357. } else {
  358. this.tableData = [];
  359. }
  360. this.tableLoading = false;
  361. });
  362. },
  363. handleSelectionChange(val) {
  364. this.multipleSelection = val;
  365. },
  366. /**
  367. * pagesize改变时触发
  368. */
  369. handleSizeChange(val) {
  370. this.form.pageSize = val;
  371. this.search();
  372. },
  373. /**
  374. * 当前页改变时触发
  375. */
  376. handleCurrentChange() {
  377. this.search();
  378. },
  379. openExportDialog() {
  380. if (!this.form.examId) {
  381. this.$notify({
  382. title: "警告",
  383. message: "请选择考试",
  384. type: "warning",
  385. duration: 1000,
  386. });
  387. return false;
  388. }
  389. this.dialogExportTypeVisible = true;
  390. this.exportType = "ALL";
  391. this.form.startLimit = "";
  392. this.form.endLimit = "";
  393. },
  394. exportData() {
  395. this.$http
  396. .post("/api/ecs_oe_admin/exam/record/detail/check", this.form)
  397. .then((response) => {
  398. if (response.data > 0) {
  399. this.$confirm("成绩统计存在待审数据,是否继续导出?", "提示", {
  400. confirmButtonText: "确定",
  401. cancelButtonText: "取消",
  402. type: "warning",
  403. }).then(() => {
  404. this.dialogExportTypeVisible = false;
  405. // this._exportData();
  406. this.asyncExportData();
  407. });
  408. } else {
  409. this.dialogExportTypeVisible = false;
  410. // this._exportData();
  411. this.asyncExportData();
  412. }
  413. });
  414. },
  415. asyncExportData() {
  416. this.form.rootOrgId = this.user.rootOrgId;
  417. this.form.creator = this.user.userId;
  418. this.$http
  419. .get(
  420. this.exportUrl +
  421. "?$key=" +
  422. this.user.key +
  423. "&$token=" +
  424. this.user.token,
  425. {
  426. params: {
  427. query: this.form,
  428. },
  429. }
  430. )
  431. .then(() => {
  432. this.$notify({
  433. type: "success",
  434. message: "正在后台导出中,请稍后到“导出任务列表”中下载!",
  435. });
  436. })
  437. .catch((error) => {
  438. this.$notify({
  439. type: "error",
  440. message: error.response.data.desc,
  441. });
  442. });
  443. },
  444. _exportData() {
  445. this.exportLoading = true;
  446. this.form.creator = this.user.userId;
  447. this.$http
  448. .get(this.exportUrl, {
  449. params: {
  450. query: this.form,
  451. },
  452. responseType: "arraybuffer",
  453. timeout: 20 * 60 * 1000, //限时20分钟
  454. })
  455. .then((response) => {
  456. if (response.data) {
  457. var blob = new Blob([response.data], {
  458. type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  459. });
  460. var url = URL.createObjectURL(blob);
  461. var a = document.createElement("a");
  462. a.href = url;
  463. a.download = this.exportFileName + ".xlsx";
  464. a.target = "_blank";
  465. a.click();
  466. URL.revokeObjectURL(url);
  467. }
  468. this.exportLoading = false;
  469. });
  470. },
  471. sortByDisciplineCount(obj1, obj2) {
  472. let p1 = Number(obj1.disciplineCount);
  473. let p2 = Number(obj2.disciplineCount);
  474. if (isNaN(p1)) {
  475. p1 = 0;
  476. }
  477. if (isNaN(p2)) {
  478. p2 = 0;
  479. }
  480. return p1 - p2;
  481. },
  482. sortBySubmitCount(obj1, obj2) {
  483. let p1 = Number(obj1.submitCount);
  484. let p2 = Number(obj2.submitCount);
  485. if (isNaN(p1)) {
  486. p1 = 0;
  487. }
  488. if (isNaN(p2)) {
  489. p2 = 0;
  490. }
  491. return p1 - p2;
  492. },
  493. },
  494. };
  495. </script>
  496. <style scoped src="../style/common.css"></style>