Merge branch 'feature/2.0'

feature/2.0-sales-trade
Lei OT 2 years ago
commit 7ef623a2fc

@ -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 (
<>
<KPISettings {...{ searchProps, KPISubjects }} {...props} />

@ -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)) {

@ -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 (
<>
<Row gutter={16} className="mb-1">
<Col className="gutter-row mb-n1 p-none" span={24}>
<SearchForm
defaultValue={{
'initialValue': {
// ...searchPayloadHome,
},
// hides: ['businessUnits', 'months', 'WebCode', 'dates'],
shows: ['HTBusinessUnits', 'DateType', 'DepartmentList', 'years'],
'fieldProps': {
HTBusinessUnits: { show_all: true },
DepartmentList: { show_all: true },
WebCode: { show_all: false },
years: { hide_vs: true },
},
}}
confirmText="查询"
onSubmit={(_err, obj, form, str) => {
// TradeStore.setStateSearch(form);
// pageRefresh(obj);
}}
/>
</Col>
</Row>
<Row gutter={16} className="mb-1 p-s1">
<Col className="gutter-row mb-n1 p-none" span={24} style={{ backgroundColor: '#ffffff' }}>
<Tabs
tabPosition={'left'}
style={
{
// height: 220,
}
}
items={KPIObjects.map((ele, i) => {
const id = String(i);
return {
...ele,
children: `Content of tab ${id}`,
};
})}
/>
</Col>
</Row>
</>
);
});

@ -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: '毛利' },

@ -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;

@ -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;
}

@ -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(() => {

@ -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);

@ -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: (

Loading…
Cancel
Save