|
@@ -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);
|
|
|
},
|
|
|
},
|
|
|
};
|