|
|
|
@ -2,163 +2,159 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
|
|
import { history, useParams, useRequest } from 'umi';
|
|
|
|
|
import { ModalForm, ProFormInstance } from '@ant-design/pro-form';
|
|
|
|
|
import { ProFormRadio } from '@ant-design/pro-form';
|
|
|
|
|
import ProForm, {
|
|
|
|
|
StepsForm,
|
|
|
|
|
ProFormText,
|
|
|
|
|
ProFormDatePicker,
|
|
|
|
|
ProFormSelect,
|
|
|
|
|
ProFormTextArea,
|
|
|
|
|
ProFormCheckbox,
|
|
|
|
|
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 { Button, Checkbox, Col, Divider, Input, List, Menu, message, Radio, Row, Space } from 'antd';
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
|
|
|
|
import styles from './index.less'
|
|
|
|
|
import { saveRules, querySubjectList, queryRulesView, queryRulesList, queryRulesPaper, saveQuestionTypeScore, autoPaperOfficial } from '../../service';
|
|
|
|
|
import { queryQuestionType } from '@/pages/questionbank/service';
|
|
|
|
|
import ProTable, { ActionType, EditableProTable, ProColumns } from '@ant-design/pro-table';
|
|
|
|
|
import { TableListPagination } from '@/pages/ListTableList2/data';
|
|
|
|
|
//import { TableListPagination } from '@/pages/ListTableList2/data';
|
|
|
|
|
import { DiffOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
|
|
import { TableListItem } from '../../components/QuestionSelector';
|
|
|
|
|
//import { TableListItem } from '../../components/QuestionSelector';
|
|
|
|
|
import ScoreSetter from '../../components/ScoreSetter';
|
|
|
|
|
import AutoSelector from '../components/AutoSelector';
|
|
|
|
|
import QuestionSelector from '../../components/QuestionSelector';
|
|
|
|
|
|
|
|
|
|
/** 题型序号 */
|
|
|
|
|
const numberType = ['一','二','三','四','五','六','七','八','九','十'];
|
|
|
|
|
const questions = []
|
|
|
|
|
export default () => {
|
|
|
|
|
const params = useParams();
|
|
|
|
|
|
|
|
|
|
const waitTime = (time: number = 100) => {
|
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
resolve(true);
|
|
|
|
|
}, time);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const numbers = [];
|
|
|
|
|
for (let i = 0; i < 50; i++) {
|
|
|
|
|
numbers.push({ id: `${i}` })
|
|
|
|
|
}
|
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
const setterRef = useRef();
|
|
|
|
|
const autoRef = useRef();
|
|
|
|
|
|
|
|
|
|
const [questionTypeValues, setQuestionTypeValues] = useState([]); // 题型数据[{count:0, score:0, score_harf:0}]
|
|
|
|
|
|
|
|
|
|
/** 自动组卷窗口 */
|
|
|
|
|
const [autoModalVisible, handleAutoModalVisible] = useState<boolean>(false);
|
|
|
|
|
/** 分值窗口 */
|
|
|
|
|
const [scoreModalVisible, handleScoreModalVisible] = useState<boolean>(false);
|
|
|
|
|
/** 试卷详情窗口 */
|
|
|
|
|
const [paperModalVisible, handlePaperModalVisible] = useState<boolean>(false);
|
|
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
|
/** 列表项定义 */
|
|
|
|
|
const columns: ProColumns<TableListItem>[] = [
|
|
|
|
|
const columns: ProColumns[] = [
|
|
|
|
|
{
|
|
|
|
|
title: '序号',
|
|
|
|
|
key: 'index',
|
|
|
|
|
valueType: 'indexBorder',
|
|
|
|
|
width: 48,
|
|
|
|
|
title: '序号',
|
|
|
|
|
key: 'index',
|
|
|
|
|
valueType: 'indexBorder',
|
|
|
|
|
width: 48,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '考试名称',
|
|
|
|
|
dataIndex: 'rules_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
title: '考试名称',
|
|
|
|
|
dataIndex: 'rules_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '试卷',
|
|
|
|
|
dataIndex: 'examination_time',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: true,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
},
|
|
|
|
|
title: '试卷',
|
|
|
|
|
dataIndex: 'examination_time',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: true,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '关联主题',
|
|
|
|
|
dataIndex: 'subject_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: true,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
title: '关联主题',
|
|
|
|
|
dataIndex: 'subject_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: true,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '题型设置',
|
|
|
|
|
dataIndex: 'question_type_count',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
request: async () => {
|
|
|
|
|
/*
|
|
|
|
|
const { data: Items } = await querySubjectList({});
|
|
|
|
|
// console.log(Items, ')))');
|
|
|
|
|
title: '题型设置',
|
|
|
|
|
dataIndex: 'question_type_count',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
request: async () => {
|
|
|
|
|
/*
|
|
|
|
|
const { data: Items } = await querySubjectList({});
|
|
|
|
|
// console.log(Items, ')))');
|
|
|
|
|
|
|
|
|
|
const sinfo = []
|
|
|
|
|
for (let i = 0; i < Items.list.length; i++) {
|
|
|
|
|
// console.log(Items.list[i], ">>>")
|
|
|
|
|
sinfo.push({ label: Items.list[i].subject_name, value: Items.list[i].subject_id })
|
|
|
|
|
}
|
|
|
|
|
console.log(sinfo, 'sinfo');
|
|
|
|
|
*/
|
|
|
|
|
return [];
|
|
|
|
|
const sinfo = []
|
|
|
|
|
for (let i = 0; i < Items.list.length; i++) {
|
|
|
|
|
// console.log(Items.list[i], ">>>")
|
|
|
|
|
sinfo.push({ label: Items.list[i].subject_name, value: Items.list[i].subject_id })
|
|
|
|
|
}
|
|
|
|
|
console.log(sinfo, 'sinfo');
|
|
|
|
|
*/
|
|
|
|
|
return [];
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '总分',
|
|
|
|
|
dataIndex: 'sum_score',
|
|
|
|
|
sorter: false,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
renderText: (val: string) => `${val || 0} 分`,
|
|
|
|
|
title: '总分',
|
|
|
|
|
dataIndex: 'sum_score',
|
|
|
|
|
sorter: false,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
renderText: (val: string) => `${val || 0} 分`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '通过线',
|
|
|
|
|
dataIndex: 'pass_score',
|
|
|
|
|
sorter: false,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
renderText: (val: string) => `${val || '-'}`,
|
|
|
|
|
title: '通过线',
|
|
|
|
|
dataIndex: 'pass_score',
|
|
|
|
|
sorter: false,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
renderText: (val: string) => `${val || '-'}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
dataIndex: 'option',
|
|
|
|
|
valueType: 'option',
|
|
|
|
|
width: 200,
|
|
|
|
|
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => {
|
|
|
|
|
console.log(record, 'record')
|
|
|
|
|
return [
|
|
|
|
|
<a
|
|
|
|
|
key="detail"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
//console.log('entity', entity);
|
|
|
|
|
//setCurrentRow(record);
|
|
|
|
|
//handleDetailModalVisible(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
查看
|
|
|
|
|
</a>,
|
|
|
|
|
<a
|
|
|
|
|
key="create"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
//history.push(`/examination/option/registration/${record.examination_id}`);
|
|
|
|
|
//setCurrentRow(record);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
重新生成
|
|
|
|
|
</a>,
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
title: '操作',
|
|
|
|
|
dataIndex: 'option',
|
|
|
|
|
valueType: 'option',
|
|
|
|
|
width: 200,
|
|
|
|
|
render: (_dom: any, record: React.SetStateAction) => {
|
|
|
|
|
console.log(record, 'record')
|
|
|
|
|
return [
|
|
|
|
|
<a
|
|
|
|
|
key="detail"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
//console.log('entity', entity);
|
|
|
|
|
//setCurrentRow(record);
|
|
|
|
|
handlePaperModalVisible(true); // 试卷详情
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
查看
|
|
|
|
|
</a>,
|
|
|
|
|
<a
|
|
|
|
|
key="create"
|
|
|
|
|
onClick={async () => {
|
|
|
|
|
//history.push(`/examination/option/registration/${record.examination_id}`);
|
|
|
|
|
//setCurrentRow(record);
|
|
|
|
|
const _type_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),
|
|
|
|
|
question_count: '50,50', // 当前数据库没保存,只能采用默认
|
|
|
|
|
question_type_count: _type_count?.toString()
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
重新生成
|
|
|
|
|
</a>,
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const params = useParams();
|
|
|
|
|
|
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
const setterRef = useRef();
|
|
|
|
|
const autoRef = useRef();
|
|
|
|
|
|
|
|
|
|
/** 自动组卷窗口 */
|
|
|
|
|
const [autoModalVisible, handleAutoModalVisible] = useState<boolean>(false);
|
|
|
|
|
/** 分值窗口 */
|
|
|
|
|
const [scoreModalVisible, handleScoreModalVisible] = useState<boolean>(false);
|
|
|
|
|
|
|
|
|
|
console.log(params, 'params');
|
|
|
|
|
let ruleData = {}
|
|
|
|
|
if (params?.id) {
|
|
|
|
@ -198,7 +194,6 @@ export default () => {
|
|
|
|
|
}>
|
|
|
|
|
formRef={formRef}
|
|
|
|
|
onFinish={async () => {
|
|
|
|
|
await waitTime(1000);
|
|
|
|
|
message.success('提交成功');
|
|
|
|
|
}}
|
|
|
|
|
formProps={{
|
|
|
|
@ -231,8 +226,6 @@ export default () => {
|
|
|
|
|
start_time: fileds.dateRange[0],
|
|
|
|
|
end_time: fileds.dateRange[1]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// await waitTime(2000);
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
@ -305,7 +298,8 @@ export default () => {
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div style={{ margin: '0' }}>
|
|
|
|
|
<ProTable<TableListItem, TableListPagination>
|
|
|
|
|
{`试卷`}
|
|
|
|
|
<ProTable
|
|
|
|
|
page
|
|
|
|
|
headerTitle={false}
|
|
|
|
|
actionRef={actionRef}
|
|
|
|
@ -336,6 +330,7 @@ export default () => {
|
|
|
|
|
)}
|
|
|
|
|
request={async (value) => {
|
|
|
|
|
console.log('queryRulesPaper::')
|
|
|
|
|
/** 获取试卷 */
|
|
|
|
|
const _data = await queryRulesPaper(
|
|
|
|
|
{
|
|
|
|
|
rules_id: params?.id,
|
|
|
|
@ -343,6 +338,28 @@ export default () => {
|
|
|
|
|
page_size: value.pageSize
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const _questionTypeCountData = [];
|
|
|
|
|
_data.question_list[0]?.question_type_count.forEach((item)=>{
|
|
|
|
|
_questionTypeCountData.push(item.count)
|
|
|
|
|
})
|
|
|
|
|
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})
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
_questionTypeCountData?.forEach((item, index)=>{
|
|
|
|
|
_questionType.push({count: _questionTypeCountData[index], score:0, score_harf: 0})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('_questionType', _questionType)
|
|
|
|
|
setQuestionTypeValues(_questionType)
|
|
|
|
|
return {
|
|
|
|
|
current: _data?.pageNumber,
|
|
|
|
|
data: _data?.question_list,
|
|
|
|
@ -437,7 +454,32 @@ export default () => {
|
|
|
|
|
return true;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<ScoreSetter ref={setterRef} />
|
|
|
|
|
<ScoreSetter ref={setterRef} questionTypeValues={questionTypeValues} />
|
|
|
|
|
</ModalForm>
|
|
|
|
|
<ModalForm
|
|
|
|
|
title={`试卷详情`}
|
|
|
|
|
//
|
|
|
|
|
width="80%"
|
|
|
|
|
visible={paperModalVisible}
|
|
|
|
|
onVisibleChange={handlePaperModalVisible}
|
|
|
|
|
footer={null}
|
|
|
|
|
onFinish={async () => {
|
|
|
|
|
const values = setterRef.current?.getData()
|
|
|
|
|
console.log('试卷详情::::', values);
|
|
|
|
|
//const {code, data: paper, msg} = await saveQuestionTypeScore({rules_id:Number(params?.id), type_score: JSON.stringify(values)})
|
|
|
|
|
console.log('paper', paper)
|
|
|
|
|
// setUuidPaper(paper?.paper_uuid)
|
|
|
|
|
// message.success('提交成功');
|
|
|
|
|
handleScoreModalVisible(false)
|
|
|
|
|
return true;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{questions && questions?.map((item)=>{
|
|
|
|
|
return <>
|
|
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
})}
|
|
|
|
|
试卷详情正在调整布局。。。。。。
|
|
|
|
|
</ModalForm>
|
|
|
|
|
</PageContainer>
|
|
|
|
|
|
|
|
|
|