Administrator 3 years ago
commit 0faffcf5bf

@ -49,7 +49,7 @@
"not ie <= 10"
],
"dependencies": {
"@ant-design/charts": "^0.9.4",
"@ant-design/charts": "^1.3.5",
"@ant-design/icons": "^4.5.0",
"@ant-design/pro-card": "^1.18.23",
"@ant-design/pro-descriptions": "^1.6.8",

@ -44,7 +44,7 @@ const handleAdd = async (fields: TableListItem) => {
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
console.log('fields',fields)
try {
await saveCourse({
...currentRow,
@ -70,11 +70,15 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
if (!selectedRows) return true;
console.log('key', selectedRows);
try {
await removeCourse({
const {code, msg} = await removeCourse({
key: selectedRows.map((row) => row.key),
});
hide();
message.success('删除成功,即将刷新');
if(code === 2000 ){
message.success('删除成功,即将刷新');
}else{
message.warning(msg);
}
return true;
} catch (error) {
console.log('error', error)
@ -84,7 +88,6 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
}
};
const CourseList: React.FC = () => {
/** 新建窗口的弹窗 */
@ -286,7 +289,7 @@ const CourseList: React.FC = () => {
hideInForm: true,
hideInSearch: true,
width: 100,
renderText: (val: string) => `${val}M`,
renderText: (val: string) => `${val} 字节`,
formItemProps: {
// 参照 https://ant.design/components/form-cn/#Rule
rules: [
@ -333,7 +336,7 @@ const CourseList: React.FC = () => {
</a>,
<a
key="remove"
onClick={() => {
onClick={ () => {
handleRemove([{ key: record?.course_id }]); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
@ -442,9 +445,12 @@ const CourseList: React.FC = () => {
<Modal
title={currentRow?.course_name || '课程详细'}
width="50%"
destroyOnClose={true}
visible={detailModalVisible}
onCancel={() => {
playerRef.current?.pause();
//playerRef?.current?.ended();
playerRef?.current?.dispose();
//videoRef.current.play()
console.log('playerRef:', playerRef.current)
setCurrentRow(undefined); // 设置当前行
@ -600,14 +606,18 @@ const CourseList: React.FC = () => {
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values) => {
alert(0)
console.log('values', values)
console.log('currentRow', currentRow)
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
//console.log('url', url)
await handleUpdate({
...values,
attachment_filesize: attachment_json?.size || 0, // Bit 字节
course_id: currentRow?.course_id,
//attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/M3u8/${uuid?.substr(0, 2)}/${uuid}.m3u8"}`
attachment_json: `{"img":"", "name": "${values.attachment_json?.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}`
});
handleUpdateModalVisible(false); // 隐藏编辑窗口
actionRef.current?.reloadAndRest?.();
console.log(values);
}}
submitter={{

@ -121,7 +121,7 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
};
/**
*
*
*
* @param selectedRows
*/
@ -130,11 +130,15 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
if (!selectedRows) return true;
try {
await removeSubject({
const {code, msg} = await removeSubject({
key: selectedRows.map((row) => row.key),
});
hide();
message.success('删除成功,即将刷新');
if(code === 2000 ){
message.success('删除成功,即将刷新');
}else{
message.warning(msg);
}
return true;
} catch (error) {
hide();
@ -282,11 +286,12 @@ const TableList: React.FC = () => {
</a>,
<a
key="deleteAlert"
onClick={() => {
// handleCopyItem({});
}}
>
key="remove"
onClick={ () => {
handleRemove([{ key: record?.subject_id }]); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}>
</a>,
],

@ -147,3 +147,14 @@ export async function saveChapter(data: Record<string, any>, options?: Record<st
...(options || {}),
});
}
/** 删除主题 */
export async function removeSubject(data: { key: number[] }, options?: Record<string, any>) {
console.log('data:::', data);
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/subject/deleteSubject', {
data: { subject_id: data?.key[0] }, // 当前接口不支持批量操作
method: 'POST',
requestType: 'form',
...(options || {}),
});
}

@ -1,8 +1,9 @@
import { DingdingOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm } from 'antd';
import { Fragment, useRef, useState } from 'react';
import { Fragment, useEffect, useRef, useState } from 'react';
import { GridContent } from '@ant-design/pro-layout';
import { Line } from '@ant-design/charts';
import { DualAxes } from "@ant-design/charts";
import styles from './index.less';
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css'
@ -16,7 +17,102 @@ const { Step } = Steps;
export default () => {
const uuid = uuidv4()
console.log('uuid', uuidv4());
const data = [
{
year: "1991",
value: 3,
count: 10
},
{
year: "1992",
value: 4,
count: 4
},
{
year: "1993",
value: 3.5,
count: 5
},
{
year: "1994",
value: 5,
count: 5
},
{
year: "1995",
value: 4.9,
count: 4.9
},
{
year: "1996",
value: 6,
count: 35
},
{
year: "1997",
value: 7,
count: 7
},
{
year: "1998",
value: 9,
count: 1
},
{
year: "1999",
value: 13,
count: 20
}
];
const data2 = [
{
year: "1991",
value: 30,
count: 100
},
{
year: "1992",
value: 40,
count: 40
},
{
year: "1993",
value: 3.5,
count: 50
},
{
year: "1994",
value: 5,
count: 50
},
{
year: "1995",
value: 40.9,
count: 24.9
},
{
year: "1996",
value: 6,
count: 395
},
{
year: "1997",
value: 7,
count: 79
},
{
year: "1998",
value: 99,
count: 1
},
{
year: "1999",
value: 193,
count: 20
}
];
const [modalVisible, handleModalVisible] = useState<boolean>(false);
const saveInputRef = useRef();
//const currentRow = {course_name:'课程0001'};
@ -27,6 +123,17 @@ export default () => {
{dataIndex: "course_name", hideInDescriptions: false, hideInForm: false,hideInSearch: true,hideInTable: false, title: "课程名称1", valueType: "text"},
{}
];
const [chartData, setChartData] = useState([data, data]);
useEffect(() => {
setInterval(() => {
setChartData(Math.random() > 0.5 ? [data, data] : [data2, data2]);
}, 1000);
}, []);
const config = {
data: chartData,
xField: "year",
yField: ["value", "count"]
};
return(
<>
<Input value={123} ref={saveInputRef} />
@ -103,6 +210,8 @@ export default () => {
<Popconfirm title="Are you sure" okText="Yes" cancelText="No">
<a href="#">Delete</a>
</Popconfirm>
<DualAxes {...config} />
</>
)
};

@ -16,6 +16,7 @@ import UpdateForm from './components/UpdateForm';
import { querySubjectList, updateExamination, removeExamination, queryExaminationList, queryRulesList } from '../service';
import type { TableListItem, TableListPagination } from './data';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
import { ConsoleMessage } from 'puppeteer-core';
@ -48,14 +49,15 @@ const handleUpdate = async (fields: FormValueType) => {
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
console.log('selectedRows', selectedRows)
const hide = message.loading('正在删除');
if (!selectedRows) return true;
try {
await removeExamination({
key: selectedRows.map((row) => row.key),
});
},currentRow);
hide();
message.success('删除成功,即将刷新');
return true;
@ -317,7 +319,13 @@ const ExaminationList: React.FC = () => {
>
</a>,
<a key="subscribeAlert" href="https://procomponents.ant.design/">
<a
key="remove"
onClick={ () => {
handleRemove([{ key: record?.examination_id }], record); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}>
</a>,
<a
@ -585,6 +593,15 @@ const ExaminationList: React.FC = () => {
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values) => {
console.log('values', values);
//const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url;
//console.log('url', url)
await handleUpdate({
...values,
examination_id: currentRow?.examination_id,
});
handleUpdateModalVisible(false); // 隐藏编辑窗口
actionRef.current?.reloadAndRest?.();
console.log(values);
}}
submitter={{

@ -81,14 +81,16 @@ export async function updateExamination(data: Record<string, any>, options?: Rec
});
}
/** 删除考试 POST /dsideal_yy/ypt/careerTraining/course/delete */
export async function removeExamination(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
data,
/** 删除考试 */
export async function removeExamination(data: { key: number[]}, options?: Record<string, any>) {
console.log('data:::', data);
return request<Record<string, any>>('/dsideal_yy/zygh/training/examination/delExamination', {
data: { examination_id: data?.key[0], rules_id: options?.rules_id}, // 当前接口不支持批量操作
method: 'POST',
...(options || {}),
requestType: 'form',
});
}
/** saveRegistration */
export async function saveRegistration(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {
@ -97,6 +99,7 @@ export async function saveRegistration(data: { key: number[] }, options?: Record
...(options || {}),
});
}
/** removeRegistration */
export async function removeRegistration(data: { key: number[] }, options?: Record<string, any>) {
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/course/delete', {

@ -10,7 +10,7 @@ import { BetaSchemaForm, ModalForm, ProFormText, ProFormTextArea } from '@ant-de
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import ProDescriptions from '@ant-design/pro-descriptions';
import type { FormValueType } from './components/UpdateForm';
import { querySubjectList, saveExamination, removeExamination, queryRulesList } from '../service';
import { querySubjectList, saveExamination, removeExamination, queryRulesList, removeRules } from '../service';
import type { TableListItem, TableListPagination } from './data';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
@ -60,18 +60,18 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
};
/**
*
*
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
try {
await removeExamination({
await removeRules({
key: selectedRows.map((row) => row.key),
});
}, currentRow);
hide();
message.success('删除成功,即将刷新');
return true;
@ -213,7 +213,13 @@ const ExaminationRules: React.FC = () => {
>
</a>,
<a key="subscribeAlert" href="https://procomponents.ant.design/">
<a
key="remove"
onClick={ () => {
handleRemove([{ key: record?.id }], record); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}>
</a>,
<a

@ -11,69 +11,23 @@ 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 { querySubjectList, saveExamination, removeExamination, queryRulesList } from '../service';
import { querySubjectList, queryRulesList, removeRules } from '../service';
import type { TableListItem, TableListPagination } from './data';
import type { DataItem } from '@antv/data-set/lib/transform/tag-cloud';
/**
*
*
* @param fields
*/
const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加');
try {
await saveExamination({ ...fields });
hide();
message.success('添加成功');
return true;
} catch (error) {
hide();
message.error('添加失败请重试!');
return false;
}
};
/**
*
*
* @param fields
*/
/*
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
try {
await saveExamination({
...currentRow,
...fields,
});
hide();
message.success('配置成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
return false;
}
};
*/
/**
*
*
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const handleRemove = async (selectedRows: TableListItem[], currentRow) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
try {
await removeExamination({
await removeRules({
key: selectedRows.map((row) => row.key),
});
}, currentRow);
hide();
message.success('删除成功,即将刷新');
return true;
@ -85,12 +39,7 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
};
const ExaminationRules: React.FC = () => {
/** 更新窗口的弹窗 */
const [createModalVisible, handleCreateModalVisible] = useState<boolean>(false);
const [detailModalVisible, handleDetailModalVisible] = useState<boolean>(false);
const [updateModalVisible, handleUpdateModalVisible] = useState<boolean>(false);
//const [registrationModalVisible, handleRegistrationModalVisible] = useState<boolean>(false);
const actionRef = useRef<ActionType>();
const [currentRow, setCurrentRow] = useState<TableListItem>();
const [selectedRowsState, setSelectedRows] = useState<TableListItem[]>([]);
@ -210,12 +159,17 @@ const ExaminationRules: React.FC = () => {
key="update"
onClick={() => {
history.push('/examinationrules/normal/step/' + record.id)
}}
>
</a>,
<a key="subscribeAlert" href="https://procomponents.ant.design/">
<a
key="remove"
onClick={ () => {
handleRemove([{ key: record?.id }], record); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}>
</a>,
<a
@ -309,109 +263,6 @@ const ExaminationRules: React.FC = () => {
<Button type="primary"></Button>
</FooterToolbar>
)}
<Modal
title={currentRow?.examination_name || '考试详细'}
width="60%"
visible={detailModalVisible}
onCancel={() => {
setCurrentRow(undefined); // 设置当前行
handleDetailModalVisible(false);
}}
footer={null}
centered
>{console.log('currentRow', currentRow)}
{currentRow?.name && (
<ProDescriptions<TableListItem>
column={2}
/* title={currentRow?.name} */
dataSource={currentRow}
/*
request={async () => ({
data: currentRow || {},
})}*/
params={{
id: currentRow?.examination_id,
}}
columns={
columns
//columns.slice(0, columns.length - 1) as ProDescriptionsItemProps<TableListItem>[]
}
/>
)}
</Modal>
<Modal
title="新建考试"
//
width="60%"
visible={createModalVisible}
destroyOnClose
onCancel={() => {
handleCreateModalVisible(false);
}}
footer={null}
>
<BetaSchemaForm<DataItem>
layout="horizontal"
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values: any) => {
// 表单处理
console.log('columns:', columns);
console.log('values:', values);
}}
submitter={{
render: (props, doms) => (
<Row>
<Col span={12} offset={8}>
<Space>{doms}</Space>
</Col>
</Row>
),
}}
// action = ''
title="新建"
columns={columns}
/>
</Modal>
<Modal
title="编辑"
width="60%"
visible={updateModalVisible}
destroyOnClose
onCancel={() => {
handleUpdateModalVisible(false);
}}
footer={null}
>
{currentRow?.name && (
<BetaSchemaForm<DataItem>
layout="horizontal"
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values) => {
console.log(values);
}}
submitter={{
render: (props, doms) => (
<Row>
<Col span={12} offset={8}>
<Space>{doms}</Space>
</Col>
</Row>
),
}}
// action = ''
title="编辑"
columns={getInitialValues(columns, currentRow)}
/>
)}
</Modal>
</PageContainer>
);
};

@ -28,7 +28,7 @@ export async function querySubjectList(params: {
});
}
/dsideal_yy/zygh/training/rules/delRules
@ -67,3 +67,14 @@ export async function updateFakeList(
},
});
}
/** 删除考试规则 */
export async function removeRules(data: { key: number[] }, options?: Record<string, any>) {
console.log('data:::', data);
return request<Record<string, any>>('/dsideal_yy/zygh/training/rules/delRules', {
data: { id: data?.key[0], rules_type: options?.rules_type, subject_id: options?.subject_id}, // 当前接口不支持批量操作
method: 'POST',
requestType: 'form',
...(options || {}),
});
}

@ -130,4 +130,15 @@ export async function queryRegistrationList(
},
...(options || {}),
});
}
/** 删除考试规则 */
export async function removeRules(data: { key: number[] }, options?: Record<string, any>) {
console.log('data:::', data);
return request<Record<string, any>>('/dsideal_yy/zygh/training/rules/delRules', {
data: { id: data?.key[0], rules_type: options?.rules_type, subject_id: options?.subject_id}, // 当前接口不支持批量操作
method: 'POST',
requestType: 'form',
...(options || {}),
});
}

@ -1,15 +1,13 @@
/** 历次考试成绩统计 */
import { PlusOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer } from 'antd';
import { DownloadOutlined, PlusOutlined } from '@ant-design/icons';
import { Button } from 'antd';
import React, { useState, useRef } from 'react';
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 { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import ProDescriptions from '@ant-design/pro-descriptions';
import { rule, } from '../service';
import { getExaminationPersonStatistics } from '../service';
//import type { TableListItem, TableListPagination } from '../data';
@ -29,76 +27,62 @@ const TableList: React.FC = () => {
{
title: '序号',
key: 'index',
valueType: 'indexBorder',
valueType: 'indexBorder',
width: 48,
},
{
title: '生涯课程',
dataIndex: 'name',
title: '考试名称',
dataIndex: 'examination_name',
valueType: 'textarea',
},
{
title: '学习人数',
dataIndex: 'callNo',
title: '报名人数',
dataIndex: 'apply_count',
sorter: true,
hideInForm: true,
renderText: (val: string) => `${val}`,
},
{
title: '学习完成率',
dataIndex: 'callNo',
sorter: true,
hideInForm: true,
renderText: (val: string) => `${val}%`,
},
{
title: '考试报名人数',
dataIndex: 'callNo',
title: '通过人数',
dataIndex: 'pass_count',
sorter: true,
hideInForm: true,
renderText: (val: string) => `${val}`,
},
{
title: '考试通过人数',
dataIndex: 'callNo',
sorter: true,
hideInForm: true,
renderText: (val: string) => `${val}`,
},
{
title: '考试通过率',
dataIndex: 'callNo',
title: '比例',
dataIndex: 'pass_rate',
sorter: true,
hideInForm: true,
renderText: (val: string) => `${val}%`,
},
];
return (
<div style={{marginBottom:'20px'}}>
<div style={{ marginBottom: '20px' }}>
<ProTable<TableListItem, TableListPagination>
headerTitle="历次考试成绩统计"
actionRef={actionRef}
rowKey="key"
search={false}
options={false}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
handleModalVisible(true);
}}
>
<PlusOutlined />
</Button>,
]}
request={rule}
columns={columns}
rowSelection={false}
/>
</div>
headerTitle="历次考试成绩统计"
actionRef={actionRef}
rowKey="key"
search={false}
options={false}
toolBarRender={() => [
<Button icon={<DownloadOutlined />} type="primary" key="subscribeAlert" href={`/dsideal_yy/zygh/training/statistics/exportExaminationData`}>
</Button>,
]}
request={async (value) => {
console.log(value, "value11")
const _data = await getExaminationPersonStatistics({ ...value, current: value.page_number, sort_type: 2, sort_colum: 1 });
return {
data: _data?.table_List,
};
}}
columns={columns}
rowSelection={false}
/>
</div>
);
};

@ -1,83 +1,18 @@
/** 各市州资质证书统计 */
import { PlusOutlined } from '@ant-design/icons';
import { DownloadOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer, Col, Row } from 'antd';
import React, { useState, useRef } from 'react';
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 { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import ProDescriptions from '@ant-design/pro-descriptions';
import { getCredentialPersonStatistics } from '../service';
import { rule } from '../service';
import type { TableListItem, TableListPagination } from '../data';
import { FormValueType } from '@/pages/ListTableList2/components/UpdateForm2';
import type { FormValueType } from '@/pages/ListTableList2/components/UpdateForm2';
import cookie from 'react-cookies';
/**
*
*
* @param fields
*/
const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加');
try {
await addRule({ ...fields });
hide();
message.success('添加成功');
return true;
} catch (error) {
hide();
message.error('添加失败请重试!');
return false;
}
};
/**
*
*
* @param fields
*/
const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => {
const hide = message.loading('正在配置');
try {
await updateRule({
...currentRow,
...fields,
});
hide();
message.success('配置成功');
return true;
} catch (error) {
hide();
message.error('配置失败请重试!');
return false;
}
};
/**
*
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
try {
await removeRule({
key: selectedRows.map((row) => row.key),
});
hide();
message.success('删除成功,即将刷新');
return true;
} catch (error) {
hide();
message.error('删除失败,请重试');
return false;
}
};
const topColResponsiveProps = {
xs: 24,
@ -96,54 +31,41 @@ const TableList: React.FC = () => {
{
title: '序号',
key: 'index',
valueType: 'indexBorder',
valueType: 'indexBorder',
width: 48,
},
{
title: '市州',
dataIndex: 'name',
dataIndex: 'city_name',
valueType: 'text',
},
{
title: '参加学习人数',
dataIndex: 'callNo',
sorter: true,
dataIndex: 'learning_person_number',
// sorter: true,
hideInForm: true,
renderText: (val: string) => `${val}`,
},
{
title: '学习完成率',
dataIndex: 'callNo',
sorter: true,
dataIndex: 'completion_rate',
// sorter: true,
hideInForm: true,
renderText: (val: string) => `${val}%`,
},
{
title: '取得资质证书人数',
sorter: true,
dataIndex: 'callNo',
sorter: false,
dataIndex: 'count',
valueType: 'text',
renderFormItem: (item, { defaultRender, ...rest }, form) => {
const status = form.getFieldValue('status');
if (`${status}` === '0') {
return false;
}
if (`${status}` === '3') {
return <Input {...rest} placeholder="请输入异常原因!" />;
}
return defaultRender(item);
},
},
{
title: '取得资质比例',
sorter: true,
dataIndex: 'callNo',
// sorter: true,
dataIndex: 'credential_rate',
valueType: 'text',
renderText: (val: string) => `${Number(val) / 10}%`,
},
renderText: (val: string) => `${val ? val : 0}%`,
},
];
return (
@ -155,18 +77,21 @@ const TableList: React.FC = () => {
rowKey="key"
search={false}
options={false}
toolBarRender={() => [
<Button
type="primary"
key="primary"
onClick={() => {
//handleModalVisible(true);
}}
>
<PlusOutlined />
</Button>,
]}
request={rule}
pagination={false}
request={async (value) => {
const _data = await getCredentialPersonStatistics({ province_id: cookie.load('background_province_id') });
return {
data: _data?.list,
};
}}
toolBarRender={() => {
return [
<Button type="primary" icon={<DownloadOutlined />} key="subscribeAlert" href={`/dsideal_yy/zygh/training/statistics/exportCredentialData?province_id=${cookie.load('background_province_id')}`}>
</Button>,
]
}}
columns={columns}
rowSelection={false}
/>

@ -1,15 +1,16 @@
import { useEffect, useRef, useState } from 'react';
import { TinyArea, TinyColumn } from '@ant-design/charts';
import { Card, Col, Progress, Row, Tabs, DatePicker, Select, Form, Statistic } from 'antd';
import { Card, Col, Progress, Row, Tabs, DatePicker, Select, Form, Statistic, Button } from 'antd';
import numeral from 'numeral';
import { ChartCard, Field } from './Charts';
import type { DataItem } from '../data.d';
import { getAsyncOrgTree, getMainBranchSchool } from '../service';
import { getAsyncOrgTree, getEduUnitList } from '../service';
const { Option } = Select;
import styles from '../style.less';
import ProForm, { ProFormSelect } from '@ant-design/pro-form';
import { useRequest } from 'umi';
const { RangePicker } = DatePicker;
const topColResponsiveProps = {
xs: 24,
@ -20,11 +21,7 @@ const topColResponsiveProps = {
offset: 1,
style: { marginBottom: 24 },
};
const cityData = await getAsyncOrgTree({
org_id: 100025,
org_type: 1,
get_next: 1
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
@ -34,12 +31,51 @@ const layout = {
const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: DataItem[] }) => {
const [provinceId, setProvinceId] = useState("100007")
const [cityList, setCityList] = useState([]);
const [areaList, setAreaList] = useState([]);
const [schoolList, setSchoolList] = useState([]);
const { loading: courseBrowseTimesLoading, data: eduUnitList = null } = useRequest(() => getEduUnitList({
random_num: 277470,
area_id: provinceId,
edu_type: -1,
// main_school_id: 200125116,
// org_name:"",
org_type: 2,
pageNumber: 1,
pageSize: 1000,
school_type: -1,
showPassWord: true,
}), {
formatResult: (result) => {
return result.table_List;
}
});
const [form] = Form.useForm();
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => {
useEffect(async () => {
const cityData = await getAsyncOrgTree({
org_id: provinceId,
org_type: 1,
get_next: 1
});
setCityList(cityData || []);
}, []);
@ -50,20 +86,43 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
org_type: 2,
get_next: 1
});
form.setFieldsValue({ area: "" })
// console.log(form.setFieldsValue({ area: "" }), 'form');
form.setFieldsValue({ area: 0 })
setAreaList(areaData || []);
}
let timeout: NodeJS.Timeout | null;
const getSchoolData = async (e, callback) => {
// timeout = setTimeout(async () => {
try {
schoolData = await getEduUnitList({
random_num: 277470,
area_id: provinceId,
edu_type: -1,
// main_school_id: 200125116,
org_name: e,
org_type: 2,
pageNumber: 1,
pageSize: 1000,
school_type: -1,
showPassWord: true,
}).then((e) => {
callback(e.table_List)
console.log(e.table_List);
setSchoolList(e.table_List || [])
});
} catch (error) {
// error.message; // "Oops!"
}
// }, 500);
// console.log(schoolList, 'schoolList 1');
const getSchoolData = async (e) => {
// const areaData = await getAsyncOrgTree({
// org_id: e,
// org_type: 2,
// get_next: 1
// });
console.log(areaData);
}
@ -94,11 +153,13 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
<Select
style={{ width: 120 }}
onChange={(id) => { getAreaData(id) }}
// defaultValue={provinceId}
>
{cityList.map((e, i) => {
<Option key={provinceId} value={provinceId}></Option>
{/* {cityList.map((e, i) => {
return <Option key={e.id} value={e.id}>{e.name}</Option>
})}
})} */}
</Select>
</Form.Item>
@ -107,12 +168,14 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
<Select
style={{ width: 120 }}
// defaultValue={0}
onChange={(id) => { getSchoolData(id) }}
>
{areaList.map((e, i) => {
<Option key={0} value={0}></Option>
{/* {areaList.map((e, i) => {
return <Option key={e.id} value={e.id}>{e.name}</Option>
})}
})} */}
</Select>
</Form.Item>
@ -126,18 +189,22 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
// value={this.state.value}
// placeholder={this.props.placeholder}
// style={this.props.style}
defaultActiveFirstOption={false}
showArrow={false}
filterOption={false}
// defaultActiveFirstOption={true}
showArrow={true}
filterOption={true}
// onSearch={this.handleSearch}
// onChange={this.handleChange}
// onChange={getSchoolData}
fieldNames={{ value: "ORG_ID", label: "ORG_NAME" }}
onSearch={(value) => getSchoolData(value)}
notFoundContent={null}
>
{/* {options} */}
</Select>
</Form.Item>
options={schoolList}
/>
{console.log(schoolList, 'schoolList111')}
</Form.Item>
<Button></Button>
</Form>
</div>

@ -1,98 +1,79 @@
import { Card, Col, DatePicker, Row, Tabs } from 'antd';
import type { RangePickerProps } from 'antd/es/date-picker/generatePicker';
import type moment from 'moment';
import { Column } from '@ant-design/charts';
import { Card, Col, Row, Tabs } from 'antd';
import { DualAxes } from '@ant-design/plots';
import numeral from 'numeral';
import type { DataItem } from '../data.d';
import styles from '../style.less';
type RangePickerValue = RangePickerProps<moment.Moment>['value'];
// import { useRequest } from 'react';
import { getCredentialPersonStatistics } from '../service';
import cookie from 'react-cookies';
import { useRequest } from 'umi';
export type TimeType = 'today' | 'week' | 'month' | 'year';
const { RangePicker } = DatePicker;
const { TabPane } = Tabs;
// const credentialPersonStatistics = await getCredentialPersonStatistics({
// province_id: cookie.load('background_province_id')
// });
const SalesCard = () => {
const { loading: courseBrowseTimesLoading, data: credentialPersonStatistics = null } = useRequest(() => getCredentialPersonStatistics({
province_id: cookie.load('background_province_id')
}), {
formatResult: (result) => {
return result.list;
}
});
const data = []
// console.log(credentialPersonStatistics, 'credentialPersonStatistics')
const SalesCard = ({
rangePickerValue,
salesData,
isActive,
handleRangePickerChange,
loading,
selectDate,
}: {
rangePickerValue: RangePickerValue;
isActive: (key: TimeType) => string;
salesData: DataItem[];
loading: boolean;
handleRangePickerChange: (dates: RangePickerValue, dateStrings: [string, string]) => void;
selectDate: (key: TimeType) => void;
}) => (
<Card loading={loading} bordered={false} bodyStyle={{ padding: 0, marginBottom: '24px' }}>
credentialPersonStatistics?.map((e, i) => {
data.push({
city: e.city_name,
count: e.count,
credential_rate: e.credential_rate
})
})
const config = {
data: [data, data],
xField: 'city',
yField: ['count', 'credential_rate'],
yAxis: [{
title: {
text: '资质证书人数',
},
}, {
title: {
text: '证书比例',
},
}],
geometryOptions: [
{
geometry: 'column',
},
{
geometry: 'line',
lineStyle: {
lineWidth: 2,
},
},
],
};
return (<Card bordered={false} bodyStyle={{ padding: 0, marginBottom: '24px' }}>
<div className={styles.salesCard}>
<Tabs
tabBarExtraContent={
<div className={styles.salesExtraWrap}>
<div className={styles.salesExtra}>
<a className={isActive('today')} onClick={() => selectDate('today')}>
</a>
<a className={isActive('week')} onClick={() => selectDate('week')}>
</a>
<a className={isActive('month')} onClick={() => selectDate('month')}>
</a>
<a className={isActive('year')} onClick={() => selectDate('year')}>
</a>
</div>
<RangePicker
value={rangePickerValue}
onChange={handleRangePickerChange}
style={{ width: 256 }}
/>
</div>
}
size="large"
tabBarStyle={{ marginBottom: 24 }}
>
<TabPane tab="培训情况" key="train">
<TabPane tab="各市州资质证书情况" key="train">
<Row>
<Col xl={24} lg={24} md={24} sm={24} xs={24}>
<div className={styles.salesBar}>
<Column
height={300}
forceFit
data={salesData as any}
xField="x"
yField="y"
xAxis={{
visible: true,
title: {
visible: false,
},
}}
yAxis={{
visible: true,
title: {
visible: false,
},
}}
title={{
visible: true,
text: '销售趋势',
style: {
fontSize: 14,
},
}}
meta={{
y: {
alias: '销售量',
},
}}
/>
<DualAxes {...config} />
</div>
</Col>
</Row>
@ -101,6 +82,7 @@ const SalesCard = ({
</Tabs>
</div>
</Card>
);
)
};
export default SalesCard;

@ -53,25 +53,61 @@ export async function getAsyncOrgTree(params: {
/**
*
* /dsideal_yy/admin/new_base/getMainBranchSchool
* /dsideal_yy/ypt/sys/org/getEduUnitList
* @param params
* @returns
*/
export async function getMainBranchSchool(params: {
export async function getEduUnitList(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/admin/new_base/getMainBranchSchool', {
return request('/dsideal_yy/ypt/sys/org/getEduUnitList', {
params,
});
}
/**
*
* /dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics
* @param params
* @returns
*/
export async function getCredentialPersonStatistics(params: {
province_id: { province_id: number };
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics', {
params,
});
}
/**
*
* /dsideal_yy/zygh/training/statistics/getCredentialPersonStatistics
* @param params
* @returns
*/
export async function getExaminationPersonStatistics(params: {
page_number: number,
page_size: number,
sort_colum: number,
sort_type: number,
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/zygh/training/statistics/getExaminationPersonStatistics', {
params,
});
}
/*
http://10.10.14.199/dsideal_yy/org/getAsyncOrgTree?org_id=100025&org_type=1&get_next=1
org_idID 100025org_type1get_next1
/dsideal_yy/ypt/sys/org/getEduUnitList?random_num=277470&area_id=200125116&edu_type=-1&main_school_id=200125116&org_name=&org_type=2&pageNumber=1&pageSize=20&school_type=-1&showPassWord=true
http://10.10.14.199/dsideal_yy/org/getAsyncOrgTree?org_id=200265&org_type=2&get_next=1
org_idIDorg_type2get_next1

@ -17,7 +17,7 @@ import { queryQuestionById, queryQuestionList, queryQuestionType } from '@/pages
import ProForm, { ProFormSelect } from '@ant-design/pro-form';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
const labels = ['A','B','C','D','E','F','G','H','I','J']; // 默认10个
//const { Paragraph } = Typography;
const formItemLayout = {
@ -40,13 +40,14 @@ console.log('first');
const AnswersSelector = () => {
return (
<Form.List
<Form.List
initialValue={['','','','']}
name="names"
rules={[
{
validator: async (_, names) => {
if (!names || names.length < 2) {
return Promise.reject(new Error('At least 2 passengers'));
return Promise.reject(new Error('至少填写2个选项'));
}
},
},
@ -56,24 +57,24 @@ const AnswersSelector = () => {
<>
{fields.map((field, index) => (
<Form.Item
{...(index === 0 ? formItemLayout : formItemLayoutWithOutLabel)}
label={index === 0 ? 'Passengers' : ''}
label={labels[index]}
required={false}
key={field.key}
>
<Form.Item
{...field}
validateTrigger={['onChange', 'onBlur']}
rules={[
{
required: true,
whitespace: true,
message: "Please input passenger's name or delete this field.",
message: "选项不能为空",
},
]}
noStyle
>
<Input placeholder="passenger name" style={{ width: '100%' }} />
<Input placeholder="" style={{ width: '80%' }} />
</Form.Item>
{fields.length > 1 ? (
<MinusCircleOutlined
@ -87,20 +88,10 @@ const AnswersSelector = () => {
<Button
type="dashed"
onClick={() => add()}
style={{ width: '60%' }}
icon={<PlusOutlined />}
>
Add field
</Button>
<Button
type="dashed"
onClick={() => {
add('The head item', 0);
}}
style={{ width: '60%', marginTop: '20px' }}
style={{ marginLeft: 22, width: '60%' }}
icon={<PlusOutlined />}
>
Add field at head
</Button>
<Form.ErrorList errors={errors} />
</Form.Item>

@ -1,4 +1,9 @@
@import '~antd/es/style/themes/default.less';
:global {
.anticon.anticon-minus-circle.dynamic-delete-button{
padding: 10px;
}
}
.questionbank{
:global {
.ant-list-split.ant-list-something-after-last-item .ant-spin-container > .ant-list-items > .ant-list-item:last-child{

@ -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, querySubjectList } from './service';
import { queryTrainList, saveTrain, removeTrain, queryOrgTree, queryValueByKey, querySubjectList, querySubjectView } from './service';
import type { TableListItem, TableListPagination } from './data';
import { useRequest } from 'umi';
@ -57,29 +57,33 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
};
/**
*
*
* ()
*
* @param selectedRows
*/
const handleRemove = async (selectedRows: TableListItem[]) => {
const hide = message.loading('正在删除');
if (!selectedRows) return true;
console.log('key', selectedRows);
try {
await removeTrain({
const { code, msg } = await removeTrain({
key: selectedRows.map((row) => row.key),
});
hide();
message.success('删除成功,即将刷新');
if (code === 2000) {
message.success('删除成功,即将刷新');
} else {
message.warning(msg);
}
return true;
} catch (error) {
console.log('error', error)
hide();
message.error('删除失败,请重试');
return false;
}
};
interface OrgTreeForOaItem {
id?: number;
pId?: number;
@ -139,6 +143,7 @@ const TableList: React.FC = () => {
title: '序号',
key: 'index',
valueType: 'indexBorder',
render: (text: React.ReactNode, _: any, index: number) => {
if (actionRef && actionRef?.current && actionRef?.current?.pageInfo) {
return `${(actionRef?.current?.pageInfo?.current - 1) * (actionRef.current.pageInfo?.pageSize) + (index + 1)}`;
@ -148,17 +153,36 @@ const TableList: React.FC = () => {
},
width: 48,
},
{
title: '培训名称',
dataIndex: 'train_name',
valueType: 'text',
hideInSearch: true,
formItemProps: {
rules: [
{
required: true,
message: '请输入培训名称',
},
]
},
},
{
title: '培训对象',
valueType: 'select',
hideInSearch: true,
fieldProps: {
mode: "multiple"
},
formItemProps: {
rules: [
{
required: true,
message: '请选择培训对象',
},
]
},
dataIndex: 'org_names',
request: async () => {
const Value = await queryValueByKey({});
@ -184,8 +208,16 @@ const TableList: React.FC = () => {
hideInTable: true,
hideInForm: false,
hideInSearch: false,
formItemProps: {
rules: [
{
required: true,
message: '请选择主题',
},
]
},
request: async () => {
const { data: Items } = await querySubjectList({ page_size: 1000 });
const { data: Items } = await querySubjectList();
// console.log(Items, ')))');
const sinfo = []
@ -203,23 +235,34 @@ const TableList: React.FC = () => {
dataIndex: 'start_time',
sorter: false,
hideInForm: true,
hideInSearch: true,
renderText: (val: string) => `${val}`,
},
{
title: '结束时间',
dataIndex: 'end_time',
sorter: false,
hideInSearch: true,
hideInForm: true,
renderText: (val: string) => `${val}`,
},
{
title: '培训时间',
valueType: 'dateTimeRange',
dataIndex: 'datetime',
dataIndex: 'date_time',
sorter: false,
hideInForm: false,
hideInTable: true,
hideInSearch: false,
renderText: (val: string) => `${val}`,
formItemProps: {
rules: [
{
required: true,
message: '请选择培训时间',
},
]
},
},
{
title: '学时安排',
@ -227,6 +270,7 @@ const TableList: React.FC = () => {
dataIndex: 'total_course_hours',
valueType: 'text',
hideInForm: true,
hideInSearch: true,
renderText: (val: string) => `${val}小时`,
},
{
@ -234,34 +278,39 @@ const TableList: React.FC = () => {
dataIndex: 'option',
valueType: 'option',
render: (_, record) => [
<a
key="detail"
onClick={() => {
handleUpdateModalVisible(true);
setCurrentRow(record);
}}
>
</a>,
<a
key="update"
onClick={() => {
handleUpdateModalVisible(true);
const idsArr = record?.org_ids?.split(",")
const orgName = record?.org_names?.split(",")
const idsData = []
idsArr.map((e,i) => {
idsData.push({
label: orgName[i], value: Number(e)
})
})
record.org_names = idsData
// const _record = JSON.parse(JSON.stringify(record))
// const idsArr = _record?.org_ids?.split(",")
// const orgName = _record.org_names != "" ? _record.org_names.split(",") : ""
// const idsData = []
// if (_record?.org_ids != false) {
// idsArr.map((e, i) => {
// idsData.push({
// label: orgName[i], value: Number(e)
// })
// })
// }
// _record.org_names = idsData
// _record.date_time = [_record.start_time, _record.end_time]
// console.log("2323", _record);
setCurrentRow(record);
}}
>
</a>,
<a key="subscribeAlert" href="https://procomponents.ant.design/">
<a
key="remove"
onClick={() => {
handleRemove([{ key: record?.train_id }]); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}>
</a>,
],
@ -303,7 +352,16 @@ const TableList: React.FC = () => {
</Button>,
]}
request={async (value) => {
if (value.date_time) {
value.begin_time = value.date_time[0]
value.end_time = value.date_time[1]
}
// delete value.date_time
console.log('search', value);
const _data = await queryTrainList(value);
return {
current: _data?.page_number,
data: _data?.data?.list,
@ -387,11 +445,11 @@ const TableList: React.FC = () => {
console.log(tree, 'tree');
const _data = {
...values,
end_time: values.datetime[1],
start_time: values.datetime[0],
end_time: values.date_time[1],
start_time: values.date_time[0],
target_list_json: JSON.stringify(tree)
}
delete _data.datetime
delete _data.date_time
delete _data.org_names
// delete params.course_time
// delete params.examination_time
@ -403,6 +461,8 @@ const TableList: React.FC = () => {
if (res.code === 2000) {
handleModalVisible(false);
actionRef.current?.reloadAndRest?.();
} else {
message.error(res.msg);
}
}}
@ -436,8 +496,94 @@ const TableList: React.FC = () => {
layoutType="Form"
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values) => {
console.log(values);
request={async () => {
const { data } = await querySubjectView({ train_id: currentRow?.train_id });
data.date_time = [currentRow.start_time, currentRow.end_time]
data.org_names = []
data.target_list.map((e) => {
console.log('1111', e);
data.org_names.push({
value: e.org_id,
label: e.org_name
})
console.log("222", data);
})
console.log("edit", data);
return data
}}
onFinish={async (values: any) => {
// 表单处理
//console.log('columns:', columns);
console.log('values1:', values, orgTree);
//return false;
// values.attachment_json.response.file.response.url
let tree = []
if (typeof values.org_names[0] === 'number') {
// tree = values.org_names
console.log('true values.org_names', tree, orgTree, values)
tree = orgTree?.filter((item, idx, self) => {
return (values?.org_names?.indexOf(item?.id) !== -1)
});
console.log("tree,1111", tree);
tree.map((e, i) => {
tree[i].org_id = e.id
tree[i].org_name = e.name
delete tree[i].id
delete tree[i].name
delete tree[i].pId
})
} else {
values.org_names.map((e) => {
console.log(e, 'e');
})
// tree[i].org_id = e.id
// tree[i].org_name = e.name
console.log(values.org_names, 'false values.org_names')
}
console.log(321);
console.log(tree, 'tree');
const _data = {
...values,
end_time: values.date_time[1],
start_time: values.date_time[0],
target_list_json: JSON.stringify(tree),
train_id: currentRow.train_id
}
delete _data.date_time
delete _data.org_names
// delete params.course_time
// delete params.examination_time
console.log('_data', _data);
const res = await saveTrain(_data);
// console.log(res, 'ressss');
if (res.code === 2000) {
handleUpdateModalVisible(false);
actionRef.current?.reloadAndRest?.();
} else {
message.error(res.msg);
}
}}
submitter={{
render: (props, doms) => (
@ -450,7 +596,7 @@ const TableList: React.FC = () => {
}}
// action = ''
title="编辑"
columns={getInitialValues(columns, currentRow)}
columns={columns}
/>
)}
</Modal>

@ -41,9 +41,11 @@ export async function saveTrain(data: Record<string, any>, options?: Record<stri
/** 删除课程 POST /dsideal_yy/ypt/careerTraining/train/delete */
export async function removeTrain(data: { key: number[] }, options?: Record<string, any>) {
console.log('data:::', data);
return request<Record<string, any>>('/dsideal_yy/ypt/careerTraining/train/delete', {
data,
data: { train_id: data?.key[0] }, // 当前接口不支持批量操作
method: 'POST',
requestType: 'form',
...(options || {}),
});
}
@ -87,7 +89,22 @@ export async function querySubjectList(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', {
return request('/dsideal_yy/ypt/careerTraining/component/listSubject', {
params,
});
}
/**
*
* http://10.10.14.252:8080/workspace/myWorkspace.do?projectId=382#6426
* @param params
* @returns
*/
export async function querySubjectView(params: {
page_size: number;
//count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/ypt/careerTraining/train/view', {
params,
});
}

Loading…
Cancel
Save