xialiang 3 years ago
commit 9892eec8f8

@ -162,8 +162,8 @@ export default defineConfig({
component: './examinationrules/normal',
},
{
name: '创建模拟考试规则',
icon: 'smile',
//name: '创建模拟考试规则',
//icon: 'smile',
path: '/examinationrules/normal/step',
component: './examinationrules/normal/step',
hideInMenu: true,
@ -182,8 +182,8 @@ export default defineConfig({
component: './examinationrules/attestation',
},
{
name: '新建资质考试规则',
icon: 'smile',
//name: '新建资质考试规则',
//icon: 'smile',
path: '/examinationrules/attestation/step',
component: './examinationrules/attestation/step',
hideInMenu: true,

@ -28,7 +28,7 @@ const uuid = uuidv4();
const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加');
try {
await saveCourse({ ...fields, attachment_filesize: 0, });
await saveCourse({ ...fields });
hide();
message.success('添加成功');
return true;
@ -45,7 +45,7 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
console.log('fields',fields)
try {
await saveCourse({
@ -53,11 +53,11 @@ console.log('fields',fields)
...fields,
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};
@ -176,7 +176,12 @@ const CourseList: React.FC = () => {
hideInTable: true,
hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val} 分钟`,
render: (text: React.ReactNode, _: any, index: number) => {
return(
<div>{text}</div>
)
},
// renderText: (val: string) => `${val} 分钟`,
formItemProps: {
// 参照 https://ant.design/components/form-cn/#Rule
rules: [
@ -255,7 +260,8 @@ const CourseList: React.FC = () => {
beforeUpload={async (file) => {
/** 获取视频文件信息 */
const {media: {track:[General, Video, Audio]}} = await getInfo(file)
if(Video.format !== 'AVC' || Audio.format !== 'AAC'){
console.log('media',General,Video,Audio)
if(Video.Format !== 'AVC' || Audio.Format !== 'AAC'){
message.error('视频编码格式不正确视频采用AVC音频采用AAC')
return false;
}
@ -276,7 +282,7 @@ const CourseList: React.FC = () => {
maxCount={1}
multiple={false}
file={()=>{
// location.pathname
// location.pathname
}}
>
<Button icon={<UploadOutlined />}></Button>
@ -300,7 +306,7 @@ const CourseList: React.FC = () => {
hideInForm: true,
hideInSearch: true,
width: 100,
renderText: (val: string) => `${val} 字节`,
renderText: (val: number) => `${(val / 1024).toFixed(2)} KB`,
formItemProps: {
// 参照 https://ant.design/components/form-cn/#Rule
rules: [
@ -489,7 +495,7 @@ const CourseList: React.FC = () => {
fluid: true, // 当true时Video.js player将拥有流体大小。换句话说它将按比例缩放以适应其容器。
sources: [
{
src: (currentRow?.attachment_json?.url) || '/dsideal_yy/html/down/Syzx/3b/3b225da8-87a5-4619-82a4-664ae2b37e23.mp4', // 测试地址后续请删除
src: '/dsideal_yy/html/' + currentRow?.attachment_json?.url, // 测试地址后续请删除
type: 'application/x-mpegURL'
}
],
@ -578,11 +584,12 @@ const CourseList: React.FC = () => {
//return false;
// values.attachment_json.response.file.response.url
//console.log('currentRow', currentRow)
console.log('values00000000000ss',values)
console.log('values00000000000ss',values)
await handleAdd({
...values,
//course_id: currentRow?.course_id,
attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`
attachment_json: `{"img":"", "name": "${values?.attachment_json?.file?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`,
attachment_filesize: values?.attachment_json?.file?.size, // 字节
});
handleCreateModalVisible(false); // 隐藏创建窗口
actionRef.current?.reloadAndRest?.();
@ -624,13 +631,14 @@ const CourseList: React.FC = () => {
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
//console.log('url', url)
console.log('values编辑',values)
await handleUpdate({
...values,
attachment_filesize: attachment_json?.size || 0, // Bit 字节
course_id: currentRow?.course_id,
attachment_json: `{"img":"", "name":"${values.attachment_json.file.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}`
});
await handleUpdate({
...values,
attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`,
attachment_filesize: values.attachment_json?.size || 0, // Bit 字节
course_id: currentRow?.course_id,
// attachment_json:JSON.stringify(values.attachment_json)
// attachment_json: `{"img":"", "name":"${values.attachment_json.file.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}`
});
handleUpdateModalVisible(false); // 隐藏编辑窗口
actionRef.current?.reloadAndRest?.();
console.log(values);

@ -104,18 +104,18 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
try {
await updateSubject({
...currentRow,
...fields,
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};

@ -41,7 +41,7 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
try {
await saveCourse({
@ -49,11 +49,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
...fields,
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};

@ -27,7 +27,7 @@ import { ConsoleMessage } from 'puppeteer-core';
*/
const handleUpdate = async (fields: FormValueType) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
console.log(fields, '111111111');
try {
@ -36,11 +36,11 @@ const handleUpdate = async (fields: FormValueType) => {
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};

@ -43,7 +43,7 @@ const handleAdd = async (fields: TableListItem) => {
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
try {
await saveRegistration({
@ -51,11 +51,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
...fields,
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};

@ -42,7 +42,7 @@ const handleAdd = async (fields: TableListItem) => {
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
try {
await saveExamination({
@ -50,11 +50,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
...fields,
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};
@ -110,7 +110,7 @@ const ExaminationRules: React.FC = () => {
width: 48,
},
{
title: '资质考试名称',
title: '考试规则名称',
dataIndex: 'rules_name',
valueType: 'text',
hideInTable: false,

@ -50,6 +50,8 @@ export default () => {
/** 试卷详情窗口 */
const [paperModalVisible, handlePaperModalVisible] = useState<boolean>(false);
const [paperInfo, setPaperInfo] = useState({})
/** 查看试卷 */
const { data: questions, run } = useRequest(async (params) => {
console.log('questions', questions)
@ -60,6 +62,37 @@ export default () => {
return result?.question_list;
}});
//
const { data: paperData, run: runPaper } = useRequest(async (params) => {
console.log('paperData', paperData)
/**
* rules_id: params?.id,
page_number: value.current,
page_size: value.pageSize
*/
return queryRulesPaper(params);
}, {
manual: true,
formatResult: (result) => {
return result?.question_list;
}
});
useEffect(() => {
console.log('paperData2', paperData)
if (paperData?.length > 0) {
console.log('paperData[0]', paperData[0])
setPaperInfo(paperData[0])
}
console.log('PaperInfo', paperInfo)
}, [paperData]);
/** 列表项定义 */
const columns: ProColumns[] = [
{
@ -192,6 +225,7 @@ export default () => {
)
if(success){
message.success('试卷生成成功')
actionRef.current?.reload()
}else{
message.success('试卷生成失败')
}
@ -406,6 +440,7 @@ export default () => {
onFinish={async () => {
console.log(formRef.current?.getFieldsValue());
setCurrentStep(2)
runPaper({ rules_id: params?.id || rulesId })
return true;
}}
>
@ -506,12 +541,13 @@ export default () => {
column={1}
//actionRef={actionRef}
title={false}
request={async () => {
const result = await queryRulesView(params)
request={async () => {
const result = await queryRulesView({id: rulesId})
console.log('queryRulesView', result)
const subjectInfo = await getSubjectInfo({subject_id: result.bean.subject_id})
const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id })
console.log('subjectInfo', subjectInfo)
return {data: {...result.bean, subject_name: subjectInfo.data.subject_name}};
return { data: { ...result.bean, subject_name: subjectInfo.data.subject_name } };
}}
extra={false}
>
@ -520,20 +556,20 @@ export default () => {
<ProDescriptions.Item dataIndex="subject_name" label="关联主题" valueType="text" />
<ProDescriptions.Item dataIndex="examination_time" label="考试时长" valueType="text" renderText={(text)=>(`${text} 分钟`)} />
<ProDescriptions.Item dataIndex="grade" label="试卷信息" valueType="text" render={()=>{
<ProDescriptions.Item dataIndex="grade" label="试卷信息" valueType="text" render={() => {
{/** 从试卷中读取 临时卷必须保存后才进入此页 */ }
return <Space direction="vertical">
<span> 0 , 100 </span>
<span>: 0 : 0 : 0 </span>
<span>线 60 </span>
<span> {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} , {paperInfo?.sum_score || '-'} </span>
<span>{paperInfo?.question_type_count?.map(item=>(<span style={{paddingRight:10}}>{`${item?.type_name} ${item?.count} 道题 `}</span>))}</span>
<span>线 {paperInfo?.pass_score || '-'} </span>
</Space>
}} />
}} />
<ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={()=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>0</span> <span><ExclamationCircleOutlined /> </span></div>
<ProDescriptions.Item dataIndex="paper_count" label="试卷数量" valueType="text" render={(dom,entity)=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>{entity?.paper_count}</span> <span><ExclamationCircleOutlined /> </span></div>
}} />
<ProDescriptions.Item dataIndex="live_time" label="试卷有效期" valueType="text" render={()=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>2020/03/01</span> <span><ExclamationCircleOutlined /> </span></div>
<ProDescriptions.Item dataIndex="live_time" label="试卷有效期" valueType="text" render={(dom,entity)=>{
return <div stype={{padding:0}}><span style={{display:'inline-block', width:200}}>{/*entity?.start_time.substring(0,10)*/} {entity?.end_time.substring(0,10)}</span> <span><ExclamationCircleOutlined /> </span></div>
}} />
</ProDescriptions>

@ -136,6 +136,11 @@ const QuestionSelector = (props: any, ref: any) => {
defaultPageSize: 10,
showSizeChanger: false,
}}
search={{
optionRender: false,
collapsed: false,
labelWidth: 40,
}}
actionRef={actionRef}
toolBarRender={false}
rowKey="id"
@ -171,7 +176,6 @@ const QuestionSelector = (props: any, ref: any) => {
total: questions?.totalRow || 0,
};
}}
//dataSource={dataSource}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
@ -179,25 +183,6 @@ const QuestionSelector = (props: any, ref: any) => {
}}
columns={columns}
// grid={{ gutter: 16, column: 1 }}
/*
metas={{
title: {
dataIndex: 'question_stem',
render: (text: React.ReactNode, record: T, index: number) => `1. ${text}`,
},
avatar: {
dataIndex: 'question_type',
valueType: 'text',
render: (text: React.ReactNode, record: T, _: number) => {
const _type = questionType?.filter((item, idx, self)=>{
return item?.code === record.question_type
});
return `[${_type[0]?.name}]`
},
},
description: {
},
}}*/
/>
</>
);

@ -1,6 +1,6 @@
/** 模拟考试 | 资质考试选题 */
//import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, InputNumber, message, Space, Form} from 'antd';
import { Button, InputNumber, message, Space, Form, Input} from 'antd';
//import { FooterToolbar, PageContainer } from '@ant-design/pro-layout';
//import { useRequest } from 'umi';
//import { queryFakeList } from './service';
@ -194,6 +194,9 @@ const ScoreSetter = (props: any, ref: any) => {
getValue: () => {
return passScore;
},
getSum: () => {
return sumScore;
},
}));
return (

@ -45,7 +45,7 @@ const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
console.log('fields', fields)
try {
await updateRules({
@ -53,11 +53,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
...fields,
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};
@ -85,7 +85,7 @@ const ExaminationRules: React.FC = () => {
width: 48,
},
{
title: '考试名称',
title: '考试规则名称',
dataIndex: 'rules_name',
valueType: 'text',
hideInTable: false,

@ -447,7 +447,7 @@ export default () => {
<div style={{ background: '#ffffff', padding: 24 }}>
<Space direction="vertical" style={{ width: '100%' }}>
<strong></strong>
<Typography> {'0'} {'-'} </Typography>
<Typography> {questions?.length} {'-'} </Typography>
<Divider style={{ margin: '6px 0', opacity: 0.5 }} />
<Space direction="vertical">
{questionType.map((item) => {
@ -504,11 +504,15 @@ export default () => {
//actionRef={actionRef}
title={false}
request={async () => {
const result = await queryRulesView(params)
console.log('rulesId...', rulesId)
//{rules_id: rulesId}
console.log('params...', params)
const result = await queryRulesView({id: rulesId})
console.log('queryRulesView', result)
const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id })
console.log('subjectInfo', subjectInfo)
return { data: { ...result.bean, subject_name: subjectInfo.data.subject_name } };
}}
extra={false}
>
@ -516,13 +520,12 @@ export default () => {
<ProDescriptions.Item dataIndex="rules_name" label="考试名称" valueType="text" />
<ProDescriptions.Item dataIndex="subject_name" label="关联主题" valueType="text" />
<ProDescriptions.Item dataIndex="examination_time" label="考试时长" valueType="text" renderText={(text) => (`${text} 分钟`)} />
<ProDescriptions.Item dataIndex="grade" label="试卷信息" valueType="text" render={() => {
{/** 需要从试卷 或 临时试卷 中读取 需要处理 */ }
{/** 从试卷中读取 临时卷必须保存后才进入此页 */ }
return <Space direction="vertical">
<span> 0 , {paperInfo?.sum_score} </span>
<span>: 0 : 0 : 0 </span>
<span>线 {paperInfo?.pass_score} </span>
<span> {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} , {paperInfo?.sum_score || '-'} </span>
<span>{paperInfo?.question_type_count?.map(item=>(<span style={{paddingRight:10}}>{`${item?.type_name} ${item?.count} 道题 `}</span>))}</span>
<span>线 {paperInfo?.pass_score || '-'} </span>
</Space>
}} />
</ProDescriptions>
@ -569,7 +572,8 @@ export default () => {
//console.log('111')
//const values = autoRef?.current?.getData()
//console.log('2222')
//const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(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)})
//console.log('paper', paper)
//setUuidPaper(paper?.paper_uuid)
// message.success('提交成功');
@ -589,23 +593,13 @@ export default () => {
console.log('typeQuestionCount', typeQuestionCount)
const values = setterRef.current?.getData() // 获取题型分值数据
const passSocre = setterRef.current?.getValue() // 获取通过分数线
const sumCore = setterRef.current?.getSum() // 获取总分
console.log('批量设置分值v::::2', 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) => {
console.log('item--', item)
_sumScore += item?.score
})
//console.log('_sumScore', _sumScore)
//console.log('passScore',passScore)
console.log('sumScore', sumScore)
const { success } = await updateScore({ rules_id: Number(params?.id || rulesId), pass_socre: passSocre, sum_score: _sumScore })
setSumScore(_sumScore)
console.log('paper', paper)
const { success } = await updateScore({ rules_id: Number(params?.id || rulesId), pass_socre: passSocre, sum_score: sumCore })
//setSumScore(_sumScore)
//console.log('paper', paper)
// setUuidPaper(paper?.paper_uuid)
// message.success('提交成功');
handleScoreModalVisible(false)

@ -72,9 +72,9 @@ const TableList: React.FC = () => {
</Button>,
]}
request={async (value) => {
console.log(value, "value11")
const _data = await getExaminationPersonStatistics({ ...value, current: value.page_number, sort_type: 2, sort_colum: 1 });
request={async (params) => {
const _data = await getExaminationPersonStatistics({ page_number:params.current, page_size:20,sort_type: 2, sort_colum: 1 });
return {
data: _data?.table_List,
};

@ -7,11 +7,12 @@ import type { DataItem } from '../data.d';
import { getAsyncOrgTree, getEduUnitList,getExaminationStatistics } from '../service';
const { Option } = Select;
import cookie from 'react-cookies';
import styles from '../style.less';
import ProForm, { ProFormSelect } from '@ant-design/pro-form';
import { useRequest } from 'umi';
import {listMyLearningChapterCourse} from "../../../../../../web/src/pages/course/list/service";
import {number} from "prop-types";
const { RangePicker } = DatePicker;
const topColResponsiveProps = {
@ -33,7 +34,7 @@ let city_id=0;
let area_id=0;
let school=0;
const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: DataItem[] }) => {
const [provinceId, setProvinceId] = useState("100007")
const [provinceId, setProvinceId] = useState(cookie.load('background_province_id') )
const [cityList, setCityList] = useState([]);
const [areaList, setAreaList] = useState([]);
@ -63,7 +64,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
const {data: examinationData, run } = useRequest(() => {
return getExaminationStatistics({
bureau_id:school,
bureau_id:typeof (school)===number?school:0,
city_id:city_id,
district_id: area_id,
province_id: provinceId
@ -75,7 +76,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
result.num=num;
}else {
const percent=result.credential_person_count/result.apply_person_count;
const num=percent.toFixed(4);
const num=percent.toFixed(2);
result.num=num;
}
@ -154,13 +155,22 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
if (value >= 'a' && value <= 'z') {
return false;
}
if (value) {
if (value) {
school=value;
// console.log('value::', value)
// setOptions([{ORG_NAME:"aaa", ORG_ID:"111"},{ORG_NAME:"aab", ORG_ID:"112"}])
let id=provinceId;
if(city_id!==0){
if(area_id!==0){
id=area_id;
}else {
id=city_id;
}
}
console.log('iddidididididididi',id)
const { table_List } = await getEduUnitList({
random_num: 277470,
area_id: provinceId,
area_id: id,
edu_type: -1,
// main_school_id: 200125116,
org_name: value,
@ -291,7 +301,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
style={{ textAlign: 'center', marginBottom: 0 , padding:12, border:'solid 1px #f0f0f0'}}
bodyStyle={{padding:0}}
>
<Progress type="circle" percent={examinationData?.num*100} width={80} strokeWidth={10} style={{ position: 'relative', margin: '15px auto 0 auto' }} />
<Progress type="circle" percent={examinationData?parseInt(examinationData.num*100):0} width={80} strokeWidth={10} style={{ position: 'relative', margin: '15px auto 0 auto' }} />
</ChartCard>
</Col>
</Row>

@ -32,7 +32,7 @@ const SalesCard = () => {
data.push({
city: e.city_name,
count: e.count,
credential_rate: e.credential_rate
credential_rate: e.credential_rate?e.credential_rate:0
})
})
@ -48,7 +48,40 @@ const SalesCard = () => {
title: {
text: '证书比例',
},
label: {
formatter: (val) => `${val}%`,
},
}],
tooltip: {
customContent: (title, items) => {
return (
<>
<h5 style={{ marginTop: 16 }}>{title}</h5>
<ul style={{ paddingLeft: 0 }}>
{items?.map((item, index) => {
const { name, value, color } = item;
return (
<li
key={item.year}
className="g2-tooltip-list-item"
data-index={index}
style={{ marginBottom: 4, display: 'flex', alignItems: 'center' }}
>
<span className="g2-tooltip-marker" style={{ backgroundColor: color }}></span>
<span
style={{ display: 'inline-flex', flex: 1, justifyContent: 'space-between' }}
>
<span style={{ margiRight: 16 }}>{name}:&nbsp;&nbsp;&nbsp;</span>
<span className="g2-tooltip-list-item-value">{value}{index===0?'':'%'}</span>
</span>
</li>
);
})}
</ul>
</>
);
},
},
geometryOptions: [
{
geometry: 'column',
@ -81,7 +114,7 @@ const SalesCard = () => {
<TabPane tab="各市州资质证书情况" key="train">
<Row>
<Col xl={24} lg={24} md={24} sm={24} xs={24}>
<div className={styles.salesBar}>
<div className={styles.salesBar} style={{marginRight:'2rem'}}>
<DualAxes {...config} />
</div>

@ -99,7 +99,8 @@ const QuestionBank = () => {
const type = history.location.pathname === '/questionbank/attestation' ? 1 : 0 ; // 题库类型
const actionRef = useRef<ActionType>();
const formRef = useRef();
const [questionType, setQuestionType] = useState([]);
const [parsing, setParsing] = useState();
@ -114,6 +115,7 @@ const QuestionBank = () => {
const [pageNumber, setPageNumber] = useState(1)
//const [answertrueValues, setAnswertrueValues] = useState(); // 编辑试题答案项值
//const [options, setOptions] = useState([]); // 设置当前选项, 用于删除选项时判断
/** 表单项定义 */
const columns: ProColumns<TableListItem>[] = [
@ -233,7 +235,7 @@ const QuestionBank = () => {
dependencies:['answers'],
renderFormItem: (item, { defaultRender, ...rest }, form) => {
console.log('正确答案...', form.getFieldValue('answers'))
// 需要处理 关联长度变化及编辑回显
// 关联长度变化及编辑回显
console.log('edit answertrue11', item)
console.log('form::::::',form.getFieldValue('answertrue'))
console.log('rest', rest)
@ -245,12 +247,13 @@ const QuestionBank = () => {
for(let i=0; i<len; i++){
opts.push(labels[i])
}
if(Number(form.getFieldValue('question_type')) === 0){
console.log('my type', Number(form.getFieldValue('question_type')))
}else{
console.log('====0')
}
console.log('answers??',form.getFieldValue('answers')?.length)
console.log('addType?.value', addType?.value)
@ -488,7 +491,7 @@ const QuestionBank = () => {
title: '题干',
search: false,
dataIndex: 'question_stem',
render: (text: React.ReactNode, record: T, index: number) => (<><Text code style={{width:80, fontSize:10, color:'bfbfbf',display:'none'}}>{record?.id}</Text> {text}</>),
render: (text: React.ReactNode, record: T, index: number) => (<span style={{fontFamily:'auto'}}><Text code style={{width:80, fontSize:10, color:'bfbfbf',display:'none'}}>{record?.id}</Text> {text}</span>),
},
avatar: {
title: '题型',
@ -729,14 +732,41 @@ const QuestionBank = () => {
footer={null}
>
<BetaSchemaForm<DataItem>
formRef={formRef}
layout="horizontal"
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onValuesChange={()=>{
//console.log('formRef', formRef.current.getFieldInstance('answertrue'))
//console.log('formRef.current', formRef.current.getFieldsValue(['answertrue']))
//console.log('v', value)
//console.log('answers', formRef?.current?.getFieldValue('answers'))
const answerTrue = formRef?.current?.getFieldValue('answertrue');
let fixed_answertrue;
// 如果正确答案为字符串(单选 / 判断)
if(typeof answerTrue === 'string'){
console.log('string.....')
fixed_answertrue = labels.indexOf(answerTrue) < (formRef?.current?.getFieldValue('answers')?.length || 0) ? answerTrue : undefined;
}else if(answerTrue?.length > 0){
fixed_answertrue = answerTrue?.filter((item, key)=>{
return labels.indexOf(item) < (formRef?.current?.getFieldValue('answers')?.length || 0)
})
}
console.log('answerTrue', answerTrue)
/*
const */
//console.log('fixed', fixed_answertrue)
formRef?.current?.setFieldsValue({answertrue: fixed_answertrue})
}}
onFinish={async (values: any) => {
//console.log('formRef.current', formRef.current.getFieldsValue(['answertrue']))
// 表单处理
console.log('columns:', columns);
console.log('values:', values);
console.log('values:', values);
return false
const opts = [];
values?.answers?.forEach((item, key)=>{
//

@ -40,18 +40,18 @@ const handleAdd = async (fields: TableListItem) => {
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
const hide = message.loading('正在更新');
try {
await saveTrain({
...currentRow,
...fields,
});
hide();
message.success('配置成功');
message.success('操作成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
message.error('操作失败请重试!');
return false;
}
};

Loading…
Cancel
Save