|
|
|
@ -466,8 +466,8 @@ class CustomerStore {
|
|
|
|
// mergedData: [],
|
|
|
|
// mergedData: [],
|
|
|
|
rawData: [],
|
|
|
|
rawData: [],
|
|
|
|
searchValues: {
|
|
|
|
searchValues: {
|
|
|
|
DepartmentList: ['1', '2', '28', '7'].map(kk => groupsMappedByKey[kk]),
|
|
|
|
DepartmentList: ['1', '2', '28', '7', '33'].map(kk => groupsMappedByKey[kk]),
|
|
|
|
WebCode: ['CHT','AH','JH','GH','ZWQD','GH_ZWQD_HW','GHKYZG','GHKYHW'].map(kk => sitesMappedByCode[kk]),
|
|
|
|
WebCode: ['CHT','AH','HTravel','JH','GH','ZWQD','GH_ZWQD_HW','GHKYZG','GHKYHW'].map(kk => sitesMappedByCode[kk]),
|
|
|
|
DateType: { key: 'applyDate', label: '提交日期'},
|
|
|
|
DateType: { key: 'applyDate', label: '提交日期'},
|
|
|
|
IncludeTickets: { key: '0', label: '不含门票' },
|
|
|
|
IncludeTickets: { key: '0', label: '不含门票' },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -554,17 +554,19 @@ class CustomerStore {
|
|
|
|
// console.log('regular_data_pivot -------------------------------------------------------------- rawData 000 ', toJS(this.sales_regular_data.rawData));
|
|
|
|
// console.log('regular_data_pivot -------------------------------------------------------------- rawData 000 ', toJS(this.sales_regular_data.rawData));
|
|
|
|
// console.log('regular_data_pivot ---- ', pivotRow, pivotCol);
|
|
|
|
// console.log('regular_data_pivot ---- ', pivotRow, pivotCol);
|
|
|
|
const [result1, result2] = this.sales_regular_data.rawDataArr;
|
|
|
|
const [result1, result2] = this.sales_regular_data.rawDataArr;
|
|
|
|
const allRows = Array.from(new Set([...result1.filterHasOld.map(row=>row[pivotRow]), ...result2.filterHasOld.map(row=>row[pivotRow])]));
|
|
|
|
// const allRows = Array.from(new Set([...result1.filterHasOld.map(row=>row[pivotRow]), ...result2.filterHasOld.map(row=>row[pivotRow])]));
|
|
|
|
// console.log(' ------ allRows', allRows);
|
|
|
|
// console.log(' ------ allRows', allRows);
|
|
|
|
const [pivot1, pivot2] = [result1, result2].map(_result => {
|
|
|
|
const [{ pivotResult: pivot1, rowValues: rowValues1 }, { pivotResult: pivot2, rowValues: rowValues2 }] = [result1, result2].map(_result => {
|
|
|
|
const dataColField = pivotCol.replace('_txt', '');
|
|
|
|
const dataColField = pivotCol.replace('_txt', '');
|
|
|
|
const rawData = pivotCol === 'hasOld' ? _result.filterHasOld : _result.filterHasOld.filter((ele) => ele[dataColField] === '1');
|
|
|
|
const rawData = pivotCol === 'hasOld' ? _result.filterHasOld : _result.filterHasOld.filter((ele) => ele[dataColField] === '1');
|
|
|
|
const { data: pivotResult } = pivotBy(rawData, [[pivotRow, pivotCol], [], []]);
|
|
|
|
const { data: pivotResult, columnValues: [[rowValues,], columnsKeys, dateKeys] } = pivotBy(rawData, [[pivotRow, pivotCol], [], []]);
|
|
|
|
return pivotResult;
|
|
|
|
return { pivotResult, rowValues };
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const allRowValues = Array.from(new Set([...rowValues1, ...rowValues2]));
|
|
|
|
|
|
|
|
// console.log(' ------ xx', rowValues1);
|
|
|
|
const rows1 = groupBy(pivot1, pivotRow);
|
|
|
|
const rows1 = groupBy(pivot1, pivotRow);
|
|
|
|
const rows2 = groupBy(pivot2, pivotRow);
|
|
|
|
const rows2 = groupBy(pivot2, pivotRow);
|
|
|
|
const pivotResultWithCompare = isEmpty(pivot2) ? pivot1 : allRows.reduce((r, rowName) => {
|
|
|
|
const pivotResultWithCompare = isEmpty(pivot2) ? pivot1 : allRowValues.reduce((r, rowName) => {
|
|
|
|
const _default = { [pivotRow]: rowName, rowLabel: rows1?.[rowName]?.rowLabel || rows2?.[rowName]?.rowLabel, children: rows1?.[rowName], key: rowName};
|
|
|
|
const _default = { [pivotRow]: rowName, rowLabel: rows1?.[rowName]?.rowLabel || rows2?.[rowName]?.rowLabel, children: rows1?.[rowName], key: rowName};
|
|
|
|
const operatorRow = {...(rows1?.[rowName]?.[0] || _default), vsData: rows2?.[rowName]?.[0] || {}};
|
|
|
|
const operatorRow = {...(rows1?.[rowName]?.[0] || _default), vsData: rows2?.[rowName]?.[0] || {}};
|
|
|
|
// 展开的两项: '老客户', '老客户推荐'
|
|
|
|
// 展开的两项: '老客户', '老客户推荐'
|
|
|
|
@ -582,7 +584,7 @@ class CustomerStore {
|
|
|
|
// console.log(' ------ pivot1', pivot1, '\npivot2', pivot2, '\npivotResultWithCompare', pivotResultWithCompare);
|
|
|
|
// console.log(' ------ pivot1', pivot1, '\npivot2', pivot2, '\npivotResultWithCompare', pivotResultWithCompare);
|
|
|
|
|
|
|
|
|
|
|
|
const filterColValues = uniqWith(
|
|
|
|
const filterColValues = uniqWith(
|
|
|
|
allRows.map((rr) => ({ text: rr, value: rr })),
|
|
|
|
allRowValues.map((rr) => ({ text: rr, value: rr })),
|
|
|
|
(a, b) => JSON.stringify(a) === JSON.stringify(b)
|
|
|
|
(a, b) => JSON.stringify(a) === JSON.stringify(b)
|
|
|
|
).sort((a, b) => a.text.localeCompare(b.text, 'zh-CN'));
|
|
|
|
).sort((a, b) => a.text.localeCompare(b.text, 'zh-CN'));
|
|
|
|
|
|
|
|
|
|
|
|
|