|
|
|
@ -56,7 +56,7 @@ const AutoSelector = (props: any, ref: any) => {
|
|
|
|
|
console.log('props subject_id', props)
|
|
|
|
|
const { subjectId, questionType } = props;
|
|
|
|
|
console.log('questionType', questionType)
|
|
|
|
|
const [typeChapterCount, setTypeChapterCount] = useState([]) ; // 题型分数数组 [{"question_type":0,"chapter_list": [{ "chapter_id":3, "count":1 }]}]
|
|
|
|
|
const [rows, setRows] = useState([]) ; // 章节
|
|
|
|
|
|
|
|
|
|
//const [dataSource, setDataSource] = useState<DataSourceType[]>(() => defaultData);
|
|
|
|
|
|
|
|
|
@ -96,20 +96,7 @@ const AutoSelector = (props: any, ref: any) => {
|
|
|
|
|
//key: 'code',
|
|
|
|
|
dataIndex: `type${item?.code}`,
|
|
|
|
|
render: ( _dom, record, index) => {
|
|
|
|
|
return <Form.Item style={{margin:0}} name={['questionType', idx, index]}><Input min={0} max={3} defaultValue={0} type='text'
|
|
|
|
|
onChange={(value)=>{
|
|
|
|
|
console.log('record', record)
|
|
|
|
|
//{chapter_id: record?.chapter_id, count:0}
|
|
|
|
|
/*
|
|
|
|
|
console.log('typeChapterCount',typeChapterCount)
|
|
|
|
|
const data = typeChapterCount?.map((item, key)=>{
|
|
|
|
|
data.push({...item, score_harf: ((index === key) ? value : item?.score_harf)})
|
|
|
|
|
})
|
|
|
|
|
setTypeChapterCount(data)
|
|
|
|
|
console.log('setTypeChapterCount---',typeChapterCount)
|
|
|
|
|
*/
|
|
|
|
|
}}
|
|
|
|
|
/></Form.Item>;
|
|
|
|
|
return <Form.Item style={{margin:0}} name={['questionType', idx, index]}><Input min={0} max={3} defaultValue={0} type='text' /></Form.Item>;
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
@ -119,7 +106,18 @@ const AutoSelector = (props: any, ref: any) => {
|
|
|
|
|
useImperativeHandle(ref, () => ({
|
|
|
|
|
// 构造ref的获取数据方法
|
|
|
|
|
getData: () => { // 组卷数据
|
|
|
|
|
return [];
|
|
|
|
|
console.log('useImperativeHandle')
|
|
|
|
|
const values = formRef.current.getFieldsValue()
|
|
|
|
|
console.log(values)
|
|
|
|
|
const data = values?.questionType.map((item, key)=>{
|
|
|
|
|
return {
|
|
|
|
|
question_type:key,
|
|
|
|
|
chapter_list: item.map((val,idx)=>(
|
|
|
|
|
{chapter_id:rows[idx]?.chapter_id, count: val}
|
|
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
}) // 题型分数数组 [{"question_type":0,"chapter_list": [{ "chapter_id":3, "count":1 }]}]
|
|
|
|
|
return data;
|
|
|
|
|
},
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
@ -144,6 +142,7 @@ const AutoSelector = (props: any, ref: any) => {
|
|
|
|
|
page_number: 1,
|
|
|
|
|
page_size: 1000,
|
|
|
|
|
});
|
|
|
|
|
setRows(data?.list)
|
|
|
|
|
console.log('data--',data)
|
|
|
|
|
/*
|
|
|
|
|
const _data = [];
|
|
|
|
|