|
|
|
@ -61,7 +61,7 @@ const ScoreSetter = (props: any, ref: any) => {
|
|
|
|
|
e.currentTarget.value = val.slice(0,3)
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
defaultValue={questionTypeValues ? questionTypeValues[index]?.score : 0}
|
|
|
|
|
defaultValue={questionTypeValues ? questionTypeValues[index]?.score || 0 : 0}
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
size="small"
|
|
|
|
|
onChange={(e)=>{
|
|
|
|
@ -87,7 +87,7 @@ const ScoreSetter = (props: any, ref: any) => {
|
|
|
|
|
message: '请输入分值!',
|
|
|
|
|
},*/
|
|
|
|
|
]}
|
|
|
|
|
><InputNumber min={0} max={99} maxLength={2} type="number" defaultValue={questionTypeValues ? questionTypeValues[index]?.score_harf : 0} placeholder="请输入" size="small" name='score_harf' onChange={(value)=>{
|
|
|
|
|
><InputNumber min={0} max={99} maxLength={2} type="number" defaultValue={questionTypeValues ? questionTypeValues[index]?.score_harf || 0 : 0} placeholder="请输入" size="small" name='score_harf' onChange={(value)=>{
|
|
|
|
|
const harf = typeScore?.map((item: { score_harf: any; }, key: number)=>{
|
|
|
|
|
return {...item, score_harf: ((index === key) ? value : item?.score_harf)}
|
|
|
|
|
})
|
|
|
|
@ -102,7 +102,7 @@ const ScoreSetter = (props: any, ref: any) => {
|
|
|
|
|
title: '题目数量',
|
|
|
|
|
dataIndex: 'count',
|
|
|
|
|
width: 80,
|
|
|
|
|
render: (_text: any, _: any, index: number) => <>{questionTypeValues ? questionTypeValues[index]?.count : '0'}</>,
|
|
|
|
|
render: (_text: any, _: any, index: number) => <>{questionTypeValues ? questionTypeValues[index]?.count || 0 : '0'}</>,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '总分值',
|
|
|
|
@ -112,8 +112,8 @@ const ScoreSetter = (props: any, ref: any) => {
|
|
|
|
|
render: (_text: any, _: any, index: number) => {
|
|
|
|
|
return <>
|
|
|
|
|
{flag?.indexOf(index) === -1 ?
|
|
|
|
|
questionTypeValues[index]?.score * questionTypeValues[index].count :
|
|
|
|
|
(typeScore && questionTypeValues) ? ((typeScore[index]?.score > 0 ? typeScore[index]?.score : 0) * questionTypeValues[index]?.count).toFixed(1) : '0'
|
|
|
|
|
(questionTypeValues[index]?.score || 0) * (questionTypeValues[index]?.count || 0) :
|
|
|
|
|
(typeScore && questionTypeValues) ? ((typeScore[index]?.score > 0 ? typeScore[index]?.score : 0) * (questionTypeValues[index]?.count || 0)).toFixed(1) : '0'
|
|
|
|
|
}
|
|
|
|
|
</>
|
|
|
|
|
},
|
|
|
|
@ -154,20 +154,23 @@ const ScoreSetter = (props: any, ref: any) => {
|
|
|
|
|
>
|
|
|
|
|
<ProTable
|
|
|
|
|
title={()=>{
|
|
|
|
|
return <Space size="large"><span>共计 {sumQuestion} 题,</span><span>总计 {
|
|
|
|
|
return <Space size="large"><span>共计 {sumQuestion || 0} 题,</span><span>总计 {
|
|
|
|
|
typeScore?.length > 0 &&
|
|
|
|
|
typeScore?.map((item: any, key: number)=>{return item?.score * questionTypeValues[key].count})?.reduce((total: number, item: number)=>(total + item)) || 0
|
|
|
|
|
} 分</span> 通过分数线
|
|
|
|
|
<Form.Item style={{margin:0}} name='pass_socre' initialValue={passScore}><InputNumber min={0} onChange={(value)=>{
|
|
|
|
|
<Form.Item style={{margin:0}} name='pass_socre' initialValue={passScore || 0}><InputNumber min={0} onChange={(value)=>{
|
|
|
|
|
setPassScore(value)
|
|
|
|
|
}} /></Form.Item>
|
|
|
|
|
分</Space>}}
|
|
|
|
|
//formMapRef={formMapRef}
|
|
|
|
|
rowKey={'code'}
|
|
|
|
|
request={async ()=>{
|
|
|
|
|
console.log('questionTypeValues1111', questionTypeValues)
|
|
|
|
|
const result = await queryQuestionType() // 从字典获取题型数据 [{code: 0, name:"单选题"},]
|
|
|
|
|
setTypeScore(questionTypeValues?.map((item: { score: any; score_harf: any; }, key: number)=>{
|
|
|
|
|
return {question_type: result.list[key]?.code, score: item?.score, score_harf: (item?.score_harf || 0)}
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
return {data:questionTypeValues?.map((item: any, key: number)=>({
|
|
|
|
|
...item,
|
|
|
|
|
code: result.list[key]?.code,
|
|
|
|
@ -175,6 +178,17 @@ const ScoreSetter = (props: any, ref: any) => {
|
|
|
|
|
name: result.list[key]?.name,
|
|
|
|
|
count: result.list[key]?.count
|
|
|
|
|
}))}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
return {data:result?.list?.map((item: any)=>({
|
|
|
|
|
...item,
|
|
|
|
|
code: item?.code,
|
|
|
|
|
question_type: item?.code,
|
|
|
|
|
name: item?.name,
|
|
|
|
|
count: item?.count || 0
|
|
|
|
|
}))}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
bordered
|
|
|
|
|
cardProps={{bodyStyle:{padding:0}}}
|
|
|
|
|