|
|
|
@ -30,18 +30,21 @@ import { forEach } from 'lodash';
|
|
|
|
|
*
|
|
|
|
|
* @param values
|
|
|
|
|
*/
|
|
|
|
|
const handleAppend = async (rules_id: number, rows: any[]) => {
|
|
|
|
|
const handleAppend = async (rules_id: number, rows: any[], paper_uuid: number) => {
|
|
|
|
|
const hide = message.loading('正在添加');
|
|
|
|
|
try {
|
|
|
|
|
const questions: { question_id: any; }[] = [];
|
|
|
|
|
|
|
|
|
|
rows?.forEach((key) => {
|
|
|
|
|
questions.push({ question_id: key })
|
|
|
|
|
})
|
|
|
|
|
const _data = await manualPaper({
|
|
|
|
|
const values = {
|
|
|
|
|
question_count: questions?.length || 0,
|
|
|
|
|
questions: JSON.stringify(questions),
|
|
|
|
|
rules_id: Number(rules_id)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const _data = await manualPaper(paper_uuid ? {...values, paper_uuid: paper_uuid} : values);
|
|
|
|
|
|
|
|
|
|
hide();
|
|
|
|
|
message.success('添加成功');
|
|
|
|
|
return _data;
|
|
|
|
@ -657,10 +660,11 @@ export default () => {
|
|
|
|
|
console.log('v::::', values.name);
|
|
|
|
|
const rows = selectorRef?.current?.getSelectedRowKeys()
|
|
|
|
|
console.log('rows::::', rows);
|
|
|
|
|
const { code, data: paper, msg } = await handleAppend(Number(params?.id || rulesId), rows)
|
|
|
|
|
const { code, data: paper, msg } = await handleAppend(Number(params?.id || rulesId), rows, uuidPaper)
|
|
|
|
|
console.log('paper', paper)
|
|
|
|
|
setUuidPaper(paper?.paper_uuid)
|
|
|
|
|
console.log('paper_uuid', paper?.paper_uuid)
|
|
|
|
|
/** 回显临时表 */
|
|
|
|
|
run({
|
|
|
|
|
paper_uuid: paper?.paper_uuid,
|
|
|
|
|
page_size: 1000,
|
|
|
|
@ -671,7 +675,7 @@ export default () => {
|
|
|
|
|
return true;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{selectorModalVisible && <QuestionSelector ref={selectorRef} />}
|
|
|
|
|
{selectorModalVisible && <QuestionSelector data={{rules_id: Number(params?.id || rulesId), subject_id:subjectId, paper_uuid: uuidPaper}} ref={selectorRef} />}
|
|
|
|
|
</ModalForm>
|
|
|
|
|
<ModalForm
|
|
|
|
|
title={`系统组卷`}
|
|
|
|
@ -682,7 +686,7 @@ export default () => {
|
|
|
|
|
const values = autoRef?.current.getData()
|
|
|
|
|
console.log('data-v', values)
|
|
|
|
|
//const values = [{"question_type":0,"chapter_list": [{ "chapter_id":76, "count":1 },{ "chapter_id":77, "count":1 }]}]
|
|
|
|
|
const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(values)})
|
|
|
|
|
const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id || rulesId), auto_param: JSON.stringify(values)})
|
|
|
|
|
//console.log('paper', paper)
|
|
|
|
|
setUuidPaper(paper?.paper_uuid)
|
|
|
|
|
run({
|
|
|
|
@ -708,6 +712,10 @@ export default () => {
|
|
|
|
|
const values = setterRef.current?.getData() // 获取题型分值数据
|
|
|
|
|
const passSocre = setterRef.current?.getValue() // 获取通过分数线
|
|
|
|
|
const sumCore = setterRef.current?.getSum() // 获取总分
|
|
|
|
|
if(passSocre > sumCore){
|
|
|
|
|
message.error('通过分数线不能大于总分,请修改通过分数线');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
console.log('批量设置分值v::::2', values);
|
|
|
|
|
// 题型分数
|
|
|
|
|
const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) })
|
|
|
|
|