diff --git a/src/components/kpi/ObjectPanel.jsx b/src/components/kpi/ObjectPanel.jsx index 2caa53a..ba7ab01 100644 --- a/src/components/kpi/ObjectPanel.jsx +++ b/src/components/kpi/ObjectPanel.jsx @@ -7,13 +7,13 @@ const yearInitial = {}; const searchFormItemSet = { 'bu': { shows: ['DateType', 'years', 'HTBusinessUnits'], sort }, 'dept': { shows: ['DateType', 'years', 'DepartmentList'], sort, fieldProps: { DepartmentList: { allowClear: true,isLeaf: true, show_all: false } }, }, - 'operator': { shows: ['DateType', 'years', 'DepartmentList', 'operator'], fieldProps: { DepartmentList: { allowClear: true, isLeaf: true }, operator: { param: { is_assign: 1 } } }, sort }, + 'operator': { shows: ['DateType', 'years', 'DepartmentList', 'operator'], fieldProps: { DepartmentList: { allowClear: true, isLeaf: true }, operator: { param: { } } }, sort }, // is_assign: 1 'destination': { shows: ['DateType', 'years', 'destination'], sort }, 'country': { shows: ['DateType', 'years', 'country'], sort }, }; export default observer((props) => { - const searchProps = searchFormItemSet?.[props.curObject] || {}; + const searchProps = searchFormItemSet?.[props.curObject] || { shows: ['DateType', 'years',] , sort }; return ( <> diff --git a/src/components/kpi/SubjectTable/Profit.jsx b/src/components/kpi/SubjectTable/Profit.jsx index d4446f0..79de9c8 100644 --- a/src/components/kpi/SubjectTable/Profit.jsx +++ b/src/components/kpi/SubjectTable/Profit.jsx @@ -201,8 +201,8 @@ export default observer((props) => { const mergePageData = Object.values( Object.assign( {}, - _initialTable.reduce((r, v) => ({ ...r, [v.object_name]: v }), {}), - dataSource.reduce((r, v) => ({ ...r, [v.object_name]: v }), {}) + _initialTable.reduce((r, v) => ({ ...r, [v.object_id]: v }), {}), + dataSource.reduce((r, v) => ({ ...r, [v.object_id]: v }), {}) ) ); if (e && isEmpty(dataSource)) { diff --git a/src/components/kpi/SubjectTable/SumProfitPanel.jsx b/src/components/kpi/SubjectTable/SumProfitPanel.jsx deleted file mode 100644 index 1b5666d..0000000 --- a/src/components/kpi/SubjectTable/SumProfitPanel.jsx +++ /dev/null @@ -1,57 +0,0 @@ -import { useContext } from 'react'; -import { observer } from 'mobx-react'; -// import { stores_Context } from '../config'; -import { Button, Table, Switch, Input, Space, Typography, Row, Col, Spin, Radio, Tabs } from 'antd'; -import SearchForm from '../../search/SearchForm'; -import { bu, KPIObjects } from '../../../libs/ht'; - -export default observer((props) => { - // const { } = useContext(stores_Context); - return ( - <> - - - { - // TradeStore.setStateSearch(form); - // pageRefresh(obj); - }} - /> - - - - - { - const id = String(i); - return { - ...ele, - children: `Content of tab ${id}`, - }; - })} - /> - - - - ); -}); diff --git a/src/libs/ht.js b/src/libs/ht.js index 7834e61..dfb5cd4 100644 --- a/src/libs/ht.js +++ b/src/libs/ht.js @@ -56,6 +56,7 @@ export const groups = [ ]; export const groupsMappedByCode = groups.reduce((a, c) => ({ ...a, [String(c.code || c.key)]: c }), {}); export const leafGroup = groups.slice(3); +export const overviewGroup = groups.slice(0, 3); // todo: 花梨鹰 APP Trippest /** * 来源 */ @@ -117,13 +118,38 @@ export const dataFieldAlias = dataFieldOptions.reduce( * KPI对象 */ export const KPIObjects = [ - { key: 'overview', value: 'overview', label: '海纳' }, + { key: 'overview', value: 'overview', label: '海纳', data: [ + { key: 'ALL', value: 'ALL', label: '海纳' }, + ...overviewGroup + ] + }, + { + key: 'bizarea', + value: 'bizarea', + label: '国内外业务', + data: [ + { key: 'inside', value: 'inside', label: '国内' }, + { key: 'outside', value: 'outside', label: '海外' }, + ], + }, { key: 'bu', value: 'bu', label: 'HT事业部', data: bu }, { key: 'dept', value: 'dept', label: '小组', data: leafGroup }, { key: 'du', value: 'du', label: '销售小组', data: deptUnits }, { key: 'operator', value: 'operator', label: '顾问' }, { key: 'destination', value: 'destination', label: '目的地' }, { key: 'country', value: 'country', label: '国籍' }, + { + key: 'guestgrouptype', + value: 'guestgrouptype', + label: '成员关系', + data: [ + { key: '146001', value: '146001', label: '夫妻' }, + { key: '146002', value: '146002', label: '家庭' }, + { key: '146003', value: '146003', label: 'Solo' }, + { key: '146004', value: '146004', label: '组织' }, + { key: '146005', value: '146005', label: '其他' }, + ], + }, ]; export const KPISubjects = [ { key: 'sum_profit', value: 'sum_profit', label: '毛利' }, diff --git a/src/stores/Distribution.js b/src/stores/Distribution.js index 5f62d6c..52e8f48 100644 --- a/src/stores/Distribution.js +++ b/src/stores/Distribution.js @@ -10,6 +10,7 @@ const modelMapper = { 'PersonNum': { url: '/service-Analyse2/GetTradeApartByPersonNum' }, 'destination': { url: '/service-Analyse2/GetTradeApartByDestination' }, 'GlobalDestination': { url: '/service-Analyse2/GetTradeApartByGlobalDestination' }, + 'destinationCountry': { url: '/service-Analyse2/GetTradeApartByDestinationCountry' }, }; class Distribution { constructor(appStore){ @@ -21,6 +22,7 @@ class Distribution { * 各个类型的分布 */ getApartData = async (param) => { + this.pageLoading = true; const mkey = this.curTab; this[mkey] = { loading: true, dataSource: [] }; const json = await req.fetchJSON(modelMapper[mkey].url, param); @@ -30,6 +32,7 @@ class Distribution { this[mkey].loading = false; this[mkey].originData = json.result; this[mkey].dataSource = dataLength > 20 ? json.result.slice(0, 30) : json.result; + this.pageLoading = false; }); } return this[mkey]; @@ -63,6 +66,7 @@ class Distribution { this.PersonNum = { loading: false, dataSource: [] }; this.destination = { loading: false, dataSource: [] }; this.GlobalDestination = { loading: false, dataSource: [] }; + this.destinationCountry = { loading: false, dataSource: [] }; }; curTab = 'tourDays'; @@ -82,5 +86,6 @@ class Distribution { PersonNum = { loading: false, dataSource: [] }; destination = { loading: false, dataSource: [] }; GlobalDestination = { loading: false, dataSource: [] }; + destinationCountry = { loading: false, dataSource: [] }; } export default Distribution; diff --git a/src/stores/Trade.js b/src/stores/Trade.js index 50e2fed..2f8e01a 100644 --- a/src/stores/Trade.js +++ b/src/stores/Trade.js @@ -14,7 +14,7 @@ class Trade { */ fetchSummaryData(queryData) { this.summaryData.loading = true; - queryData.groupType = 'overview'; + queryData.groupType = queryData?.groupType || 'overview'; queryData.groupDateType = 'year'; this.fetchTradeData(queryData).then((json) => { if (json.errcode === 0) { @@ -57,7 +57,8 @@ class Trade { fetchTradeDataByDate(queryData) { this.timeData.loading = true; queryData = queryData || this.searchPayloadHome; - Object.assign(queryData, { groupType: 'overview', groupDateType: this.timeLineKey }); + queryData.groupType = queryData?.groupType || 'overview'; + Object.assign(queryData, { groupDateType: this.timeLineKey }); this.fetchTradeData(queryData).then((json) => { if (json.errcode === 0) { runInAction(() => { @@ -90,6 +91,24 @@ class Trade { }); } + /** + * 成员关系, 年度 + */ + fetchTradeDataByGuestType(queryData) { + this.BuData.loading = true; + Object.assign(queryData, { groupType: 'GuestGroupType', groupDateType: 'year' }); + this.fetchTradeData(queryData).then((json) => { + if (json.errcode === 0) { + runInAction(() => { + const data = json.result1; + + this.BuData.loading = false; + this.BuData.dataSource = data; + }); + } + }); + } + /** * 业务区域, 按月 */ @@ -141,6 +160,11 @@ class Trade { return null; } + /** + * 从结果中取出目标客户的数据 + */ + getTargetsRes = () => {}; + setStateSearch(body) { this.searchPayloadHome = body; } diff --git a/src/views/Distribution.jsx b/src/views/Distribution.jsx index 59c6876..1131b4a 100644 --- a/src/views/Distribution.jsx +++ b/src/views/Distribution.jsx @@ -17,6 +17,7 @@ const apartOptions = [ { key: 'PersonNum', value: 'PersonNum', label: '人等' }, { key: 'destination', value: 'destination', label: '国内目的地' }, { key: 'GlobalDestination', value: 'GlobalDestination', label: '海外目的地' }, + { key: 'destinationCountry', value: 'GlobalDestination', label: '目的地国籍' }, ]; export default observer(() => { diff --git a/src/views/Home.jsx b/src/views/Home.jsx index 6605fb0..2f9143c 100644 --- a/src/views/Home.jsx +++ b/src/views/Home.jsx @@ -41,6 +41,8 @@ export default observer(() => { }, []); const pageRefresh = (queryData) => { + const overviewFlag = queryData.DepartmentList.toLowerCase() === 'all' || queryData.DepartmentList.toLowerCase().includes(','); + queryData.groupType = overviewFlag ? 'overview' : 'dept'; TradeStore.fetchSummaryData(queryData); TradeStore.fetchTradeDataByDate(queryData); TradeStore.fetchTradeDataByBU(queryData); diff --git a/src/views/KPI.jsx b/src/views/KPI.jsx index 524e364..7ab7e3d 100644 --- a/src/views/KPI.jsx +++ b/src/views/KPI.jsx @@ -9,7 +9,8 @@ import OverviewPanel from './../components/kpi/OverviewPanel'; import './kpi.css'; const objectComponents = { - 'overview': OverviewPanel, + // 'overview': OverviewPanel, + 'overview': ObjectPanel, 'bu': ObjectPanel, 'dept': ObjectPanel, 'du': ObjectPanel, @@ -60,7 +61,7 @@ export default observer((props) => { if (curObject === 'operator') { KPIStore.setListLoading(true); const searchOperator = await DictDataStore.fetchDictData('operator', { - is_assign: 1, + // is_assign: 1, dept_id: (obj?.DepartmentList || '').replace('ALL', ''), q: searchFormStore.formValues?.operator?.label || '', }); @@ -68,7 +69,7 @@ export default observer((props) => { || !isEmpty(searchFormStore.formValues?.operator)) { // && isEmpty(getkpiParam.object_id) setRetObjects(searchOperator.dataSource); - getkpiParam.object_id = searchOperator.dataSource.map((ele) => ele.key).join(','); + // getkpiParam.object_id = searchOperator.dataSource.map((ele) => ele.key).join(','); // todo: 多选 delete getkpiParam.dept_id; } } @@ -95,7 +96,7 @@ export default observer((props) => { onChange={onObjectChange} type="card" items={KPIObjects.map((ele, i) => { - const ObjectItemPanel = objectComponents[ele.key]; + const ObjectItemPanel = objectComponents?.[ele.key] || ObjectPanel; return { ...ele, children: (