master
xialiang 3 years ago
parent 4c1d2152a5
commit c14e07b191

@ -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",

@ -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 (
<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
type="primary"
key="primary"
onClick={() => {
handleModalVisible(true);
}}
>
<PlusOutlined />
</Button>,
]}
request={async (value) => {
const _data = await getExaminationPersonStatistics({ sort_type: 0, sort_colum: 1 });
return {
data: _data?.list,
};
}}
columns={columns}
rowSelection={false}
/>
</div>
);
};

@ -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 <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 +141,22 @@ 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={(record) => {
console.log(record, 'a]]')
return [
<a key="subscribeAlert" href={`/dsideal_yy/zygh/training/statistics/exportCredentialData?province_id=${cookie.load('background_province_id')}`}>
</a>,
]
}}
columns={columns}
rowSelection={false}
/>

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

@ -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;

@ -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,
});
}
/*

@ -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 = () => {
</a>,
<a
key="remove"
onClick={ () => {
onClick={() => {
handleRemove([{ key: record?.train_id }]); // 调用批量删除函数如果接口不支持批量需要在service中处理
setSelectedRows([]);
actionRef.current?.reloadAndRest?.();
}}>
</a>,
</a>,
],
},
];

@ -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,
});
}

Loading…
Cancel
Save