MarkPaperCheck.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. <template>
  2. <div>
  3. <section class="content">
  4. <div class="box box-info">
  5. <div class="box-body">
  6. <el-form
  7. ref="formSearch"
  8. :inline="true"
  9. :model="formSearch"
  10. label-width="70px"
  11. >
  12. <el-form-item label="评卷名称" prop="workId">
  13. <el-select
  14. v-model="formSearch.workId"
  15. clearable
  16. filterable
  17. :remote-method="getMarkWorks"
  18. remote
  19. class="input"
  20. placeholder="请选择"
  21. style="width: 150px"
  22. @change="changeMarkWork"
  23. @clear="resetForm"
  24. >
  25. <el-option
  26. v-for="item in markWorkSelect"
  27. :key="item.workId"
  28. :label="item.markName"
  29. :value="item.workId"
  30. ></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="学习中心" prop="orgCode">
  34. <el-select
  35. v-model="formSearch.orgCode"
  36. :remote-method="getOrgs"
  37. remote
  38. :loading="getOrgsSearchLoading"
  39. class="input"
  40. clearable
  41. placeholder="请选择"
  42. filterable
  43. style="width: 150px"
  44. @focus="(e) => getOrgs(e.target.value)"
  45. >
  46. <el-option
  47. v-for="item in orgList"
  48. :key="item.code"
  49. :label="item.name"
  50. :value="item.code"
  51. ></el-option>
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="姓名" prop="studentName">
  55. <el-input
  56. v-model="formSearch.studentName"
  57. placeholder="请输入姓名"
  58. style="width: 150px"
  59. ></el-input>
  60. </el-form-item>
  61. <el-form-item label="学号" prop="studentCode">
  62. <el-input
  63. v-model="formSearch.studentCode"
  64. placeholder="请输入学号"
  65. style="width: 150px"
  66. ></el-input>
  67. </el-form-item>
  68. <el-form-item label="标记卷" prop="tag">
  69. <el-select
  70. v-model="formSearch.tag"
  71. clearable
  72. placeholder="请选择"
  73. filterable
  74. style="width: 150px"
  75. >
  76. <el-option
  77. v-for="item in tags"
  78. :key="item.code"
  79. :label="item.name"
  80. :value="item.code"
  81. ></el-option>
  82. </el-select>
  83. </el-form-item>
  84. <el-form-item label="课程" prop="courseCode">
  85. <el-select
  86. v-model="formSearch.courseCode"
  87. clearable
  88. filterable
  89. class="input"
  90. placeholder="请选择"
  91. style="width: 150px"
  92. >
  93. <el-option
  94. v-for="item in courseAllListSelect"
  95. :key="item.code"
  96. :label="item.courseInfo"
  97. :value="item.code"
  98. ></el-option>
  99. </el-select>
  100. </el-form-item>
  101. <el-form-item label="评委" prop="userId">
  102. <el-select
  103. v-model="formSearch.userId"
  104. clearable
  105. filterable
  106. class="input"
  107. placeholder="请选择"
  108. style="width: 150px"
  109. >
  110. <el-option
  111. v-for="item in userList"
  112. :key="item.userId"
  113. :label="item.name"
  114. :value="item.userId"
  115. ></el-option>
  116. </el-select>
  117. </el-form-item>
  118. <el-form-item label="评卷备注" prop="markRemark">
  119. <el-input
  120. v-model="formSearch.markRemark"
  121. placeholder="请输入备注"
  122. style="width: 150px"
  123. ></el-input>
  124. </el-form-item>
  125. <el-form-item label="试卷ID" prop="examRecordDataId">
  126. <el-input
  127. v-model="formSearch.examRecordDataId"
  128. placeholder="请输入试卷ID"
  129. style="width: 150px"
  130. maxlength="18"
  131. ></el-input>
  132. </el-form-item>
  133. <el-form-item label="身份证号" prop="identityNumber">
  134. <el-input
  135. v-model="formSearch.identityNumber"
  136. placeholder="请输入身份证号"
  137. style="width: 150px"
  138. ></el-input>
  139. </el-form-item>
  140. <div></div>
  141. <el-form-item>
  142. <el-button
  143. size="small"
  144. type="primary"
  145. icon="el-icon-search"
  146. @click="searchMarkPaperCheck"
  147. >查询</el-button
  148. >
  149. <el-button
  150. size="small"
  151. icon="el-icon-refresh"
  152. @click="resetForm()"
  153. >重置</el-button
  154. >
  155. </el-form-item>
  156. </el-form>
  157. <div class="block-seperator"></div>
  158. <span>操作:</span>
  159. <el-button
  160. type="danger"
  161. icon="el-icon-arrow-left"
  162. size="mini"
  163. :disabled="noBatchSelected"
  164. @click="bachBackRefresh"
  165. >打回
  166. </el-button>
  167. <el-button
  168. type="primary"
  169. size="mini"
  170. icon="el-icon-download"
  171. @click="exportData"
  172. >导出</el-button
  173. >
  174. <div style="width: 100%; margin-bottom: 10px"></div>
  175. <!-- 页面列表 -->
  176. <el-table
  177. v-loading="loading"
  178. stripe
  179. element-loading-text="拼命加载中"
  180. :data="tableData"
  181. border
  182. style="width: 100%"
  183. @selection-change="selectChange"
  184. >
  185. <el-table-column type="selection" width="50"></el-table-column>
  186. <el-table-column
  187. label="试卷ID"
  188. width="150"
  189. prop="examRecordDataId"
  190. />
  191. <el-table-column
  192. label="身份证号"
  193. width="150"
  194. prop="identityNumber"
  195. />
  196. <el-table-column label="学习中心" width="150" prop="orgName" />
  197. <el-table-column
  198. label="学号"
  199. width="120"
  200. prop="studentCode"
  201. sortable
  202. />
  203. <el-table-column label="姓名" width="120" prop="studentName" />
  204. <el-table-column
  205. label="课程代码"
  206. width="120"
  207. prop="courseCode"
  208. sortable
  209. />
  210. <el-table-column label="课程" width="120" prop="courseName" />
  211. <el-table-column label="试卷名称" width="120" prop="paperType" />
  212. <el-table-column label="评卷员" width="120" prop="userName" />
  213. <el-table-column label="主观总分" width="120" prop="score" />
  214. <el-table-column
  215. label="客观总分"
  216. width="120"
  217. prop="objectiveScore"
  218. sortable
  219. />
  220. <el-table-column
  221. label="卷面总分"
  222. width="120"
  223. prop="totalScore"
  224. sortable
  225. />
  226. <el-table-column label="标记卷" width="120">
  227. <template slot-scope="scope">
  228. <div>
  229. <span>{{ scope.row.tag | tagFilter }}</span>
  230. </div>
  231. </template>
  232. </el-table-column>
  233. <el-table-column label="评卷备注" width="120">
  234. <template slot-scope="scope">
  235. <el-popover trigger="hover" name="text" placement="top">
  236. <div style="width: 200px">{{ scope.row.markRemark }}</div>
  237. <div slot="reference" class="interceptStr">
  238. <span>{{ scope.row.markRemark }}</span>
  239. </div>
  240. </el-popover>
  241. </template>
  242. </el-table-column>
  243. <el-table-column fixed="right" label="操作" width="180">
  244. <template slot-scope="scope">
  245. <el-button
  246. type="primary"
  247. size="mini"
  248. icon="el-icon-view"
  249. plain
  250. @click="viewPaper(scope.row)"
  251. >原卷</el-button
  252. >
  253. <el-button
  254. type="danger"
  255. icon="el-icon-arrow-left"
  256. size="mini"
  257. @click="backRefresh(scope.row)"
  258. >打回</el-button
  259. >
  260. </template>
  261. </el-table-column>
  262. </el-table>
  263. <div class="page pull-right">
  264. <el-pagination
  265. v-if="paginationShow"
  266. :current-page="currentPage"
  267. :page-size="pageSize"
  268. :page-sizes="[10, 20, 50, 100, 200, 300]"
  269. layout="total, sizes, prev, pager, next, jumper"
  270. :total="total"
  271. @current-change="handleCurrentChange"
  272. @size-change="handleSizeChange"
  273. ></el-pagination>
  274. </div>
  275. </div>
  276. </div>
  277. </section>
  278. <el-dialog
  279. title="预览"
  280. width="400px"
  281. :visible.sync="imageDialog"
  282. @close="closeImageDialog"
  283. >
  284. <div
  285. style="text-align: center; width: 90%; height: 90%"
  286. v-html="imgHtml"
  287. ></div>
  288. </el-dialog>
  289. </div>
  290. </template>
  291. <script>
  292. import { mapState } from "vuex";
  293. import {
  294. CORE_API,
  295. MARKING_API,
  296. MARKING_LOGIC_API,
  297. } from "@/constants/constants";
  298. import "viewerjs/dist/viewer.css";
  299. import Viewer from "viewerjs";
  300. export default {
  301. data() {
  302. return {
  303. selectedIds: [],
  304. formSearch: {
  305. orgCode: "",
  306. studentName: "",
  307. studentCode: "",
  308. tag: "",
  309. courseCode: "",
  310. userId: "",
  311. workId: "",
  312. markRemark: "",
  313. examRecordDataId: "",
  314. identityNumber: "",
  315. },
  316. orgList: [],
  317. courseList: [],
  318. specialtyList: [],
  319. userList: [],
  320. tableData: [],
  321. currentPage: 1,
  322. pageSize: 10,
  323. total: 0,
  324. paginationShow: false,
  325. tags: [],
  326. loading: false,
  327. getOrgsSearchLoading: false,
  328. markWorkList: [],
  329. imgHtml: "",
  330. imageDialog: false,
  331. };
  332. },
  333. computed: {
  334. ...mapState({ user: (state) => state.user }),
  335. markWorkSelect() {
  336. let markWorkNames = [];
  337. for (let markWork of this.markWorkList) {
  338. markWorkNames.push({
  339. workId: markWork.id,
  340. markName: markWork.name,
  341. });
  342. }
  343. return markWorkNames;
  344. },
  345. courseAllListSelect() {
  346. let courseSelect = [];
  347. for (let course of this.courseList) {
  348. let courseInfo = course.name + "(" + course.code + ")";
  349. courseSelect.push({ code: course.code, courseInfo: courseInfo });
  350. }
  351. return courseSelect;
  352. },
  353. noBatchSelected() {
  354. return this.selectedIds.length === 0;
  355. },
  356. },
  357. created() {
  358. //查询标记卷
  359. this.getTags();
  360. this.getMarkWorks();
  361. this.operaQuery();
  362. },
  363. mounted() {
  364. window.viewPicture = this.viewPicture;
  365. },
  366. methods: {
  367. exportData() {
  368. if (!this.formSearch.workId) {
  369. this.$notify({
  370. title: "警告",
  371. message: "请选择评卷工作",
  372. type: "warning",
  373. duration: 1000,
  374. });
  375. return false;
  376. }
  377. let regx = /^\d*$/;
  378. if (!regx.test(this.formSearch.examRecordDataId)) {
  379. this.$notify({
  380. title: "警告",
  381. message: "试卷ID只能输入数字",
  382. type: "warning",
  383. });
  384. return false;
  385. }
  386. this.$confirm("确定执行导出?", "提示", {
  387. confirmButtonText: "确定",
  388. cancelButtonText: "取消",
  389. type: "warning",
  390. }).then(() => {
  391. this.$http
  392. .get(MARKING_API + "/export/task/paper_check", {
  393. params: {
  394. query: this.formSearch,
  395. },
  396. })
  397. .then(() => {
  398. this.$notify({
  399. type: "success",
  400. message: "正在后台导出中,请稍后到“导出任务列表”中下载!",
  401. });
  402. })
  403. .catch((error) => {
  404. this.$notify({
  405. type: "error",
  406. message: error.response.data.desc,
  407. });
  408. });
  409. });
  410. },
  411. selectChange(rows) {
  412. this.selectedIds = [];
  413. rows.forEach((element) => {
  414. this.selectedIds.push(element.id);
  415. });
  416. },
  417. viewPicture(imagesClass, index) {
  418. const viewer = new Viewer(document.querySelector(imagesClass), {
  419. container: "#app",
  420. zIndex: 99999,
  421. title: false,
  422. toolbar: {
  423. zoomIn: 1,
  424. zoomOut: 1,
  425. oneToOne: 1,
  426. reset: 1,
  427. prev: 1,
  428. play: {
  429. show: 0,
  430. size: "large",
  431. },
  432. next: 1,
  433. rotateLeft: 1,
  434. rotateRight: 1,
  435. flipHorizontal: 1,
  436. flipVertical: 1,
  437. },
  438. ready() {
  439. viewer.view(index);
  440. },
  441. hidden() {
  442. viewer.destroy();
  443. },
  444. });
  445. viewer.show();
  446. },
  447. changeMarkWork() {
  448. if (this.$route.query) {
  449. this.$router.push({ path: "/marking/mark_paper_check" });
  450. }
  451. this.getCourses();
  452. this.getUserList();
  453. this.formSearch = Object.assign(this.formSearch, {
  454. orgCode: "",
  455. studentName: "",
  456. studentCode: "",
  457. tag: "",
  458. courseCode: "",
  459. userId: "",
  460. markRemark: "",
  461. examRecordDataId: "",
  462. identityNumber: "",
  463. });
  464. },
  465. getMarkWorks(name = "") {
  466. this.$http
  467. .get(MARKING_LOGIC_API + "/markWorks?status=1" + `&name=${name}`)
  468. .then((response) => {
  469. this.markWorkList = response.data?.content || [];
  470. if (this.$route.query && this.$route.query.workId) {
  471. this.formSearch.workId = parseInt(this.$route.query.workId);
  472. }
  473. });
  474. },
  475. //查询学习中心
  476. getOrgs(name) {
  477. this.getOrgsSearchLoading = true;
  478. this.$http.get(CORE_API + "/org/query?name=" + name).then((response) => {
  479. this.getOrgsSearchLoading = false;
  480. this.orgList = response.data;
  481. });
  482. },
  483. //查询课程
  484. getCourses() {
  485. this.$http
  486. .get(
  487. MARKING_API +
  488. "/markResults/queryExamCourseList?workId=" +
  489. this.formSearch.workId
  490. )
  491. .then((response) => {
  492. this.courseList = response.data;
  493. if (this.$route.query && this.$route.query.courseCode) {
  494. this.formSearch.courseCode = this.$route.query.courseCode;
  495. }
  496. });
  497. },
  498. //查询评委
  499. getUserList() {
  500. if (!this.formSearch.workId) {
  501. this.userList = [];
  502. return;
  503. }
  504. this.$http
  505. .get(
  506. MARKING_LOGIC_API +
  507. "/markUsers/assign?workId=" +
  508. this.formSearch.workId +
  509. "&courseCode="
  510. )
  511. .then((response) => {
  512. this.userList = response.data;
  513. if (this.$route.query && this.$route.query.userId) {
  514. this.formSearch.userId = parseInt(this.$route.query.userId);
  515. }
  516. });
  517. },
  518. //查询标记卷
  519. getTags() {
  520. this.$http.get(MARKING_API + "/markResults/tag").then((response) => {
  521. this.tags = response.data;
  522. //移除科目错误
  523. for (let i = 0; i < this.tags.length; i++) {
  524. if (this.tags[i].code === "SUBJECT_ERROR") {
  525. this.tags.splice(i, 1);
  526. }
  527. }
  528. });
  529. },
  530. //查询专业
  531. getSpecialtys() {
  532. var orgId = this.user.rootOrgId;
  533. this.$http
  534. .get(CORE_API + "/specialty/all?orgId=" + orgId)
  535. .then((response) => {
  536. this.specialtyList = response.data;
  537. });
  538. },
  539. //查询方法
  540. searchMarkPaperCheck() {
  541. this.currentPage = 1;
  542. this.initMarkPaperCheck();
  543. },
  544. initMarkPaperCheck() {
  545. if (!this.formSearch.workId) {
  546. this.$notify({
  547. title: "警告",
  548. message: "请选择评卷名称",
  549. type: "warning",
  550. });
  551. return false;
  552. }
  553. let regx = /^\d*$/;
  554. if (!regx.test(this.formSearch.examRecordDataId)) {
  555. this.$notify({
  556. title: "警告",
  557. message: "试卷ID只能输入数字",
  558. type: "warning",
  559. });
  560. return false;
  561. }
  562. this.loading = true;
  563. var url =
  564. MARKING_LOGIC_API +
  565. "/markResults/all/" +
  566. (this.currentPage - 1) +
  567. "/" +
  568. this.pageSize;
  569. this.$http.get(url, { params: this.formSearch }).then((response) => {
  570. this.tableData = response.data.list;
  571. this.total = response.data.total;
  572. this.loading = false;
  573. this.$router.push({
  574. path: "/marking/mark_paper_check",
  575. query: {
  576. workId: this.formSearch.workId,
  577. orgCode: this.formSearch.orgCode,
  578. studentName: this.formSearch.studentName,
  579. studentCode: this.formSearch.studentCode,
  580. tag: this.formSearch.tag,
  581. courseCode: this.formSearch.courseCode,
  582. userId: this.formSearch.userId,
  583. markRemark: this.formSearch.markRemark,
  584. currentPage: this.currentPage,
  585. pageSize: this.pageSize,
  586. examRecordDataId: this.formSearch.examRecordDataId,
  587. identityNumber: this.formSearch.identityNumber,
  588. },
  589. });
  590. this.$nextTick(function () {
  591. this.paginationShow = true;
  592. });
  593. });
  594. },
  595. resetForm() {
  596. this.formSearch = Object.assign(this.formSearch, {
  597. orgCode: "",
  598. studentName: "",
  599. studentCode: "",
  600. tag: "",
  601. courseCode: "",
  602. userId: "",
  603. workId: "",
  604. markRemark: "",
  605. examRecordDataId: "",
  606. identityNumber: "",
  607. });
  608. this.tableData = [];
  609. this.total = 0;
  610. this.$router.push({ path: "/marking/mark_paper_check" });
  611. },
  612. handleCurrentChange(val) {
  613. this.currentPage = val;
  614. this.initMarkPaperCheck();
  615. },
  616. handleSizeChange(val) {
  617. this.pageSize = val;
  618. this.currentPage = 1;
  619. this.initMarkPaperCheck();
  620. },
  621. //查看原卷
  622. viewPaper(row) {
  623. if (row.examType == "OFFLINE") {
  624. let url = row.studentSubjectiveHtml;
  625. if (/(.*)\.(jpg|gif|jpeg|png)$/.test(url)) {
  626. this.imgHtml = this.parseImgs(url);
  627. this.imageDialog = true;
  628. } else {
  629. window.open(url);
  630. }
  631. } else {
  632. let studentPaperId = row.studentPaper.id;
  633. let url =
  634. "/marking/view_paper/" +
  635. this.formSearch.workId +
  636. "/" +
  637. studentPaperId;
  638. this.$router.push({
  639. path: url,
  640. });
  641. }
  642. },
  643. closeImageDialog() {
  644. this.imageDialog = false;
  645. this.imgHtml = "";
  646. },
  647. parseImgs(urls) {
  648. let uuid = this.generateUUID();
  649. let group1 = [];
  650. let group2 = [];
  651. let elements = urls.split(",");
  652. for (let n = 0; n < elements.length; n++) {
  653. let url = elements[n];
  654. group1.push(
  655. "<a onclick=\"window.viewPicture('#pic-" +
  656. uuid +
  657. "','" +
  658. n +
  659. '\')" target="_blank"><img class="photo-answer" src="' +
  660. url +
  661. '?x-oss-process=image/resize,m_lfit,h_200,w_200"/></a>'
  662. );
  663. if ((n + 1) % 3 == 0) {
  664. group1.push("</br>");
  665. }
  666. group2.push('<img src="' + url + '"/>');
  667. }
  668. let html =
  669. '<div class="photo-answers-block">' +
  670. group1.join("") +
  671. '</div><div id="pic-' +
  672. uuid +
  673. '" style="display:none">' +
  674. group2.join("") +
  675. "</div>";
  676. return html;
  677. },
  678. generateUUID() {
  679. let date = new Date().getTime();
  680. return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function (c) {
  681. let r = (date + Math.random() * 16) % 16 | 0;
  682. date = Math.floor(date / 16);
  683. return (c == "x" ? r : (r & 0x3) | 0x8).toString(16);
  684. });
  685. },
  686. //批量打回
  687. bachBackRefresh() {
  688. this.$confirm("确定打回?", "提示", {
  689. confirmButtonText: "确定",
  690. cancelButtonText: "取消",
  691. type: "warning",
  692. })
  693. .then(() => {
  694. var url = MARKING_API + "/markResults/reject";
  695. this.$http.post(url, this.selectedIds).then(() => {
  696. this.searchMarkPaperCheck();
  697. });
  698. })
  699. .catch(() => {
  700. /*ignore*/
  701. });
  702. },
  703. //打回
  704. backRefresh(row) {
  705. this.$confirm("确定打回?", "提示", {
  706. confirmButtonText: "确定",
  707. cancelButtonText: "取消",
  708. type: "warning",
  709. })
  710. .then(() => {
  711. var url = MARKING_API + "/markResults/reject";
  712. var markResultIds = [row.id];
  713. this.$http.post(url, markResultIds).then(() => {
  714. this.searchMarkPaperCheck();
  715. });
  716. })
  717. .catch(() => {
  718. /*ignore*/
  719. });
  720. },
  721. operaQuery() {
  722. let formData = this.$route.query;
  723. if (formData && formData.workId) {
  724. this.formSearch.workId = formData.workId;
  725. this.formSearch.orgCode = formData.orgCode;
  726. this.formSearch.studentName = formData.studentName;
  727. this.formSearch.studentCode = formData.studentCode;
  728. this.formSearch.markRemark = formData.markRemark;
  729. this.formSearch.courseCode = formData.courseCode;
  730. this.formSearch.userId = formData.userId;
  731. this.formSearch.tag = formData.tag;
  732. this.formSearch.examRecordDataId = formData.examRecordDataId;
  733. this.formSearch.identityNumber = formData.identityNumber;
  734. this.currentPage = parseInt(formData.currentPage);
  735. this.pageSize = parseInt(formData.pageSize);
  736. this.getCourses();
  737. this.getUserList();
  738. this.initMarkPaperCheck();
  739. }
  740. },
  741. },
  742. };
  743. </script>
  744. <style lang="css" scoped>
  745. .interceptStr {
  746. text-overflow: ellipsis;
  747. overflow: hidden;
  748. white-space: nowrap;
  749. }
  750. </style>
  751. <style>
  752. img.photo-answer {
  753. width: 100px;
  754. padding: 10px;
  755. height: 100px;
  756. }
  757. .photo-answers-block {
  758. width: 350px !important;
  759. }
  760. .photo-answers-block a {
  761. cursor: pointer;
  762. }
  763. </style>