题库管理和试卷管理代码提交

main
hujunpeng 3 months ago
parent af2ec9c3b3
commit a0ee60876b
  1. 8
      packages/examination/src/views/question/questionAdd.tsx
  2. 2
      packages/examination/src/views/question/questionList.tsx

@ -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);

@ -213,7 +213,7 @@ class QuestionList extends Component<any, States> {
dataIndex: 'serviceTypeId', dataIndex: 'serviceTypeId',
key: 'serviceTypeId', key: 'serviceTypeId',
align: 'center', align: 'center',
width: 150, width: 160,
render: (serviceTypeId: any) => { render: (serviceTypeId: any) => {
const serviceType = serviceTypeDict?.find((item: any) => item.dictKey === serviceTypeId); const serviceType = serviceTypeDict?.find((item: any) => item.dictKey === serviceTypeId);
return serviceType? serviceType.dictValue : serviceTypeId; return serviceType? serviceType.dictValue : serviceTypeId;

Loading…
Cancel
Save