zhangjie преди 2 години
родител
ревизия
464bba77e9
променени са 3 файла, в които са добавени 76 реда и са изтрити 70 реда
  1. 17 11
      src/modules/question/api.js
  2. 53 59
      src/modules/question/views/QuestionRecycle.vue
  3. 6 0
      src/modules/questions/routes/routes.js

+ 17 - 11
src/modules/question/api.js

@@ -37,11 +37,11 @@ export function classifyQuestionPageListApi(data) {
   const url = `${QUESTION_API}/question/classify/find_current_classify_question_page`;
   return $httpWithMsg.post(url, {}, { params: data });
 }
-export function deleteQuestionApi(idList) {
+export function deleteQuestionApi(questionIdList) {
   return $httpWithMsg.post(
-    `${QUESTION_API}/question/delete`,
+    `${QUESTION_API}/question/recycle`,
     {},
-    { params: { idList } }
+    { params: { questionIdList } }
   );
 }
 export function moveQuestionApi(questionIdList, targetClassifyId) {
@@ -114,7 +114,7 @@ export function updateClassifyApi(datas) {
 }
 export function deleteClassifyApi(questionClassifyIdList) {
   return $httpWithMsg.post(
-    `${QUESTION_API}/question/classify/delete`,
+    `${QUESTION_API}/question/classify/recycle`,
     {},
     {
       params: {
@@ -134,21 +134,27 @@ export function moveClassifyApi(movedClassifyId, targetClassifyId) {
 }
 
 // question-recycle
-export function questionRecycleListApi(data) {
+export function questionRecycleListApi(data = {}) {
   return $httpWithMsg.post(
-    `${QUESTION_API}/question/recycle/list`,
+    `${QUESTION_API}/question/recycle_find`,
     {},
     { params: data }
   );
 }
-export function recoverQuestionApi(ids) {
-  return $httpWithMsg.post(`${QUESTION_API}/question/recycle/recover`, { ids });
+export function recoverQuestionApi(recycleParamList) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/question/recycle_recover`,
+    recycleParamList
+  );
 }
-export function thoroughDeleteQuestionApi(ids) {
-  return $httpWithMsg.post(`${QUESTION_API}/question/recycle/delete`, { ids });
+export function thoroughDeleteQuestionApi(recycleParamList) {
+  return $httpWithMsg.post(
+    `${QUESTION_API}/question/recycle_clear`,
+    recycleParamList
+  );
 }
 export function clearQuestionRecycleApi() {
-  return $httpWithMsg.post(`${QUESTION_API}/question/recycle/clear`, {});
+  return $httpWithMsg.post(`${QUESTION_API}/question/recycle_clear_all`, {});
 }
 
 // question-audit

+ 53 - 59
src/modules/question/views/QuestionRecycle.vue

@@ -51,31 +51,23 @@
         <el-table-column label="文件夹/试题">
           <template slot-scope="scope">
             <rich-text
+              v-if="scope.row.recycleType === 'QUESTION'"
               class="row-question-body"
               title="点击查看试题"
-              :text-json="scope.row.quesBody"
-              @click="toViewQuestion(scope.row)"
+              :text-json="scope.row.name"
             ></rich-text>
+            <div v-else>{{ scope.row.name }}</div>
           </template>
         </el-table-column>
-        <el-table-column label="课程" width="120">
-          <template slot-scope="scope">
-            <span>{{ scope.row.course.name }}</span>
-          </template>
+        <el-table-column prop="courseName" label="课程" width="120">
         </el-table-column>
-        <el-table-column label="题型" width="100">
-          <template slot-scope="scope">
-            <span>{{ scope.row.questionType | questionType }}</span>
-          </template>
+        <el-table-column prop="questionType" label="题型" width="100">
         </el-table-column>
-        <el-table-column label="操作人" width="120">
-          <template slot-scope="scope">
-            <span>{{ scope.row.creator }}</span>
-          </template>
+        <el-table-column prop="operator" label="操作人" width="120">
         </el-table-column>
-        <el-table-column label="删除时间" width="170" prop="creationTime">
+        <el-table-column label="删除时间" width="170" prop="deleteTime">
         </el-table-column>
-        <el-table-column label="操作" width="180" fixed="right">
+        <el-table-column label="操作" width="160" fixed="right">
           <template slot-scope="scope">
             <div class="operate_left">
               <el-button
@@ -96,18 +88,6 @@
           </template>
         </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>
   </div>
 </template>
@@ -125,14 +105,12 @@ export default {
   data() {
     return {
       dataList: [],
-      currentPage: 1,
-      pageSize: 10,
-      total: 0,
-      selectedIds: [],
+      loading: false,
+      recycleParamList: [],
     };
   },
   mounted() {
-    // this.toPage(1);
+    this.toPage(1);
   },
   methods: {
     toPage(page) {
@@ -140,19 +118,26 @@ export default {
       this.getList();
     },
     async getList() {
-      this.selectedIds = [];
+      this.recycleParamList = [];
       this.loading = true;
-      const res = await questionRecycleListApi({
-        curPage: this.currentPage,
-        pageSize: this.pageSize,
-      }).catch(() => {});
+      const res = await questionRecycleListApi().catch(() => {});
       this.loading = false;
       if (!res) return;
-      this.dataList = res.data.content;
-      this.total = res.data.totalElements;
+      res.data.forEach((item) => {
+        if (item.recycleType === "QUESTION") {
+          item.name = JSON.parse(item.name);
+        }
+        return item;
+      });
+      this.dataList = res.data;
     },
     tableSelectChange(selections) {
-      this.selectedIds = selections.map((item) => item.id);
+      this.recycleParamList = selections.map((item) => {
+        return {
+          id: item.id,
+          recycleType: item.recycleType,
+        };
+      });
     },
     async toClear() {
       const confirm = await this.$confirm("确认要清空回收站吗?", "提示", {
@@ -182,16 +167,23 @@ export default {
       }).catch(() => {});
       if (confirm !== "confirm") return;
 
-      this.deleteData([row.id]);
+      this.deleteData([
+        {
+          id: row.id,
+          recycleType: row.recycleType,
+        },
+      ]);
     },
-    async deleteData(ids) {
+    async deleteData(recycleParamList) {
       this.loading = true;
-      const res = await thoroughDeleteQuestionApi(ids).catch((error) => {
-        this.$notify({
-          message: error.response.data.desc,
-          type: "error",
-        });
-      });
+      const res = await thoroughDeleteQuestionApi(recycleParamList).catch(
+        (error) => {
+          this.$notify({
+            message: error.response.data.desc,
+            type: "error",
+          });
+        }
+      );
 
       if (!res) return;
 
@@ -202,7 +194,7 @@ export default {
       this.getList();
     },
     async toBatchDelete() {
-      if (!this.selectedIds.length) {
+      if (!this.recycleParamList.length) {
         this.$message.error("请选择数据!");
         return;
       }
@@ -212,7 +204,7 @@ export default {
       }).catch(() => {});
       if (confirm !== "confirm") return;
 
-      this.deleteData(this.selectedIds);
+      this.deleteData(this.recycleParamList);
     },
     async toRecover(row) {
       const confirm = await this.$confirm("确认恢复数据吗?", "提示", {
@@ -220,11 +212,16 @@ export default {
       }).catch(() => {});
       if (confirm !== "confirm") return;
 
-      this.recoverData([row.id]);
+      this.recoverData([
+        {
+          id: row.id,
+          recycleType: row.recycleType,
+        },
+      ]);
     },
-    async recoverData(ids) {
+    async recoverData(recycleParamList) {
       this.loading = true;
-      const res = await recoverQuestionApi(ids).catch((error) => {
+      const res = await recoverQuestionApi(recycleParamList).catch((error) => {
         this.$notify({
           message: error.response.data.desc,
           type: "error",
@@ -240,7 +237,7 @@ export default {
       this.getList();
     },
     async toBatchRecover() {
-      if (!this.selectedIds.length) {
+      if (!this.recycleParamList.length) {
         this.$message.error("请选择数据!");
         return;
       }
@@ -250,10 +247,7 @@ export default {
       }).catch(() => {});
       if (confirm !== "confirm") return;
 
-      this.recoverData(this.selectedIds);
-    },
-    toViewQuestion(row) {
-      console.log(row);
+      this.recoverData(this.recycleParamList);
     },
   },
 };

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

@@ -8,6 +8,7 @@ import CourseProperty from "../views/CourseProperty.vue";
 import PropertyInfo from "../views/PropertyInfo.vue";
 // import ImportPaper from "../views/ImportPaper.vue";
 import ImportPaper from "../../question/views/QuestionManage";
+import QuestionRecycle from "../../question/views/QuestionRecycle";
 import GenPaper from "../views/GenPaper.vue";
 import ImportPaperInfo from "../views/ImportPaperInfo.vue";
 // import GenPaperDetail from "../views/GenPaperDetail.vue";
@@ -109,6 +110,11 @@ export const menuRoutes = [
         path: "import_paper/:isClear", //题库试卷列表
         component: ImportPaper,
       },
+      {
+        path: "question_recycle", // 题库列表回车站
+        component: QuestionRecycle,
+        name: "QuestionRecycle",
+      },
       {
         path: "paper_pending_trial/:isClear", //题库待审列表
         component: QuestionAudit,