|
|
|
@ -1,8 +1,9 @@
|
|
|
|
|
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 ProForm, { StepsForm, ProFormText, ProFormSelect, ProFormDateRangePicker } from '@ant-design/pro-form';
|
|
|
|
|
import ProCard from '@ant-design/pro-card';
|
|
|
|
|
import { Button, Checkbox, Col, Divider, Input, List, Menu, message, Radio, Row, Space, Typography } from 'antd';
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
@ -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';
|
|
|
|
@ -21,22 +23,22 @@ import { getSubjectInfo } from '@/pages/course/subject/service';
|
|
|
|
|
import { max } from 'lodash';
|
|
|
|
|
|
|
|
|
|
/** 选项序号 */
|
|
|
|
|
const labels = ['A','B','C','D','E','F','G','H','I','J','K'];
|
|
|
|
|
const labels = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'];
|
|
|
|
|
|
|
|
|
|
/** 题型序号 */
|
|
|
|
|
const numberType = ['一','二','三','四','五','六','七','八','九','十'];
|
|
|
|
|
const numberType = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
|
const questionNumber = [1,1,1];
|
|
|
|
|
const questionNumber = [1, 1, 1];
|
|
|
|
|
const params = useParams();
|
|
|
|
|
|
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
const setterRef = useRef();
|
|
|
|
|
const autoRef = useRef();
|
|
|
|
|
|
|
|
|
|
const [currentStep, setCurrentStep] = useState(0);
|
|
|
|
|
const [currentStep, setCurrentStep] = useState(0);
|
|
|
|
|
|
|
|
|
|
const [questionTypeValues, setQuestionTypeValues] = useState([]); // 题型数据[{count:0, score:0, score_harf:0}]
|
|
|
|
|
const [questionType, setQuestionType] = useState([]); // 题型
|
|
|
|
@ -56,11 +58,13 @@ export default () => {
|
|
|
|
|
const { data: questions, run } = useRequest(async (params) => {
|
|
|
|
|
console.log('questions', questions)
|
|
|
|
|
return queryPaperQuestionList(params);
|
|
|
|
|
},{
|
|
|
|
|
}, {
|
|
|
|
|
manual: true,
|
|
|
|
|
formatResult: (result) => {
|
|
|
|
|
return result?.question_list;
|
|
|
|
|
}});
|
|
|
|
|
|
|
|
|
|
return result?.question_list;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -127,9 +131,9 @@ export default () => {
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: true,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
render: (dom, record,index) => {
|
|
|
|
|
render: (dom, record, index) => {
|
|
|
|
|
return <>
|
|
|
|
|
{record.question_type_count.map((item)=>{return <span style={{paddingRight:15}}>{`${item.type_name} ${item.count} 题`}</span>})}
|
|
|
|
|
{record.question_type_count.map((item) => { return <span style={{ paddingRight: 15 }}>{`${item.type_name} ${item.count} 题`}</span> })}
|
|
|
|
|
</>
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -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'
|
|
|
|
@ -197,13 +201,13 @@ export default () => {
|
|
|
|
|
//setCurrentRow(record);
|
|
|
|
|
//
|
|
|
|
|
run({
|
|
|
|
|
paper_id: record?.paper_id,
|
|
|
|
|
paper_id: record?.paper_id,
|
|
|
|
|
}); // 获取试卷试题列表
|
|
|
|
|
handlePaperModalVisible(true); // 试卷详情
|
|
|
|
|
}}
|
|
|
|
|
style={{fontSize:14, padding:'0 2px 0 0'}}
|
|
|
|
|
style={{ fontSize: 14, padding: '0 2px 0 0' }}
|
|
|
|
|
>
|
|
|
|
|
查看
|
|
|
|
|
查看
|
|
|
|
|
</Button>,
|
|
|
|
|
<Button
|
|
|
|
|
type='link'
|
|
|
|
@ -212,28 +216,28 @@ export default () => {
|
|
|
|
|
//history.push(`/examination/option/registration/${record.examination_id}`);
|
|
|
|
|
//setCurrentRow(record);
|
|
|
|
|
const _type_count: any[] = [];
|
|
|
|
|
record?.question_type_count.forEach((item: { count: any; })=>{
|
|
|
|
|
record?.question_type_count.forEach((item: { count: any; }) => {
|
|
|
|
|
_type_count.push(item?.count || 0)
|
|
|
|
|
})
|
|
|
|
|
const { success } = await autoPaperOfficial(
|
|
|
|
|
{
|
|
|
|
|
paper_id: record?.paper_id,
|
|
|
|
|
rules_id: Number(params?.id || rulesId),
|
|
|
|
|
rules_id: Number(params?.id || rulesId),
|
|
|
|
|
question_count: '50,50', // 当前数据库没保存,只能采用默认
|
|
|
|
|
question_type_count: _type_count?.toString()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
if(success){
|
|
|
|
|
message.success('试卷生成成功')
|
|
|
|
|
if (success) {
|
|
|
|
|
message.success('试卷生成成功')
|
|
|
|
|
actionRef.current?.reload()
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
message.success('试卷生成失败')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
style={{fontSize:14, padding:'0 2px 0 0'}}
|
|
|
|
|
style={{ fontSize: 14, padding: '0 2px 0 0' }}
|
|
|
|
|
>
|
|
|
|
|
重新生成
|
|
|
|
|
重新生成
|
|
|
|
|
</Button>,
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
@ -255,20 +259,20 @@ export default () => {
|
|
|
|
|
/** 获取题型 */
|
|
|
|
|
const { data: questionTypeData } = useRequest(() => {
|
|
|
|
|
return queryQuestionType();
|
|
|
|
|
},{
|
|
|
|
|
}, {
|
|
|
|
|
formatResult: (result) => {
|
|
|
|
|
return result.list;
|
|
|
|
|
return result.list;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setQuestionType(questionTypeData || []);
|
|
|
|
|
return ()=>{
|
|
|
|
|
/** 退出当前页面清空Map */
|
|
|
|
|
//parsingMap.clear();
|
|
|
|
|
return () => {
|
|
|
|
|
/** 退出当前页面清空Map */
|
|
|
|
|
//parsingMap.clear();
|
|
|
|
|
}
|
|
|
|
|
}, [questionTypeData]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<PageContainer content={''} extraContent={''}>
|
|
|
|
|
<ProCard className={styles.examinationrules}>
|
|
|
|
@ -302,7 +306,7 @@ export default () => {
|
|
|
|
|
}
|
|
|
|
|
console.log(fileds, 'fileds', params);
|
|
|
|
|
// return false
|
|
|
|
|
const {data} = await saveRules({
|
|
|
|
|
const { data } = await saveRules({
|
|
|
|
|
...fileds,
|
|
|
|
|
b_use: 0,
|
|
|
|
|
rules_type: 1,
|
|
|
|
@ -323,14 +327,14 @@ export default () => {
|
|
|
|
|
name="rules_name"
|
|
|
|
|
label="考试名称"
|
|
|
|
|
width="lg"
|
|
|
|
|
fieldProps={{
|
|
|
|
|
fieldProps={{
|
|
|
|
|
type: 'text',
|
|
|
|
|
allowClear: false,
|
|
|
|
|
width: 'large',
|
|
|
|
|
onInput:(e)=>{
|
|
|
|
|
onInput: (e) => {
|
|
|
|
|
const val = `${e.currentTarget?.value}`;
|
|
|
|
|
if(val.length > 50) {
|
|
|
|
|
e.currentTarget.value = val.slice(0,50)
|
|
|
|
|
if (val.length > 50) {
|
|
|
|
|
e.currentTarget.value = val.slice(0, 50)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//style:{width: '100%'}
|
|
|
|
@ -362,70 +366,70 @@ export default () => {
|
|
|
|
|
label="关联主题"
|
|
|
|
|
disabled={params?.id}
|
|
|
|
|
/>
|
|
|
|
|
<Row style={{marginBottom:24,marginTop:-7}}>
|
|
|
|
|
<Col offset={8} style={{color:'#bfbfbf'}}>关联主题选择并提交将后将不支持修改。</Col>
|
|
|
|
|
<Row style={{ marginBottom: 24, marginTop: -7 }}>
|
|
|
|
|
<Col offset={8} style={{ color: '#bfbfbf' }}>关联主题选择并提交将后将不支持修改。</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<ProFormText addonAfter={`分钟`} name="examination_time" label="考试时间"
|
|
|
|
|
initialValue={ruleData.examination_time}
|
|
|
|
|
rules={[{ required: true, message: '请输入考试时间' }]}
|
|
|
|
|
fieldProps={{
|
|
|
|
|
fieldProps={{
|
|
|
|
|
type: 'number',
|
|
|
|
|
min:1,
|
|
|
|
|
min: 1,
|
|
|
|
|
allowClear: false,
|
|
|
|
|
width: 'large',
|
|
|
|
|
onInput:(e)=>{
|
|
|
|
|
onInput: (e) => {
|
|
|
|
|
const val = `${e.currentTarget?.value}`;
|
|
|
|
|
console.log('val', val)
|
|
|
|
|
console.log('val.charAt(0)', val.charAt(0))
|
|
|
|
|
if(val.charAt(0) === ''){
|
|
|
|
|
if (val.charAt(0) === '') {
|
|
|
|
|
console.log('vvv', val)
|
|
|
|
|
e.currentTarget.value = '0'
|
|
|
|
|
}
|
|
|
|
|
if(val.length > 3) {
|
|
|
|
|
e.currentTarget.value = val.slice(0,3)
|
|
|
|
|
if (val.length > 3) {
|
|
|
|
|
e.currentTarget.value = val.slice(0, 3)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//style: {marginRight:3}
|
|
|
|
|
}}
|
|
|
|
|
// tooltip="限制考试时长的情况下,用户考试中离开,倒计时不会停止。"
|
|
|
|
|
/>
|
|
|
|
|
<Row style={{marginBottom:24,marginTop:-7}}>
|
|
|
|
|
<Col offset={8} style={{color:'#bfbfbf'}}>限制考试时长的情况下,用户考试中离开,倒计时不会停止。</Col>
|
|
|
|
|
<Row style={{ marginBottom: 24, marginTop: -7 }}>
|
|
|
|
|
<Col offset={8} style={{ color: '#bfbfbf' }}>限制考试时长的情况下,用户考试中离开,倒计时不会停止。</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
<ProFormText name="paper_count" label="试卷数量"
|
|
|
|
|
width='lg'
|
|
|
|
|
initialValue={ruleData.paper_count}
|
|
|
|
|
rules={[{ required: true, message: '请输入试卷数量' }]}
|
|
|
|
|
fieldProps={{
|
|
|
|
|
fieldProps={{
|
|
|
|
|
type: 'number',
|
|
|
|
|
min:1,
|
|
|
|
|
min: 1,
|
|
|
|
|
allowClear: false,
|
|
|
|
|
//width: 'large',
|
|
|
|
|
onInput:(e)=>{
|
|
|
|
|
onInput: (e) => {
|
|
|
|
|
const val = `${e.currentTarget?.value}`;
|
|
|
|
|
console.log('val', val)
|
|
|
|
|
console.log('val.charAt(0)', val.charAt(0))
|
|
|
|
|
if(val.charAt(0) === ''){
|
|
|
|
|
if (val.charAt(0) === '') {
|
|
|
|
|
console.log('vvv', val)
|
|
|
|
|
e.currentTarget.value = ''
|
|
|
|
|
}
|
|
|
|
|
if(val.length > 3) {
|
|
|
|
|
e.currentTarget.value = val.slice(0,3)
|
|
|
|
|
if (val.length > 3) {
|
|
|
|
|
e.currentTarget.value = val.slice(0, 3)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//style:{width: '100%'}
|
|
|
|
|
}}
|
|
|
|
|
// tooltip="限制考试时长的情况下,用户考试中离开,倒计时不会停止。"
|
|
|
|
|
/>
|
|
|
|
|
<Row style={{marginBottom:24,marginTop:-7}}>
|
|
|
|
|
<Col offset={8} style={{color:'#bfbfbf'}}>试卷数量与学生重复考试次数一致</Col>
|
|
|
|
|
<Row style={{ marginBottom: 24, marginTop: -7 }}>
|
|
|
|
|
<Col offset={8} style={{ color: '#bfbfbf' }}>试卷数量与学生重复考试次数一致</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
{console.log('###', ruleData)}
|
|
|
|
|
<ProFormDateRangePicker width='lg' name="dateRange" label="试卷有效期" initialValue={ (ruleData?.start_time && ruleData?.end_time) ? [ruleData?.start_time, ruleData?.end_time] : []} rules={[{ required: true, message: '请输试卷有效期' }]} />
|
|
|
|
|
<Row style={{marginBottom:24,marginTop:-7}}>
|
|
|
|
|
<Col offset={8} style={{color:'#bfbfbf'}}>试卷有效期指超过试卷有效期重新生成试卷</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<ProFormDateRangePicker width='lg' name="dateRange" label="试卷有效期" initialValue={(ruleData?.start_time && ruleData?.end_time) ? [ruleData?.start_time, ruleData?.end_time] : []} rules={[{ required: true, message: '请输试卷有效期' }]} />
|
|
|
|
|
<Row style={{ marginBottom: 24, marginTop: -7 }}>
|
|
|
|
|
<Col offset={8} style={{ color: '#bfbfbf' }}>试卷有效期指超过试卷有效期重新生成试卷</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Col>
|
|
|
|
@ -457,17 +461,17 @@ export default () => {
|
|
|
|
|
options={false}
|
|
|
|
|
search={false}
|
|
|
|
|
toolBarRender={() => (
|
|
|
|
|
<Space style={{margin:-48}} >
|
|
|
|
|
<Space style={{ margin: -48 }} >
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
key="primary"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
handleAutoModalVisible(true)
|
|
|
|
|
}}
|
|
|
|
|
style={{marginRight:5}}
|
|
|
|
|
style={{ marginRight: 5 }}
|
|
|
|
|
>
|
|
|
|
|
<PlusOutlined /> 系统组卷
|
|
|
|
|
</Button>
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
key="primary"
|
|
|
|
@ -477,39 +481,53 @@ export default () => {
|
|
|
|
|
>
|
|
|
|
|
<DiffOutlined /> 批量设置分值
|
|
|
|
|
</Button>
|
|
|
|
|
</Space>
|
|
|
|
|
</Space>
|
|
|
|
|
)}
|
|
|
|
|
request={async (value) => {
|
|
|
|
|
console.log('queryRulesPaper::')
|
|
|
|
|
/** 获取试卷 */
|
|
|
|
|
const _data = await queryRulesPaper(
|
|
|
|
|
{
|
|
|
|
|
rules_id: params?.id || rulesId,
|
|
|
|
|
page_number: value.current,
|
|
|
|
|
page_size: value.pageSize
|
|
|
|
|
rules_id: params?.id || rulesId,
|
|
|
|
|
page_number: value.current,
|
|
|
|
|
page_size: value.pageSize
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const _questionType = [];
|
|
|
|
|
|
|
|
|
|
const _questionTypeCountData = [];
|
|
|
|
|
_data.question_list[0]?.question_type_count.forEach((item)=>{
|
|
|
|
|
_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})
|
|
|
|
|
if (_data?.question_type_score.length > 0) {
|
|
|
|
|
_data.question_type_score?.forEach((item, index) => {
|
|
|
|
|
_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})
|
|
|
|
|
} else {
|
|
|
|
|
_questionTypeCountData?.forEach((item, index) => {
|
|
|
|
|
_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,
|
|
|
|
@ -546,7 +564,7 @@ export default () => {
|
|
|
|
|
//actionRef={actionRef}
|
|
|
|
|
title={false}
|
|
|
|
|
request={async () => {
|
|
|
|
|
const result = await queryRulesView({id: rulesId})
|
|
|
|
|
const result = await queryRulesView({ id: rulesId })
|
|
|
|
|
console.log('queryRulesView', result)
|
|
|
|
|
const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id })
|
|
|
|
|
console.log('subjectInfo', subjectInfo)
|
|
|
|
@ -558,22 +576,22 @@ export default () => {
|
|
|
|
|
<ProDescriptions.Item dataIndex="id" hideInDescriptions />
|
|
|
|
|
<ProDescriptions.Item dataIndex="rules_name" label="考试名称" valueType="text" />
|
|
|
|
|
<ProDescriptions.Item dataIndex="subject_name" label="关联主题" valueType="text" />
|
|
|
|
|
<ProDescriptions.Item dataIndex="examination_time" label="考试时长" valueType="text" renderText={(text)=>(`${text} 分钟`)} />
|
|
|
|
|
<ProDescriptions.Item dataIndex="examination_time" label="考试时长" valueType="text" renderText={(text) => (`${text} 分钟`)} />
|
|
|
|
|
|
|
|
|
|
<ProDescriptions.Item dataIndex="grade" label="试卷信息" valueType="text" render={() => {
|
|
|
|
|
{/** 从试卷中读取 临时卷必须保存后才进入此页 */ }
|
|
|
|
|
return <Space direction="vertical">
|
|
|
|
|
<span>共 {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} 道题, {paperInfo?.sum_score || '-'} 分</span>
|
|
|
|
|
<span>{paperInfo?.question_type_count?.map(item=>(<span style={{paddingRight:10}}>{`${item?.type_name} ${item?.count} 道题 `}</span>))}</span>
|
|
|
|
|
<span>共 {paperInfo?.question_type_count?.map(item => item.count)?.reduce((prev, curr) => prev + curr)} 道题, {paperInfo?.sum_score || '-'} 分</span>
|
|
|
|
|
<span>{paperInfo?.question_type_count?.map(item => (<span style={{ paddingRight: 10 }}>{`${item?.type_name} ${item?.count} 道题 `}</span>))}</span>
|
|
|
|
|
<span>通过线 {paperInfo?.pass_score || '-'} 分</span>
|
|
|
|
|
</Space>
|
|
|
|
|
}} />
|
|
|
|
|
|
|
|
|
|
<ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={(dom,entity)=>{
|
|
|
|
|
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>{entity?.paper_count}</span> <span><ExclamationCircleOutlined /> 试卷数量是学生重复考试次数</span></div>
|
|
|
|
|
<ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={(dom, entity) => {
|
|
|
|
|
return <div stype={{ padding: 0 }}><span style={{ display: 'inline-block', width: 200 }}>{entity?.paper_count}</span> <span><ExclamationCircleOutlined /> 试卷数量是学生重复考试次数</span></div>
|
|
|
|
|
}} />
|
|
|
|
|
<ProDescriptions.Item dataIndex="live_time" label="试卷有效期" valueType="text" render={(dom,entity)=>{
|
|
|
|
|
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>{/*entity?.start_time.substring(0,10)*/} {entity?.end_time.substring(0,10)}</span> <span><ExclamationCircleOutlined /> 超过试卷有效期将重新生成试卷</span></div>
|
|
|
|
|
<ProDescriptions.Item dataIndex="live_time" label="试卷有效期" valueType="text" render={(dom, entity) => {
|
|
|
|
|
return <div stype={{ padding: 0 }}><span style={{ display: 'inline-block', width: 200 }}>{/*entity?.start_time.substring(0,10)*/} {entity?.end_time.substring(0, 10)}</span> <span><ExclamationCircleOutlined /> 超过试卷有效期将重新生成试卷</span></div>
|
|
|
|
|
}} />
|
|
|
|
|
|
|
|
|
|
</ProDescriptions>
|
|
|
|
@ -588,9 +606,9 @@ export default () => {
|
|
|
|
|
visible={autoModalVisible}
|
|
|
|
|
onVisibleChange={handleAutoModalVisible}
|
|
|
|
|
onFinish={async () => {
|
|
|
|
|
const values = autoRef.current?.getData();
|
|
|
|
|
const values = autoRef.current?.getData();
|
|
|
|
|
console.log('系统组卷::::', values);
|
|
|
|
|
const {code, data: paper, msg} = await autoPaperOfficial({rules_id:Number(params?.id || rulesId), question_count: values?.questionCount.toString(), question_type_count: values?.questionTypeCount.toString()})
|
|
|
|
|
const { code, data: paper, msg } = await autoPaperOfficial({ rules_id: Number(params?.id || rulesId), question_count: values?.questionCount.toString(), question_type_count: values?.questionTypeCount.toString() })
|
|
|
|
|
console.log('paper', paper)
|
|
|
|
|
// setUuidPaper(paper?.paper_uuid)
|
|
|
|
|
// message.success('提交成功');
|
|
|
|
@ -599,7 +617,7 @@ export default () => {
|
|
|
|
|
return true;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<AutoSelector ref={autoRef} questionType={questionType} />
|
|
|
|
|
<AutoSelector ref={autoRef} questionType={questionType} ruleData = {ruleData} />
|
|
|
|
|
</ModalForm>
|
|
|
|
|
<ModalForm
|
|
|
|
|
title={`批量设置分值`}
|
|
|
|
@ -611,30 +629,32 @@ export default () => {
|
|
|
|
|
const values = setterRef.current?.getData() // 获取题型分值数据
|
|
|
|
|
const passSocre = setterRef.current?.getValue() // 获取通过分数线
|
|
|
|
|
console.log('批量设置分值v::::', values);
|
|
|
|
|
const {code, data: paper, msg} = await saveQuestionTypeScore({rules_id:Number(params?.id || rulesId), type_score: JSON.stringify(values)})
|
|
|
|
|
const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) })
|
|
|
|
|
console.log('paper', paper)
|
|
|
|
|
// 总分及通过分
|
|
|
|
|
let _sumScore = 0;
|
|
|
|
|
values?.forEach((item: { score: number; })=>{
|
|
|
|
|
console.log('item--',item)
|
|
|
|
|
values?.forEach((item: { score: number; }) => {
|
|
|
|
|
console.log('item--', item)
|
|
|
|
|
_sumScore += item?.score
|
|
|
|
|
})
|
|
|
|
|
console.log('_sumScore', _sumScore)
|
|
|
|
|
// 需要处理
|
|
|
|
|
console.log('passSocre',passSocre)
|
|
|
|
|
console.log('passSocre', passSocre)
|
|
|
|
|
//console.log('sumScore',sumScore)
|
|
|
|
|
const {success} = await updateScore({rules_id:Number(params?.id || rulesId), pass_socre: passSocre, sum_score: _sumScore})
|
|
|
|
|
const { success } = await updateScore({ rules_id: Number(params?.id || rulesId), pass_socre: passSocre, sum_score: _sumScore })
|
|
|
|
|
//setSumScore(_sumScore)
|
|
|
|
|
// setUuidPaper(paper?.paper_uuid)
|
|
|
|
|
// message.success('提交成功');
|
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
|
handleScoreModalVisible(false)
|
|
|
|
|
return true;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<ScoreSetter ref={setterRef} questionTypeValues={questionTypeValues || false} />
|
|
|
|
|
<ScoreSetter ref={setterRef} questionTypeValues={questionTypeValues || false} />
|
|
|
|
|
</ModalForm>
|
|
|
|
|
<ModalForm
|
|
|
|
|
title={`试卷详情`}
|
|
|
|
|
// title={`试卷详情`}
|
|
|
|
|
title={ruleData?.rules_name}
|
|
|
|
|
//
|
|
|
|
|
width="80%"
|
|
|
|
|
visible={paperModalVisible}
|
|
|
|
@ -651,57 +671,59 @@ 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 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}
|
|
|
|
|
</Typography>
|
|
|
|
|
{(item?.question_type === 0) && // 单选题
|
|
|
|
|
<div style={{padding:'0 15px 15px 15px'}}>
|
|
|
|
|
{item?.answers && item?.answers.map((anster, k)=>(
|
|
|
|
|
<div value={k} checked style={{width: '100%', padding: 5, fontSize: 14 }}>
|
|
|
|
|
{anster?.is_true === '0' && <span style={{color:'#1890ff', border:'1px solid #1890ff', display:'inline-block', width:16, height:16, textAlign:'center', borderRadius:'50%', fontSize:12, lineHeight:'12px', marginRight:10}}>{labels[k]} </span> }
|
|
|
|
|
{anster?.is_true === '1' && <span style={{color:'#ffffff', border:'1px solid #1890ff', display:'inline-block', width:16, height:16, textAlign:'center', borderRadius:'50%', fontSize:12, lineHeight:'12px', marginRight:10, backgroundColor:'#1890ff'}}>{labels[k]} </span> }
|
|
|
|
|
<span style={{display:'inline-block'}}>{anster?.answer}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{(item?.question_type === 1) && // 多选题
|
|
|
|
|
<div style={{padding:'0 15px 15px 15px'}}>
|
|
|
|
|
{item?.answers && item?.answers.map((anster, k)=>(
|
|
|
|
|
<div value={k} checked style={{width: '100%', padding: 5, fontSize: 14 }}>
|
|
|
|
|
{anster?.is_true === '0' && <span style={{color:'#1890ff', border:'1px solid #1890ff', display:'inline-block', width:16, height:16, textAlign:'center', borderRadius:'50%', fontSize:12, lineHeight:'12px', marginRight:10}}>{labels[k]} </span> }
|
|
|
|
|
{anster?.is_true === '1' && <span style={{color:'#ffffff', border:'1px solid #1890ff', display:'inline-block', width:16, height:16, textAlign:'center', borderRadius:'50%', fontSize:12, lineHeight:'12px', marginRight:10, backgroundColor:'#1890ff'}}>{labels[k]} </span> }
|
|
|
|
|
<span style={{display:'inline-block'}}>{anster?.answer}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{(item?.question_type === 2) && // 判断选题
|
|
|
|
|
<div style={{padding:'0 15px 15px 15px'}}>
|
|
|
|
|
{item?.answers && item?.answers.map((anster, k)=>(
|
|
|
|
|
<div value={k} checked style={{width: '100%', padding: 5, fontSize: 14 }}>
|
|
|
|
|
{anster?.is_true === '0' && <span style={{color:'#1890ff', border:'1px solid #1890ff', display:'inline-block', width:16, height:16, textAlign:'center', borderRadius:'50%', fontSize:12, lineHeight:'12px', marginRight:10}}>{labels[k]} </span> }
|
|
|
|
|
{anster?.is_true === '1' && <span style={{color:'#ffffff', border:'1px solid #1890ff', display:'inline-block', width:16, height:16, textAlign:'center', borderRadius:'50%', fontSize:12, lineHeight:'12px', marginRight:10, backgroundColor:'#1890ff'}}>{labels[k]} </span> }
|
|
|
|
|
<span style={{display:'inline-block'}}>{anster?.answer}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</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]++}. ({typeItem?.typeName},分值{typeItem?.score}){item?.question_stem}
|
|
|
|
|
</Typography>
|
|
|
|
|
{(item?.question_type === 0) && // 单选题
|
|
|
|
|
<div style={{ padding: '0 15px 15px 15px' }}>
|
|
|
|
|
{item?.answers && item?.answers.map((anster, k) => (
|
|
|
|
|
<div value={k} checked style={{ width: '100%', padding: 5, fontSize: 14 }}>
|
|
|
|
|
{anster?.is_true === '0' && <span style={{ color: '#1890ff', border: '1px solid #1890ff', display: 'inline-block', width: 16, height: 16, textAlign: 'center', borderRadius: '50%', fontSize: 12, lineHeight: '12px', marginRight: 10 }}>{labels[k]} </span>}
|
|
|
|
|
{anster?.is_true === '1' && <span style={{ color: '#ffffff', border: '1px solid #1890ff', display: 'inline-block', width: 16, height: 16, textAlign: 'center', borderRadius: '50%', fontSize: 12, lineHeight: '12px', marginRight: 10, backgroundColor: '#1890ff' }}>{labels[k]} </span>}
|
|
|
|
|
<span style={{ display: 'inline-block' }}>{anster?.answer}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{(item?.question_type === 1) && // 多选题
|
|
|
|
|
<div style={{ padding: '0 15px 15px 15px' }}>
|
|
|
|
|
{item?.answers && item?.answers.map((anster, k) => (
|
|
|
|
|
<div value={k} checked style={{ width: '100%', padding: 5, fontSize: 14 }}>
|
|
|
|
|
{anster?.is_true === '0' && <span style={{ color: '#1890ff', border: '1px solid #1890ff', display: 'inline-block', width: 16, height: 16, textAlign: 'center', borderRadius: '50%', fontSize: 12, lineHeight: '12px', marginRight: 10 }}>{labels[k]} </span>}
|
|
|
|
|
{anster?.is_true === '1' && <span style={{ color: '#ffffff', border: '1px solid #1890ff', display: 'inline-block', width: 16, height: 16, textAlign: 'center', borderRadius: '50%', fontSize: 12, lineHeight: '12px', marginRight: 10, backgroundColor: '#1890ff' }}>{labels[k]} </span>}
|
|
|
|
|
<span style={{ display: 'inline-block' }}>{anster?.answer}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{(item?.question_type === 2) && // 判断选题
|
|
|
|
|
<div style={{ padding: '0 15px 15px 15px' }}>
|
|
|
|
|
{item?.answers && item?.answers.map((anster, k) => (
|
|
|
|
|
<div value={k} checked style={{ width: '100%', padding: 5, fontSize: 14 }}>
|
|
|
|
|
{anster?.is_true === '0' && <span style={{ color: '#1890ff', border: '1px solid #1890ff', display: 'inline-block', width: 16, height: 16, textAlign: 'center', borderRadius: '50%', fontSize: 12, lineHeight: '12px', marginRight: 10 }}>{labels[k]} </span>}
|
|
|
|
|
{anster?.is_true === '1' && <span style={{ color: '#ffffff', border: '1px solid #1890ff', display: 'inline-block', width: 16, height: 16, textAlign: 'center', borderRadius: '50%', fontSize: 12, lineHeight: '12px', marginRight: 10, backgroundColor: '#1890ff' }}>{labels[k]} </span>}
|
|
|
|
|
<span style={{ display: 'inline-block' }}>{anster?.answer}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</ModalForm>
|
|
|
|
|
</PageContainer>
|
|
|
|
|
|
|
|
|
|