scoreStatistics.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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. examStageId: null
  256. },
  257. getExamCondition: {
  258. params: {
  259. name: "",
  260. examTypes: "ONLINE#OFFLINE#ONLINE_HOMEWORK"
  261. },
  262. filterCondition: ""
  263. },
  264. tableData: [],
  265. exportUrl: "/api/ecs_oe_admin/exam/score/statistic/list/export/async",
  266. exportFileName: "成绩统计",
  267. currentPagePrivileges: {
  268. SCORE_STATICS_EXPORT: false //导出
  269. },
  270. exportType: "ALL"
  271. };
  272. },
  273. computed: {
  274. ...mapState({ user: state => state.user })
  275. },
  276. methods: {
  277. resetForm() {
  278. this.form = {
  279. examRecordDataId: null,
  280. hasStranger: null,
  281. courseId: null,
  282. courseLevel: null,
  283. examId: null,
  284. faceSuccessPercentLower: null,
  285. faceSuccessPercentUpper: null,
  286. livenessSuccessPercentLower: null,
  287. livenessSuccessPercentUpper: null,
  288. identityNumber: null,
  289. orgId: this.form.ORG_FIND_ALL ? null : this.form.orgId,
  290. studentCode: null,
  291. studentName: null,
  292. isWarn: null,
  293. pageNo: 1,
  294. pageSize: 10,
  295. finished: "",
  296. startLimit: "",
  297. endLimit: "",
  298. ORG_FIND_ALL: this.form.ORG_FIND_ALL,
  299. examStageId: null
  300. };
  301. },
  302. search(type) {
  303. if (!this.form.examId) {
  304. this.$notify({
  305. title: "警告",
  306. message: "请选择考试",
  307. type: "warning",
  308. duration: 1000
  309. });
  310. return false;
  311. }
  312. if (type && type == "clickSelectBtn") {
  313. this.form.pageNo = 1;
  314. }
  315. this.tableLoading = true;
  316. this.$http
  317. .post("/api/ecs_oe_admin/exam/score/statistic/list", this.form)
  318. .then(response => {
  319. if (response.data) {
  320. this.tableData = response.data.content;
  321. this.total = response.data.totalElements;
  322. } else {
  323. this.tableData = [];
  324. }
  325. this.tableLoading = false;
  326. });
  327. },
  328. handleSelectionChange(val) {
  329. this.multipleSelection = val;
  330. },
  331. /**
  332. * pagesize改变时触发
  333. */
  334. handleSizeChange(val) {
  335. this.form.pageSize = val;
  336. this.search();
  337. },
  338. /**
  339. * 当前页改变时触发
  340. */
  341. handleCurrentChange() {
  342. this.search();
  343. },
  344. openExportDialog() {
  345. if (!this.form.examId) {
  346. this.$notify({
  347. title: "警告",
  348. message: "请选择考试",
  349. type: "warning",
  350. duration: 1000
  351. });
  352. return false;
  353. }
  354. this.dialogExportTypeVisible = true;
  355. this.exportType = "ALL";
  356. this.form.startLimit = "";
  357. this.form.endLimit = "";
  358. },
  359. exportData() {
  360. this.$http
  361. .post("/api/ecs_oe_admin/exam/record/detail/check", this.form)
  362. .then(response => {
  363. if (response.data > 0) {
  364. this.$confirm("成绩统计存在待审数据,是否继续导出?", "提示", {
  365. confirmButtonText: "确定",
  366. cancelButtonText: "取消",
  367. type: "warning"
  368. }).then(() => {
  369. this.dialogExportTypeVisible = false;
  370. // this._exportData();
  371. this.asyncExportData();
  372. });
  373. } else {
  374. this.dialogExportTypeVisible = false;
  375. // this._exportData();
  376. this.asyncExportData();
  377. }
  378. });
  379. },
  380. asyncExportData() {
  381. this.form.rootOrgId = this.user.rootOrgId;
  382. this.$http
  383. .get(this.exportUrl, {
  384. params: {
  385. query: this.form
  386. }
  387. })
  388. .then(() => {
  389. this.$notify({
  390. type: "success",
  391. message: "正在后台导出中,请稍后到“导出任务列表”中下载!"
  392. });
  393. });
  394. },
  395. _exportData() {
  396. this.exportLoading = true;
  397. this.$http
  398. .get(this.exportUrl, {
  399. params: {
  400. query: this.form
  401. },
  402. responseType: "arraybuffer",
  403. timeout: 20 * 60 * 1000 //限时20分钟
  404. })
  405. .then(response => {
  406. if (response.data) {
  407. var blob = new Blob([response.data], {
  408. type:
  409. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  410. });
  411. var url = URL.createObjectURL(blob);
  412. var a = document.createElement("a");
  413. a.href = url;
  414. a.download = this.exportFileName + ".xlsx";
  415. a.target = "_blank";
  416. a.click();
  417. URL.revokeObjectURL(url);
  418. }
  419. this.exportLoading = false;
  420. });
  421. },
  422. sortByDisciplineCount(obj1, obj2) {
  423. let p1 = Number(obj1.disciplineCount);
  424. let p2 = Number(obj2.disciplineCount);
  425. if (isNaN(p1)) {
  426. p1 = 0;
  427. }
  428. if (isNaN(p2)) {
  429. p2 = 0;
  430. }
  431. return p1 - p2;
  432. },
  433. sortBySubmitCount(obj1, obj2) {
  434. let p1 = Number(obj1.submitCount);
  435. let p2 = Number(obj2.submitCount);
  436. if (isNaN(p1)) {
  437. p1 = 0;
  438. }
  439. if (isNaN(p2)) {
  440. p2 = 0;
  441. }
  442. return p1 - p2;
  443. }
  444. },
  445. created() {}
  446. };
  447. </script>
  448. <style scoped src="../style/common.css"></style>