|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import React, { useState, useRef } from 'react';
|
|
|
|
|
import { useRequest } from 'umi';
|
|
|
|
|
import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
|
|
|
|
|
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd';
|
|
|
|
|
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Select } from 'antd';
|
|
|
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
|
|
|
|
|
import type { ProColumns, ActionType } from '@ant-design/pro-table';
|
|
|
|
|
import ProTable from '@ant-design/pro-table';
|
|
|
|
@ -12,13 +12,14 @@ import type { FormValueType } from './components/UpdateForm';
|
|
|
|
|
import UpdateForm from './components/UpdateForm';
|
|
|
|
|
import { saveCertificate, removeCertificate, queryCertificateList } from '../service';
|
|
|
|
|
import type { TableListItem, TableListPagination } from '../data';
|
|
|
|
|
import { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
|
|
|
|
|
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加证书
|
|
|
|
|
*
|
|
|
|
|
* @param fields
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
const handleAdd = async (fields: TableListItem) => {
|
|
|
|
|
const hide = message.loading('正在添加');
|
|
|
|
|
|
|
|
|
@ -86,7 +87,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
|
|
|
|
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
const [currentRow, setCurrentRow] = useState<TableListItem>();
|
|
|
|
|
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
|
|
|
|
@ -96,21 +97,21 @@ const CourseList: React.FC = () => {
|
|
|
|
|
{
|
|
|
|
|
title: '序号',
|
|
|
|
|
key: 'index',
|
|
|
|
|
valueType: 'indexBorder',
|
|
|
|
|
valueType: 'indexBorder',
|
|
|
|
|
width: 48,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '考试名称',
|
|
|
|
|
title: '证件名称',
|
|
|
|
|
dataIndex: 'examination_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '创建日期',
|
|
|
|
|
dataIndex: 'create_time',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
@ -120,7 +121,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
{
|
|
|
|
|
title: '报名开始日期',
|
|
|
|
|
dataIndex: 'apply_start_time',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
@ -128,14 +129,16 @@ const CourseList: React.FC = () => {
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '考试开始时间',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
title: '考试时间',
|
|
|
|
|
valueType: 'dateTimeRange',
|
|
|
|
|
dataIndex: 'examination_start_time',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
render: (dom, entity) => {
|
|
|
|
|
return entity.examination_start_time + " - " + entity.examination_end_time
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '试卷数量',
|
|
|
|
@ -143,6 +146,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
sorter: false,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -151,17 +155,73 @@ const CourseList: React.FC = () => {
|
|
|
|
|
sorter: false,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '通过人数',
|
|
|
|
|
dataIndex: 'apply_person_count',
|
|
|
|
|
sorter: false,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
title: '状态',
|
|
|
|
|
dataIndex: 'status_type',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInForm: true,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
renderFormItem: (_, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
|
|
|
|
|
if (type === 'form') {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
const status = form.getFieldValue('state');
|
|
|
|
|
if (status !== 'open') {
|
|
|
|
|
return (
|
|
|
|
|
// value 和 onchange 会通过 form 自动注入。
|
|
|
|
|
<Select defaultValue="0" >
|
|
|
|
|
<Option value="0">待报名</Option>
|
|
|
|
|
<Option value="1">报名中</Option>
|
|
|
|
|
<Option value="2">待考试</Option>
|
|
|
|
|
<Option value="3">考试中</Option>
|
|
|
|
|
<Option value="4">考试完成</Option>
|
|
|
|
|
|
|
|
|
|
</Select>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return defaultRender(_);
|
|
|
|
|
},
|
|
|
|
|
render: (dom, entity) => {
|
|
|
|
|
switch (entity.status_type) {
|
|
|
|
|
case 0:
|
|
|
|
|
return "待报名"
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
return "报名中"
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
return "待考试"
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
return "考试中"
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
return "考试完成";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// return entity.status_type;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
dataIndex: 'option',
|
|
|
|
@ -203,24 +263,31 @@ const CourseList: React.FC = () => {
|
|
|
|
|
search={{
|
|
|
|
|
labelWidth: 120,
|
|
|
|
|
}}
|
|
|
|
|
toolBarRender={() => [
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
key="primary"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
handleCreateModalVisible(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<PlusOutlined /> 新建课程
|
|
|
|
|
</Button>,
|
|
|
|
|
]}
|
|
|
|
|
// toolBarRender={() => [
|
|
|
|
|
// <Button
|
|
|
|
|
// type="primary"
|
|
|
|
|
// key="primary"
|
|
|
|
|
// onClick={() => {
|
|
|
|
|
// handleCreateModalVisible(true);
|
|
|
|
|
// }}
|
|
|
|
|
// >
|
|
|
|
|
// <PlusOutlined /> 新建课程
|
|
|
|
|
// </Button>,
|
|
|
|
|
// ]}
|
|
|
|
|
request={async (value) => {
|
|
|
|
|
const _data = await queryCertificateList(value);
|
|
|
|
|
console.log(value, 'form value')
|
|
|
|
|
const { create_time } = value;
|
|
|
|
|
if (create_time) {
|
|
|
|
|
value.start_time = create_time[0]
|
|
|
|
|
value.end_time = create_time[1]
|
|
|
|
|
}
|
|
|
|
|
const _data = await queryCertificateList();
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
current: _data?.page_number,
|
|
|
|
|
data: _data?.data?.list,
|
|
|
|
|
pageSize: _data?.page_size,
|
|
|
|
|
total: _data?.total_row || 0,
|
|
|
|
|
current: _data?.pageNumber,
|
|
|
|
|
data: _data?.table_List,
|
|
|
|
|
pageSize: _data?.pageSize,
|
|
|
|
|
total: _data?.totalRow || 0,
|
|
|
|
|
};
|
|
|
|
|
}}
|
|
|
|
|
// dataSource={list}
|
|
|
|
@ -265,7 +332,7 @@ const CourseList: React.FC = () => {
|
|
|
|
|
}}
|
|
|
|
|
footer={null}
|
|
|
|
|
centered
|
|
|
|
|
>{ console.log('currentRow',currentRow)}
|
|
|
|
|
>{console.log('currentRow', currentRow)}
|
|
|
|
|
{currentRow?.name && (
|
|
|
|
|
<ProDescriptions<TableListItem>
|
|
|
|
|
column={2}
|
|
|
|
|