diff --git a/src/stores/CustomerStore.js b/src/stores/CustomerStore.js index 1a7abf6..c4f67cb 100644 --- a/src/stores/CustomerStore.js +++ b/src/stores/CustomerStore.js @@ -407,6 +407,7 @@ class CustomerStore { summaryData: [], // 汇总数据 groupData: [], // 小组数据 counselorData: [], // 顾问数据 + singleDetailData:[], // 单团详细数据 group_select_mode: 'multiple', groups: ['1', '2', '28', '7'], searchValues: { @@ -436,6 +437,9 @@ class CustomerStore { case "3": this.host_case_data.groupData = json.result?json.result:[]; break; + case "4": + this.host_case_data.singleDetailData = json.result?json.result:[]; + break; } }); }) diff --git a/src/views/HostCaseCount.jsx b/src/views/HostCaseCount.jsx index df29603..ce42b74 100644 --- a/src/views/HostCaseCount.jsx +++ b/src/views/HostCaseCount.jsx @@ -37,13 +37,17 @@ const HostCaseCount = () => { sorter: (a, b) => parseInt(a.TotalPrice) - parseInt(b.TotalPrice), }, ]; + // 筛选函数 + const getFiltersData=(filterData,filterKey)=>{ + return comm.uniqWith(filterData.map(rr => ({ text: rr[filterKey], value: rr[filterKey] })), + (a, b) => JSON.stringify(a) === JSON.stringify(b)).sort((a, b) => a.text.localeCompare(b.text)); + }; // 小组筛选菜单项 - // console.log(host_case_data.groupData); - const allOPI1 = comm.uniqWith(host_case_data.groupData.map(rr => ({ text: rr.GroupBy, value: rr.GroupBy })), - (a, b) => JSON.stringify(a) === JSON.stringify(b)).sort((a, b) => a.text.localeCompare(b.text)); + const allOPIGroup = getFiltersData(host_case_data.summaryData,"GroupBy"); // 顾问筛选菜单项 - const allOPI2 = comm.uniqWith(host_case_data.counselorData.map(rr => ({ text: rr.GroupBy, value: rr.GroupBy })), - (a, b) => JSON.stringify(a) === JSON.stringify(b)).sort((a, b) => a.text.localeCompare(b.text)); + const allOPIConsultant = getFiltersData(host_case_data.counselorData,"GroupBy"); + // 明细表顾问名筛选菜单项 + const allOPIDetailConsultant = getFiltersData(host_case_data.singleDetailData,"OPI_Name"); const summaryColumnsList = [{ title: '', dataIndex: 'GroupBy', @@ -53,7 +57,7 @@ const HostCaseCount = () => { title: '组名', dataIndex: 'GroupBy', key: 'GroupBy', - filters: allOPI1, + filters: allOPIGroup, onFilter: (value, record) => record.GroupBy === value, filterSearch: true, }, ...columnsList]; @@ -61,10 +65,48 @@ const HostCaseCount = () => { title: '顾问名', dataIndex: 'GroupBy', key: 'GroupBy', - filters: allOPI2, + filters: allOPIConsultant, onFilter: (value, record) => record.GroupBy === value, filterSearch: true, }, ...columnsList]; + const singleDetailColumnsList = [{ + title: '团名', + dataIndex: 'GroupBy', + key: 'GroupBy', + }, + { + title: '顾问名', + dataIndex: 'OPI_Name', + key: 'OPI_Name', + filters: allOPIDetailConsultant, + onFilter: (value, record) => record.OPI_Name === value, + filterSearch: true, + }, + ...columnsList.slice(1)]; + + const renderRow=(rowColumns,rowDataSource,title)=>{ + return( + + + {title} + + + + record.key} + loading={host_case_data.loading} + pagination={false} + scroll={{ x: 1000 }} + /> + + + ); + }; return ( <> @@ -88,67 +130,15 @@ const HostCaseCount = () => { customer_store.getHostCaseData("1"); customer_store.getHostCaseData("2"); customer_store.getHostCaseData("3"); + customer_store.getHostCaseData("4"); }} /> - - - 东道主项目汇总 - - - -
record.key} - loading={host_case_data.loading} - pagination={false} - scroll={{ x: 1000 }} - /> - - - - - 东道主项目小组统计 - - - -
record.key} - loading={host_case_data.loading} - pagination={false} - scroll={{ x: 1000 }} - /> - - - - - 东道主项目顾问统计 - - - -
record.key} - loading={host_case_data.loading} - pagination={false} - scroll={{ x: 1000 }} - /> - - + {renderRow(summaryColumnsList,host_case_data.summaryData,'东道主项目汇总')} + {renderRow(groupColumnsList,host_case_data.groupData,'东道主项目小组统计')} + {renderRow(counselorColumnsList,host_case_data.counselorData,'东道主项目顾问统计')} + {renderRow(singleDetailColumnsList,host_case_data.singleDetailData,'单团明细')} );