perf: 销售业绩数据: 筛选顾问

feature/hotel-cruise
Lei OT 1 year ago
parent ac82432e67
commit 5dcdcd6345

@ -169,8 +169,8 @@ class SaleStore {
} else {
const result1 = comm.isEmpty(this.searchValues.operator) ? json.result1 : json.result1.filter(row => (this.searchValues.operator.split(',')).includes(String(row.OPI_SN)));
const result2 = comm.isEmpty(this.searchValues.operator) ? json.result2 : json.result2.filter(row => (this.searchValues.operator.split(',')).includes(String(row.OPI_SN)));
const allOPI1 = comm.uniqWith(result1.map(rr => ({ text: rr.OPI_Name, value: rr.OPI_SN })), (a, b) => JSON.stringify(a) === JSON.stringify(b)).sort((a, b) => a.text.localeCompare(b.text));
if (this.active_tab_key === 'All') {
const allOPI = result1.map(rr => ({ text: rr.OPI_Name, value: rr.OPI_SN })).sort((a, b) => a.text.localeCompare(b.text));
result.columns = [
{
title: '账户名',
@ -181,7 +181,7 @@ class SaleStore {
},
],
sorter: (a, b) => (a?.OPI_Name || '').localeCompare(b.OPI_Name, 'zh-CN'),
filters: allOPI,
filters: allOPI1,
onFilter: (value, record) => record.OPI_SN === value,
filterSearch: true,
},
@ -234,6 +234,9 @@ class SaleStore {
},
],
sorter: (a, b) => (a?.OPI_Name || '').localeCompare(b.OPI_Name, 'zh-CN'),
filters: allOPI1,
onFilter: (value, record) => record.OPI_SN === value,
filterSearch: true,
},
{
title: '报价次数',
@ -290,6 +293,9 @@ class SaleStore {
},
],
sorter: (a, b) => (a?.OPI_Name || '').localeCompare(b.OPI_Name, 'zh-CN'),
filters: allOPI1,
onFilter: (value, record) => record.OPI_SN === value,
filterSearch: true,
},
{
title: '首次回复率',
@ -378,7 +384,7 @@ class SaleStore {
const total_data_value = items.length ? items.reduce((a, b) => a + b.COLI_YJLY, 0) : ''; // 记录累加
const total_data_value_diff = items.length ? items.reduce((a, b) => a + b.COLI_YJLY2, 0) : ''; // 记录累加
if (comm.empty(type_data[op_sn])) {
type_data[op_sn] = [{ key: item.OPI_SN }, { T_name: item.OPI_Name }, { T_total: total_data_value }, { V_total: total_data_value_diff }];
type_data[op_sn] = [{ key: item.OPI_SN }, { T_name: item.OPI_Name }, { T_OPI: item.OPI_SN }, { T_total: total_data_value }, { V_total: total_data_value_diff }];
}
const _diff = comm.objectMapper(comm.pick(item, ['COLI_YJLY_diff', 'COLI_YJLY_vs', 'COLI_YJLY2']), {
COLI_YJLY2: { key: `v_${item.SubTypeSN}` },
@ -412,6 +418,9 @@ class SaleStore {
result.columns.push(
{ title: '顾问', children: [{ title: '', dataIndex: 'T_name', render: (text, record) => <NavLink to={`/sale_sub/${this.active_tab_key}`}>{text}</NavLink> }],
sorter: (a, b) => (a?.T_name || '').localeCompare(b.T_name, 'zh-CN'),
filters: allOPI1,
onFilter: (value, record) => record.T_OPI === value,
filterSearch: true,
},
{
title: '合计',

@ -256,7 +256,7 @@ export function unique(arr) {
const x = new Set(arr);
return [...x];
}
export const uniqWith = (arr, fn) => arr.filter((element, index) => arr.findIndex((step) => fn(element, step)) === index);
export function getWeek(date) {
// 参数时间戳
const week = moment(date).day();

Loading…
Cancel
Save