考试记录删除
This commit is contained in:
parent
52edb6a399
commit
2b8e63517e
|
@ -141,3 +141,10 @@ export function exportwTest(id,data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function deleteExamtest(id) {
|
||||||
|
return request({
|
||||||
|
url: `/examtest/examtest/${id}/`,
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
|
@ -54,7 +54,7 @@
|
||||||
icon="el-icon-refresh-left"
|
icon="el-icon-refresh-left"
|
||||||
@click="resetFilter"
|
@click="resetFilter"
|
||||||
>刷新重置</el-button>
|
>刷新重置</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 style="margin-top:10px">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,6 +111,12 @@
|
||||||
size="small"
|
size="small"
|
||||||
@click="handleExport2(scope)"
|
@click="handleExport2(scope)"
|
||||||
>重新生成</el-button>
|
>重新生成</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.type=='正式考试'"
|
||||||
|
type="danger"
|
||||||
|
size="small"
|
||||||
|
@click="handleDelete(scope)"
|
||||||
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -125,7 +131,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getExamTestlist, exportTest, exportwTest } from "@/api/examtest";
|
import { getExamTestlist, exportTest, exportwTest, deleteExamtest } from "@/api/examtest";
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
import Pagination from "@/components/Pagination";
|
import Pagination from "@/components/Pagination";
|
||||||
|
|
||||||
|
@ -236,6 +242,24 @@ export default {
|
||||||
window.open(res.data.path, "_blank");
|
window.open(res.data.path, "_blank");
|
||||||
}).catch(e=>{loading.close()})
|
}).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) {
|
handleExport2(scope) {
|
||||||
const loading = this.$loading({text: '正在重新生成word...',});
|
const loading = this.$loading({text: '正在重新生成word...',});
|
||||||
exportwTest(scope.row.id, {anew:true}).then(res=>{
|
exportwTest(scope.row.id, {anew:true}).then(res=>{
|
||||||
|
@ -264,7 +288,8 @@ export default {
|
||||||
|
|
||||||
this.getList()
|
this.getList()
|
||||||
|
|
||||||
}
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</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
|
pagination_class = CommonPagination
|
||||||
queryset = ExamTest.objects.filter(is_delete=0).all()
|
queryset = ExamTest.objects.filter(is_delete=0).all()
|
||||||
serializer_class = ExamTestListSerializer
|
serializer_class = ExamTestListSerializer
|
||||||
|
|
Loading…
Reference in New Issue