培训管理

master
xialiang 3 years ago
parent ecbece7dfa
commit 6b7a27ace1

@ -212,7 +212,7 @@ export default defineConfig({
name: '制证名单',
icon: 'smile',
hideInMenu: true,
path: '/examination/certificate/person/:id',
path: '/examination/certificate/person/:id/:accreditation_status',
component: './examination/certificate/person',
},
],

@ -171,7 +171,7 @@ const CourseList: React.FC = () => {
{
title: '制证状态',
dataIndex: 'status_type',
dataIndex: 'accreditation_status',
sorter: false,
valueType: 'text',
hideInForm: false,
@ -185,23 +185,16 @@ const CourseList: React.FC = () => {
return (
// value 和 onchange 会通过 form 自动注入。
<Select defaultValue="" allowClear={true} >
<Option value="0"></Option>
<Option value="1"></Option>
<Option value="2"></Option>
<Option value="3"></Option>
<Option value="4"></Option>
<Option value="0"></Option>
<Option value="1"></Option>
</Select>
);
}
return defaultRender(_);
},
valueEnum: {
0: { text: '待报名' },
1: { text: '报名中' },
2: { text: '待考试' },
3: { text: '考试中' },
4: { text: '考试完成' },
0: { text: '未制证' },
1: { text: '已制证' },
},
},
@ -215,14 +208,14 @@ const CourseList: React.FC = () => {
<a
key="detail"
onClick={() => {
history.push('/examination/certificate/person/' + record.examination_id)
history.push('/examination/certificate/person/' + record.examination_id + "/" + record.accreditation_status)
}}
>
</a>,
<a key="subscribeAlert" href="https://procomponents.ant.design/">
<a key="subscribeAlert" href={`/dsideal_yy/zygh/training/person/exportPersonApplyDataModifyStatus?examination_id=${record.examination_id}`}>
</a>,
],
},

@ -1,11 +1,12 @@
import React, { useState, useRef } from 'react';
import { useRequest } from 'umi';
import { useRequest, useParams } from 'umi';
import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons';
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';
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 ProDescriptions from '@ant-design/pro-descriptions';
import type { FormValueType } from './components/UpdateForm';
@ -86,7 +87,7 @@ const CourseList: React.FC = () => {
const [createModalVisible, handleCreateModalVisible] = useState<boolean>(false);
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
const params = useParams();
const actionRef = useRef<ActionType>();
const formRef = useRef<ProFormInstance>();
@ -103,18 +104,40 @@ const CourseList: React.FC = () => {
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',
valueType: 'text',
hideInTable: false,
hideInForm: false,
hideInSearch: true,
},
{
title: '市',
dataIndex: 'city_id',
valueType: 'select',
hideInTable: false,
hideInTable: true,
hideInForm: false,
hideInSearch: false,
request: async () => {
@ -124,17 +147,10 @@ const CourseList: React.FC = () => {
get_next: 1
}).then();
const option = []
data?.map((e, i) => {
console.log(e, i);
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;
},
},
@ -142,11 +158,12 @@ const CourseList: React.FC = () => {
title: '区',
dataIndex: 'district_id',
valueType: 'select',
hideInTable: false,
hideInTable: true,
hideInForm: false,
hideInSearch: false,
dependencies: ['city_id'],
request: async (params) => {
if (params.city_id) {
console.log(params, 'params::::');
console.log(formRef, 'formRef::::');
console.log(formRef.current?.getFieldsValue(['district_id']));
@ -171,69 +188,9 @@ const CourseList: React.FC = () => {
// tags.push({ label: Items[i].tag_name, value: Items[i].tag_id })
// }
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,
},
{
title: '制证状态',
dataIndex: 'status_type',
@ -241,65 +198,12 @@ const CourseList: React.FC = () => {
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(_);
},
valueEnum: {
0: { text: '待报名' },
1: { text: '报名中' },
2: { text: '待考试' },
3: { text: '考试中' },
4: { text: '考试完成' },
render: (dom, entity) => {
return params.accreditation_status == 1 ? "已制证" : "未制证";
},
},
{
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 (
@ -325,57 +229,33 @@ const CourseList: React.FC = () => {
// </Button>,
// ]}
request={async (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 getExaminationPersonApplyList({
// ...value,
// page_number: value.current,
// page_size: value.pageSize
// });
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 getExaminationPersonApplyList({
...value,
examination_id: params.id,
city_id: value.city_id ? value.city_id : 0,
district_id: value.district_id ? value.district_id : 0,
page_number: value.current,
page_size: value.pageSize
});
// return {
// current: _data?.pageNumber,
// data: _data?.table_List,
// pageSize: _data?.pageSize,
// total: _data?.totalRow || 0,
// };
return {
current: _data?.pageNumber,
data: _data?.table_List,
pageSize: _data?.pageSize,
total: _data?.totalRow || 0,
};
}}
// dataSource={list}
columns={columns}
rowSelection={false}
/>
{selectedRowsState?.length > 0 && (
<FooterToolbar
extra={
<div>
{' '}
<a
style={{
fontWeight: 600,
}}
>
{selectedRowsState.length}
</a>{' '}
&nbsp;&nbsp;
</div>
}
>
<Button
onClick={async () => {
await handleRemove(selectedRowsState);
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}
>
</Button>
<Button type="primary"></Button>
</FooterToolbar>
)}
<Modal
title={currentRow?.course_name || '课程详细'}
width="60%"

@ -503,12 +503,12 @@ const ExaminationList: React.FC = () => {
// values.attachment_json.response.file.response.url
const params = {
...values,
apply_end_time: values.apply_time[0],
apply_start_time: values.apply_time[1],
course_end_time: values.course_time[0],
course_start_time: values.course_time[1],
apply_start_time: values.apply_time[0],
apply_end_time: values.apply_time[1],
course_start_time: values.course_time[0],
course_end_time: values.course_time[1],
examination_start_time: values.examination_time[0],
examination_end_time: values.examination_time[0]
examination_end_time: values.examination_time[1]
}
delete params.apply_time

@ -9,7 +9,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 { queryTrainList, saveTrain, removeTrain, queryOrgTree, queryValueByKey } from './service';
import { queryTrainList, saveTrain, removeTrain, queryOrgTree, queryValueByKey, querySubjectList } from './service';
import type { TableListItem, TableListPagination } from './data';
import { useRequest } from 'umi';
@ -132,6 +132,7 @@ const TableList: React.FC = () => {
const actionRef = useRef<ActionType>();
const [currentRow, setCurrentRow] = useState<TableListItem>();
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
const [orgTree, setOrgTree] = useState([]);
const columns: ProColumns<TableListItem>[] = [
{
@ -167,6 +168,7 @@ const TableList: React.FC = () => {
org_type: 2,
school_type: 1,
})
setOrgTree(tree.table_List)
console.log('orgId', orgId)
console.log('tree.table_List', tree.table_List)
return getJsonTree(tree.table_List, orgId)
@ -175,6 +177,27 @@ const TableList: React.FC = () => {
hideInForm: false,
//renderText: (val: string) => `${val}`,
},
{
title: '关联主题',
dataIndex: 'subject_id',
valueType: 'text',
hideInTable: true,
hideInForm: false,
hideInSearch: false,
request: async () => {
const { data: Items } = await querySubjectList({ page_size: 1000 });
// console.log(Items, ')))');
const sinfo = []
for (let i = 0; i < Items.list.length; i++) {
// console.log(Items.list[i], ">>>")
sinfo.push({ label: Items.list[i].subject_name, value: Items.list[i].subject_id })
}
console.log(sinfo, 'sinfo');
return sinfo;
},
},
{
title: '开始时间',
dataIndex: 'start_time',
@ -195,6 +218,7 @@ const TableList: React.FC = () => {
dataIndex: 'datetime',
sorter: false,
hideInForm: false,
hideInTable: true,
renderText: (val: string) => `${val}`,
},
{
@ -245,6 +269,7 @@ const TableList: React.FC = () => {
search={{
labelWidth: 120,
}}
toolBarRender={() => [
<Button
type="primary"
@ -315,11 +340,36 @@ const TableList: React.FC = () => {
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values: any) => {
// 表单处理
console.log('columns:', columns);
console.log('values:', values);
//console.log('columns:', columns);
console.log('values1:', values, orgTree);
//return false;
// values.attachment_json.response.file.response.url
const params = {
...values,
end_time: values.datetime[1],
start_time: values.datetime[0],
}
delete params.datetime
console.log(123);
const tree = orgTree.filter((item, idx, self) => {
console.log(item.id);
return (values.org_names.find(item.id) >= 0)
});
console.log(321);
console.log(tree, 'tree');
// delete params.course_time
// delete params.examination_time
// await handleUpdate(params);
// handleCreateModalVisible(false);
// actionRef.current?.reloadAndRest?.();
}}
submitter={{
render: (props, doms) => (

@ -1,6 +1,6 @@
import { ParamsType } from '@ant-design/pro-table/node_modules/@ant-design/pro-provider';
import type { ParamsType } from '@ant-design/pro-table/node_modules/@ant-design/pro-provider';
import { request } from 'umi';
import { TableListItem } from './data';
import type { TableListItem } from './data';
/** 获取课程列表 GET /dsideal_yy/ypt/careerTraining/train/list */
export async function queryTrainList(
@ -11,7 +11,7 @@ export async function queryTrainList(
/** 页面的容量 */
pageSize?: number;
},
options?: { [key: string]: any },
options?: Record<string, any>,
) {
return request<{
data: TableListItem[];
@ -30,7 +30,7 @@ export async function queryTrainList(
}
/** 新建/修改课程 POST /dsideal_yy/ypt/careerTraining/train/save */
export async function saveTrain(data: { [key: string]: any }, options?: { [key: string]: any }) {
export async function saveTrain(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/train/save', {
data,
method: 'POST',
@ -39,7 +39,7 @@ export async function saveTrain(data: { [key: string]: any }, options?: { [key:
}
/** 删除课程 POST /dsideal_yy/ypt/careerTraining/train/delete */
export async function removeTrain(data: { key: number[] }, options?: { [key: string]: any }) {
export async function removeTrain(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/train/delete', {
data,
method: 'POST',
@ -48,7 +48,7 @@ export async function removeTrain(data: { key: number[] }, options?: { [key: str
}
/** 查看课程仅仅获取课程详情不标记浏览量GET /dsideal_yy/ypt/careerTraining/course/view */
export async function queryTrainView(data: { [key: string]: any }, options?: { [key: string]: any }) {
export async function queryTrainView(data: Record<string, any>, options?: Record<string, any>) {
return request<TableListItem>('/dsideal_yy/ypt/careerTraining/train/view', {
data,
method: 'POST',
@ -73,3 +73,21 @@ export async function queryValueByKey(
params,
});
}
/**
*
* http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426
* @param params
* @returns
*/
export async function querySubjectList(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', {
params,
});
}

Loading…
Cancel
Save