考试画面修改

main
liuyiliang 3 months ago
parent 864e353a93
commit a8cf3d81ac
  1. 75
      packages/examination/src/views/exam-online/compoents/ExamDetailAnalysisPage.tsx
  2. 63
      packages/examination/src/views/exam-online/compoents/ExamListPage.tsx
  3. 3
      packages/examination/src/views/exam-online/exam-schedule.tsx
  4. 7
      packages/examination/src/views/statistical/serviceStatistics.tsx

@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Row, Col, Input, Select, Button, Table, Space, Cascader, Modal } from 'antd'; import {Row, Col, Input, Select, Button, Table, Space, Cascader, Modal, Form, TreeSelect} from 'antd';
import ReactECharts from 'echarts-for-react'; import ReactECharts from 'echarts-for-react';
import {getExamDetailAnalysisPageList, getIndustryList, getScoreDistribution} from 'api/exam-online/index'; import {getExamDetailAnalysisPageList, getIndustryList, getScoreDistribution} from 'api/exam-online/index';
import { convertToCascaderData } from "./ExamEditPage"; import { convertToCascaderData } from "./ExamEditPage";
@ -21,6 +21,7 @@ type ExamDataItem = {
}; };
const ExamDetailAnalysisPage: React.FC = () => { const ExamDetailAnalysisPage: React.FC = () => {
let formRef = React.createRef<any>();
const [examName, setExamName] = useState(''); const [examName, setExamName] = useState('');
const [paperName, setPaperName] = useState(''); const [paperName, setPaperName] = useState('');
const [examArea, setExamArea] = useState(''); const [examArea, setExamArea] = useState('');
@ -63,7 +64,8 @@ const ExamDetailAnalysisPage: React.FC = () => {
setPaperName(''); setPaperName('');
setExamArea(''); setExamArea('');
setIndustry(null); setIndustry(null);
handleSearch(); const form = formRef.current;
form.resetFields();
}; };
const handleSearch = () => { const handleSearch = () => {
@ -170,41 +172,40 @@ const ExamDetailAnalysisPage: React.FC = () => {
<div> <div>
<div className="header-filter"> <div className="header-filter">
<div className="list-filter" style={{display: 'flex', padding: 15}}> <div className="list-filter" style={{display: 'flex', padding: 15}}>
<Row gutter={16}> <Form
<Col span={5}> ref={formRef}
<span style={{ marginRight: 8 }}>:</span> className="filter"
<Input layout="inline"
placeholder="考试名称" name="basic"
value={examName} style={{ paddingLeft: 20 }}>
onChange={(e) => setExamName(e.target.value)} <Form.Item
style={{ width: 'calc(100% - 100px)' }} // 调整输入框宽度 label="考试名称:"
/> name="examName">
</Col> <Input placeholder="考试名称" onChange={(e) => setExamName(e.target.value)}/>
<Col span={5}> </Form.Item>
<span style={{ marginRight: 8 }}>:</span> <Form.Item
<Input label="试卷名称:"
placeholder="试卷名称" name="paperName">
value={paperName} <Input placeholder="试卷名称" onChange={(e) => setPaperName(e.target.value)}/>
onChange={(e) => setPaperName(e.target.value)} </Form.Item>
style={{ width: 'calc(100% - 100px)' }} // 调整输入框宽度 <Form.Item
/> label="考试区域:"
</Col> name="examArea">
<Col span={5}>
<span style={{ marginRight: 8 }}>:</span>
<Cascader <Cascader
options={convertToCascaderData()} options={convertToCascaderData()}
placeholder="请选择考试区域" placeholder="考试区域"
onChange={(values) => setExamArea(convertArrToRegion(values))} onChange={(values) => setExamArea(convertArrToRegion(values))}
style={{ width: 'calc(100% - 100px)' }} // 调整级联选择器宽度 style={{width: 195}}
/> />
</Col> </Form.Item>
<Col span={5}> <Form.Item
<span style={{ marginRight: 8 }}>:</span> label="监管行业:"
name="industry">
<Select <Select
placeholder="监管行业" placeholder="监管行业"
value={industry} value={industry}
onChange={(value) => setIndustry(value)} onChange={(value) => setIndustry(value)}
style={{ width: 150 }} // 调整下拉框宽度 style={{width: 195}}
allowClear allowClear
> >
{industryOptions.map((option) => ( {industryOptions.map((option) => (
@ -213,14 +214,16 @@ const ExamDetailAnalysisPage: React.FC = () => {
</Option> </Option>
))} ))}
</Select> </Select>
</Col> </Form.Item>
<Col span={4}> <Form.Item>
<Space> <Button htmlType="button" onClick={handleReset}>
<Button onClick={handleReset}></Button>
</Button>
</Form.Item>
<Form.Item>
<Button type="primary" onClick={handleSearch}></Button> <Button type="primary" onClick={handleSearch}></Button>
</Space> </Form.Item>
</Col> </Form>
</Row>
</div> </div>
</div> </div>
<Table <Table

@ -111,6 +111,10 @@ const ExamListPage = ({ history }: { history: any }) => {
if (!res) { if (!res) {
return; return;
} }
message.open({
type: 'success',
content: '操作成功',
});
research(); research();
}).catch(() => { }) }).catch(() => { })
}, },
@ -132,9 +136,28 @@ const ExamListPage = ({ history }: { history: any }) => {
onOk: () => { onOk: () => {
const hasWithdrawn = selectedExams.some(exam => exam.publishStatus === 0 || exam.publishStatus === 2); const hasWithdrawn = selectedExams.some(exam => exam.publishStatus === 0 || exam.publishStatus === 2);
if (hasWithdrawn) { if (hasWithdrawn) {
const confirm = window.confirm('选中数据当中有无法撤回的数据,是否继续'); let warn1Arr = selectedExams.filter(exam => exam.publishStatus === 0);
if (!confirm) { if (warn1Arr && warn1Arr.length) {
return; let warnMessage = [];
for (let index = 0; index < warn1Arr.length; index ++) {
warnMessage.push(warn1Arr[index].examName);
}
message.open({
type: 'warning',
content: '操作失败:' + warnMessage.join('、') + '禁止撤回',
});
}
let warn2Arr = selectedExams.filter(exam => exam.publishStatus === 2);
if (warn2Arr && warn2Arr.length) {
let warnMessage = [];
for (let index = 0; index < warn2Arr.length; index ++) {
warnMessage.push(warn2Arr[index].examName);
}
message.open({
type: 'warning',
content: '操作失败:' + warnMessage.join('、') + '数据已撤回',
});
} }
} }
@ -147,6 +170,10 @@ const ExamListPage = ({ history }: { history: any }) => {
if (!res) { if (!res) {
return; return;
} }
message.open({
type: 'success',
content: '操作成功',
});
research(); research();
}).catch(() => { }) }).catch(() => { })
} }
@ -167,16 +194,24 @@ const ExamListPage = ({ history }: { history: any }) => {
title: '确认发布', title: '确认发布',
content: '你确定要发布这些选中的考试吗?', content: '你确定要发布这些选中的考试吗?',
onOk: () => { onOk: () => {
const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1 || exam.publishStatus === 2); const hasPublishedOrWithdrawn = selectedExams.some(exam => exam.publishStatus === 1);
if (hasPublishedOrWithdrawn) { if (hasPublishedOrWithdrawn) {
const confirm = window.confirm('选中数据当中有无法发布的数据,是否继续'); let warn1Arr = selectedExams.filter(exam => exam.publishStatus === 1);
if (!confirm) { if (warn1Arr && warn1Arr.length) {
return; let warnMessage = [];
for (let index = 0; index < warn1Arr.length; index ++) {
warnMessage.push(warn1Arr[index].examName);
}
message.open({
type: 'warning',
content: '操作失败:' + warnMessage.join('、') + '数据已发布',
});
} }
} }
// 筛选出可以发布的数据 // 筛选出可以发布的数据
const validExams = selectedExams.filter(exam => exam.publishStatus === 0); const validExams = selectedExams.filter(exam => exam.publishStatus === 0 || exam.publishStatus === 2);
const validIds = validExams.map(exam => String(exam.examId)); const validIds = validExams.map(exam => String(exam.examId));
if (validIds.length > 0) { if (validIds.length > 0) {
@ -184,6 +219,10 @@ const ExamListPage = ({ history }: { history: any }) => {
if (!res) { if (!res) {
return; return;
} }
message.open({
type: 'success',
content: '操作成功',
});
research(); research();
}).catch(() => { }) }).catch(() => { })
} }
@ -231,8 +270,9 @@ const ExamListPage = ({ history }: { history: any }) => {
const handleGenerateQrCode = (exam: any) => { const handleGenerateQrCode = (exam: any) => {
// 实现生成考试码逻辑 // 实现生成考试码逻辑
setExamId(exam.examId); setExamId(exam.examId);
setQrCodeData(exam.examId); setQrCodeData(exam.path ? exam.path : exam.examId);
setExamName(exam.examName); setExamName(exam.examName);
debugger
if (exam.captcha) { if (exam.captcha) {
setCaptcha(exam.captcha); setCaptcha(exam.captcha);
} else { } else {
@ -319,7 +359,7 @@ const ExamListPage = ({ history }: { history: any }) => {
// 判断是否全选 // 判断是否全选
const isAllSelected = currentPageExamList.length > 0 && selectedRows.length === currentPageExamList.length; const isAllSelected = currentPageExamList.length > 0 && selectedRows.length === currentPageExamList.length;
const columns = [ const columns: any = [
{ {
title: ( title: (
<Checkbox <Checkbox
@ -329,6 +369,7 @@ const ExamListPage = ({ history }: { history: any }) => {
), ),
dataIndex: 'examId', dataIndex: 'examId',
key: 'examId', key: 'examId',
align: 'center',
render: (cellValue: number, record: Exam) => ( render: (cellValue: number, record: Exam) => (
<Checkbox <Checkbox
checked={selectedRows.includes(record.examId)} checked={selectedRows.includes(record.examId)}
@ -420,7 +461,7 @@ const ExamListPage = ({ history }: { history: any }) => {
> >
</a>)} </a>)}
{record.publishStatus === 0 || record.publishStatus === 2 && ( {(record.publishStatus === 0 || record.publishStatus === 2) && (
<a onClick={() => handlePublishSingle(record.examId)}></a> <a onClick={() => handlePublishSingle(record.examId)}></a>
)} )}
{record.publishStatus === 1 && ( {record.publishStatus === 1 && (

@ -14,13 +14,12 @@ class ExamSchedule extends Component<any, States> {
this.state = { this.state = {
resData: undefined, resData: undefined,
visible: false, visible: false,
title: '新增公告', title: '',
current: {} current: {}
} }
} }
componentDidMount() { componentDidMount() {
// this.getList()
} }
render() { render() {

@ -108,7 +108,12 @@ const App: React.FC = () => {
const query = { page: current, num: pageSize || 20 } const query = { page: current, num: pageSize || 20 }
setTimeout(() => { setTimeout(() => {
setQuery(query); setQuery(query);
getListApi({}, query.page, query.num) getListApi({
dateFilter: form.getFieldValue('dateFilter'),
startDate: form.getFieldValue('selectDateTime') ? formatDate(form.getFieldValue('selectDateTime')[0]) : null,
doneDate: form.getFieldValue('selectDateTime') ? formatDate(form.getFieldValue('selectDateTime')[1]) : null,
serviceStatus: form.getFieldValue('serviceStatus')
}, query.page, query.num)
}, 0) }, 0)
} }

Loading…
Cancel
Save