|
|
|
@ -149,20 +149,28 @@ class ExamPaperList extends Component<any, States> { |
|
|
|
|
const newStatus = paperStatus === 0? 1 : 0; |
|
|
|
|
const newStatusText = paperStatus === 0? '启用' : '停用'; |
|
|
|
|
const idList = [id]; |
|
|
|
|
upPaperStatus(idList, newStatus).then((res) => { |
|
|
|
|
const success = res['success']; |
|
|
|
|
if (success) { |
|
|
|
|
message.success(`${newStatusText}成功`); |
|
|
|
|
this.setState((prevState) => ({ |
|
|
|
|
list: prevState.list.map((item) => |
|
|
|
|
item.id === id? { ...item, paperStatus: newStatus } : item |
|
|
|
|
) |
|
|
|
|
})); |
|
|
|
|
} else { |
|
|
|
|
message.error(`${newStatusText}失败,请稍后重试`); |
|
|
|
|
} |
|
|
|
|
}).catch(() => { |
|
|
|
|
message.error(`${newStatusText}时发生错误,请检查`); |
|
|
|
|
Modal.confirm({ |
|
|
|
|
title: `确认${newStatusText}`, |
|
|
|
|
content: `你确定要${newStatusText}这个试卷吗?`, |
|
|
|
|
onOk: () => { |
|
|
|
|
upPaperStatus(idList, newStatus).then((res) => { |
|
|
|
|
const success = res['success']; |
|
|
|
|
if (success) { |
|
|
|
|
message.success(`${newStatusText}成功`); |
|
|
|
|
this.setState((prevState) => ({ |
|
|
|
|
list: prevState.list.map((item) => |
|
|
|
|
item.id === id? { ...item, paperStatus: newStatus } : item |
|
|
|
|
) |
|
|
|
|
})); |
|
|
|
|
} else { |
|
|
|
|
message.error(`${newStatusText}失败,请稍后重试`); |
|
|
|
|
} |
|
|
|
|
}).catch(() => { |
|
|
|
|
message.error(`${newStatusText}时发生错误,请检查`); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
onCancel: () => { |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -269,7 +277,11 @@ class ExamPaperList extends Component<any, States> { |
|
|
|
|
dataIndex: 'examDuration', |
|
|
|
|
key: 'examDuration', |
|
|
|
|
align: 'center', |
|
|
|
|
width: 120 |
|
|
|
|
width: 120, |
|
|
|
|
render: (examDuration: any, record: any) => { |
|
|
|
|
const unit = String(record.durationType) === '1'? '分(min)' : '时(h)'; |
|
|
|
|
return `${examDuration} ${unit}`; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '状态', |
|
|
|
|