From a0ee60876b1b627f617389710400a05ecdb2ef38 Mon Sep 17 00:00:00 2001 From: hujunpeng Date: Mon, 24 Mar 2025 16:47:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=98=E5=BA=93=E7=AE=A1=E7=90=86=E5=92=8C?= =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=AE=A1=E7=90=86=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/examination/src/views/question/questionAdd.tsx | 8 +++++++- packages/examination/src/views/question/questionList.tsx | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/examination/src/views/question/questionAdd.tsx b/packages/examination/src/views/question/questionAdd.tsx index a1f1f68..dba709c 100644 --- a/packages/examination/src/views/question/questionAdd.tsx +++ b/packages/examination/src/views/question/questionAdd.tsx @@ -85,7 +85,9 @@ class QuestionAdd extends Component { // 新增试题 handleAddNewQuestion = () => { const { formIds } = this.state; - const newId = `form_${formIds.length}`; + const lastId = formIds[formIds.length - 1]; + const lastNumber = parseInt(lastId.split('_')[1], 10); + const newId = `form_${lastNumber + 1}`; const formValues = { [`questionTypes_${newId}`]: "1" }; @@ -206,6 +208,10 @@ class QuestionAdd extends Component { const formIds: string[] = []; const questionTypesMap = {}; + if (rows.length === 0) { + message.warn('导入的文件中没有有效数据行'); + return; + } rows.forEach((row: any, index) => { const formId = `form_${index}`; formIds.push(formId); diff --git a/packages/examination/src/views/question/questionList.tsx b/packages/examination/src/views/question/questionList.tsx index 4f24b63..b2def50 100644 --- a/packages/examination/src/views/question/questionList.tsx +++ b/packages/examination/src/views/question/questionList.tsx @@ -213,7 +213,7 @@ class QuestionList extends Component { dataIndex: 'serviceTypeId', key: 'serviceTypeId', align: 'center', - width: 150, + width: 160, render: (serviceTypeId: any) => { const serviceType = serviceTypeDict?.find((item: any) => item.dictKey === serviceTypeId); return serviceType? serviceType.dictValue : serviceTypeId;