Browse Source

feat: 试卷日志

zhangjie 7 tháng trước cách đây
mục cha
commit
20e38f4fca

+ 3 - 0
src/modules/paper/api.js

@@ -67,6 +67,9 @@ export const paperDetailInfoApi = ({ paperId, seqMode }) => {
 export const paperDetailApi = (paperId) => {
   return $httpWithMsg.get(`${QUESTION_API}/paper/${paperId}`, {});
 };
+export const paperEditLogsApi = (paperId) => {
+  return $httpWithMsg.get(`${QUESTION_API}/paper/log/${paperId}`, {});
+};
 export const paperSaveApi = (paper) => {
   return $httpWithMsg.post(`${QUESTION_API}/paper`, paper);
 };

+ 94 - 0
src/modules/paper/components/PaperEditLogDialog.vue

@@ -0,0 +1,94 @@
+<template>
+  <div>
+    <el-dialog
+      custom-class="question-preview-dialog"
+      :visible.sync="modalIsShow"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      @open="openHandle"
+    >
+      <div class="box-justify" slot="title">
+        <h2>修改记录</h2>
+        <div>
+          <el-button icon="el-icon-back" @click="cancel">返回</el-button>
+        </div>
+      </div>
+
+      <el-table element-loading-text="加载中" :data="logList">
+        <el-table-column label="内容" prop="creationTime"> </el-table-column>
+        <el-table-column label="修改时间" width="180" prop="creationTime">
+        </el-table-column>
+        <el-table-column label="修改人" prop="creator" width="120">
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          :current-page="currentPage"
+          :page-size="pageSize"
+          :page-sizes="[10, 20, 50, 100, 200, 300]"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="total"
+          @current-change="toPage"
+          @size-change="handleSizeChange"
+        >
+        </el-pagination>
+      </div>
+
+      <div slot="footer"></div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { paperEditLogsApi } from "../api";
+
+export default {
+  name: "PaperEditLogDialog",
+  props: {
+    paperId: {
+      type: [String, Number],
+      default: "",
+    },
+  },
+  data() {
+    return {
+      modalIsShow: false,
+      logList: [],
+      currentPage: 1,
+      pageSize: 10,
+      total: 0,
+    };
+  },
+  methods: {
+    openHandle() {
+      this.logList = [];
+      this.toPage(1);
+    },
+    async toPage(page) {
+      this.currentPage = page;
+      await this.getList();
+    },
+    async getList() {
+      const res = await paperEditLogsApi({
+        paperId: this.paperId,
+        pageNumber: this.currentPage,
+        pageSize: this.pageSize,
+      });
+
+      this.logList = res.data.content;
+      this.total = res.data.totalElements;
+    },
+    handleSizeChange(val) {
+      this.pageSize = val;
+      this.toPage(1);
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+  },
+};
+</script>

+ 11 - 0
src/modules/paper/views/EditPaper.vue

@@ -168,6 +168,7 @@
           </el-button>
         </div>
         <div>
+          <el-button size="small" @click="toViewLog">试卷修改记录</el-button>
           <tool-tip-btn
             name="shenhejilu"
             content="审核记录"
@@ -830,6 +831,11 @@
       select-mode="paper"
       @confirm="questionSelected"
     ></select-question-dialog>
+    <!-- PaperEditLogDialog -->
+    <paper-edit-log-dialog
+      ref="PaperEditLogDialog"
+      :paper-id="paperId"
+    ></paper-edit-log-dialog>
   </div>
 </template>
 
@@ -859,6 +865,7 @@ import PaperQuestypeInfo from "../components/PaperQuestypeInfo.vue";
 import PaperBlueInfo from "../components/PaperBlueInfo.vue";
 import PaperAuditInfo from "../components/PaperAuditInfo.vue";
 import ModifyDetailStruct from "../components/ModifyDetailStruct.vue";
+import PaperEditLogDialog from "../components/PaperEditLogDialog.vue";
 import ModifyRichText from "@/components/ModifyRichText.vue";
 import QuestionEditDialog from "../../question/components/QuestionEditDialog.vue";
 import SelectQuestionDialog from "../components/SelectQuestionDialog.vue";
@@ -881,6 +888,7 @@ export default {
     ImportFileDialog,
     SelectQuestionDialog,
     QuestionAnswer,
+    PaperEditLogDialog,
   },
   data() {
     return {
@@ -1161,6 +1169,9 @@ export default {
       await paperCardDeleteApi(this.paperId);
       this.$message.success("操作成功!");
     },
+    toViewLog() {
+      this.$refs.PaperEditLogDialog.open();
+    },
     // header-action ----end
     // 考试说明
     toEditExamRemark() {

+ 2 - 2
src/modules/question/components/QuestionEditLogDialog.vue

@@ -168,7 +168,7 @@ import { questionEditLogsApi } from "../api";
 export default {
   name: "QuestionEditLogDialog",
   props: {
-    paperId: {
+    questionId: {
       type: [String, Number],
       default: "",
     },
@@ -183,7 +183,7 @@ export default {
   },
   methods: {
     async openHandle() {
-      const res = await questionEditLogsApi(this.paperId);
+      const res = await questionEditLogsApi(this.questionId);
 
       this.logList = res || [];
 

+ 1 - 1
src/modules/question/components/QuestionPreviewDialog.vue

@@ -150,7 +150,7 @@
     <question-edit-log-dialog
       v-if="showLog"
       ref="QuestionEditLogDialog"
-      :paper-id="this.question.id"
+      :question-id="this.question.id"
     ></question-edit-log-dialog>
   </div>
 </template>