考试记录删除
This commit is contained in:
parent
52edb6a399
commit
2b8e63517e
|
@ -140,4 +140,11 @@ export function exportwTest(id,data) {
|
|||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteExamtest(id) {
|
||||
return request({
|
||||
url: `/examtest/examtest/${id}/`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
|
@ -54,7 +54,7 @@
|
|||
icon="el-icon-refresh-left"
|
||||
@click="resetFilter"
|
||||
>刷新重置</el-button>
|
||||
<el-button type="primary" icon="el-icon-download" @click="exportTest">导出Excel</el-button>
|
||||
<el-button type="primary" icon="el-icon-download" @click="exportTest" >导出Excel</el-button>
|
||||
<div style="margin-top:10px">
|
||||
</div>
|
||||
</div>
|
||||
|
@ -111,6 +111,12 @@
|
|||
size="small"
|
||||
@click="handleExport2(scope)"
|
||||
>重新生成</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.type=='正式考试'"
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="handleDelete(scope)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -125,7 +131,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getExamTestlist, exportTest, exportwTest } from "@/api/examtest";
|
||||
import { getExamTestlist, exportTest, exportwTest, deleteExamtest } from "@/api/examtest";
|
||||
import checkPermission from "@/utils/permission";
|
||||
import Pagination from "@/components/Pagination";
|
||||
|
||||
|
@ -236,6 +242,24 @@ export default {
|
|||
window.open(res.data.path, "_blank");
|
||||
}).catch(e=>{loading.close()})
|
||||
},
|
||||
handleDelete(scope){
|
||||
this.$confirm("确认删除该考试记录吗?将丢失数据!", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error"
|
||||
})
|
||||
.then(async () => {
|
||||
await deleteExamtest(scope.row.id);
|
||||
this.getList()
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "成功删除!"
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
handleExport2(scope) {
|
||||
const loading = this.$loading({text: '正在重新生成word...',});
|
||||
exportwTest(scope.row.id, {anew:true}).then(res=>{
|
||||
|
@ -264,7 +288,8 @@ export default {
|
|||
|
||||
this.getList()
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -342,7 +342,7 @@ class ExamTestViewSet(ModelViewSet):
|
|||
"""
|
||||
考试记录列表和详情
|
||||
"""
|
||||
perms_map = [{'get': 'examtest_view'},{'post': '*'}]
|
||||
perms_map = [{'get': 'examtest_view'},{'post': '*'}, {'delete':'examtest_delete'}]
|
||||
pagination_class = CommonPagination
|
||||
queryset = ExamTest.objects.filter(is_delete=0).all()
|
||||
serializer_class = ExamTestListSerializer
|
||||
|
|
Loading…
Reference in New Issue