zhangjie пре 2 година
родитељ
комит
ea930a7d2c

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

@@ -183,3 +183,27 @@ export const paperSimpleCountDistributeApi = (params) => {
     { params }
     { params }
   );
   );
 };
 };
+
+// paper-recycle
+export function paperRecycleListApi(data = {}) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/paper/recycle_find`,
+    {},
+    { params: data }
+  );
+}
+export function recoverPaperApi(recycleParamList) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/paper/recycle_recover`,
+    recycleParamList
+  );
+}
+export function thoroughDeletePaperApi(recycleParamList) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/paper/recycle_clear`,
+    recycleParamList
+  );
+}
+export function clearPaperRecycleApi() {
+  return $httpWithMsg.post(`${QUESTION_API}/paper/recycle_clear_all`, {});
+}

+ 6 - 0
src/modules/paper/router.js

@@ -1,5 +1,6 @@
 import BuildPaper from "./views/BuildPaper.vue";
 import BuildPaper from "./views/BuildPaper.vue";
 import AuditPaper from "./views/AuditPaper";
 import AuditPaper from "./views/AuditPaper";
+import PaperRecycle from "./views/PaperRecycle";
 
 
 export default [
 export default [
   {
   {
@@ -12,4 +13,9 @@ export default [
     name: "AuditPaper",
     name: "AuditPaper",
     component: AuditPaper,
     component: AuditPaper,
   },
   },
+  {
+    path: "/recycle-paper",
+    name: "PaperRecycle",
+    component: PaperRecycle,
+  },
 ];
 ];

+ 247 - 0
src/modules/paper/views/PaperRecycle.vue

@@ -0,0 +1,247 @@
+<template>
+  <div class="content question-recycle">
+    <div class="part-box">
+      <div class="part-box-header">
+        <h2 class="part-box-title">回收站</h2>
+
+        <el-button type="danger" plain @click="goback">返回</el-button>
+      </div>
+
+      <div class="part-box-action">
+        <div>
+          <el-button
+            type="primary"
+            plain
+            icon="el-icon-data-analysis"
+            @click="toBatchRecover"
+            >恢复</el-button
+          >
+          <el-button
+            type="danger"
+            plain
+            icon="el-icon-lock"
+            @click="toBatchDelete"
+            >删除</el-button
+          >
+        </div>
+        <div>
+          <el-button
+            type="primary"
+            plain
+            icon="el-icon-folder-opened"
+            @click="toClear"
+            >清空回收站</el-button
+          >
+        </div>
+      </div>
+    </div>
+
+    <div class="part-box">
+      <el-table
+        v-loading="loading"
+        element-loading-text="加载中"
+        :data="dataList"
+        @selection-change="tableSelectChange"
+      >
+        <el-table-column
+          type="selection"
+          width="50"
+          align="center"
+        ></el-table-column>
+        <el-table-column prop="name" label="试卷名称"> </el-table-column>
+        <el-table-column label="课程名称">
+          <template slot-scope="scope">
+            <span
+              >{{ scope.row.course.name }}({{ scope.row.course.code }})</span
+            >
+          </template>
+        </el-table-column>
+        <el-table-column prop="operator" label="操作人" width="120">
+        </el-table-column>
+        <el-table-column prop="deleteTime" label="删除时间" width="170">
+        </el-table-column>
+        <el-table-column label="操作" width="160" fixed="right">
+          <template slot-scope="scope">
+            <div class="operate_left">
+              <el-button
+                size="mini"
+                type="primary"
+                plain
+                @click="toRecover(scope.row)"
+                >恢复</el-button
+              >
+              <el-button
+                size="mini"
+                type="danger"
+                plain
+                @click="toDelete(scope.row)"
+                >删除</el-button
+              >
+            </div>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+import {
+  paperRecycleListApi,
+  recoverPaperApi,
+  thoroughDeletePaperApi,
+  clearPaperRecycleApi,
+} from "../api";
+
+export default {
+  name: "QuestionRecycle",
+  data() {
+    return {
+      dataList: [],
+      loading: false,
+      recycleParamList: [],
+    };
+  },
+  mounted() {
+    this.toPage(1);
+  },
+  methods: {
+    toPage(page) {
+      this.currentPage = page;
+      this.getList();
+    },
+    async getList() {
+      this.recycleParamList = [];
+      this.loading = true;
+      const res = await paperRecycleListApi().catch(() => {});
+      this.loading = false;
+      if (!res) return;
+      res.data.forEach((item) => {
+        if (item.recycleType === "QUESTION") {
+          item.name = JSON.parse(item.name);
+        }
+        return item;
+      });
+      this.dataList = res.data;
+    },
+    tableSelectChange(selections) {
+      this.recycleParamList = selections.map((item) => {
+        return {
+          id: item.id,
+          recycleType: item.recycleType,
+        };
+      });
+    },
+    async toClear() {
+      const confirm = await this.$confirm("确认要清空回收站吗?", "提示", {
+        type: "warning",
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      this.loading = true;
+      const res = await clearPaperRecycleApi().catch((error) => {
+        this.$notify({
+          message: error.response.data.desc,
+          type: "error",
+        });
+      });
+
+      if (!res) return;
+
+      this.$notify({
+        message: "操作成功",
+        type: "success",
+      });
+      this.toPage(1);
+    },
+    async toDelete(row) {
+      const confirm = await this.$confirm("确认彻底删除数据吗?", "提示", {
+        type: "warning",
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      this.deleteData([
+        {
+          id: row.id,
+          recycleType: row.recycleType,
+        },
+      ]);
+    },
+    async deleteData(recycleParamList) {
+      this.loading = true;
+      const res = await thoroughDeletePaperApi(recycleParamList).catch(
+        (error) => {
+          this.$notify({
+            message: error.response.data.desc,
+            type: "error",
+          });
+        }
+      );
+
+      if (!res) return;
+
+      this.$notify({
+        message: "删除成功",
+        type: "success",
+      });
+      this.getList();
+    },
+    async toBatchDelete() {
+      if (!this.recycleParamList.length) {
+        this.$message.error("请选择数据!");
+        return;
+      }
+
+      const confirm = await this.$confirm("确认彻底删除选中数据吗?", "提示", {
+        type: "warning",
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      this.deleteData(this.recycleParamList);
+    },
+    async toRecover(row) {
+      const confirm = await this.$confirm("确认恢复数据吗?", "提示", {
+        type: "warning",
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      this.recoverData([
+        {
+          id: row.id,
+          recycleType: row.recycleType,
+        },
+      ]);
+    },
+    async recoverData(recycleParamList) {
+      this.loading = true;
+      const res = await recoverPaperApi(recycleParamList).catch((error) => {
+        this.$notify({
+          message: error.response.data.desc,
+          type: "error",
+        });
+      });
+
+      if (!res) return;
+
+      this.$notify({
+        message: "操作成功",
+        type: "success",
+      });
+      this.getList();
+    },
+    async toBatchRecover() {
+      if (!this.recycleParamList.length) {
+        this.$message.error("请选择数据!");
+        return;
+      }
+
+      const confirm = await this.$confirm("确认恢复选中数据吗?", "提示", {
+        type: "warning",
+      }).catch(() => {});
+      if (confirm !== "confirm") return;
+
+      this.recoverData(this.recycleParamList);
+    },
+  },
+};
+</script>

+ 1 - 2
src/modules/question/views/QuestionManage.vue

@@ -46,6 +46,7 @@
             @click="toSafetySet"
             @click="toSafetySet"
             >安全设置</el-button
             >安全设置</el-button
           >
           >
+          <el-button type="danger" @click="toRecycle">回收站</el-button>
         </div>
         </div>
         <div>
         <div>
           <el-button
           <el-button
@@ -166,8 +167,6 @@
         >
         >
         </el-pagination>
         </el-pagination>
       </div>
       </div>
-
-      <el-button type="danger" @click="toRecycle">回收站</el-button>
     </div>
     </div>
 
 
     <!-- QuestionEditDialog -->
     <!-- QuestionEditDialog -->

+ 6 - 0
src/modules/questions/routes/routes.js

@@ -35,6 +35,7 @@ import OrgProperty from "../views/OrgProperty.vue";
 // import PaperPendingTrial from "../views/PaperPendingTrial.vue";
 // import PaperPendingTrial from "../views/PaperPendingTrial.vue";
 import QuestionAudit from "../../question/views/QuestionAudit.vue";
 import QuestionAudit from "../../question/views/QuestionAudit.vue";
 import EditPaperPendingTrial from "../views/EditPaperPendingTrial.vue";
 import EditPaperPendingTrial from "../views/EditPaperPendingTrial.vue";
+import PaperRecycle from "../../paper/views/PaperRecycle.vue";
 import ExamPaperPendingTrial from "../../paper/views/AuditPaper.vue";
 import ExamPaperPendingTrial from "../../paper/views/AuditPaper.vue";
 // import ExamPaperPendingTrial from "../views/ExamPaperPendingTrial.vue";
 // import ExamPaperPendingTrial from "../views/ExamPaperPendingTrial.vue";
 import CheckDuplicateList from "../views/CheckDuplicateList.vue";
 import CheckDuplicateList from "../views/CheckDuplicateList.vue";
@@ -126,6 +127,11 @@ export const menuRoutes = [
         path: "exam_paper_pending_trial/:isClear", //题库待审列表
         path: "exam_paper_pending_trial/:isClear", //题库待审列表
         component: ExamPaperPendingTrial,
         component: ExamPaperPendingTrial,
       },
       },
+      {
+        path: "paper-recycle", //卷库回收站
+        name: "PaperRecycle",
+        component: PaperRecycle,
+      },
       {
       {
         path: "gen_paper/:isClear", //卷库试卷列表
         path: "gen_paper/:isClear", //卷库试卷列表
         component: GenPaper,
         component: GenPaper,

+ 6 - 0
src/modules/questions/views/GenPaper.vue

@@ -88,6 +88,7 @@
             @click="openQuesPro"
             @click="openQuesPro"
             >试卷属性</el-button
             >试卷属性</el-button
           >
           >
+          <el-button type="danger" @click="toRecycle">回收站</el-button>
         </div>
         </div>
         <div>
         <div>
           <el-button
           <el-button
@@ -888,6 +889,11 @@ export default {
         })
         })
       );
       );
     },
     },
+    toRecycle() {
+      this.$router.push({
+        name: "PaperRecycle",
+      });
+    },
     initVue() {
     initVue() {
       this.isClear = this.$route.params.isClear;
       this.isClear = this.$route.params.isClear;
       if (this.isClear == 0 || !this.isClear) {
       if (this.isClear == 0 || !this.isClear) {