|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
/** 认证考试规则 */
|
|
|
|
|
import React, { useState, useRef } from 'react';
|
|
|
|
|
import { useRequest } from 'umi';
|
|
|
|
|
import { useParams, useRequest } from 'umi';
|
|
|
|
|
import { ExportOutlined, PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
|
|
|
|
|
import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd';
|
|
|
|
|
import { PageContainer, FooterToolbar } from '@ant-design/pro-layout';
|
|
|
|
@ -11,7 +11,7 @@ import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
|
|
|
|
|
import ProDescriptions from '@ant-design/pro-descriptions';
|
|
|
|
|
import type { FormValueType } from './components/UpdateForm';
|
|
|
|
|
import UpdateForm from './components/UpdateForm';
|
|
|
|
|
import { saveRegistration, removeRegistration, queryRegistrationList } from '../service';
|
|
|
|
|
import { saveRegistration, removeRegistration, getExaminationPersonApplyList, getAsyncOrgTree } from '../service';
|
|
|
|
|
import type { TableListItem, TableListPagination } from './data';
|
|
|
|
|
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
|
|
|
|
|
|
|
|
|
@ -84,10 +84,19 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const RegistrationList: React.FC = () => {
|
|
|
|
|
const params = useParams();
|
|
|
|
|
/** 更新窗口的弹窗 */
|
|
|
|
|
const [createModalVisible, handleCreateModalVisible] = useState<boolean>(false);
|
|
|
|
|
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
|
|
|
|
|
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
|
|
|
|
|
const [provinceId, setProvinceId] = useState("100007")
|
|
|
|
|
const [cityId, setCityId] = useState("0")
|
|
|
|
|
const [areaId, setAreaId] = useState("0")
|
|
|
|
|
const [exportData, setExportData] = useState({
|
|
|
|
|
examination_id: Number(params.id),
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
@ -95,6 +104,16 @@ const RegistrationList: React.FC = () => {
|
|
|
|
|
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取列数据初始值 */
|
|
|
|
|
const getInitialValues = (cols: any[], vals: any) => {
|
|
|
|
|
const initialValues: any[] = [];
|
|
|
|
|
cols.forEach((column: { dataIndex: string }) => {
|
|
|
|
|
const key: any = column?.dataIndex || '';
|
|
|
|
|
initialValues.push({ ...column, initialValue: key ? vals[key] : '' });
|
|
|
|
|
});
|
|
|
|
|
return initialValues || [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 列表项定义 */
|
|
|
|
|
const columns: ProColumns<TableListItem>[] = [
|
|
|
|
|
{
|
|
|
|
@ -105,13 +124,14 @@ const RegistrationList: React.FC = () => {
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '姓名',
|
|
|
|
|
dataIndex: 'username',
|
|
|
|
|
dataIndex: 'person_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
title: '市',
|
|
|
|
|
dataIndex: 'city_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
@ -119,22 +139,56 @@ const RegistrationList: React.FC = () => {
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
colSize: 1,
|
|
|
|
|
request: async (params) => {
|
|
|
|
|
|
|
|
|
|
const Items = await getAsyncOrgTree({
|
|
|
|
|
org_id: provinceId,
|
|
|
|
|
org_type: 1,
|
|
|
|
|
get_next: 1
|
|
|
|
|
});
|
|
|
|
|
console.log('queryCourseListByTag...', Items)
|
|
|
|
|
const courses = [{ label: "全部", value: "0" }]
|
|
|
|
|
for (let i = 0; i < Items?.length; i++) {
|
|
|
|
|
courses.push({ label: Items[i]?.name, value: Items[i]?.id })
|
|
|
|
|
}
|
|
|
|
|
console.log(courses, 'courses:::');
|
|
|
|
|
return courses;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '区县',
|
|
|
|
|
dataIndex: 'area_name',
|
|
|
|
|
dataIndex: 'district_name',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
renderText: (val: string) => `${val}`,
|
|
|
|
|
dependencies: ['city_name'],
|
|
|
|
|
request: async (params) => {
|
|
|
|
|
const courses = [{ label: "全部", value: "0" }]
|
|
|
|
|
|
|
|
|
|
if (params.city_name) {
|
|
|
|
|
console.log(params, 'params')
|
|
|
|
|
const Items = await getAsyncOrgTree({
|
|
|
|
|
org_id: params.city_name,
|
|
|
|
|
org_type: 2,
|
|
|
|
|
get_next: 1
|
|
|
|
|
});
|
|
|
|
|
console.log('queryCourseListByTag...', Items)
|
|
|
|
|
for (let i = 0; i < Items?.length; i++) {
|
|
|
|
|
courses.push({ label: Items[i]?.name, value: Items[i]?.id })
|
|
|
|
|
}
|
|
|
|
|
console.log(courses, 'courses:::');
|
|
|
|
|
}
|
|
|
|
|
return courses;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '学校',
|
|
|
|
|
valueType: 'text',
|
|
|
|
|
dataIndex: 'org_name',
|
|
|
|
|
dataIndex: 'bureau_name',
|
|
|
|
|
sorter: false,
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: false,
|
|
|
|
@ -152,44 +206,17 @@ const RegistrationList: React.FC = () => {
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '考试时间',
|
|
|
|
|
dataIndex: 'create_time',
|
|
|
|
|
dataIndex: 'examination_time',
|
|
|
|
|
valueType: 'dateRange',
|
|
|
|
|
sorter: true,
|
|
|
|
|
hideInTable: true,
|
|
|
|
|
hideInTable: false,
|
|
|
|
|
hideInForm: true,
|
|
|
|
|
hideInSearch: false,
|
|
|
|
|
|
|
|
|
|
//renderText: (val: string) => `${val}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
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>,
|
|
|
|
|
],
|
|
|
|
|
render: (dom, entity) => {
|
|
|
|
|
return entity.examination_start_time + "-" + entity.examination_end_time;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
@ -202,33 +229,54 @@ const RegistrationList: React.FC = () => {
|
|
|
|
|
search={{
|
|
|
|
|
labelWidth: 120,
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
toolBarRender={() => [
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
key="primary"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
// handleCreateModalVisible(true);
|
|
|
|
|
}}
|
|
|
|
|
href={`/dsideal_yy/zygh/training/person/exportPersonApplyData?examination_id=${params.id}`}
|
|
|
|
|
|
|
|
|
|
>
|
|
|
|
|
<ExportOutlined /> 导出名单
|
|
|
|
|
</Button>,
|
|
|
|
|
]}
|
|
|
|
|
request={async (value) => {
|
|
|
|
|
const _data = await queryRegistrationList(value);
|
|
|
|
|
|
|
|
|
|
console.log('value', value);
|
|
|
|
|
let examination_time = {}
|
|
|
|
|
if (value.examination_time) {
|
|
|
|
|
examination_time = {
|
|
|
|
|
examination_start_time: value.examination_time[0],
|
|
|
|
|
examination_end_time: value.examination_time[1]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
value = {
|
|
|
|
|
...value,
|
|
|
|
|
page_number: value.current,
|
|
|
|
|
page_size: value.pageSize,
|
|
|
|
|
city_id: cityId,
|
|
|
|
|
district_id: areaId,
|
|
|
|
|
examination_id: params.id,
|
|
|
|
|
...examination_time
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// setExportData(value)
|
|
|
|
|
const _data = await getExaminationPersonApplyList(value);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
current: _data?.page_number,
|
|
|
|
|
data: _data?.data?.list,
|
|
|
|
|
data: _data?.table_List,
|
|
|
|
|
pageSize: _data?.page_size,
|
|
|
|
|
total: _data?.total_row || 0,
|
|
|
|
|
};
|
|
|
|
|
}}
|
|
|
|
|
// dataSource={list}
|
|
|
|
|
columns={columns}
|
|
|
|
|
rowSelection={{
|
|
|
|
|
onChange: (_, selectedRows) => {
|
|
|
|
|
setSelectedRows(selectedRows);
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
columns={getInitialValues(columns, { city_name: cityId, area_name: areaId })}
|
|
|
|
|
// rowSelection={{
|
|
|
|
|
// onChange: (_, selectedRows) => {
|
|
|
|
|
// setSelectedRows(selectedRows);
|
|
|
|
|
// },
|
|
|
|
|
// }}
|
|
|
|
|
/*
|
|
|
|
|
pagination={{
|
|
|
|
|
showTotal: (total) => {
|
|
|
|
|