xialiang 3 years ago
parent 01358c446c
commit 19a4f9be39

@ -207,7 +207,7 @@ const ExaminationRules: React.FC = () => {
valueType: 'option',
width: 100,
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => {
console.log(record, 'record')
// console.log(record, 'record')
return [
// <a
// key="detail"

@ -1,6 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { history, useParams, useRequest } from 'umi';
import { ModalForm, ProFormInstance } from '@ant-design/pro-form';
import type { ProFormInstance } from '@ant-design/pro-form';
import { ModalForm } from '@ant-design/pro-form';
import { ProFormRadio } from '@ant-design/pro-form';
import ProForm, { StepsForm, ProFormText, ProFormSelect, ProFormDateRangePicker } from '@ant-design/pro-form';
import ProCard from '@ant-design/pro-card';
@ -10,7 +11,8 @@ import ProDescriptions from '@ant-design/pro-descriptions';
import styles from './index.less'
import { saveRules, querySubjectList, queryRulesView, queryRulesList, queryRulesPaper, saveQuestionTypeScore, autoPaperOfficial, queryPaperQuestionList, updateScore } from '../../service';
import { queryQuestionList, queryQuestionType } from '@/pages/questionbank/service';
import ProTable, { ActionType, EditableProTable, ProColumns } from '@ant-design/pro-table';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable, { EditableProTable } from '@ant-design/pro-table';
//import { TableListPagination } from '@/pages/ListTableList2/data';
import { DiffOutlined, ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons';
//import { TableListItem } from '../../components/QuestionSelector';
@ -59,8 +61,10 @@ export default () => {
}, {
manual: true,
formatResult: (result) => {
return result?.question_list;
}});
}
});
@ -170,7 +174,7 @@ export default () => {
valueType: 'text',
hideInSearch: true,
hideInForm: false,
renderText: (val: string) => `${val || '-'}`,
renderText: (val: string) => `${val || '0'}`,
},
{
title: '通过线',
@ -179,7 +183,7 @@ export default () => {
valueType: 'text',
hideInSearch: true,
hideInForm: false,
renderText: (val: string) => `${val || '-'}`,
renderText: (val: string) => `${val || '0'}`,
},
{
title: '操作',
@ -187,7 +191,7 @@ export default () => {
valueType: 'option',
width: 220,
render: (_dom: any, record: React.SetStateAction) => {
console.log(record, 'record')
// console.log(record, 'record')
return [
<Button
type='link'
@ -490,26 +494,40 @@ export default () => {
}
);
const _questionType = [];
const _questionTypeCountData = [];
_data.question_list[0]?.question_type_count.forEach((item) => {
_questionTypeCountData.push(item.count)
_questionType.push({ typeName: item.type_name, code: item.question_type })
})
console.log('_questionTypeCountData', _questionTypeCountData)
const _questionType = [];
console.log('_data.question_type_score', _data.question_type_score)
if (_data?.question_type_score.length > 0) {
_data.question_type_score?.forEach((item, index) => {
_questionType.push({count: _questionTypeCountData[index], score: item.score, score_harf: item.score_harf})
_questionType[index] = { ..._questionType[index], count: _questionTypeCountData[index], score: item.score, score_harf: item.score_harf }
})
} else {
_questionTypeCountData?.forEach((item, index) => {
_questionType.push({count: _questionTypeCountData[index], score:0, score_harf: 0})
_questionType[index] = { ..._questionType[index], count: _questionTypeCountData[index], score: 0, score_harf: 0 }
})
}
console.log('_questionType', _questionType)
// question_type_count
console.log('_questionType 1', _questionType)
setQuestionTypeValues(_questionType)
return {
current: _data?.pageNumber,
data: _data?.question_list,
@ -599,7 +617,7 @@ export default () => {
return true;
}}
>
<AutoSelector ref={autoRef} questionType={questionType} />
<AutoSelector ref={autoRef} questionType={questionType} ruleData = {ruleData} />
</ModalForm>
<ModalForm
title={`批量设置分值`}
@ -627,6 +645,7 @@ export default () => {
//setSumScore(_sumScore)
// setUuidPaper(paper?.paper_uuid)
// message.success('提交成功');
actionRef.current?.reloadAndRest?.();
handleScoreModalVisible(false)
return true;
}}
@ -634,7 +653,8 @@ export default () => {
<ScoreSetter ref={setterRef} questionTypeValues={questionTypeValues || false} />
</ModalForm>
<ModalForm
title={`试卷详情`}
// title={`试卷详情`}
title={ruleData?.rules_name}
//
width="80%"
visible={paperModalVisible}
@ -651,17 +671,19 @@ export default () => {
return true;
}}
>
{questionType && questionType?.map((typeItem, index)=>{
//console.log('questionType:::', questionType)
{questionTypeValues && questionTypeValues?.map((typeItem, index) => {
console.log('questionType:::', typeItem)
return <>
{questions?.length === 0 && <div></div>}
<div key={typeItem?.code} style={{padding:10, fontSize:16}}>{numberType[index]}. {typeItem?.name}</div>
{/* 题型 */}
<div key={typeItem?.code} style={{ padding: 10, fontSize: 16 }}>{numberType[index]}. {typeItem?.typeName} ({typeItem?.count})</div>
{/* 试题列表 */}
<div style={{ padding: '0 10px 0 50px' }}>
{questions && questions.map((item, idx) => (
(typeItem?.code === item?.question_type) &&
<div style={{ border: 'none' }}>
<Typography style={{ marginBottom: 16, fontSize: 14, padding: '15px 15px 0 15px' }}>
{questionNumber[item?.question_type]++}. {item?.question_stem}
{questionNumber[item?.question_type]++}. {typeItem?.typeName},{typeItem?.score}{item?.question_stem}
</Typography>
{(item?.question_type === 0) && // 单选题
<div style={{ padding: '0 15px 15px 15px' }}>

Loading…
Cancel
Save