CreateTaskApply.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. <template>
  2. <el-dialog
  3. class="create-task-apply"
  4. :visible.sync="modalIsShow"
  5. title="新增命题申请"
  6. top="10px"
  7. width="1000px"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. destroy-on-close
  12. @open="visibleChange"
  13. >
  14. <div class="part-box part-box-pad part-box-border">
  15. <el-form
  16. ref="examTaskComp"
  17. :model="examTask"
  18. :rules="rules"
  19. label-width="120px"
  20. >
  21. <el-row>
  22. <el-col :span="12">
  23. <el-form-item prop="teachingRoomId" label="教研室:">
  24. <teaching-room-select
  25. v-model="examTask.teachingRoomId"
  26. @change="clearCard"
  27. ></teaching-room-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="12">
  31. <el-form-item prop="courseCode" label="课程(代码):">
  32. <course-select
  33. v-model="examTask.courseCode"
  34. @change="courseChange"
  35. ></course-select>
  36. </el-form-item>
  37. </el-col>
  38. </el-row>
  39. <el-row>
  40. <el-col :span="12">
  41. <el-form-item prop="cardRuleId" label="题卡规则:">
  42. <card-rule-select
  43. ref="CardRuleSelect"
  44. v-model.trim="examTask.cardRuleId"
  45. placeholder="请选择"
  46. clearable
  47. @change="clearCard"
  48. ></card-rule-select>
  49. <p class="tips-info">
  50. 说明:若选择全部通卡,则命题老师只能选择通卡,若选择题卡规则,则专卡和通卡均可选择
  51. </p>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="12">
  55. <el-form-item label="试卷编号:">
  56. <el-input
  57. v-model.trim="examTask.paperNumber"
  58. placeholder="请输入试卷编号"
  59. :maxlength="50"
  60. clearable
  61. ></el-input>
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-row>
  66. <el-col :span="12">
  67. <el-form-item label="拟卷教师:">
  68. <el-input
  69. v-model.trim="examTask.teacherName"
  70. placeholder="请输入拟卷教师"
  71. :maxlength="50"
  72. clearable
  73. ></el-input>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="12">
  77. <el-form-item label="主讲教师:">
  78. <el-input
  79. v-model.trim="examTask.lecturerName"
  80. placeholder="请输入主讲教师"
  81. :maxlength="50"
  82. clearable
  83. ></el-input>
  84. </el-form-item>
  85. </el-col>
  86. </el-row>
  87. </el-form>
  88. </div>
  89. <div class="task-apply-steps" v-if="flows.length">
  90. <el-steps align-center>
  91. <el-step
  92. v-for="flow in flows"
  93. :key="flow.taskKey"
  94. :title="flow.taskName"
  95. :status="flow.status"
  96. >
  97. <div slot="description">
  98. <div class="step-info" v-if="flow.firstUser">
  99. <span>{{ flow.firstUser }}</span>
  100. <el-popover
  101. v-if="flow.moreUser"
  102. placement="top-start"
  103. width="300"
  104. trigger="hover"
  105. :content="flow.moreUser"
  106. >
  107. <span class="color-primary ml-1" slot="reference">更多</span>
  108. </el-popover>
  109. </div>
  110. </div>
  111. </el-step>
  112. </el-steps>
  113. </div>
  114. <div class="apply-content task-detail" v-if="modalIsShow">
  115. <div class="task-body">
  116. <div class="mb-2 text-right">
  117. <el-button
  118. type="info"
  119. icon="el-icon-circle-plus-outline"
  120. @click="addAtachment"
  121. >增加卷型</el-button
  122. >
  123. </div>
  124. <table class="table mb-2">
  125. <tr>
  126. <th>试卷类型</th>
  127. <th>试卷文件</th>
  128. <th>答题卡创建方式</th>
  129. <th>答题卡</th>
  130. <th>操作</th>
  131. </tr>
  132. <tr v-for="(attachment, index) in paperAttachments" :key="index">
  133. <td>{{ attachment.name }}卷</td>
  134. <td>
  135. <el-button
  136. type="text"
  137. class="btn-primary"
  138. @click="toUpload(attachment)"
  139. >
  140. <i
  141. :class="[
  142. 'icon',
  143. attachment.attachmentId ? 'icon-files-act' : 'icon-files'
  144. ]"
  145. ></i
  146. >{{
  147. attachment.attachmentId
  148. ? attachment.filename
  149. : "点击上传试卷文件"
  150. }}
  151. </el-button>
  152. </td>
  153. <td :rowspan="paperAttachments.length" v-if="index === 0">
  154. {{ createCardTypeName }}
  155. </td>
  156. <td :rowspan="paperAttachments.length" v-if="index === 0">
  157. <el-button
  158. type="text"
  159. class="btn-primary"
  160. @click="toCreateOrViewCard"
  161. >{{ cardTodoName }}</el-button
  162. >
  163. <el-button
  164. v-if="examTaskDetail.makeMethod"
  165. size="mini"
  166. type="primary"
  167. @click="changeCreateCardType"
  168. >切换题卡创建方式</el-button
  169. >
  170. </td>
  171. <td>
  172. <el-button
  173. class="btn-danger"
  174. type="text"
  175. @click="deleteAttachment(index)"
  176. >删除</el-button
  177. >
  178. </td>
  179. </tr>
  180. <tr v-if="!paperAttachments.length">
  181. <td colspan="5">
  182. <p class="tips-info text-center">暂无数据</p>
  183. </td>
  184. </tr>
  185. </table>
  186. <p class="tips-info tips-dark mb-2">
  187. 提示:多卷型试卷由于会绑定一个答题卡模板,因此试卷结构必须相同。多卷型试卷之间客观题要求试题内容相同,可允许大题内的小题题序不同。
  188. </p>
  189. <el-form>
  190. <el-form-item label="单次抽卷卷型数量:" label-width="150">
  191. <el-input-number
  192. v-model="examTaskDetail.drawCount"
  193. :min="1"
  194. :max="maxFetchCount"
  195. :step="1"
  196. step-strictly
  197. :controls="false"
  198. ></el-input-number>
  199. </el-form-item>
  200. </el-form>
  201. <h4 class="mb-2">备注说明:</h4>
  202. <el-input
  203. class="mb-2"
  204. v-model="examTaskDetail.remark"
  205. type="textarea"
  206. resize="none"
  207. :rows="2"
  208. :maxlength="100"
  209. clearable
  210. show-word-limit
  211. placeholder="建议不超过100个字"
  212. ></el-input>
  213. <h4 class="mb-2">上传入库审核表(最多4张)</h4>
  214. <div class="image-list">
  215. <div
  216. class="image-item"
  217. v-for="(img, index) in paperConfirmAttachments"
  218. :key="index"
  219. >
  220. <img
  221. :src="img.url"
  222. :alt="img.filename"
  223. title="点击查看大图"
  224. @click="toPreview(index)"
  225. />
  226. <div class="image-delete">
  227. <i
  228. class="el-icon-delete-solid"
  229. @click="deletePaperConfirmAttachment(index)"
  230. ></i>
  231. </div>
  232. </div>
  233. <div
  234. v-if="paperConfirmAttachments.length < 4"
  235. class="image-item image-add"
  236. title="上传入库审核表"
  237. @click="toUploadPaperConfirm"
  238. >
  239. <i class="el-icon-plus"></i>
  240. </div>
  241. </div>
  242. </div>
  243. <div class="task-action">
  244. <el-button type="primary" :disabled="isSubmit" @click="submit"
  245. >确认提交</el-button
  246. >
  247. <el-button type="primary" :disabled="isSubmit" @click="toSave"
  248. >暂存</el-button
  249. >
  250. <el-button @click="cancel">取消</el-button>
  251. </div>
  252. </div>
  253. <div slot="footer"></div>
  254. <!-- upload-paper-dialog -->
  255. <upload-paper-dialog
  256. :paper-attachment="curAttachment"
  257. :upload-type="curUploadType"
  258. @confirm="uploadConfirm"
  259. ref="UploadPaperDialog"
  260. ></upload-paper-dialog>
  261. <!-- card-option-dialog -->
  262. <card-option-dialog
  263. ref="CardOptionDialog"
  264. :data="task"
  265. @upload-sample-over="initData"
  266. @confirm="cardConfirm"
  267. ></card-option-dialog>
  268. <!-- image-preview -->
  269. <simple-image-preview
  270. :cur-image="curImage"
  271. @on-prev="toPrevImage"
  272. @on-next="toNextImage"
  273. ref="SimpleImagePreview"
  274. ></simple-image-preview>
  275. </el-dialog>
  276. </template>
  277. <script>
  278. import { examRuleDetail } from "../../base/api";
  279. import {
  280. teacherCreateTaskApply,
  281. teacherCancelTaskApply,
  282. switchCardCreateMethod,
  283. taskAllApproverPeople
  284. } from "../api";
  285. import UploadPaperDialog from "./UploadPaperDialog";
  286. import CardOptionDialog from "./CardOptionDialog";
  287. import SimpleImagePreview from "@/components/SimpleImagePreview";
  288. import { CARD_SOURCE_TYPE } from "@/constants/enumerate";
  289. const initExamTask = {
  290. id: null,
  291. courseCode: "",
  292. courseName: "",
  293. paperNumber: "",
  294. cardRuleId: "",
  295. teachingRoomId: "",
  296. teacherName: "",
  297. lecturerName: ""
  298. };
  299. const initExamTaskDetail = {
  300. operateType: "STAGE",
  301. paperType: "A",
  302. cardId: "",
  303. paperAttachmentIds: [],
  304. paperConfirmAttachmentIds: [],
  305. drawCount: 2,
  306. remark: "",
  307. makeMethod: "",
  308. // 题卡状态
  309. status: "",
  310. // 考务规则
  311. review: false,
  312. includePaper: false,
  313. customCard: false
  314. };
  315. export default {
  316. name: "create-task-apply",
  317. components: { UploadPaperDialog, CardOptionDialog, SimpleImagePreview },
  318. data() {
  319. return {
  320. modalIsShow: false,
  321. isSubmit: false,
  322. examTask: {},
  323. needReview: false,
  324. task: {},
  325. examRule: {},
  326. flows: [
  327. {
  328. flowId: "160684605807001600",
  329. taskName: "提交试卷",
  330. taskKey: "usertask1",
  331. setup: 1,
  332. status: "process",
  333. desc: "进行中"
  334. },
  335. {
  336. flowId: "160684605807001600",
  337. taskName: "审核试卷",
  338. taskKey: "usertask2",
  339. setup: 2,
  340. status: "wait",
  341. desc: "待进行"
  342. },
  343. {
  344. flowId: "160684605807001600",
  345. taskName: "审核试卷",
  346. taskKey: "usertask3",
  347. setup: 3,
  348. status: "wait",
  349. desc: "待进行"
  350. }
  351. ],
  352. rules: {
  353. teachingRoomId: [
  354. {
  355. required: true,
  356. message: "请选择教研室",
  357. trigger: "change"
  358. }
  359. ],
  360. courseCode: [
  361. {
  362. required: true,
  363. message: "请选择课程",
  364. trigger: "change"
  365. }
  366. ],
  367. cardRuleId: [
  368. {
  369. required: true,
  370. message: "请选择题卡规则",
  371. trigger: "change"
  372. }
  373. ]
  374. },
  375. // exam-task-detail
  376. examTaskDetail: {},
  377. paperConfirmAttachmentId: { attachmentId: "", filename: "", url: "" },
  378. paperAttachments: [],
  379. paperConfirmAttachments: [],
  380. curAttachment: {},
  381. curUploadType: "paper",
  382. attachmentLimitCount: 26,
  383. abc: "abcdefghijklmnopqrstuvwxyz".toUpperCase(),
  384. // image-preview
  385. curImage: {},
  386. curImageIndex: 0
  387. };
  388. },
  389. computed: {
  390. cardTodoName() {
  391. let name = "创建答题卡";
  392. if (this.examTaskDetail.cardId) {
  393. if (this.examTaskDetail.makeMethod === "SELECT") {
  394. name = "选择题卡";
  395. } else if (this.examTaskDetail.makeMethod === "SELF") {
  396. name = "编辑题卡";
  397. } else {
  398. // 已经审核的题卡可以自行编辑,未审核的题卡只能查看
  399. name =
  400. this.examTaskDetail.status === "SUBMIT" ? "编辑题卡" : "查看题卡";
  401. }
  402. }
  403. return name;
  404. },
  405. createCardTypeName() {
  406. return CARD_SOURCE_TYPE[this.examTaskDetail.makeMethod] || "";
  407. },
  408. maxFetchCount() {
  409. return this.paperAttachments.length < 1
  410. ? 1
  411. : this.paperAttachments.length;
  412. }
  413. },
  414. created() {
  415. this.getExamRule();
  416. },
  417. methods: {
  418. async getExamRule() {
  419. const examRule = await examRuleDetail();
  420. this.examRule = examRule || {};
  421. this.needReview = examRule && examRule.review;
  422. },
  423. initData() {
  424. this.examTask = { ...initExamTask };
  425. this.examTaskDetail = { ...initExamTaskDetail };
  426. this.examTaskDetail.includePaper = this.examRule.includePaper;
  427. this.examTaskDetail.review = this.examRule.review;
  428. this.examTaskDetail.customCard = this.examRule.customCard;
  429. this.paperAttachments = [];
  430. },
  431. visibleChange() {
  432. this.initData();
  433. },
  434. checkData() {
  435. return this.$refs.examTaskComp.validate().catch(() => {});
  436. },
  437. async cancel() {
  438. if (this.examTask.id) {
  439. await teacherCancelTaskApply(this.examTask.id);
  440. this.$message.success("取消命题申请成功!");
  441. }
  442. this.close();
  443. },
  444. close() {
  445. this.modalIsShow = false;
  446. },
  447. open() {
  448. this.modalIsShow = true;
  449. },
  450. // exam-task-detail edit
  451. addAtachment() {
  452. if (this.paperAttachments.length >= this.attachmentLimitCount) return;
  453. const newAttachment = {
  454. name: this.abc[this.paperAttachments.length],
  455. attachmentId: "",
  456. filename: "",
  457. pages: 0
  458. };
  459. this.paperAttachments.push(newAttachment);
  460. },
  461. deleteAttachment(index) {
  462. if (this.paperAttachments.length <= 1) {
  463. this.$message.error("试卷类型数量不得少于1");
  464. return;
  465. }
  466. this.paperAttachments.splice(index, 1);
  467. this.paperAttachments.forEach((item, itemIndex) => {
  468. item.name = this.abc[itemIndex];
  469. });
  470. if (
  471. this.examTaskDetail.drawCount &&
  472. this.examTaskDetail.drawCount > this.paperAttachments.length
  473. ) {
  474. this.examTaskDetail.drawCount = this.paperAttachments.length;
  475. }
  476. },
  477. toUpload(attachment) {
  478. this.curUploadType = "paper";
  479. this.curAttachment = {
  480. ...attachment
  481. };
  482. this.$refs.UploadPaperDialog.open();
  483. },
  484. toUploadPaperConfirm() {
  485. if (this.paperConfirmAttachments.length >= 4) return;
  486. this.curUploadType = "paperConfirm";
  487. this.curAttachment = {
  488. ...this.paperConfirmAttachmentId
  489. };
  490. this.$refs.UploadPaperDialog.open();
  491. },
  492. uploadConfirm(attachment, uploadType) {
  493. if (uploadType === "paper") {
  494. const index = this.paperAttachments.findIndex(
  495. item => item.name === attachment.name
  496. );
  497. this.paperAttachments.splice(index, 1, { ...attachment });
  498. } else {
  499. this.paperConfirmAttachments.push(attachment);
  500. }
  501. },
  502. deletePaperConfirmAttachment(index) {
  503. this.paperConfirmAttachments.splice(index, 1);
  504. },
  505. toViewCard() {
  506. window.open(
  507. this.getRouterPath({
  508. name: "CardPreview",
  509. params: {
  510. cardId: this.examTaskDetail.cardId,
  511. viewType: "view"
  512. }
  513. })
  514. );
  515. },
  516. toEditCard() {
  517. this.cachePrepareTcpCard();
  518. this.$router.push({
  519. name: "CardDesign",
  520. params: {
  521. cardId: this.examTaskDetail.cardId
  522. }
  523. });
  524. },
  525. cachePrepareTcpCard() {
  526. this.$ls.set("prepareTcPCard", {
  527. examTaskId: this.examTask.id,
  528. courseCode: this.examTask.courseCode,
  529. courseName: this.examTask.courseName,
  530. makeMethod: this.examTaskDetail.makeMethod,
  531. cardRuleId: this.examTask.cardRuleId
  532. });
  533. },
  534. async toCreateOrViewCard() {
  535. const result = await this.toSave(1);
  536. if (!result) return;
  537. this.task = {
  538. ...this.examTask,
  539. ...this.examTaskDetail,
  540. examTaskId: this.examTask.id
  541. };
  542. if (!this.examTaskDetail.cardId) {
  543. this.$refs.CardOptionDialog.open();
  544. return;
  545. }
  546. if (this.examTaskDetail.makeMethod === "SELECT") {
  547. this.$refs.CardOptionDialog.open();
  548. } else if (this.examTaskDetail.makeMethod === "SELF") {
  549. this.toEditCard();
  550. } else {
  551. // 客服制卡:制作完毕则可以编辑,未制作完毕则可以查看
  552. if (this.examTaskDetail.status === "SUBMIT") {
  553. this.toEditCard();
  554. } else {
  555. this.toViewCard();
  556. }
  557. }
  558. },
  559. cardConfirm(data) {
  560. this.examTaskDetail = this.$objAssign(this.examTaskDetail, data);
  561. },
  562. async changeCreateCardType() {
  563. const h = this.$createElement;
  564. const result = await this.$msgbox({
  565. title: "切换题卡操作说明",
  566. message: h("div", null, [
  567. h("p", null, "1、切换题卡会将之前选择题卡数据删除。"),
  568. h(
  569. "p",
  570. null,
  571. "2、之前选择专卡进行绘制,切换题卡后再次选择专卡,需要重新开始绘制。"
  572. )
  573. ]),
  574. showCancelButton: true,
  575. type: "warning"
  576. }).catch(() => {});
  577. if (result !== "confirm") return;
  578. await this.clearMakeMethod();
  579. this.toCreateOrViewCard();
  580. },
  581. async clearMakeMethod() {
  582. // 清除后台记录的题卡
  583. if (this.examTask.id && this.examTaskDetail.cardId)
  584. await switchCardCreateMethod(this.examTask.id);
  585. this.examTaskDetail.makeMethod = "";
  586. this.examTaskDetail.cardId = "";
  587. },
  588. courseChange(val) {
  589. this.examTask.courseName = val.name;
  590. this.clearCard();
  591. this.updateApproverPeople();
  592. },
  593. clearCard() {
  594. this.clearMakeMethod();
  595. },
  596. async updateApproverPeople() {
  597. const data = await taskAllApproverPeople({
  598. courseCode: this.examTask.courseCode
  599. });
  600. let approvePeople = {};
  601. data.approveUserList.forEach(item => {
  602. item.users = item.approveUser.map(
  603. user => `${user.realName}(${user.orgName})`
  604. );
  605. item.firstUser = item.users[0];
  606. item.moreUser = item.users.length > 1 ? item.users.join(",") : null;
  607. approvePeople[item.setup] = item;
  608. });
  609. this.flows = this.flows.map(flow => {
  610. return {
  611. ...flow,
  612. ...approvePeople[flow.setup]
  613. };
  614. });
  615. },
  616. getTaskDetailData() {
  617. let data = { ...this.examTaskDetail };
  618. data.paperType = this.paperAttachments.map(item => item.name).join(",");
  619. data.paperAttachmentIds = JSON.stringify(this.paperAttachments, (k, v) =>
  620. k === "url" ? undefined : v
  621. );
  622. data.paperConfirmAttachmentIds = JSON.stringify(
  623. this.paperConfirmAttachments
  624. );
  625. this.examTaskDetail = data;
  626. },
  627. checkDataValid() {
  628. const attachmentValid = !this.paperAttachments.some(
  629. item => !item.attachmentId
  630. );
  631. // 设置了入库强制包含试卷时,校验试卷是否上传。
  632. if (this.examTaskDetail.includePaper && !attachmentValid) {
  633. this.$message.error("请完成试卷文件上传!");
  634. return;
  635. }
  636. // if (!this.paperConfirmAttachments.length) {
  637. // this.$message.error("请上传入库审核表!");
  638. // return;
  639. // }
  640. if (!this.examTaskDetail.cardId) {
  641. this.$message.error("请选择题卡创建方式!");
  642. return;
  643. }
  644. if (
  645. this.examTaskDetail.makeMethod !== "SELECT" &&
  646. this.examTaskDetail.status !== "SUBMIT"
  647. ) {
  648. this.$message.error("请先提交题卡!");
  649. return;
  650. }
  651. return true;
  652. },
  653. async toSave(silent) {
  654. const valid = await this.$refs.examTaskComp.validate().catch(() => {});
  655. if (!valid) return;
  656. if (this.isSubmit) return;
  657. this.isSubmit = true;
  658. this.getTaskDetailData();
  659. const datas = {
  660. examTaskDetail: this.examTaskDetail,
  661. examTask: this.examTask
  662. };
  663. const data = await teacherCreateTaskApply(datas).catch(() => {});
  664. this.isSubmit = false;
  665. if (!data) return;
  666. this.examTask = this.$objAssign(this.examTask, data);
  667. if (!silent) this.$message.success("保存成功!");
  668. return true;
  669. },
  670. async submit() {
  671. const valid = await this.$refs.examTaskComp.validate().catch(() => {});
  672. if (!valid) return;
  673. if (!this.checkDataValid()) return;
  674. this.$confirm(
  675. "任务确定提交后,则不可更改试卷及答题卡内容,确定提交该任务?",
  676. "提示",
  677. {
  678. type: "warning"
  679. }
  680. )
  681. .then(async () => {
  682. this.getTaskDetailData();
  683. this.examTaskDetail.operateType = "SUBMIT";
  684. const datas = {
  685. examTaskDetail: this.examTaskDetail,
  686. examTask: this.examTask
  687. };
  688. const data = await teacherCreateTaskApply(datas).catch(() => {});
  689. if (!data) return;
  690. this.$message.success("提交成功!");
  691. this.close();
  692. this.$emit("modified");
  693. })
  694. .catch(() => {});
  695. },
  696. // image-preview
  697. toPreview(index) {
  698. this.curImageIndex = index;
  699. this.selectImage(index);
  700. this.$refs.SimpleImagePreview.open();
  701. },
  702. selectImage(index) {
  703. this.curImage = this.paperConfirmAttachments[index];
  704. },
  705. toPrevImage() {
  706. if (this.curImageIndex === 0) {
  707. this.curImageIndex = this.paperConfirmAttachments.length - 1;
  708. } else {
  709. this.curImageIndex--;
  710. }
  711. this.selectImage(this.curImageIndex);
  712. },
  713. toNextImage() {
  714. if (this.curImageIndex === this.paperConfirmAttachments.length - 1) {
  715. this.curImageIndex = 0;
  716. } else {
  717. this.curImageIndex++;
  718. }
  719. this.selectImage(this.curImageIndex);
  720. }
  721. }
  722. };
  723. </script>