|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import React, { useRef } from 'react';
|
|
|
|
|
import { history, useParams } from 'umi';
|
|
|
|
|
import { history, useParams, useRequest } from 'umi';
|
|
|
|
|
import type { ProFormInstance } from '@ant-design/pro-form';
|
|
|
|
|
import { ProFormRadio } from '@ant-design/pro-form';
|
|
|
|
|
import ProForm, {
|
|
|
|
@ -16,7 +16,7 @@ import { Button, Checkbox, Col, Divider, List, Menu, message, Radio, Row, Space,
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
|
|
|
|
import styles from './index.less'
|
|
|
|
|
import { queryProvince, querySubjectList } from '../service';
|
|
|
|
|
import { saveRules, querySubjectList, queryRulesView } from '../../service';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const waitTime = (time: number = 100) => {
|
|
|
|
@ -34,6 +34,18 @@ export default () => {
|
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
|
const params = useParams();
|
|
|
|
|
console.log(params, 'params');
|
|
|
|
|
let ruleData = {}
|
|
|
|
|
if (params.id) {
|
|
|
|
|
console.log(JSON.stringify(params), "878");
|
|
|
|
|
|
|
|
|
|
const { data } = useRequest(async () => {
|
|
|
|
|
const { bean } = await queryRulesView(params);
|
|
|
|
|
return { data: bean }
|
|
|
|
|
});
|
|
|
|
|
ruleData = data
|
|
|
|
|
}
|
|
|
|
|
console.log(ruleData, 'ruleData');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<PageContainer content={''} extraContent={''}>
|
|
|
|
@ -63,47 +75,74 @@ export default () => {
|
|
|
|
|
stepProps={{
|
|
|
|
|
description: false,
|
|
|
|
|
}}
|
|
|
|
|
onFinish={async () => {
|
|
|
|
|
console.log(formRef.current?.getFieldsValue());
|
|
|
|
|
await waitTime(2000);
|
|
|
|
|
onFinish={async (fileds) => {
|
|
|
|
|
if (params.id) {
|
|
|
|
|
fileds = { ...fileds, id: params.id }
|
|
|
|
|
}
|
|
|
|
|
console.log(fileds, 'fileds', params);
|
|
|
|
|
// return false
|
|
|
|
|
await saveRules({
|
|
|
|
|
...fileds,
|
|
|
|
|
b_use: 0,
|
|
|
|
|
rules_type: 1,
|
|
|
|
|
start_time: fileds.dateRange[0],
|
|
|
|
|
end_time: fileds.dateRange[1]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// await waitTime(2000);
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Row gutter={24}>
|
|
|
|
|
<Col lg={24} md={24} sm={24}>
|
|
|
|
|
<ProFormText
|
|
|
|
|
name="name"
|
|
|
|
|
label="考试名称"
|
|
|
|
|
width="md"
|
|
|
|
|
// tooltip="最长为 6 位汉字,需要与考生身份证一致"
|
|
|
|
|
placeholder="请输入名称"
|
|
|
|
|
rules={[{ required: true, message: '请输入考试名称' }]}
|
|
|
|
|
// value="锦书"
|
|
|
|
|
// disabled
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<ProFormSelect
|
|
|
|
|
width="md"
|
|
|
|
|
{ruleData && (
|
|
|
|
|
<>
|
|
|
|
|
<ProFormText
|
|
|
|
|
name="rules_name"
|
|
|
|
|
label="考试名称"
|
|
|
|
|
width="md"
|
|
|
|
|
initialValue={ruleData.rules_name}
|
|
|
|
|
// tooltip="最长为 6 位汉字,需要与考生身份证一致"
|
|
|
|
|
placeholder="请输入名称"
|
|
|
|
|
rules={[{ required: true, message: '请输入考试名称' }]}
|
|
|
|
|
// value="锦书"
|
|
|
|
|
// disabled
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
request={async () => {
|
|
|
|
|
return querySubjectList().then(({ data }) => {
|
|
|
|
|
console.log(data)
|
|
|
|
|
return data.list.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
label: item.subject_name,
|
|
|
|
|
value: item.subject_id,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
rules={[{ required: true, message: '请选择主题' }]}
|
|
|
|
|
name="unusedMode"
|
|
|
|
|
label="关联主题"
|
|
|
|
|
/>
|
|
|
|
|
<ProFormText name="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="限制考试时长的情况下,用户考试中离开,倒计时不会停止。"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<ProFormText name="paper_count" label="试卷数量"
|
|
|
|
|
initialValue={ruleData.paper_count}
|
|
|
|
|
rules={[{ required: true, message: '请输入数量' }]}
|
|
|
|
|
// tooltip="限制考试时长的情况下,用户考试中离开,倒计时不会停止。"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<ProFormDateRangePicker name="dateRange" label="试卷有效期" initialValue={[ruleData.start_time, ruleData.end_time]} />
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|