|
|
@ -85,7 +85,9 @@ class QuestionAdd extends Component<any, States> { |
|
|
|
// 新增试题
|
|
|
|
// 新增试题
|
|
|
|
handleAddNewQuestion = () => { |
|
|
|
handleAddNewQuestion = () => { |
|
|
|
const { formIds } = this.state; |
|
|
|
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 = { |
|
|
|
const formValues = { |
|
|
|
[`questionTypes_${newId}`]: "1" |
|
|
|
[`questionTypes_${newId}`]: "1" |
|
|
|
}; |
|
|
|
}; |
|
|
@ -206,6 +208,10 @@ class QuestionAdd extends Component<any, States> { |
|
|
|
const formIds: string[] = []; |
|
|
|
const formIds: string[] = []; |
|
|
|
const questionTypesMap = {}; |
|
|
|
const questionTypesMap = {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (rows.length === 0) { |
|
|
|
|
|
|
|
message.warn('导入的文件中没有有效数据行'); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
rows.forEach((row: any, index) => { |
|
|
|
rows.forEach((row: any, index) => { |
|
|
|
const formId = `form_${index}`; |
|
|
|
const formId = `form_${index}`; |
|
|
|
formIds.push(formId); |
|
|
|
formIds.push(formId); |
|
|
|