Explorar el Código

回收站合并

刘洋 hace 1 año
padre
commit
52220b25f7

+ 1 - 1
src/assets/styles/home.scss

@@ -177,7 +177,7 @@
     height: 40px;
     line-height: 40px;
   }
-  .el-submenu .el-menu-item.is-active {
+  .el-submenu .el-menu-item.is-active,.other-menus .el-menu-item.is-active {
     font-weight: 600;
     color:$--color-primary !important;
   }

+ 89 - 41
src/modules/paper/views/PaperRecycle.vue

@@ -1,38 +1,61 @@
 <template>
   <div class="content question-recycle">
-    <div class="part-box">
-      <div class="part-box-header">
+    <!-- <div class="part-box-header">
         <h2 class="part-box-title">回收站</h2>
 
         <el-button type="danger" plain @click="goback">返回</el-button>
+      </div> -->
+    <el-form class="part-filter-form" inline :model="searchForm">
+      <el-form-item label="课程">
+        <el-select
+          v-model="searchForm.courseId"
+          :remote-method="getCoursesList"
+          :loading="courseLoading4Search"
+          remote
+          filterable
+          clearable
+          placeholder="请选择"
+          @clear="getCoursesList('')"
+        >
+          <el-option
+            v-for="item in courseList"
+            :key="item.id"
+            :label="item.name + ' - ' + item.code"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="handleCurrentChange(1)">
+          查询
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <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 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>
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-folder-opened"
+          @click="toClear"
+          >清空回收站</el-button
+        >
       </div>
     </div>
 
@@ -86,31 +109,56 @@ import {
   thoroughDeletePaperApi,
   clearPaperRecycleApi,
 } from "../api";
-
+import { courseQueryApi } from "../../card/api";
 export default {
   name: "QuestionRecycle",
   data() {
     return {
+      courseList: [],
       dataList: [],
       loading: false,
       recycleParamList: [],
+      courseLoading4Search: false,
+      searchForm: {
+        courseId: "",
+      },
+      currentPage: 1,
+      pageSize: 10,
+      total: 10,
     };
   },
-  mounted() {
-    this.toPage(1);
+  created() {
+    this.getCoursesList();
+    this.handleCurrentChange(1);
   },
   methods: {
-    toPage(page) {
-      this.currentPage = page;
-      this.getList();
+    handleSizeChange(val) {
+      this.currentPage = 1;
+      this.pageSize = val;
+      this.search();
     },
-    async getList() {
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      this.search();
+    },
+    async getCoursesList(query) {
+      this.courseLoading4Search = true;
+      const res = await courseQueryApi(query);
+      this.courseList = res.data || [];
+      this.courseLoading4Search = false;
+    },
+    async search() {
       this.recycleParamList = [];
       this.loading = true;
-      const res = await paperRecycleListApi().catch(() => {});
+      const res = await paperRecycleListApi({
+        ...this.searchForm,
+        pageNumber: this.currentPage,
+        pageSize: this.pageSize,
+      }).catch(() => {});
       this.loading = false;
       if (!res) return;
-      this.dataList = res.data;
+      this.total = res.data.totalElements;
+      this.dataList = res.data.content || [];
     },
     tableSelectChange(selections) {
       this.recycleParamList = selections.map((item) => {
@@ -135,7 +183,7 @@ export default {
         message: "操作成功",
         type: "success",
       });
-      this.toPage(1);
+      this.handleCurrentChange(1);
     },
     async toDelete(row) {
       const confirm = await this.$confirm("确认彻底删除数据吗?", "提示", {
@@ -163,7 +211,7 @@ export default {
         message: "删除成功",
         type: "success",
       });
-      this.getList();
+      this.search();
     },
     async toBatchDelete() {
       if (!this.recycleParamList.length) {
@@ -202,7 +250,7 @@ export default {
         message: "操作成功",
         type: "success",
       });
-      this.getList();
+      this.search();
     },
     async toBatchRecover() {
       if (!this.recycleParamList.length) {

+ 47 - 12
src/modules/portal/views/home/HomeSide.vue

@@ -37,20 +37,44 @@
         </el-submenu>
       </el-menu>
     </div>
-    <div class="other-menus">
-      <div class="el-menu-item">
+
+    <el-menu
+      class="other-menus"
+      active-text-color="#705eff"
+      text-color="#383b4a"
+      router
+    >
+      <el-menu-item>
+        <i class="icon icon-safe"></i>
+        <span> 安全设置 </span>
+      </el-menu-item>
+      <el-menu-item>
+        <i class="icon icon-fast"></i>
+        <span> 快捷路径 </span>
+      </el-menu-item>
+      <el-menu-item
+        class="red"
+        :index="'/questions/recycle'"
+        :route="{ path: '/questions/recycle' }"
+      >
+        <i class="el-icon-delete" style="font-size: 16px"></i>
+        <span> 回收站 </span>
+      </el-menu-item>
+    </el-menu>
+    <!-- <ul class="other-menus">
+      <li class="el-menu-item">
         <i class="icon icon-safe"></i>
         <span>安全设置</span>
-      </div>
-      <div class="el-menu-item">
+      </li>
+      <li class="el-menu-item">
         <i class="icon icon-fast"></i>
         <span>快捷路径</span>
-      </div>
-      <div class="el-menu-item red">
+      </li>
+      <li class="el-menu-item red" @click="toPage('/questions/recycle')">
         <i class="el-icon-delete" style="font-size: 16px"></i>
         <span>回收站</span>
-      </div>
-    </div>
+      </li>
+    </ul> -->
   </div>
 </template>
 
@@ -111,7 +135,9 @@ const MENU_ICONS = {
 import { mapMutations } from "vuex";
 import { UPDATE_CURRENT_PATHS } from "../../store/currentPaths";
 import { UPDATE_MENU_LIST } from "../../store/menuList";
-
+const localMenusConfig = {
+  Recycle: "回收站",
+};
 export default {
   name: "HomeSide",
   data() {
@@ -146,6 +172,9 @@ export default {
   },
   methods: {
     ...mapMutations([UPDATE_CURRENT_PATHS, UPDATE_MENU_LIST]),
+    toPage(path) {
+      this.$router.push(path);
+    },
     toggoleSidebar() {
       this.isCollapse = !this.isCollapse;
     },
@@ -173,8 +202,11 @@ export default {
       this.curRoutePath = curRoutePath;
       let currentPaths = [];
       let part = this.menuList.find((v) => v.ext5 === curRoutePath);
+
       if (!part) {
-        this.UPDATE_CURRENT_PATHS([]);
+        this.UPDATE_CURRENT_PATHS(
+          [localMenusConfig[this.$route.name]].filter(Boolean)
+        );
         return;
       }
       currentPaths.unshift(part.name);
@@ -184,6 +216,7 @@ export default {
       }
       // console.log(currentPaths);
       this.UPDATE_CURRENT_PATHS(currentPaths);
+      console.log("currentPaths", currentPaths);
     },
   },
 };
@@ -213,16 +246,18 @@ export default {
     .el-menu-item {
       height: 40px;
       line-height: 40px;
+      font-weight: bold;
       &:not(:last-child) {
         i {
           margin-right: 9px;
-          margin-left: 3px;
+          margin-left: 20px;
         }
       }
       &.red {
-        color: #f76560;
+        color: #f76560 !important;
         i {
           color: #f76560;
+          margin-left: 16px;
         }
       }
     }

+ 9 - 0
src/modules/question/router.js

@@ -1,6 +1,7 @@
 import QuestionManage from "./views/QuestionManage";
 import QuestionRecycle from "./views/QuestionRecycle";
 import SourceDetailManage from "./views/SourceDetailManage";
+import Recycle from "./views/Recycle.vue";
 
 export default [
   {
@@ -18,4 +19,12 @@ export default [
     name: "SourceDetailManage",
     component: SourceDetailManage,
   },
+  {
+    path: "/recycle",
+    name: "Recycle",
+    component: Recycle,
+    meta: {
+      breadTitle: "回收站",
+    },
+  },
 ];

+ 91 - 42
src/modules/question/views/QuestionRecycle.vue

@@ -1,38 +1,62 @@
 <template>
   <div class="content question-recycle">
-    <div class="part-box">
-      <div class="part-box-header">
+    <!-- <div class="part-box-header">
         <h2 class="part-box-title">回收站</h2>
 
         <el-button type="danger" plain @click="goback">返回</el-button>
-      </div>
+      </div> -->
+    <el-form class="part-filter-form" inline :model="searchForm">
+      <el-form-item label="课程">
+        <el-select
+          v-model="searchForm.courseId"
+          :remote-method="getCoursesList"
+          :loading="courseLoading4Search"
+          remote
+          filterable
+          clearable
+          placeholder="请选择"
+          @clear="getCoursesList('')"
+        >
+          <el-option
+            v-for="item in courseList"
+            :key="item.id"
+            :label="item.name + ' - ' + item.code"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="handleCurrentChange(1)">
+          查询
+        </el-button>
+      </el-form-item>
+    </el-form>
 
-      <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 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>
 
@@ -97,36 +121,61 @@ import {
   thoroughDeleteQuestionApi,
   clearQuestionRecycleApi,
 } from "../api";
-
+import { courseQueryApi } from "../../card/api";
 export default {
   name: "QuestionRecycle",
   data() {
     return {
+      courseList: [],
       dataList: [],
       loading: false,
       recycleParamList: [],
+      courseLoading4Search: false,
+      searchForm: {
+        courseId: "",
+      },
+      currentPage: 1,
+      pageSize: 10,
+      total: 10,
     };
   },
-  mounted() {
-    this.toPage(1);
+  created() {
+    this.getCoursesList();
+    this.handleCurrentChange(1);
   },
   methods: {
-    toPage(page) {
-      this.currentPage = page;
-      this.getList();
+    handleSizeChange(val) {
+      this.currentPage = 1;
+      this.pageSize = val;
+      this.search();
     },
-    async getList() {
+    handleCurrentChange(val) {
+      this.currentPage = val;
+      this.search();
+    },
+    async getCoursesList(query) {
+      this.courseLoading4Search = true;
+      const res = await courseQueryApi(query);
+      this.courseList = res.data || [];
+      this.courseLoading4Search = false;
+    },
+    async search() {
       this.recycleParamList = [];
       this.loading = true;
-      const res = await questionRecycleListApi().catch(() => {});
+      const res = await questionRecycleListApi({
+        ...this.searchForm,
+        pageNumber: this.currentPage,
+        pageSize: this.pageSize,
+      }).catch(() => {});
       this.loading = false;
       if (!res) return;
-      res.data.forEach((item) => {
+      this.total = res.data.totalElements;
+      (res.data.content || []).forEach((item) => {
         if (item.recycleType === "QUESTION") {
           item.name = item.name ? JSON.parse(item.name) : null;
         }
       });
-      this.dataList = res.data;
+      this.dataList = res.data.content || [];
     },
     tableSelectChange(selections) {
       this.recycleParamList = selections.map((item) => {
@@ -151,7 +200,7 @@ export default {
         message: "操作成功",
         type: "success",
       });
-      this.toPage(1);
+      this.handleCurrentChange(1);
     },
     async toDelete(row) {
       const confirm = await this.$confirm("确认彻底删除数据吗?", "提示", {
@@ -179,7 +228,7 @@ export default {
         message: "删除成功",
         type: "success",
       });
-      this.getList();
+      this.search();
     },
     async toBatchDelete() {
       if (!this.recycleParamList.length) {
@@ -218,7 +267,7 @@ export default {
         message: "操作成功",
         type: "success",
       });
-      this.getList();
+      this.search();
     },
     async toBatchRecover() {
       if (!this.recycleParamList.length) {

+ 30 - 0
src/modules/question/views/Recycle.vue

@@ -0,0 +1,30 @@
+<template>
+  <div class="recycle">
+    <div class="part-box">
+      <el-tabs v-model="curTab" type="card">
+        <el-tab-pane label="试题" name="tab1">
+          <QuestionRecycle></QuestionRecycle>
+        </el-tab-pane>
+        <el-tab-pane label="试卷" name="tab2">
+          <PaperRecycle></PaperRecycle>
+        </el-tab-pane>
+      </el-tabs>
+    </div>
+  </div>
+</template>
+
+<script>
+import PaperRecycle from "@/modules/paper/views/PaperRecycle.vue";
+import QuestionRecycle from "@/modules/question/views/QuestionRecycle.vue";
+export default {
+  name: "Recycle",
+  components: { PaperRecycle, QuestionRecycle },
+  data() {
+    return {
+      curTab: "tab1",
+    };
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>

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

@@ -43,6 +43,7 @@ import CheckDuplicateList from "../views/CheckDuplicateList.vue";
 import CheckDuplicateInfo from "../views/CheckDuplicateInfo.vue";
 import License from "../views/License.vue";
 import QuestionHome from "../views/Home";
+import Recycle from "../../question/views/Recycle.vue";
 
 export const menuRoutes = [
   {
@@ -120,6 +121,11 @@ export const menuRoutes = [
         component: QuestionRecycle,
         name: "QuestionRecycle",
       },
+      {
+        path: "recycle",
+        name: "Recycle",
+        component: Recycle,
+      },
       {
         path: "source_detail_manage", // 题型管理
         component: SourceDetailManage,