diff --git a/src/App.jsx b/src/App.jsx index 1169655..27c475b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -57,6 +57,7 @@ import OPProcess from './views/sales-crm/Process'; import OPRisk from './views/sales-crm/Risk'; import Cruise from './views/Cruise'; import Hotel from './views/Hotel'; +import HostCaseCount from './views/HostCaseCount'; const App = () => { const { Content, Footer, Sider, } = Layout; @@ -162,6 +163,7 @@ const App = () => { }, { key: 'cruise', label: 三峡游船 }, { key: 'hotel', label: 酒店 }, + { key: 'hostcase', label: 东道主项目 }, ], }, { @@ -265,6 +267,7 @@ const App = () => { } /> } /> } /> + } /> }> } /> diff --git a/src/stores/CustomerStore.js b/src/stores/CustomerStore.js index 6909176..d1b6535 100644 --- a/src/stores/CustomerStore.js +++ b/src/stores/CustomerStore.js @@ -101,6 +101,7 @@ class CustomerStore { // 老客户 beign + // isCompare对比数据boolean isCompareRender对比折线boolean regular_customer_order(get_detail = false, isCompare = false, isCompareRender=false) { let pivotByOrder = 'SumOrder'; let pivotByDate = 'applyDate'; @@ -399,6 +400,52 @@ class CustomerStore { }; // 在华客人 end +// 东道主项目 begin + + host_case_data = { + loading: false, + summaryData: [], // 汇总数据 + groupData: [], // 小组数据 + counselorData: [], // 顾问数据 + group_select_mode: 'multiple', + groups: ['1', '2', '28', '7'], + searchValues: { + DepartmentList: ['1', '2', '28', '7'].map(kk => groupsMappedByKey[kk]), + }, + }; + + getHostCaseData(groupBy) { + this.host_case_data.loading = true; + const date_picker_store = this.rootStore.date_picker_store; + let url = '/service-Analyse2/DDZCount'; + url += '?DEI_SN=' + this.host_case_data.groups.toString(); + url += '&ArriveDateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&ArriveDateEnd=' + date_picker_store.end_date.format(config.SMALL_DATETIME_FORMAT); + url += '&GroupBy=' + groupBy; + fetch(config.HT_HOST + url) + .then((response) => response.json()) + .then((json) => { + runInAction(() => { + this.host_case_data.loading = false; + switch(groupBy){ + case "1": + this.host_case_data.summaryData = json.result?json.result:[]; + break; + case "2": + this.host_case_data.counselorData = json.result?json.result:[]; + break; + case "3": + this.host_case_data.groupData = json.result?json.result:[]; + break; + } + }); + }) + .catch((error) => { + this.host_case_data.loading = false; + console.log('fetch data failed', error); + }); + }; +// 东道主项目 end + // 销售-老客户 sales_regular_data = { loading: false, diff --git a/src/views/HostCaseCount.jsx b/src/views/HostCaseCount.jsx new file mode 100644 index 0000000..849fef1 --- /dev/null +++ b/src/views/HostCaseCount.jsx @@ -0,0 +1,157 @@ +import { useContext } from 'react'; +import { Row, Col, Typography, Space, Table, Divider } from 'antd'; +import { stores_Context } from '../config'; +import { observer } from 'mobx-react'; +import 'moment/locale/zh-cn'; +import SearchForm from '../components/search/SearchForm'; +import { TableExportBtn } from '../components/Data'; +import * as comm from '../utils/commons'; + +const HostCaseCount = () => { + const { customer_store, date_picker_store } = useContext(stores_Context); + const host_case_data = customer_store.host_case_data; + + const columnsList = [ + { + title: '团数', + dataIndex: 'TotalGroupNum', + key: 'TotalGroupNum', + sorter: (a, b) => parseInt(a.TotalGroupNum) - parseInt(b.TotalGroupNum), + }, + { + title: '人数', + dataIndex: 'TotalPersonNum', + key: 'TotalPersonNum', + sorter: (a, b) => parseInt(a.TotalPersonNum) - parseInt(b.TotalPersonNum), + }, + { + title: '计费团天数', + dataIndex: 'TotalDays', + key: 'TotalDays', + sorter: (a, b) => parseInt(a.TotalDays) - parseInt(b.TotalDays), + }, + { + title: '交易额', + dataIndex: 'TotalPrice', + key: 'TotalPrice', + sorter: (a, b) => parseInt(a.TotalPrice) - parseInt(b.TotalPrice), + }, + ]; + // 小组筛选菜单项 + console.log(host_case_data.groupData); + const allOPI1 = comm.uniqWith(host_case_data.groupData.map(rr => ({ text: rr.GroupBy, value: rr.GroupBy })), + (a, b) => JSON.stringify(a) === JSON.stringify(b)).sort((a, b) => a.text.localeCompare(b.text)); + // 顾问筛选菜单项 + const allOPI2 = comm.uniqWith(host_case_data.counselorData.map(rr => ({ text: rr.GroupBy, value: rr.GroupBy })), + (a, b) => JSON.stringify(a) === JSON.stringify(b)).sort((a, b) => a.text.localeCompare(b.text)); + const summaryColumnsList = [{ + title: '', + dataIndex: 'GroupBy', + key: 'GroupBy', + }, ...columnsList]; + const groupColumnsList = [{ + title: '组名', + dataIndex: 'GroupBy', + key: 'GroupBy', + filters: allOPI1, + onFilter: (value, record) => record.GroupBy === value, + filterSearch: true, + }, ...columnsList]; + const counselorColumnsList = [{ + title: '顾问名', + dataIndex: 'GroupBy', + key: 'GroupBy', + filters: allOPI2, + onFilter: (value, record) => record.GroupBy === value, + filterSearch: true, + }, ...columnsList]; + + return ( + <> + + + + { + customer_store.setSearchValues(obj, form,"host_case_data"); + customer_store.getHostCaseData("1"); + customer_store.getHostCaseData("2"); + customer_store.getHostCaseData("3"); + }} + /> + + + + + 东道主项目汇总 + + + + record.key} + loading={host_case_data.loading} + pagination={false} + scroll={{ x: 1000 }} + /> + + + + + 东道主项目小组统计 + + + +
record.key} + loading={host_case_data.loading} + pagination={false} + scroll={{ x: 1000 }} + /> + + + + + 东道主项目顾问统计 + + + +
record.key} + loading={host_case_data.loading} + pagination={false} + scroll={{ x: 1000 }} + /> + + + + + ); +}; + +export default observer(HostCaseCount);