From 09876b72eecd5964a07f4c6ae3dc3d660740f368 Mon Sep 17 00:00:00 2001 From: hujunpeng Date: Fri, 28 Mar 2025 15:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=95=E9=A2=98=E5=92=8C=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/examPaper/examPaperAdd.tsx | 11 ++++++---- .../src/views/examPaper/examPaperList.tsx | 20 +++++++++++++------ .../src/views/question/questionList.tsx | 14 ++++++++++--- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/packages/examination/src/views/examPaper/examPaperAdd.tsx b/packages/examination/src/views/examPaper/examPaperAdd.tsx index 4daa61b..ee8ea9c 100644 --- a/packages/examination/src/views/examPaper/examPaperAdd.tsx +++ b/packages/examination/src/views/examPaper/examPaperAdd.tsx @@ -206,7 +206,7 @@ class ExamPaperAdd extends Component { // 手动选题 handleOpenModal = () => { const { questions, selectedQuestionList } = this.state; - this.formRef.current.validateFields(['industryId']) + this.formRef.current.validateFields(['industryId', 'questionCount']) .then((values: any) => { const industryId = values.industryId; const questionCount = values.questionCount; @@ -313,7 +313,6 @@ class ExamPaperAdd extends Component { if (this.formRefSub.current) { this.formRefSub.current.resetFields(); } - this.formRef.current.setFieldsValue({ questionCount : selectedQuestionList.length }); }; // 保存试卷 @@ -367,7 +366,7 @@ class ExamPaperAdd extends Component { selectedRowKeys, skipValidation, questionCountSum, - total + selectedParams } = this.state; const changePage = (current: number, pageSize: number) => { @@ -695,7 +694,7 @@ class ExamPaperAdd extends Component {

已选列表

- {selectedQuestionList.length}/{total} + {selectedQuestionList.length}/{selectedParams.questionCount}
{ item => !deselectedIds.includes(item.id) ); + if(finalSelectedQuestionList.length > selectedParams.questionCount){ + message.warning('选择的问题数量超过了允许的最大题目数量'); + return; + } const selectedRowKeys = finalSelectedQuestionList.map(item => String(item.id)); this.setState({ selectedQuestionList: finalSelectedQuestionList, diff --git a/packages/examination/src/views/examPaper/examPaperList.tsx b/packages/examination/src/views/examPaper/examPaperList.tsx index 4a3c0db..6c9044e 100644 --- a/packages/examination/src/views/examPaper/examPaperList.tsx +++ b/packages/examination/src/views/examPaper/examPaperList.tsx @@ -323,12 +323,20 @@ class ExamPaperList extends Component { width: 200, render: (record: any) => [ { - this.props.history.push({ - pathname: '/examPaperAdd', - state: { - id: String(record.id), - isEdit: "true" - } + Modal.confirm({ + title: `确认修改`, + content: `是否修改试卷?`, + onOk: () => { + this.props.history.push({ + pathname: '/examPaperAdd', + state: { + id: String(record.id), + isEdit: "true" + } + }); + }, + onCancel: () => { + }, }); }}>编辑, { diff --git a/packages/examination/src/views/question/questionList.tsx b/packages/examination/src/views/question/questionList.tsx index 517f4b4..bca78dc 100644 --- a/packages/examination/src/views/question/questionList.tsx +++ b/packages/examination/src/views/question/questionList.tsx @@ -266,9 +266,17 @@ class QuestionList extends Component { this.handleDeleteQuestion(record.id); }}>删除, { - this.props.history.push({ - pathname: '/questionEdit', - state: { id: record.id } + Modal.confirm({ + title: `确认修改`, + content: `是否修改试题?`, + onOk: () => { + this.props.history.push({ + pathname: '/questionEdit', + state: { id: record.id } + }); + }, + onCancel: () => { + }, }); }}>修正 ]