diff --git a/admin/package.json b/admin/package.json index fa91771..4150cdf 100644 --- a/admin/package.json +++ b/admin/package.json @@ -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", diff --git a/admin/src/pages/history/analysis/components/AchievementRow.tsx b/admin/src/pages/history/analysis/components/AchievementRow.tsx index dd929b5..5761c77 100644 --- a/admin/src/pages/history/analysis/components/AchievementRow.tsx +++ b/admin/src/pages/history/analysis/components/AchievementRow.tsx @@ -1,15 +1,13 @@ /** 历次考试成绩统计 */ import { PlusOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer } from 'antd'; +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,7 +27,7 @@ const TableList: React.FC = () => { { title: '序号', key: 'index', - valueType: 'indexBorder', + valueType: 'indexBorder', width: 48, }, { @@ -72,33 +70,38 @@ const TableList: React.FC = () => { hideInForm: true, renderText: (val: string) => `${val}%`, }, - + ]; return ( -
+
- headerTitle="历次考试成绩统计" - actionRef={actionRef} - rowKey="key" - search={false} - options={false} - toolBarRender={() => [ - , - ]} - request={rule} - columns={columns} - rowSelection={false} - /> -
+ headerTitle="历次考试成绩统计" + actionRef={actionRef} + rowKey="key" + search={false} + options={false} + toolBarRender={() => [ + , + ]} + request={async (value) => { + const _data = await getExaminationPersonStatistics({ sort_type: 0, sort_colum: 1 }); + return { + data: _data?.list, + }; + }} + columns={columns} + rowSelection={false} + /> +
); }; diff --git a/admin/src/pages/history/analysis/components/CertificateRow.tsx b/admin/src/pages/history/analysis/components/CertificateRow.tsx index 424b421..58f11a3 100644 --- a/admin/src/pages/history/analysis/components/CertificateRow.tsx +++ b/admin/src/pages/history/analysis/components/CertificateRow.tsx @@ -5,13 +5,12 @@ 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'; /** * 添加 @@ -96,54 +95,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 ; - } - - 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 +141,22 @@ const TableList: React.FC = () => { rowKey="key" search={false} options={false} - toolBarRender={() => [ - , - ]} - request={rule} + pagination={false} + request={async (value) => { + const _data = await getCredentialPersonStatistics({ province_id: cookie.load('background_province_id') }); + return { + data: _data?.list, + }; + }} + toolBarRender={(record) => { + console.log(record, 'a]]') + return [ + + 导出名单 + , + ] + }} + columns={columns} rowSelection={false} /> diff --git a/admin/src/pages/history/analysis/components/IntroduceRow.tsx b/admin/src/pages/history/analysis/components/IntroduceRow.tsx index 434504b..35fcbba 100644 --- a/admin/src/pages/history/analysis/components/IntroduceRow.tsx +++ b/admin/src/pages/history/analysis/components/IntroduceRow.tsx @@ -63,7 +63,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat // org_type: 2, // get_next: 1 // }); - console.log(areaData); + console.log(e); } diff --git a/admin/src/pages/history/analysis/components/TrainCard.tsx b/admin/src/pages/history/analysis/components/TrainCard.tsx index 3569e71..e07d584 100644 --- a/admin/src/pages/history/analysis/components/TrainCard.tsx +++ b/admin/src/pages/history/analysis/components/TrainCard.tsx @@ -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['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; -}) => ( - + 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 (
- - -
- } size="large" tabBarStyle={{ marginBottom: 24 }} > - +
- + +
@@ -101,6 +82,7 @@ const SalesCard = ({
-); + ) +}; export default SalesCard; diff --git a/admin/src/pages/history/analysis/service.ts b/admin/src/pages/history/analysis/service.ts index f07cf0f..efb5cc6 100644 --- a/admin/src/pages/history/analysis/service.ts +++ b/admin/src/pages/history/analysis/service.ts @@ -65,6 +65,36 @@ export async function getMainBranchSchool(params: { 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, + }); +} /* diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index 5a69301..91986e6 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -61,20 +61,20 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = * 参数为记录数组 * @param selectedRows */ - const handleRemove = async (selectedRows: TableListItem[]) => { +const handleRemove = async (selectedRows: TableListItem[]) => { const hide = message.loading('正在删除'); if (!selectedRows) return true; console.log('key', selectedRows); try { - const {code, msg} = await removeTrain({ + const { code, msg } = await removeTrain({ key: selectedRows.map((row) => row.key), }); hide(); - if(code === 2000 ){ + if (code === 2000) { message.success('删除成功,即将刷新'); - }else{ + } else { message.warning(msg); - } + } return true; } catch (error) { console.log('error', error) @@ -217,7 +217,7 @@ const TableList: React.FC = () => { ] }, request: async () => { - const { data: Items } = await querySubjectList({ page_size: 1000 }); + const { data: Items } = await querySubjectList(); // console.log(Items, ')))'); const sinfo = [] @@ -306,13 +306,13 @@ const TableList: React.FC = () => { , { + onClick={() => { handleRemove([{ key: record?.train_id }]); // 调用批量删除函数(如果接口不支持批量需要在service中处理) setSelectedRows([]); actionRef.current?.reloadAndRest?.(); }}> 删除 - , + , ], }, ]; diff --git a/admin/src/pages/training/option/service.ts b/admin/src/pages/training/option/service.ts index 56f5612..54fb8c5 100644 --- a/admin/src/pages/training/option/service.ts +++ b/admin/src/pages/training/option/service.ts @@ -89,7 +89,7 @@ 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, }); }