From c54fccb9641771af4d24a045331e4138360f429f Mon Sep 17 00:00:00 2001 From: LiaoYijun Date: Wed, 16 Nov 2022 10:53:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=88=86=E5=9C=B0=E6=8E=A5=E7=A4=BE?= =?UTF-8?q?=E5=92=8C=E6=8E=A5=E5=9B=A2=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.js | 8 +- src/stores/CustomerServices.js | 10 ++- .../AgentGroup.js => views/AgentList.js} | 27 +----- src/views/GroupList.js | 85 +++++++++++++++++++ 4 files changed, 99 insertions(+), 31 deletions(-) rename src/{charts/AgentGroup.js => views/AgentList.js} (78%) create mode 100644 src/views/GroupList.js diff --git a/src/App.js b/src/App.js index 57de4f9..207e392 100644 --- a/src/App.js +++ b/src/App.js @@ -13,7 +13,8 @@ import Customer_care_potential from "./charts/Customer_care_potential"; import Customer_care_regular from "./charts/Customer_care_regular"; import Wechat_session from "./charts/Wechat_session"; import WhatsApp_session from "./charts/WhatsApp_session"; -import AgentGroup from "./charts/AgentGroup"; +import AgentList from "./views/AgentList"; +import GroupList from "./views/GroupList"; import Credit_card_bill from "./views/Credit_card_bill"; import exchange_rate from "./charts/ExchangeRate"; import Sale from "./views/Sale"; @@ -70,7 +71,7 @@ const App = () => { label: "客服", icon: , children: [ - { key: 61, label: 地接社接团 }, + { key: 61, label: 地接社接团 }, ], } ]; @@ -104,7 +105,8 @@ const App = () => { } /> } /> } /> - } /> + } /> + } /> }> } /> diff --git a/src/stores/CustomerServices.js b/src/stores/CustomerServices.js index 83ae1fb..f11c355 100644 --- a/src/stores/CustomerServices.js +++ b/src/stores/CustomerServices.js @@ -1,5 +1,6 @@ import {makeAutoObservable, runInAction} from "mobx" import moment from "moment"; +import { NavLink, useParams } from "react-router-dom"; import * as config from "../config"; import * as req from '../utils/request'; @@ -31,7 +32,7 @@ class CustomerServices { children: [{ // title: this.startDate.format(config.DATE_FORMAT) + '~' + this.endDate.format(config.DATE_FORMAT), dataIndex: 'VendorName', - render: (text, record) => {text} + render: (text, record) => {record.VendorName} } ] }, @@ -121,13 +122,14 @@ class CustomerServices { }); } - fetchGroupListByAgent() { - - req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfo?VEI_SN=' + this.selectedAgent.EOI_ObjSN + '&DateType=' + this.dateType + '&Date1=' + this.startDateString + '&Date2=' + this.endDateString + '&OldDate1=' + this.startDateString + '&OldDate2=' + this.endDateString) + fetchGroupListByAgentId(agentId) { + console.info('agentId: ' + agentId); + req.fetchJSON(config.HT_HOST + '/service-web/QueryData/GetAgentGroupInfo?VEI_SN=' + agentId + '&DateType=' + this.dateType + '&Date1=' + this.startDateString + '&Date2=' + this.endDateString + '&OldDate1=' + this.startDateString + '&OldDate2=' + this.endDateString) .then(json => { if (json.errcode === 0) { runInAction(() => { this.groupList = json.result1; + this.selectedAgent = {VendorName: json.result1[0].VendorName}; const total1 = json.total1; this.groupListColumns = [ { diff --git a/src/charts/AgentGroup.js b/src/views/AgentList.js similarity index 78% rename from src/charts/AgentGroup.js rename to src/views/AgentList.js index 761bdc2..43c20ab 100644 --- a/src/charts/AgentGroup.js +++ b/src/views/AgentList.js @@ -1,34 +1,24 @@ import React, {Component} from 'react'; -import {Row, Col, List, Typography, Space, DatePicker, Button, Select, Table} from 'antd'; +import {Row, Col, Typography, Space, DatePicker, Button, Select, Table} from 'antd'; import { - ContainerOutlined, CarryOutOutlined, - SmileOutlined, TagsOutlined, GlobalOutlined, SearchOutlined, } from '@ant-design/icons'; import {stores_Context} from '../config' import * as config from "../config"; -import {Line} from "@ant-design/charts"; import {observer} from 'mobx-react'; import 'moment/locale/zh-cn'; import moment from "moment"; import zhCNlocale from 'antd/es/date-picker/locale/zh_CN'; -class AgentGroup extends Component { +class AgentList extends Component { static contextType = stores_Context; - state = { - selectedRowKeys: [], - }; - constructor(props) { super(props); } componentDidMount() { - console.info('AgentGroup.componentDidMount'); - // const {customerServicesStore} = this.context; - // customerServicesStore.fetchAgentList(); } handleSearchClick() { @@ -99,24 +89,13 @@ class AgentGroup extends Component { loading={false} pagination={false} scroll={{ x: "100%" }} - onRow={(agent) => ({ - onClick: () => { - customerServicesStore.selectAgent(agent); - }, - })} /> - - - {customerServicesStore.selectedAgent.VendorName} - record.key} loading={false} pagination={false} scroll={{ x: "100%" }} /> - - ); } } -export default observer(AgentGroup); \ No newline at end of file +export default observer(AgentList); \ No newline at end of file diff --git a/src/views/GroupList.js b/src/views/GroupList.js new file mode 100644 index 0000000..23a2335 --- /dev/null +++ b/src/views/GroupList.js @@ -0,0 +1,85 @@ +import React, {useContext, useEffect} from 'react'; +import {Row, Col, Typography, Space, DatePicker, Button, Select, Table} 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'; + +const GroupList = () => { + + const {agentId} = useParams(); + const { customerServicesStore } = useContext(stores_Context); + + useEffect(() => { + customerServicesStore.fetchGroupListByAgentId(agentId); + }, []); + + const groupList = customerServicesStore.groupList; + const groupListColumns = customerServicesStore.groupListColumns; + const {startDate, endDate, dateType} = customerServicesStore; + + return ( + <> + + + + 返回 + + + + + + {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')], + }} + /> + + + + + + + + {customerServicesStore.selectedAgent.VendorName} +
record.key} loading={false} pagination={false} scroll={{ x: "100%" }} /> + + + + + ); +} + +export default observer(GroupList);