From 4f26d97ff9126fa34c905a7bc5810f5d2eda9593 Mon Sep 17 00:00:00 2001 From: zty Date: Mon, 3 Jun 2024 14:14:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=9E=E7=8E=B0=E8=B6=85=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=8B=A5=E6=9C=89=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4questions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/dist/index.html | 2 +- client/src/api/exam.js | 13 +++++++++-- client/src/views/exam/questions.vue | 36 ++++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/client/dist/index.html b/client/dist/index.html index 4b77dbf..48785cb 100644 --- a/client/dist/index.html +++ b/client/dist/index.html @@ -1 +1 @@ -vue Admin Template
\ No newline at end of file +vue Admin Template
\ No newline at end of file diff --git a/client/src/api/exam.js b/client/src/api/exam.js index 903ddb3..b574dd7 100644 --- a/client/src/api/exam.js +++ b/client/src/api/exam.js @@ -27,10 +27,11 @@ export function updateQuestioncat(id, data) { //删除题目类型 export function deleteQuestioncat(id) { return request({ - url: `/exam/questioncat/${id}/`, + url: `/exam/question/${id}/`, method: 'delete' }) } + //题目列表 export function getQuestionList(query) { return request({ @@ -69,6 +70,14 @@ export function deleteQuestion(id) { method: 'delete' }) } + //批量删除题目类型 + export function deletesQuestion(data) { + return request({ + url: `/exam/question/deletes/`, + method: 'post', + data + }) + } //导入题目 export function importQuestion(data) { return request({ @@ -82,7 +91,7 @@ export function exportQuestion(data) { return request({ url: `/exam/question/export/`, method: 'get', - params: query + params: data }) } //启用题目 diff --git a/client/src/views/exam/questions.vue b/client/src/views/exam/questions.vue index cb9456a..8181cc6 100644 --- a/client/src/views/exam/questions.vue +++ b/client/src/views/exam/questions.vue @@ -36,7 +36,8 @@ Excel导入 - 导出Excel + 导出Excel + 批量删除 { loading.close() if (response.code == 200) { @@ -235,15 +236,44 @@ export default { // console.error(err); }); }, - exportQuestion() { + exportQuestions() { const loading = this.$loading({ text: '正在准备..' }); + console.log(this.listQuery) exportQuestion(this.listQuery).then(response => { loading.close() window.open(response.data.path, "_blank"); }).catch(e => { loading.close() }); }, + batchDelete() { + if (this.selects.length === 0) { + this.$message({ + message: '请选择要删除的项', + type: 'warning' + }); + return; + }else{ + // 删除前的提示 + this.$confirm("确认删除记录吗?", "提示", { + type: "warning", + }).then(() => { + console.log(this.selects) + this.deleteItems(this.selects); + this.getList()}); + } + }, + deleteItems(ids){ + let item = {ids:ids}; + deletesQuestion(item).then(response => { + if (response.code == 200) { + this.$message.success("删除成功"); + this.getList(); + } else { + this.$message.error(response.msg); + } + }); + }, changeSort(val) { if (val.order == "ascending") { this.listQuery.ordering = val.prop;