From 36ce786c6ca6e3adadade89759c9b8ef0f957c17 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 28 Sep 2023 14:59:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=88=90=E5=91=98=E5=85=B3?= =?UTF-8?q?=E7=B3=BB.=20=E9=A1=BE=E9=97=AEKPI=E5=85=81=E8=AE=B8=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E4=B8=8D=E5=88=86=E9=85=8D=E8=AE=A2=E5=8D=95=E7=9A=84?= =?UTF-8?q?;=20=E4=B8=9A=E7=BB=A9=E5=92=8CKPI=E6=80=BB=E9=A2=9D:=20?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=89=8D=E7=AB=AF=E9=85=8D=E7=BD=AE=E7=9A=84?= =?UTF-8?q?=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 || '', });