You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/src/views/AgentGroupList.jsx

122 lines
4.8 KiB
JavaScript

import React, {useContext, useEffect} from 'react';
import {Row, Col, Typography, Space, DatePicker, Button, Select, Table, List} from 'antd';
import {
SearchOutlined,
} from '@ant-design/icons';
import {stores_Context} from '../config';
import * as config from "../config";
import {observer} from 'mobx-react';
import { NavLink, useParams } from "react-router-dom";
import 'moment/locale/zh-cn';
import moment from "moment";
import zhCNlocale from 'antd/es/date-picker/locale/zh_CN';
import GroupSelect from './../components/search/GroupSelect';
const AgentGroupList = () => {
const {agentId} = useParams();
const { customerServicesStore } = useContext(stores_Context);
useEffect(() => {
customerServicesStore.fetchGroupListByAgentId(agentId);
}, []);
const groupList = customerServicesStore.groupList;
const groupListColumns = customerServicesStore.groupListColumns;
const {startDate, endDate, dateType, inProgress} = customerServicesStore;
return (
<>
<Space direction="vertical" style={{width: '100%'}}>
<Row gutter={{md: 24}} justify="end">
<Col span={8}>
<NavLink to={'/agent/group/count'}>返回</NavLink>
</Col>
<Col span={4}>
<GroupSelect value={customerServicesStore.selectedTeam}
onChange={(value) => customerServicesStore.selectTeam(value)}
style={{ width: '95%' }} show_all={true}
/>
</Col>
<Col span={4}>
<Select value={dateType} style={{ width: "95%" }} onChange={(value) => customerServicesStore.selectDateType(value)}>
<Select.Option key="1" value="startDate">
走团日期
</Select.Option>
<Select.Option key="2" value="ConfirmDate">
成团日期
</Select.Option>
</Select>
</Col>
<Col span={4}>
<DatePicker.RangePicker
format={config.DATE_FORMAT} locale={zhCNlocale}
allowClear={false}
value={[startDate, endDate]}
onChange={(dates) => {customerServicesStore.selectDateRange(dates[0], dates[1]);}}
ranges={{
'本周': [moment().startOf('week'), moment().endOf('week')],
'上周': [moment().startOf('week').subtract(7, 'days'), moment().endOf('week').subtract(7, 'days')],
'本月': [moment().startOf('month'), moment().endOf('month')],
'上个月': [moment().subtract(1, 'months').startOf('month'), moment(new Date()).subtract(1, 'months').endOf('month')],
'近30天': [moment().subtract(30, 'days'), moment()],
'近三个月': [moment().subtract(2, 'month').startOf('month'), moment().endOf('month')],
'今年': [moment().startOf('year').subtract(1, 'month'), moment().endOf('year').subtract(1, 'month')],
'去年': [moment().subtract(1, 'year').startOf('year').subtract(1, 'month'), moment().subtract(1, 'year').endOf('year').subtract(1, 'month')],
}}
/>
</Col>
<Col span={4}>
<Button
type="primary"
icon={<SearchOutlined />}
loading={inProgress}
onClick={() => {
customerServicesStore.fetchGroupListByAgentId(agentId);
}}>
统计
</Button>
</Col>
</Row>
<Row>
<Col span={24}>
<Typography.Title level={3}>{customerServicesStore.agentCompany}</Typography.Title>
<Table
dataSource={groupList}
columns={groupListColumns}
size="small"
rowKey={(record) => record.key}
loading={inProgress}
pagination={false}
scroll={{ x: "100%" }}
expandable={{
expandedRowRender: (record) => (
<List
itemLayout="horizontal"
>
<List.Item>
<List.Item.Meta
title='经过城市'
description={record.PassCity}
/>
</List.Item>
<List.Item>
<List.Item.Meta
title='评论内容'
description={record.ECI_Content}
/>
</List.Item>
</List>
),
}}
/>
</Col>
</Row>
</Space>
</>
);
};
export default observer(AgentGroupList);