xialiang 3 years ago
parent 01358c446c
commit 19a4f9be39

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

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

Loading…
Cancel
Save