master
xialiang 3 years ago
parent 4c1d2152a5
commit c14e07b191

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

@ -1,15 +1,13 @@
/** 历次考试成绩统计 */ /** 历次考试成绩统计 */
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { Button, message, Input, Drawer } from 'antd'; import { Button } from 'antd';
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
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 { 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'; //import type { TableListItem, TableListPagination } from '../data';
@ -94,7 +92,12 @@ const TableList: React.FC = () => {
<PlusOutlined /> <PlusOutlined />
</Button>, </Button>,
]} ]}
request={rule} request={async (value) => {
const _data = await getExaminationPersonStatistics({ sort_type: 0, sort_colum: 1 });
return {
data: _data?.list,
};
}}
columns={columns} columns={columns}
rowSelection={false} rowSelection={false}
/> />

@ -5,13 +5,12 @@ import React, { useState, useRef } from 'react';
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 { ModalForm, ProFormText, ProFormTextArea } from '@ant-design/pro-form'; import { getCredentialPersonStatistics } from '../service';
import type { ProDescriptionsItemProps } from '@ant-design/pro-descriptions';
import ProDescriptions from '@ant-design/pro-descriptions';
import { rule } from '../service'; import { rule } from '../service';
import type { TableListItem, TableListPagination } from '../data'; 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';
/** /**
* *
@ -101,48 +100,35 @@ const TableList: React.FC = () => {
}, },
{ {
title: '市州', title: '市州',
dataIndex: 'name', dataIndex: 'city_name',
valueType: 'text', valueType: 'text',
}, },
{ {
title: '参加学习人数', title: '参加学习人数',
dataIndex: 'callNo', dataIndex: 'learning_person_number',
sorter: true, // sorter: true,
hideInForm: true, hideInForm: true,
renderText: (val: string) => `${val}`, renderText: (val: string) => `${val}`,
}, },
{ {
title: '学习完成率', title: '学习完成率',
dataIndex: 'callNo', dataIndex: 'completion_rate',
sorter: true, // sorter: true,
hideInForm: true, hideInForm: true,
renderText: (val: string) => `${val}%`, renderText: (val: string) => `${val}%`,
}, },
{ {
title: '取得资质证书人数', title: '取得资质证书人数',
sorter: true, sorter: false,
dataIndex: 'callNo', dataIndex: 'count',
valueType: 'text', 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: '取得资质比例', title: '取得资质比例',
sorter: true, // sorter: true,
dataIndex: 'callNo', dataIndex: 'credential_rate',
valueType: 'text', valueType: 'text',
renderText: (val: string) => `${Number(val) / 10}%`, renderText: (val: string) => `${val ? val : 0}%`,
}, },
]; ];
@ -155,18 +141,22 @@ const TableList: React.FC = () => {
rowKey="key" rowKey="key"
search={false} search={false}
options={false} options={false}
toolBarRender={() => [ pagination={false}
<Button request={async (value) => {
type="primary" const _data = await getCredentialPersonStatistics({ province_id: cookie.load('background_province_id') });
key="primary" return {
onClick={() => { data: _data?.list,
//handleModalVisible(true); };
}} }}
> toolBarRender={(record) => {
<PlusOutlined /> console.log(record, 'a]]')
</Button>, return [
]} <a key="subscribeAlert" href={`/dsideal_yy/zygh/training/statistics/exportCredentialData?province_id=${cookie.load('background_province_id')}`}>
request={rule}
</a>,
]
}}
columns={columns} columns={columns}
rowSelection={false} rowSelection={false}
/> />

@ -63,7 +63,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat
// org_type: 2, // org_type: 2,
// get_next: 1 // get_next: 1
// }); // });
console.log(areaData); console.log(e);
} }

@ -1,98 +1,79 @@
import { Card, Col, DatePicker, Row, Tabs } from 'antd'; import { Card, Col, Row, Tabs } from 'antd';
import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; import { DualAxes } from '@ant-design/plots';
import type moment from 'moment';
import { Column } from '@ant-design/charts';
import numeral from 'numeral';
import type { DataItem } from '../data.d';
import styles from '../style.less'; import styles from '../style.less';
// import { useRequest } from 'react';
type RangePickerValue = RangePickerProps<moment.Moment>['value']; import { getCredentialPersonStatistics } from '../service';
import cookie from 'react-cookies';
import { useRequest } from 'umi';
export type TimeType = 'today' | 'week' | 'month' | 'year'; export type TimeType = 'today' | 'week' | 'month' | 'year';
const { RangePicker } = DatePicker;
const { TabPane } = Tabs; 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')
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',
},
{
const SalesCard = ({ geometry: 'line',
rangePickerValue, lineStyle: {
salesData, lineWidth: 2,
isActive, },
handleRangePickerChange, },
loading, ],
selectDate, };
}: { return (<Card bordered={false} bodyStyle={{ padding: 0, marginBottom: '24px' }}>
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' }}>
<div className={styles.salesCard}> <div className={styles.salesCard}>
<Tabs <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" size="large"
tabBarStyle={{ marginBottom: 24 }} tabBarStyle={{ marginBottom: 24 }}
> >
<TabPane tab="培训情况" key="train"> <TabPane tab="各市州资质证书情况" key="train">
<Row> <Row>
<Col xl={24} lg={24} md={24} sm={24} xs={24}> <Col xl={24} lg={24} md={24} sm={24} xs={24}>
<div className={styles.salesBar}> <div className={styles.salesBar}>
<Column <DualAxes {...config} />
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: '销售量',
},
}}
/>
</div> </div>
</Col> </Col>
</Row> </Row>
@ -101,6 +82,7 @@ const SalesCard = ({
</Tabs> </Tabs>
</div> </div>
</Card> </Card>
); )
};
export default SalesCard; export default SalesCard;

@ -65,6 +65,36 @@ export async function getMainBranchSchool(params: {
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,
});
}
/* /*

@ -217,7 +217,7 @@ const TableList: React.FC = () => {
] ]
}, },
request: async () => { request: async () => {
const { data: Items } = await querySubjectList({ page_size: 1000 }); const { data: Items } = await querySubjectList();
// console.log(Items, ')))'); // console.log(Items, ')))');
const sinfo = [] const sinfo = []

@ -89,7 +89,7 @@ export async function querySubjectList(params: {
page_size: number; page_size: number;
//count: number; //count: number;
}): Promise<{ data: { list: CardListItemDataType[] } }> { }): Promise<{ data: { list: CardListItemDataType[] } }> {
return request('/dsideal_yy/ypt/careerTraining/subject/listSubject', { return request('/dsideal_yy/ypt/careerTraining/component/listSubject', {
params, params,
}); });
} }

Loading…
Cancel
Save