模拟考试增加、修改

master
xialiang 4 years ago
parent 283b352041
commit a284b05ab9

@ -150,13 +150,19 @@ export default defineConfig({
component: './examinationrules/normal', component: './examinationrules/normal',
}, },
{ {
name: '创建模拟考试', name: '创建模拟考试规则',
icon: 'smile',
path: '/examinationrules/normal/step',
component: './examinationrules/normal/step',
hideInMenu: true,
},
{
name: '编辑模拟考试规则',
icon: 'smile', icon: 'smile',
path: '/examinationrules/normal/step/:id', path: '/examinationrules/normal/step/:id',
component: './examinationrules/normal/step', component: './examinationrules/normal/step',
hideInMenu: true, hideInMenu: true,
}, },
{ {
name: '资质考试规则维护', name: '资质考试规则维护',
icon: 'smile', icon: 'smile',

@ -116,7 +116,7 @@ const ExaminationRules: React.FC = () => {
valueType: 'text', valueType: 'text',
hideInTable: false, hideInTable: false,
hideInForm: false, hideInForm: false,
hideInSearch: true, hideInSearch: false,
}, },
{ {
title: '考试时长', title: '考试时长',
@ -143,8 +143,8 @@ const ExaminationRules: React.FC = () => {
sorter: false, sorter: false,
hideInTable: false, hideInTable: false,
hideInForm: false, hideInForm: false,
hideInSearch: true, hideInSearch: false,
renderText: (val: string) => `${val}`, // renderText: (val: string) => `${val}`,
}, },
{ {
@ -152,6 +152,7 @@ const ExaminationRules: React.FC = () => {
dataIndex: 'sum_score', dataIndex: 'sum_score',
sorter: false, sorter: false,
valueType: 'text', valueType: 'text',
hideInSearch: true,
hideInForm: false, hideInForm: false,
renderText: (val: string) => `${val}`, renderText: (val: string) => `${val}`,
}, },
@ -160,6 +161,7 @@ const ExaminationRules: React.FC = () => {
dataIndex: 'pass_score', dataIndex: 'pass_score',
sorter: false, sorter: false,
valueType: 'text', valueType: 'text',
hideInSearch: true,
hideInForm: false, hideInForm: false,
renderText: (val: string) => `${val}`, renderText: (val: string) => `${val}`,
}, },

@ -116,7 +116,7 @@ const ExaminationRules: React.FC = () => {
valueType: 'text', valueType: 'text',
hideInTable: false, hideInTable: false,
hideInForm: false, hideInForm: false,
hideInSearch: true, hideInSearch: false,
}, },
{ {
title: '考试时长', title: '考试时长',
@ -139,11 +139,11 @@ const ExaminationRules: React.FC = () => {
{ {
title: '创建日期', title: '创建日期',
dataIndex: 'create_time', dataIndex: 'create_time',
valueType: 'text', valueType: 'dateRange',
sorter: false, sorter: false,
hideInTable: false, hideInTable: false,
hideInForm: false, hideInForm: false,
hideInSearch: true, hideInSearch: false,
renderText: (val: string) => `${val}`, renderText: (val: string) => `${val}`,
}, },
@ -153,6 +153,7 @@ const ExaminationRules: React.FC = () => {
sorter: false, sorter: false,
valueType: 'text', valueType: 'text',
hideInForm: false, hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`, renderText: (val: string) => `${val}`,
}, },
{ {
@ -161,6 +162,7 @@ const ExaminationRules: React.FC = () => {
sorter: false, sorter: false,
valueType: 'text', valueType: 'text',
hideInForm: false, hideInForm: false,
hideInSearch: true,
renderText: (val: string) => `${val}`, renderText: (val: string) => `${val}`,
}, },
{ {

@ -16,7 +16,7 @@ import { Button, Checkbox, Col, Divider, List, Menu, message, Radio, Row, Space,
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import ProDescriptions from '@ant-design/pro-descriptions'; import ProDescriptions from '@ant-design/pro-descriptions';
import styles from './index.less' import styles from './index.less'
import { saveExamination, querySubjectList, queryRulesView } from '../../service'; import { saveRules, querySubjectList, queryRulesView } from '../../service';
const waitTime = (time: number = 100) => { const waitTime = (time: number = 100) => {
@ -34,13 +34,19 @@ export default () => {
const formRef = useRef<ProFormInstance>(); const formRef = useRef<ProFormInstance>();
const params = useParams(); const params = useParams();
console.log(params, 'params'); console.log(params, 'params');
if (params) { let ruleData = {}
const {data} = useRequest(async () => { if (params.id) {
const { bean } = await queryRulesView(params); console.log(JSON.stringify(params), "878");
return {data:bean}
const { data } = useRequest(async () => {
const { bean } = await queryRulesView(params);
return { data: bean }
}); });
console.log('data1`11', data); ruleData = data
} }
console.log(ruleData, 'ruleData');
return ( return (
<PageContainer content={''} extraContent={''}> <PageContainer content={''} extraContent={''}>
<ProCard className={styles.examinationrules}> <ProCard className={styles.examinationrules}>
@ -75,14 +81,18 @@ export default () => {
description: false, description: false,
}} }}
onFinish={async (fileds) => { onFinish={async (fileds) => {
console.log(fileds, 'fileds'); if (params.id) {
await saveExamination({ fileds = { ...fileds, id: params.id }
}
console.log(fileds, 'fileds', params);
await saveRules({
...fileds, ...fileds,
b_use: 0, b_use: 0,
rules_type: 0, rules_type: 0,
}); });
await waitTime(2000); // await waitTime(2000);
return true; return true;
}} }}
@ -90,39 +100,44 @@ export default () => {
> >
<Row gutter={24}> <Row gutter={24}>
<Col lg={24} md={24} sm={24}> <Col lg={24} md={24} sm={24}>
<ProFormText {ruleData && (
name="rules_name" <>
label="考试名称" <ProFormText
width="md" name="rules_name"
// tooltip="最长为 6 位汉字,需要与考生身份证一致" label="考试名称"
placeholder="请输入名称" width="md"
rules={[{ required: true, message: '请输入考试名称' }]} initialValue={ruleData.rules_name}
// value="锦书" // tooltip="最长为 6 位汉字,需要与考生身份证一致"
// disabled placeholder="请输入名称"
/> rules={[{ required: true, message: '请输入考试名称' }]}
// value="锦书"
<ProFormSelect // disabled
width="md" />
request={async () => {
return querySubjectList().then(({ data }) => {
console.log(data, 'querySubjectList')
return data.list.map((item) => {
return {
label: item.subject_name,
value: item.subject_id,
};
});
});
}}
rules={[{ required: true, message: '请选择主题' }]}
name="subject_id"
label="关联主题"
/>
<ProFormText name="examination_time" label="考试时长"
rules={[{ required: true, message: '请输入考试时长' }]}
tooltip="限制考试时长的情况下,用户考试中离开,倒计时不会停止。" />
<ProFormSelect
width="md"
initialValue={ruleData.subject_id}
request={async () => {
return querySubjectList().then(({ data }) => {
console.log(data, 'querySubjectList')
return data.list.map((item) => {
return {
label: item.subject_name,
value: item.subject_id,
};
});
});
}}
rules={[{ required: true, message: '请选择主题' }]}
name="subject_id"
label="关联主题"
/>
<ProFormText name="examination_time" label="考试时长"
initialValue={ruleData.examination_time}
rules={[{ required: true, message: '请输入考试时长' }]}
tooltip="限制考试时长的情况下,用户考试中离开,倒计时不会停止。" />
</>
)}
</Col> </Col>
</Row> </Row>

@ -28,29 +28,12 @@ export async function queryRulesList(
}); });
} }
/** 获取证书列表 GET /dsideal_yy/zygh/training/examination/getExaminationList */ /** 新建/修改考试 POST /dsideal_yy/zygh/training/rules/updateRules */
export async function queryCertificateList( export async function saveRules(data: Record<string, any>, options?: Record<string, any>) {
params: { return request<TableListItem>('/dsideal_yy/zygh/training/rules/updateRules', {
// query data,
/** 当前的页码 */ method: 'POST',
current?: number; requestType: "form",
/** 页面的容量 */
pageSize?: number;
},
options?: Record<string, any>,
) {
return request<{
data: TableListItem[];
/** 列表的内容总数 */
total_row?: number;
/** 页面的容量 */
page_size?: number;
success?: boolean;
}>('/api/zygh/training/examination/getCertificateList', {
method: 'GET',
params: {
...params,
},
...(options || {}), ...(options || {}),
}); });
} }
@ -79,7 +62,20 @@ export async function queryRulesView(
/**
*
* http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426
* @param params
* @returns
*/
export async function querySubjectList(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', {
params,
});
}

Loading…
Cancel
Save