|
@@ -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) {
|