|
|
|
@ -107,6 +107,8 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
const [typeQuestionCount, setTypeQuestionCount] = useState([0, 0, 0]); // 临时卷 各题型数量
|
|
|
|
|
|
|
|
|
|
const [rulesId, setRulesId] = useState(0); // 规则id, 保存新建的rules_id
|
|
|
|
|
|
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
|
|
|
|
|
|
const selectorRef = useRef();
|
|
|
|
@ -118,7 +120,7 @@ export default () => {
|
|
|
|
|
const params = useParams();
|
|
|
|
|
|
|
|
|
|
const [questionType, setQuestionType] = useState([]); // 题型
|
|
|
|
|
const [scoreValues, SetscoreValues] = useState([]); // 分值 [{"question_type": "0","score": "3","score_harf": "0"},]
|
|
|
|
|
const [scoreValues, setScoreValues] = useState([]); // 分值 [{"question_type": "0","score": "3","score_harf": "0"},]
|
|
|
|
|
const [paperInfo, setPaperInfo] = useState({})
|
|
|
|
|
|
|
|
|
|
/** 获取题型 */
|
|
|
|
@ -190,6 +192,7 @@ export default () => {
|
|
|
|
|
console.log(params, 'params');
|
|
|
|
|
|
|
|
|
|
let ruleData = {}
|
|
|
|
|
//
|
|
|
|
|
if (params?.id) {
|
|
|
|
|
//console.log(JSON.stringify(params), "878");
|
|
|
|
|
const { data } = useRequest(async () => {
|
|
|
|
@ -231,13 +234,15 @@ export default () => {
|
|
|
|
|
}}
|
|
|
|
|
onFinish={async (fileds) => {
|
|
|
|
|
if (params?.id) {
|
|
|
|
|
fileds = { ...fileds, id: params.id }
|
|
|
|
|
fileds = { ...fileds, id: (params.id || rulesId) }
|
|
|
|
|
}
|
|
|
|
|
await saveRules({
|
|
|
|
|
const {data} = await saveRules({
|
|
|
|
|
...fileds,
|
|
|
|
|
b_use: 0,
|
|
|
|
|
rules_type: 0,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
setRulesId(data?.rules_id) // 保存规则id
|
|
|
|
|
//run({paper_uuid:1}); // 获取当前选题列表
|
|
|
|
|
// console.log('模拟考试基本信息', fileds)
|
|
|
|
|
setSubjectId(fileds?.subject_id) // 设置当前关联主题
|
|
|
|
@ -314,7 +319,9 @@ export default () => {
|
|
|
|
|
onFinish={async () => {
|
|
|
|
|
console.log(formRef.current?.getFieldsValue());
|
|
|
|
|
setCurrentStep(2) // 设置步骤号
|
|
|
|
|
runPaper({rules_id: params?.id })
|
|
|
|
|
alert(params?.id || rulesId)
|
|
|
|
|
|
|
|
|
|
runPaper({rules_id: params?.id || rulesId})
|
|
|
|
|
return true;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
@ -434,7 +441,7 @@ export default () => {
|
|
|
|
|
console.log('uuidPaper::', uuidPaper)
|
|
|
|
|
console.log('rules_id::', params?.id)
|
|
|
|
|
const paper_id = paper_id ? paper_id : 0;
|
|
|
|
|
await handleUpdatePaper(params?.id, uuidPaper, paper_id)
|
|
|
|
|
await handleUpdatePaper(params?.id || rulesId, uuidPaper, paper_id)
|
|
|
|
|
}}>保存试卷</Button>
|
|
|
|
|
</Space>
|
|
|
|
|
</div>
|
|
|
|
@ -502,7 +509,7 @@ export default () => {
|
|
|
|
|
console.log('v::::', values.name);
|
|
|
|
|
const rows = selectorRef?.current?.getSelectedRows()
|
|
|
|
|
console.log('rows::::', rows);
|
|
|
|
|
const {code, data: paper, msg} = await handleAppend(Number(params?.id), rows)
|
|
|
|
|
const {code, data: paper, msg} = await handleAppend(Number(params?.id || rulesId), rows)
|
|
|
|
|
console.log('paper', paper)
|
|
|
|
|
setUuidPaper(paper?.paper_uuid)
|
|
|
|
|
console.log('paper_uuid', paper?.paper_uuid)
|
|
|
|
@ -552,7 +559,7 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
console.log('批量设置分值v::::2', values);
|
|
|
|
|
// 题型分数
|
|
|
|
|
const {code, data: paper, msg} = await saveQuestionTypeScore({rules_id:Number(params?.id), type_score: JSON.stringify(values)})
|
|
|
|
|
const {code, data: paper, msg} = await saveQuestionTypeScore({rules_id:Number(params?.id || rulesId), type_score: JSON.stringify(values)})
|
|
|
|
|
// 总分及通过分
|
|
|
|
|
let _sumScore = 0;
|
|
|
|
|
values?.forEach((item)=>{
|
|
|
|
@ -563,7 +570,7 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
//console.log('passScore',passScore)
|
|
|
|
|
console.log('sumScore',sumScore)
|
|
|
|
|
const {success} = await updateScore({rules_id:Number(params?.id), pass_socre: passSocre, sum_score: _sumScore})
|
|
|
|
|
const {success} = await updateScore({rules_id:Number(params?.id || rulesId), pass_socre: passSocre, sum_score: _sumScore})
|
|
|
|
|
setSumScore(_sumScore)
|
|
|
|
|
console.log('paper', paper)
|
|
|
|
|
// setUuidPaper(paper?.paper_uuid)
|
|
|
|
|