exam-plan-kj-hz-solfege.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="exam_plan_kj_hz_solfege pg-main">
  3. <div class="pg-title">
  4. <span>结果汇总进度(视唱机考)</span>
  5. </div>
  6. <div class="pg-select-infos">
  7. <Form ref="kj_progress_queryform_one" :label-width="80" inline>
  8. <Row>
  9. <Col span="8">
  10. <FormItem label="考试任务" style="width: 100%">
  11. <Select @on-change="selectExam" v-model="query.examCode">
  12. <Option value="">全部</Option>
  13. <Option
  14. v-for="item in xldata.examCodeList"
  15. :value="item.examCode"
  16. :key="item.examCode"
  17. >{{ item.name }}</Option
  18. >
  19. </Select>
  20. </FormItem>
  21. </Col>
  22. <Col span="8">
  23. <FormItem label="考点" style="width: 100%">
  24. <Select @on-change="selectPlace" v-model="query.placeCode">
  25. <Option value="">全部</Option>
  26. <Option
  27. v-for="item in xldata.placeCodeList"
  28. :value="item.value"
  29. :key="item.value"
  30. >{{ item.name }}</Option
  31. >
  32. </Select>
  33. </FormItem>
  34. </Col>
  35. <Col span="8">
  36. <FormItem label="考场" style="width: 100%">
  37. <Select v-model="query.roomCode">
  38. <Option value="">全部</Option>
  39. <Option
  40. v-for="item in xldata.roomCodeList"
  41. :value="item.value"
  42. :key="item.value"
  43. >{{ item.name }}</Option
  44. >
  45. </Select>
  46. </FormItem>
  47. </Col>
  48. </Row>
  49. </Form>
  50. <Form ref="kj_progress_queryform_two" :label-width="80" inline>
  51. <FormItem :label-width="20">
  52. <Row>
  53. <Col span="5">
  54. <Button @click="doQuery" type="primary" icon="md-search"
  55. >查询</Button
  56. >
  57. </Col>
  58. <Col span="6">
  59. <Upload
  60. :before-upload="beforeBatchImport"
  61. action=""
  62. style="display: inline-block; margin-left: 10px"
  63. >
  64. <Button type="primary" icon="md-folder">本地导入</Button>
  65. </Upload>
  66. </Col>
  67. <Col span="8">
  68. <Button
  69. style="margin-left: 30px"
  70. @click="doExport"
  71. type="primary"
  72. icon="md-document"
  73. >OW导出(无答案)</Button
  74. >
  75. </Col>
  76. </Row>
  77. </FormItem>
  78. </Form>
  79. <Row v-for="(item, index) in batchFileList" :key="index">
  80. <Col span="22">
  81. <Alert type="success"
  82. >文件:{{ item.name }}上传进度:
  83. <Progress :percent="item.percent"></Progress>
  84. </Alert>
  85. </Col>
  86. </Row>
  87. </div>
  88. <div class="pg-body">
  89. <Table
  90. ref="kj_progress_table"
  91. :columns="columns"
  92. :data="list"
  93. :stripe="true"
  94. :disabled-hover="true"
  95. ></Table>
  96. <Page
  97. placement="top"
  98. :current="query.pageNo"
  99. :loading="true"
  100. :page-size="query.pageSize"
  101. :total="query.totalElements"
  102. show-total
  103. show-sizer
  104. @on-change="changePageNo"
  105. @on-page-size-change="changePageSize"
  106. ></Page>
  107. </div>
  108. </div>
  109. </template>
  110. <script>
  111. import { axios, baseUrl } from "../../libs/http";
  112. export default {
  113. name: "exam_plan_kj_hz_solfege",
  114. data() {
  115. return {
  116. formats: ["zip"],
  117. batchFileList: [],
  118. xldata: {
  119. examCodeList: [],
  120. placeCodeList: [],
  121. roomCodeList: [],
  122. },
  123. query: {
  124. pageNo: 1,
  125. pageSize: 10,
  126. totalElements: 0,
  127. totalPages: 0,
  128. examCode: "",
  129. placeCode: "",
  130. roomCode: "",
  131. },
  132. list: [],
  133. columns: [
  134. {
  135. type: "index_seq",
  136. title: "序号",
  137. align: "center",
  138. width: 80,
  139. render: (h, params) => {
  140. return h(
  141. "span",
  142. (this.query.pageNo - 1) * this.query.pageSize + params.index + 1
  143. );
  144. },
  145. },
  146. {
  147. title: "考点",
  148. key: "placeName",
  149. minWidth: 180,
  150. align: "center",
  151. },
  152. {
  153. title: "考场",
  154. key: "roomName",
  155. minWidth: 180,
  156. align: "center",
  157. },
  158. {
  159. title: "应考人数",
  160. key: "total",
  161. width: 120,
  162. align: "center",
  163. },
  164. {
  165. title: "已上传人数",
  166. key: "uploadedCount",
  167. minWidth: 120,
  168. align: "center",
  169. },
  170. {
  171. title: "已上传人数占比",
  172. key: "uploadedPercent",
  173. minWidth: 140,
  174. align: "center",
  175. },
  176. {
  177. title: "当前汇总人数",
  178. key: "answeredCount",
  179. minWidth: 120,
  180. align: "center",
  181. },
  182. {
  183. title: "汇总人数占比",
  184. minWidth: 120,
  185. key: "answeredPercent",
  186. align: "center",
  187. },
  188. ],
  189. };
  190. },
  191. methods: {
  192. doExport() {
  193. if (!this.query.examCode) {
  194. this.$Notice.error({
  195. title: "系统提示",
  196. desc: "<p>请先选择一个考试任务</p>",
  197. });
  198. return false;
  199. }
  200. let url =
  201. baseUrl +
  202. "/system/kj/hz/owexport?examCode=" +
  203. this.query.examCode +
  204. "&A-P-T_v_auth=" +
  205. localStorage.encryptToken;
  206. axios({
  207. method: "post",
  208. url: url, // 请求地址
  209. data: {}, // 参数
  210. responseType: "blob", // 表明返回服务器返回的数据类型
  211. }).then((res) => {
  212. // 处理返回的文件流
  213. let content = res.data;
  214. let blob = new Blob([content]);
  215. let fileName = "阅卷数据.zip";
  216. if ("download" in document.createElement("a")) {
  217. let elink = document.createElement("a");
  218. elink.download = fileName;
  219. elink.style.display = "none";
  220. elink.href = URL.createObjectURL(blob);
  221. document.body.appendChild(elink);
  222. elink.click();
  223. URL.revokeObjectURL(elink.href); // 释放URL 对象
  224. document.body.removeChild(elink);
  225. } else {
  226. navigator.msSaveBlob(blob, fileName);
  227. }
  228. });
  229. },
  230. // hideProgress(index) {
  231. // let $tr = $(".ivu-table-row").eq(index);
  232. // $tr.find(".ivu-progress").hide();
  233. // $tr.find(".ivu-progress-bg").width("0%");
  234. // $tr.find(".ivu-progress-text-inner").html("0%");
  235. // },
  236. // updateProgress(index, pro) {
  237. // if (pro > 0) {
  238. // let $tr = $(".ivu-table-row").eq(index);
  239. // $tr.find(".ivu-progress").show();
  240. // $tr.find(".ivu-progress-bg").width(pro + "%");
  241. // $tr.find(".ivu-progress-text-inner").html(pro + "%");
  242. // }
  243. // },
  244. formatFileSize(size) {
  245. let fileSize = size != undefined && size != null ? size : 0;
  246. if (size > 1024 * 1024)
  247. fileSize =
  248. (Math.round((size * 100) / (1024 * 1024)) / 100).toString() + "MB";
  249. else fileSize = (Math.round((size * 100) / 1024) / 100).toString() + "KB";
  250. return fileSize;
  251. },
  252. beforeBatchImport(file) {
  253. if (!this.query.examCode) {
  254. this.$Notice.error({
  255. title: "系统提示",
  256. desc: "<p>请先选择一个考试任务</p>",
  257. });
  258. return false;
  259. }
  260. if (file.name.indexOf(".qm") == -1) {
  261. this.$Notice.error({
  262. title: "系统消息",
  263. desc: "<p>上传数据包格式错误,不是qm格式</p>",
  264. });
  265. return false;
  266. }
  267. if (file.size > 1073741824) {
  268. this.$Notice.error({
  269. title: "系统消息",
  270. desc: "<p>文件大小超过了系统限制的文件大小1G</p>",
  271. });
  272. return false;
  273. }
  274. //上传操作
  275. file.percent = 0;
  276. this.batchFileList.push(file);
  277. let fd = new FormData();
  278. fd.append("file", file);
  279. let xhr = new XMLHttpRequest();
  280. xhr.upload.addEventListener(
  281. "progress",
  282. (evt) => {
  283. if (evt.lengthComputable) {
  284. let percentComplete = Math.round((evt.loaded * 100) / evt.total);
  285. file.percent = percentComplete;
  286. }
  287. },
  288. false
  289. );
  290. xhr.addEventListener(
  291. "error",
  292. (evt) => {
  293. let index = this.batchFileList.indexOf(file);
  294. if (index > -1) {
  295. this.batchFileList.splice(index, 1);
  296. }
  297. this.$store.commit("closeloading");
  298. this.$Notice.error({
  299. title: "系统提示",
  300. desc: "<p>" + evt + "</p>",
  301. });
  302. },
  303. false
  304. );
  305. xhr.addEventListener(
  306. "load",
  307. (evt) => {
  308. let index = this.batchFileList.indexOf(file);
  309. if (index > -1) {
  310. this.batchFileList.splice(index, 1);
  311. }
  312. this.$store.commit("closeloading");
  313. let statusCode = evt.target.status;
  314. if (statusCode == 200) {
  315. let data = JSON.parse(evt.target.responseText);
  316. if (data.code != 0) {
  317. this.$Notice.error({
  318. title: "系统提示",
  319. desc:
  320. "<p>文件:" + file.name + "导入失败," + data.message + "</p>",
  321. });
  322. } else {
  323. //刷新当前的列表页面
  324. this.load();
  325. this.$Notice.success({
  326. title: "导入成功",
  327. desc: "<p>文件:" + file.name + "导入成功" + "</p>",
  328. });
  329. }
  330. } else {
  331. this.$Notice.error({
  332. title: "系统提示",
  333. desc: "<p>文件:" + file.name + "上传失败" + "</p>",
  334. });
  335. }
  336. },
  337. false
  338. );
  339. xhr.open(
  340. "POST",
  341. baseUrl + "/system/kj/hz/file/solfegeImport/" + this.query.examCode
  342. ); //修改成自己的接口
  343. xhr.setRequestHeader(
  344. "authorization-token",
  345. this.$store.state.user.accessToken
  346. );
  347. xhr.setRequestHeader("fileName", encodeURIComponent(file.name));
  348. xhr.setRequestHeader("schoolId", this.$store.state.user.schoolId);
  349. xhr.send(fd);
  350. this.$store.commit("showloading");
  351. return false;
  352. },
  353. load() {
  354. if (this.query.examCode) {
  355. axios
  356. .post("/system/kj/hz/getSolfegeKjProgress", this.query)
  357. .then((response) => {
  358. let data = response.data.data;
  359. if (data) {
  360. this.list = data.content || [];
  361. this.query.totalElements = data.totalElements;
  362. this.query.totalPages = data.totalPages;
  363. }
  364. });
  365. }
  366. },
  367. selectPlace() {
  368. if (this.query.placeCode && this.query.placeCode.length > 0) {
  369. axios
  370. .post("/system/kj/hz/getRoomByPlaceCode", this.query)
  371. .then((response) => {
  372. let data = response.data.data;
  373. if (data) {
  374. this.xldata.roomCodeList = [];
  375. this.xldata.roomCodeList = data;
  376. }
  377. });
  378. } else {
  379. this.xldata.roomCodeList = [];
  380. }
  381. },
  382. selectExam() {
  383. if (this.query.examCode && this.query.examCode.length > 0) {
  384. axios
  385. .post("/system/kj/hz/getPlaceByExamCode", this.query)
  386. .then((response) => {
  387. let data = response.data.data;
  388. if (data) {
  389. this.xldata.placeCodeList = [];
  390. this.xldata.placeCodeList = data;
  391. }
  392. });
  393. } else {
  394. this.xldata.placeCodeList = [];
  395. }
  396. },
  397. doQuery() {
  398. if (!this.query.examCode || this.query.examCode.length == 0) {
  399. this.query.pageNo = 1;
  400. this.query.pageSize = 10;
  401. this.query.totalElements = 0;
  402. this.query.totalPages = 0;
  403. this.list = [];
  404. } else {
  405. this.query.pageNo = 1;
  406. this.load();
  407. }
  408. },
  409. changePageNo(p) {
  410. //切换页码
  411. this.query.pageNo = p;
  412. this.load();
  413. },
  414. changePageSize(pageSize) {
  415. //切换每一页显示多少条
  416. if (this.query.examCode) {
  417. this.query.pageSize = pageSize;
  418. this.load();
  419. }
  420. },
  421. },
  422. created() {
  423. let myexamCode = this.query.examCode;
  424. axios.post("/system/kj/hz/getPlans", {}).then((response) => {
  425. let data = response.data.data;
  426. if (data) {
  427. this.xldata.examCodeList = [];
  428. data.forEach((item, index) => {
  429. if (item.examType == "SOLFEGE") {
  430. this.xldata.examCodeList.push(item);
  431. this.query.examCode = myexamCode;
  432. }
  433. });
  434. }
  435. });
  436. },
  437. };
  438. </script>