From fd3148cf5d2190b6acd8856ea9e19567e9db5aa2 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 27 Sep 2023 17:19:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?KPI=20=E8=AE=BE=E7=BD=AE:=20=E5=9B=BD?= =?UTF-8?q?=E5=86=85=E5=A4=96=E4=B8=9A=E5=8A=A1;=20todo:=20=E6=88=90?= =?UTF-8?q?=E5=91=98=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/kpi/ObjectPanel.jsx | 2 +- src/components/kpi/SubjectTable/Profit.jsx | 4 +- .../kpi/SubjectTable/SumProfitPanel.jsx | 57 ------------------- src/libs/ht.js | 18 +++++- src/stores/Trade.js | 23 ++++++++ src/views/KPI.jsx | 7 ++- 6 files changed, 47 insertions(+), 64 deletions(-) delete mode 100644 src/components/kpi/SubjectTable/SumProfitPanel.jsx diff --git a/src/components/kpi/ObjectPanel.jsx b/src/components/kpi/ObjectPanel.jsx index 2caa53a..c34a236 100644 --- a/src/components/kpi/ObjectPanel.jsx +++ b/src/components/kpi/ObjectPanel.jsx @@ -13,7 +13,7 @@ const searchFormItemSet = { }; 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 f5a70be..5055f31 100644 --- a/src/libs/ht.js +++ b/src/libs/ht.js @@ -116,13 +116,29 @@ export const dataFieldAlias = dataFieldOptions.reduce( * KPI对象 */ export const KPIObjects = [ - { key: 'overview', value: 'overview', label: '海纳' }, + { key: 'overview', value: 'overview', label: '海纳', data: [{ key: '-1', value: '-1', label: '海纳' }] }, + { + 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: [ // todo: + { key: 'family', value: 'family', label: '家庭' }, + { key: 'solo', value: 'solo', label: 'Solo' }, + { key: 'group', value: 'group', label: '组织' }, + { key: 'other', value: 'other', label: '其他' }, + ] + }, ]; export const KPISubjects = [ { key: 'sum_profit', value: 'sum_profit', label: '毛利' }, diff --git a/src/stores/Trade.js b/src/stores/Trade.js index 50e2fed..3e5733e 100644 --- a/src/stores/Trade.js +++ b/src/stores/Trade.js @@ -90,6 +90,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 +159,11 @@ class Trade { return null; } + /** + * 从结果中取出目标客户的数据 + */ + setTargetsRes = () => {}; + setStateSearch(body) { this.searchPayloadHome = body; } diff --git a/src/views/KPI.jsx b/src/views/KPI.jsx index 524e364..5e9977c 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, @@ -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: ( From 36ce786c6ca6e3adadade89759c9b8ef0f957c17 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 28 Sep 2023 14:59:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=88=90=E5=91=98?= =?UTF-8?q?=E5=85=B3=E7=B3=BB.=20=E9=A1=BE=E9=97=AEKPI=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=B8=8D=E5=88=86=E9=85=8D=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=9A=84;=20=E4=B8=9A=E7=BB=A9=E5=92=8CKPI=E6=80=BB=E9=A2=9D:?= =?UTF-8?q?=20=E5=8C=B9=E9=85=8D=E5=89=8D=E7=AB=AF=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=B8=9A=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/kpi/ObjectPanel.jsx | 2 +- src/libs/ht.js | 24 +++++++++++++++++------- src/stores/Distribution.js | 5 +++++ src/stores/Trade.js | 7 ++++--- src/views/Distribution.jsx | 1 + src/views/Home.jsx | 2 ++ src/views/KPI.jsx | 2 +- 7 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/components/kpi/ObjectPanel.jsx b/src/components/kpi/ObjectPanel.jsx index c34a236..ba7ab01 100644 --- a/src/components/kpi/ObjectPanel.jsx +++ b/src/components/kpi/ObjectPanel.jsx @@ -7,7 +7,7 @@ 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 }, }; diff --git a/src/libs/ht.js b/src/libs/ht.js index 5055f31..df28874 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 /** * 来源 */ @@ -116,7 +117,11 @@ export const dataFieldAlias = dataFieldOptions.reduce( * KPI对象 */ export const KPIObjects = [ - { key: 'overview', value: 'overview', label: '海纳', data: [{ key: '-1', value: '-1', label: '海纳' }] }, + { key: 'overview', value: 'overview', label: '海纳', data: [ + { key: 'ALL', value: 'ALL', label: '海纳' }, + ...overviewGroup + ] + }, { key: 'bizarea', value: 'bizarea', @@ -132,12 +137,17 @@ export const KPIObjects = [ { key: 'operator', value: 'operator', label: '顾问' }, { key: 'destination', value: 'destination', label: '目的地' }, { key: 'country', value: 'country', label: '国籍' }, - { key: 'guestgrouptype', value: 'guestgrouptype', label: '成员关系', data: [ // todo: - { key: 'family', value: 'family', label: '家庭' }, - { key: 'solo', value: 'solo', label: 'Solo' }, - { key: 'group', value: 'group', label: '组织' }, - { key: 'other', value: 'other', 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 = [ 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 3e5733e..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(() => { @@ -162,7 +163,7 @@ class Trade { /** * 从结果中取出目标客户的数据 */ - setTargetsRes = () => {}; + 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 5e9977c..7ab7e3d 100644 --- a/src/views/KPI.jsx +++ b/src/views/KPI.jsx @@ -61,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 || '', });