diff --git a/src/components/search/SearchForm.jsx b/src/components/search/SearchForm.jsx index c455725..a0f5fdb 100644 --- a/src/components/search/SearchForm.jsx +++ b/src/components/search/SearchForm.jsx @@ -198,7 +198,7 @@ export default observer((props) => { // layout="inline"
- + {getFields({ sort, initialValue, hides, shows, fieldProps, form })} {/* 'textAlign': 'right' */} diff --git a/src/stores/Distribution.js b/src/stores/Distribution.js index 0b6b256..ebf66e1 100644 --- a/src/stores/Distribution.js +++ b/src/stores/Distribution.js @@ -5,14 +5,14 @@ import moment from 'moment'; import { isEmpty, pick, sortBy, fixTo2Decimals, cloneDeep, unique } from '../utils/commons'; const modelMapper = { - 'tourDays': { url: '/service-Analyse2/GetTradeApartByTourDays' }, - 'PML': { url: '/service-Analyse2/GetTradeApartByPML' }, - 'ConfirmDays': { url: '/service-Analyse2/GetTradeApartByConfirmDays' }, - 'ApplyDays': { url: '/service-Analyse2/GetTradeApartByApplyDays' }, - 'PersonNum': { url: '/service-Analyse2/GetTradeApartByPersonNum' }, - 'destination': { url: '/service-Analyse2/GetTradeApartByDestination' }, - 'GlobalDestination': { url: '/service-Analyse2/GetTradeApartByGlobalDestination' }, - 'destinationCountry': { url: '/service-Analyse2/GetTradeApartByDestinationCountry' }, + 'tourDays': { url: '/service-Analyse2/GetTradeApartByTourDays', keySort: true }, + 'PML': { url: '/service-Analyse2/GetTradeApartByPML', keySort: true }, + 'ConfirmDays': { url: '/service-Analyse2/GetTradeApartByConfirmDays', keySort: true }, + 'ApplyDays': { url: '/service-Analyse2/GetTradeApartByApplyDays', keySort: true }, + 'PersonNum': { url: '/service-Analyse2/GetTradeApartByPersonNum', keySort: true }, + 'destination': { url: '/service-Analyse2/GetTradeApartByDestination', keySort: false }, + 'GlobalDestination': { url: '/service-Analyse2/GetTradeApartByGlobalDestination', keySort: false }, + 'destinationCountry': { url: '/service-Analyse2/GetTradeApartByDestinationCountry', keySort: false }, }; class Distribution { constructor(appStore) { @@ -41,12 +41,13 @@ class Distribution { param.DateToQ2 = DateToQ2.format(`${DATE_FORMAT} 23:59:59`); const json = await req.fetchJSON(modelMapper[mkey].url, param); if (json.errcode === 0) { + const dataLength = json.result.length; + const pickResult = dataLength > 20 ? json.result.slice(0, 30) : json.result; + const dataSource = calcDiff({ result: pickResult, resultToY: json.resultToY, resultToQ: json.resultToQ }, modelMapper[mkey].keySort); runInAction(() => { - const dataLength = json.result.length; this[mkey].loading = false; this[mkey].originData = json.result; - const pickResult = dataLength > 20 ? json.result.slice(0, 30) : json.result; - this[mkey].dataSource = calcDiff({ result: pickResult, resultToY: json.resultToY, resultToQ: json.resultToQ }); + this[mkey].dataSource = dataSource; this.pageLoading = false; }); } @@ -118,15 +119,14 @@ class Distribution { /** * 计算 同比, 环比 */ -const calcDiff = ({ result, resultToY, resultToQ }) => { - if (isEmpty(resultToY) || isEmpty(resultToQ)) { - // return result; - } - const initialDataWithAllKeys = unique([].concat(result, resultToY, resultToQ).map((ele) => `${ele.key}@${ele.label}`)).reduce((r, v) => { - const [key, label] = String(v).split('@'); - r.push({key: Number(key), label, SumML: 0, ConfirmOrder: 0, SumOrder: 0, SumMLPercent: 0, ConfirmOrderPercent: 0, SumOrderPercent: 0}); - return r; - }, []).sort(sortBy('key')); +const calcDiff = ({ result, resultToY, resultToQ }, keySort) => { + const initialDataWithAllKeys = unique([].concat(result, resultToY, resultToQ).map((ele) => `${ele.key}@${ele.label}`)) + .reduce((r, v) => { + const [key, label] = String(v).split('@'); + r.push({ key: Number(key), label, SumML: 0, ConfirmOrder: 0, SumOrder: 0, SumMLPercent: 0, ConfirmOrderPercent: 0, SumOrderPercent: 0 }); + return r; + }, []) + .sort(keySort ? sortBy('key') : undefined); const initialMapped = initialDataWithAllKeys.reduce((r, v) => ({ ...r, [v.key]: v }), {}); const resultMapped = result.reduce((r, v) => ({ ...r, [v.key]: v }), cloneDeep(initialMapped)); const resultToYMapped = resultToY.reduce((r, v) => ({ ...r, [v.key]: v }), cloneDeep(initialMapped)); diff --git a/src/stores/Trade.js b/src/stores/Trade.js index 199753a..c1bea7d 100644 --- a/src/stores/Trade.js +++ b/src/stores/Trade.js @@ -32,7 +32,7 @@ class Trade { // hasKPI: !isEmpty(summary?.[dataFieldAlias.ConfirmOrder.nestkey.p]), hasKPI: false }, - { title: '毛利', value: summary?.SumML, KPIrate: summary?.[dataFieldAlias.SumML.nestkey.p], hasKPI: false }, + { title: '毛利', value: dataFieldAlias.SumML.formatter(summary?.SumML || 0), KPIrate: summary?.[dataFieldAlias.SumML.nestkey.p], hasKPI: false }, { title: '完成率', value: `${summary?.[dataFieldAlias.SumML.nestkey.p] || ''}%`, hasKPI: false }, { title: '人数', diff --git a/src/views/Distribution.jsx b/src/views/Distribution.jsx index 4a527b7..9e9cc71 100644 --- a/src/views/Distribution.jsx +++ b/src/views/Distribution.jsx @@ -61,12 +61,14 @@ export default observer(() => { autoFit: false, // color: ['#f6bd16', '#E8EDF3'], color: ['#61ddaa', '#E8EDF3'], // #7cb305 + innerRadius: 0.90, }; const RingProgressConfigQ = { height: 50, width: 50, autoFit: false, color: ['#f6bd16', '#E8EDF3'], + innerRadius: 0.90, }; const columns = [ { title: '', dataIndex: 'label' }, @@ -76,7 +78,7 @@ export default observer(() => { render: (v, r) => ( <> - + {v} @@ -99,7 +101,7 @@ export default observer(() => { render: (v, r) => ( <> - + {dataFieldAlias.SumML.formatter(v)} @@ -119,12 +121,12 @@ export default observer(() => { { title: '团数占比', dataIndex: 'ConfirmOrderPercent', - render: (v, r) => , + render: (v, r) => v ? : '-', }, { title: '业绩占比', dataIndex: 'SumMLPercent', - render: (v, r) => , + render: (v, r) => v ? : '-', }, { title: () => <>
去年同期
{dateStringY}
, @@ -134,13 +136,13 @@ export default observer(() => { title: '团数占比', width: 90, dataIndex: 'ConfirmOrderPercent', - render: (v, r) => , + render: (v, r) => r.resultToY.ConfirmOrderPercent ? : '-', }, { title: '业绩占比', width: 90, dataIndex: 'SumMLPercent', - render: (v, r) => , + render: (v, r) => r.resultToY.SumMLPercent ? : '-', }, ], }, @@ -152,13 +154,13 @@ export default observer(() => { title: '团数占比', width: 90, dataIndex: 'ConfirmOrderPercent', - render: (v, r) => , + render: (v, r) => r.resultToQ.ConfirmOrderPercent ? : '-', }, { title: '业绩占比', width: 90, dataIndex: 'SumMLPercent', - render: (v, r) => , + render: (v, r) => r.resultToQ.SumMLPercent ? : '-', }, ], }, diff --git a/src/views/Home.jsx b/src/views/Home.jsx index 9e0a7f7..3546503 100644 --- a/src/views/Home.jsx +++ b/src/views/Home.jsx @@ -17,11 +17,11 @@ import { Line } from '@ant-design/charts'; import './home.css'; const topSeries = [ - { key: 'country', label: '国籍' }, - { key: 'dept', label: '小组' }, - { key: 'operator', label: '顾问' }, - { key: 'GuestGroupType', label: '客群类别' }, - { key: 'destination', label: '目的地' }, + { key: 'country', label: '国籍', graphVisible: true }, + { key: 'dept', label: '小组', graphVisible: true }, + { key: 'operator', label: '顾问', graphVisible: true }, + { key: 'GuestGroupType', label: '客群类别', graphVisible: false }, + { key: 'destination', label: '目的地', graphVisible: true }, ]; // const iconSets = [CheckCircleTwoTone, , , , ,,]; @@ -160,7 +160,7 @@ export default observer(() => { }; return ( <> - + {/* style={{ margin: '-16px -8px', padding: 0 }} */} { - {topSeries.map((item) => ( + {topSeries.map((item) => item.graphVisible ? (

{item.label}

- ))} + ) : null)}