Commit 4c392706 by yuananting

fix:试卷删除确认补充

parent 6a156684
......@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-04-07 15:33:33
* @LastEditTime: 2021-04-08 10:03:45
* @Description: 助学工具-题库-试卷列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -135,29 +135,45 @@ class PaperList extends Component {
// 删除试卷
deletePaper = (record) => {
if (record.relatedExam === 0) {
let params = {
paperId: record.paperId,
source: 0,
tenantId: User.getStoreId(),
userId: User.getStoreUserId(),
};
AidToolService.deletePaper(params).then((res) => {
if (res.success) {
message.success("删除成功");
const { query, total } = this.state;
const { size, current } = query;
const _query = query;
if (total / size < current) {
if (total % size === 1) {
_query.current = 1;
}
let params = {
paperId: record.paperId,
source: 0,
tenantId: User.getStoreId(),
userId: User.getStoreUserId(),
};
AidToolService.deletePaper(params).then((res) => {
if (res.success) {
message.success("删除成功");
const { query, total } = this.state;
const { size, current } = query;
const _query = query;
if (total / size < current) {
if (total % size === 1) {
_query.current = 1;
}
this.setState({ query: _query }, () => {
this.queryPaperPageList();
Bus.trigger("queryCategoryTree", "remain");
});
}
this.setState({ query: _query }, () => {
this.queryPaperPageList();
Bus.trigger("queryCategoryTree", "remain");
});
}
});
}
// 删除试卷确认
confirmDeletePaper = (record) => {
if (record.relatedExam === 0) {
return Modal.confirm({
title: "删除试卷",
content: "确认要删除该试卷吗?",
icon: (
<span className="icon iconfont default-confirm-icon">&#xe839; </span>
),
okText: "删除",
cancelText: "取消",
onOk: () => {
this.deletePaper(record);
},
});
} else {
return Modal.info({
......@@ -285,7 +301,7 @@ class PaperList extends Component {
<span onClick={() => this.editPaper(item)}>编辑</span>
</Menu.Item>
<Menu.Item key="del">
<span onClick={() => this.deletePaper(item)}>删除</span>
<span onClick={() => this.confirmDeletePaper(item)}>删除</span>
</Menu.Item>
</Menu>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment