|
|
@ -1,11 +1,12 @@
|
|
|
|
import React, { useState, useRef } from 'react';
|
|
|
|
import React, { useState, useRef } from 'react';
|
|
|
|
import { useRequest } from 'umi';
|
|
|
|
import { useRequest, useParams } from 'umi';
|
|
|
|
import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
|
|
|
|
import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
|
|
|
|
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Select } from 'antd';
|
|
|
|
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Select } from 'antd';
|
|
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
|
|
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
|
|
|
|
import type { ProColumns, ActionType } from '@ant-design/pro-table';
|
|
|
|
import type { ProColumns, ActionType } from '@ant-design/pro-table';
|
|
|
|
import ProTable from '@ant-design/pro-table';
|
|
|
|
import ProTable from '@ant-design/pro-table';
|
|
|
|
import { BetaSchemaForm, ModalForm, ProFormInstance, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
|
|
|
|
import type { ProFormInstance } from '@ant-design/pro-form';
|
|
|
|
|
|
|
|
import { BetaSchemaForm, ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
|
|
|
|
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
|
|
|
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
|
|
|
import type { FormValueType } from './components/UpdateForm';
|
|
|
|
import type { FormValueType } from './components/UpdateForm';
|
|
|
@ -86,7 +87,7 @@ const CourseList: React.FC = () => {
|
|
|
|
const [createModalVisible, handleCreateModalVisible] = useState<boolean>(false);
|
|
|
|
const [createModalVisible, handleCreateModalVisible] = useState<boolean>(false);
|
|
|
|
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
|
|
|
|
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
|
|
|
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
|
|
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
|
|
|
|
|
|
|
const params = useParams();
|
|
|
|
|
|
|
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
@ -103,18 +104,40 @@ const CourseList: React.FC = () => {
|
|
|
|
width: 48,
|
|
|
|
width: 48,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: '证件名称',
|
|
|
|
title: '姓名',
|
|
|
|
|
|
|
|
dataIndex: 'person_name',
|
|
|
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '市',
|
|
|
|
|
|
|
|
dataIndex: 'city_name',
|
|
|
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '区县',
|
|
|
|
|
|
|
|
dataIndex: 'district_name',
|
|
|
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '学校',
|
|
|
|
|
|
|
|
dataIndex: 'bureau_name',
|
|
|
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '证书类型',
|
|
|
|
dataIndex: 'examination_name',
|
|
|
|
dataIndex: 'examination_name',
|
|
|
|
valueType: 'text',
|
|
|
|
valueType: 'text',
|
|
|
|
hideInTable: false,
|
|
|
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
hideInSearch: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: '市',
|
|
|
|
title: '市',
|
|
|
|
dataIndex: 'city_id',
|
|
|
|
dataIndex: 'city_id',
|
|
|
|
valueType: 'select',
|
|
|
|
valueType: 'select',
|
|
|
|
hideInTable: false,
|
|
|
|
hideInTable: true,
|
|
|
|
hideInForm: false,
|
|
|
|
hideInForm: false,
|
|
|
|
hideInSearch: false,
|
|
|
|
hideInSearch: false,
|
|
|
|
request: async () => {
|
|
|
|
request: async () => {
|
|
|
@ -124,17 +147,10 @@ const CourseList: React.FC = () => {
|
|
|
|
get_next: 1
|
|
|
|
get_next: 1
|
|
|
|
}).then();
|
|
|
|
}).then();
|
|
|
|
const option = []
|
|
|
|
const option = []
|
|
|
|
|
|
|
|
|
|
|
|
data?.map((e, i) => {
|
|
|
|
data?.map((e, i) => {
|
|
|
|
console.log(e, i);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
option.push({ label: e.name, value: e.id })
|
|
|
|
option.push({ label: e.name, value: e.id })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log('city:', data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for (let i = 0; i < Items.length; i++) {
|
|
|
|
|
|
|
|
// tags.push({ label: Items[i].tag_name, value: Items[i].tag_id })
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return option;
|
|
|
|
return option;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -142,98 +158,39 @@ const CourseList: React.FC = () => {
|
|
|
|
title: '区',
|
|
|
|
title: '区',
|
|
|
|
dataIndex: 'district_id',
|
|
|
|
dataIndex: 'district_id',
|
|
|
|
valueType: 'select',
|
|
|
|
valueType: 'select',
|
|
|
|
hideInTable: false,
|
|
|
|
hideInTable: true,
|
|
|
|
hideInForm: false,
|
|
|
|
hideInForm: false,
|
|
|
|
hideInSearch: false,
|
|
|
|
hideInSearch: false,
|
|
|
|
dependencies: ['city_id'],
|
|
|
|
dependencies: ['city_id'],
|
|
|
|
request: async (params) => {
|
|
|
|
request: async (params) => {
|
|
|
|
console.log(params, 'params::::');
|
|
|
|
if (params.city_id) {
|
|
|
|
console.log(formRef, 'formRef::::');
|
|
|
|
console.log(params, 'params::::');
|
|
|
|
console.log(formRef.current?.getFieldsValue(['district_id']));
|
|
|
|
console.log(formRef, 'formRef::::');
|
|
|
|
|
|
|
|
console.log(formRef.current?.getFieldsValue(['district_id']));
|
|
|
|
|
|
|
|
|
|
|
|
const data = await getAsyncOrgTree({
|
|
|
|
|
|
|
|
org_id: params.city_id,
|
|
|
|
|
|
|
|
org_type: 2,
|
|
|
|
|
|
|
|
get_next: 1
|
|
|
|
|
|
|
|
}).then();
|
|
|
|
|
|
|
|
formRef.current?.setFieldsValue({district_id:{}})
|
|
|
|
|
|
|
|
const option = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data?.map((e, i) => {
|
|
|
|
const data = await getAsyncOrgTree({
|
|
|
|
console.log(e, i);
|
|
|
|
org_id: params.city_id,
|
|
|
|
|
|
|
|
org_type: 2,
|
|
|
|
|
|
|
|
get_next: 1
|
|
|
|
|
|
|
|
}).then();
|
|
|
|
|
|
|
|
formRef.current?.setFieldsValue({ district_id: {} })
|
|
|
|
|
|
|
|
const option = []
|
|
|
|
|
|
|
|
|
|
|
|
option.push({ label: e.name, value: e.id })
|
|
|
|
data?.map((e, i) => {
|
|
|
|
})
|
|
|
|
console.log(e, i);
|
|
|
|
console.log('area:', data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for (let i = 0; i < Items.length; i++) {
|
|
|
|
option.push({ label: e.name, value: e.id })
|
|
|
|
// tags.push({ label: Items[i].tag_name, value: Items[i].tag_id })
|
|
|
|
})
|
|
|
|
// }
|
|
|
|
console.log('area:', data);
|
|
|
|
return option;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '创建日期',
|
|
|
|
|
|
|
|
dataIndex: 'create_time',
|
|
|
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
|
|
|
sorter: false,
|
|
|
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '报名开始日期',
|
|
|
|
|
|
|
|
dataIndex: 'apply_start_time',
|
|
|
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
|
|
|
sorter: false,
|
|
|
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '考试时间',
|
|
|
|
|
|
|
|
valueType: 'dateTimeRange',
|
|
|
|
|
|
|
|
dataIndex: 'examination_start_time',
|
|
|
|
|
|
|
|
sorter: false,
|
|
|
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
|
|
|
render: (dom, entity) => {
|
|
|
|
|
|
|
|
return entity.examination_start_time + " - " + entity.examination_end_time
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '试卷数量',
|
|
|
|
|
|
|
|
dataIndex: 'paper_count',
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '通过人数',
|
|
|
|
|
|
|
|
dataIndex: 'apply_person_count',
|
|
|
|
|
|
|
|
sorter: false,
|
|
|
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for (let i = 0; i < Items.length; i++) {
|
|
|
|
|
|
|
|
// tags.push({ label: Items[i].tag_name, value: Items[i].tag_id })
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
return option;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: '制证状态',
|
|
|
|
title: '制证状态',
|
|
|
|
dataIndex: 'status_type',
|
|
|
|
dataIndex: 'status_type',
|
|
|
@ -241,65 +198,12 @@ const CourseList: React.FC = () => {
|
|
|
|
valueType: 'text',
|
|
|
|
valueType: 'text',
|
|
|
|
hideInForm: false,
|
|
|
|
hideInForm: false,
|
|
|
|
hideInSearch: false,
|
|
|
|
hideInSearch: false,
|
|
|
|
renderFormItem: (_, { type, defaultRender, formItemProps, fieldProps, ...rest }, form) => {
|
|
|
|
render: (dom, entity) => {
|
|
|
|
if (type === 'form') {
|
|
|
|
return params.accreditation_status == 1 ? "已制证" : "未制证";
|
|
|
|
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(_);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
valueEnum: {
|
|
|
|
|
|
|
|
0: { text: '待报名' },
|
|
|
|
|
|
|
|
1: { text: '报名中' },
|
|
|
|
|
|
|
|
2: { text: '待考试' },
|
|
|
|
|
|
|
|
3: { text: '考试中' },
|
|
|
|
|
|
|
|
4: { text: '考试完成' },
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
title: '操作',
|
|
|
|
|
|
|
|
dataIndex: 'option',
|
|
|
|
|
|
|
|
valueType: 'option',
|
|
|
|
|
|
|
|
render: (_dom: any, record: React.SetStateAction<TableListItem | undefined>) => [
|
|
|
|
|
|
|
|
<a
|
|
|
|
|
|
|
|
key="detail"
|
|
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
|
|
//console.log('entity', entity);
|
|
|
|
|
|
|
|
setCurrentRow(record);
|
|
|
|
|
|
|
|
handleDetailModalVisible(true);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
查看
|
|
|
|
|
|
|
|
</a>,
|
|
|
|
|
|
|
|
<a
|
|
|
|
|
|
|
|
key="update"
|
|
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
|
|
handleUpdateModalVisible(true);
|
|
|
|
|
|
|
|
setCurrentRow(record);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
编辑
|
|
|
|
|
|
|
|
</a>,
|
|
|
|
|
|
|
|
<a key="subscribeAlert" href="https://procomponents.ant.design/">
|
|
|
|
|
|
|
|
删除
|
|
|
|
|
|
|
|
</a>,
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -325,57 +229,33 @@ const CourseList: React.FC = () => {
|
|
|
|
// </Button>,
|
|
|
|
// </Button>,
|
|
|
|
// ]}
|
|
|
|
// ]}
|
|
|
|
request={async (value) => {
|
|
|
|
request={async (value) => {
|
|
|
|
// console.log(value, 'form value')
|
|
|
|
console.log(value, 'form value')
|
|
|
|
// const { create_time } = value;
|
|
|
|
const { create_time } = value;
|
|
|
|
// if (create_time) {
|
|
|
|
if (create_time) {
|
|
|
|
// value.start_time = create_time[0]
|
|
|
|
value.start_time = create_time[0]
|
|
|
|
// value.end_time = create_time[1]
|
|
|
|
value.end_time = create_time[1]
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// const _data = await getExaminationPersonApplyList({
|
|
|
|
const _data = await getExaminationPersonApplyList({
|
|
|
|
// ...value,
|
|
|
|
...value,
|
|
|
|
// page_number: value.current,
|
|
|
|
examination_id: params.id,
|
|
|
|
// page_size: value.pageSize
|
|
|
|
city_id: value.city_id ? value.city_id : 0,
|
|
|
|
// });
|
|
|
|
district_id: value.district_id ? value.district_id : 0,
|
|
|
|
|
|
|
|
page_number: value.current,
|
|
|
|
// return {
|
|
|
|
page_size: value.pageSize
|
|
|
|
// current: _data?.pageNumber,
|
|
|
|
});
|
|
|
|
// data: _data?.table_List,
|
|
|
|
|
|
|
|
// pageSize: _data?.pageSize,
|
|
|
|
return {
|
|
|
|
// total: _data?.totalRow || 0,
|
|
|
|
current: _data?.pageNumber,
|
|
|
|
// };
|
|
|
|
data: _data?.table_List,
|
|
|
|
|
|
|
|
pageSize: _data?.pageSize,
|
|
|
|
|
|
|
|
total: _data?.totalRow || 0,
|
|
|
|
|
|
|
|
};
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
// dataSource={list}
|
|
|
|
// dataSource={list}
|
|
|
|
columns={columns}
|
|
|
|
columns={columns}
|
|
|
|
rowSelection={false}
|
|
|
|
rowSelection={false}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
{selectedRowsState?.length > 0 && (
|
|
|
|
|
|
|
|
<FooterToolbar
|
|
|
|
|
|
|
|
extra={
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
已选择{' '}
|
|
|
|
|
|
|
|
<a
|
|
|
|
|
|
|
|
style={{
|
|
|
|
|
|
|
|
fontWeight: 600,
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{selectedRowsState.length}
|
|
|
|
|
|
|
|
</a>{' '}
|
|
|
|
|
|
|
|
项
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
|
|
|
|
onClick={async () => {
|
|
|
|
|
|
|
|
await handleRemove(selectedRowsState);
|
|
|
|
|
|
|
|
setSelectedRows([]);
|
|
|
|
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
批量删除
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
<Button type="primary">批量审批</Button>
|
|
|
|
|
|
|
|
</FooterToolbar>
|
|
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
<Modal
|
|
|
|
<Modal
|
|
|
|
title={currentRow?.course_name || '课程详细'}
|
|
|
|
title={currentRow?.course_name || '课程详细'}
|
|
|
|
width="60%"
|
|
|
|
width="60%"
|
|
|
|