scoreStatistics.vue 13 KB

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