diff --git a/src/charts/GroupSelect.js b/src/charts/GroupSelect.js index 83102fb..98c6c34 100644 --- a/src/charts/GroupSelect.js +++ b/src/charts/GroupSelect.js @@ -14,7 +14,7 @@ class GroupSelect extends Component {
{ if (!comm.empty(json.result2) && !comm.empty(date_moment.start_date_cp)) { } else { - let opi_arr = []; //顾问列表 - let row_title = ""; //行标题 - let new_data_arr = []; //行列转换后的数组 - Object.keys(json.result1[0]).map((col, col_i) => { - switch (col) { - case "OPI_Name": - opi_arr = [ - { name: "", index: "c0" }, - ...Object.values(json.result1).map((row, row_i) => { - return { name: Object.values(row)[col_i], index: "c" + ++row_i }; - }), - ]; - return; - break; - case "COLI_OrderCount": - row_title = "订单数"; - break; - case "COLI_ML": - row_title = "毛利"; - break; - case "COLI_CJCount": - row_title = "成团数"; - break; - case "COLI_CJrate": - row_title = "成行率"; - break; - case "COLI_Cycle": - row_title = "成行周期"; - break; - case "COLI_SingleML": - row_title = "单团毛利"; - break; - default: - return; - } - new_data_arr.push( - Object.assign( - { key: col_i }, - { c0: row_title }, - ...Object.values(json.result1).map((row, row_i) => { - return { ["c" + ++row_i]: Object.values(row)[col_i] }; - }) - ) - ); - }); + if (this.active_tab_key == "All") { + result.columns = [ + { + title: "", + children: [ + { + title: "", + dataIndex: "OPI_Name", + }, + ], + }, + { + title: "毛利", + children: [{ title: "毛利合计", dataIndex: "COLI_ML" }], + sorter: (a, b) => parseInt(b.COLI_ML.replace(/,/g, "")) - parseInt(a.COLI_ML.replace(/,/g, "")), + }, + { + title: "成行率", + children: [{ title: "平均成行率", dataIndex: "COLI_CJrate" }], + sorter: (a, b) => parseInt(b.COLI_CJrate) - parseInt(a.COLI_CJrate), + }, + { + title: "成团数", + children: [{ title: "成团数合计", dataIndex: "COLI_CJCount" }], + sorter: (a, b) => b.COLI_CJCount - a.COLI_CJCount, + }, + { + title: "订单数", + children: [{ title: "订单数合计", dataIndex: "COLI_OrderCount" }], + sorter: (a, b) => b.COLI_OrderCount - a.COLI_OrderCount, + }, + { + title: "单团毛利", + children: [{ title: "平均单团毛利", dataIndex: "COLI_SingleML" }], + sorter: (a, b) => parseInt(b.COLI_SingleML.replace(/,/g, "")) - parseInt(a.COLI_SingleML.replace(/,/g, "")), + }, + { + title: "成团周期", + children: [{ title: "平均成团周期", dataIndex: "COLI_Cycle" }], + sorter: (a, b) => b.COLI_Cycle - a.COLI_Cycle, + }, + ]; + result.dataSource = json.result1; + } else if (this.active_tab_key == "Country") { + //获取类型的项目,去掉重复,作为列名 + let type_name_arr = []; + json.result1.map(item => { + type_name_arr[item.SubTypeSN] = { SubTypeSN: item.SubTypeSN, SubTypeName: item.SubTypeName }; + }); + + let type_data = []; + let type_data_arr = []; - for (let item of opi_arr) { - result.columns.push({ - title: item.name, - dataIndex: item.index, + for (let item of json.result1) { + if (comm.empty(type_data["OP_" + item.OPI_SN])) { + type_data["OP_" + item.OPI_SN] = [{ key: item.OPI_SN }, { T_name: item.OPI_Name }, { T_total: item.OPI_TotalYJLY }]; + } + type_data["OP_" + item.OPI_SN].push({ ["T_" + item.SubTypeSN]: item.COLI_YJLY }); + } + Object.values(type_data).map(item => { + type_data_arr.push( + Object.assign( + ...item.map(it => { + return it; + }) + ) + ); + }); + result.columns.push({ title: "顾问", dataIndex: "T_name" }, { title: "合计", dataIndex: "T_total" }); + type_name_arr.map((item, index) => { + result.columns.push({ + title: item.SubTypeName, + dataIndex: "T_" + item.SubTypeSN, + }); }); + result.dataSource = type_data_arr; } - result.dataSource = new_data_arr; } runInAction(() => { this.type_data = result; diff --git a/src/views/Credit_card_bill.js b/src/views/Credit_card_bill.js index 50a0340..6cca6e5 100644 --- a/src/views/Credit_card_bill.js +++ b/src/views/Credit_card_bill.js @@ -114,6 +114,7 @@ const Credit_card_bill = () => { return result; }; + //去掉重复的项目 const filters_array = data_array => { return comm.unique(data_array).map(item => { return { text: item, value: item }; diff --git a/src/views/Sale.js b/src/views/Sale.js index 343e820..dfee52c 100644 --- a/src/views/Sale.js +++ b/src/views/Sale.js @@ -1,5 +1,5 @@ import React, { useContext, useEffect } from "react"; -import { Row, Col, Button, Tabs, Table, Space, Radio } from "antd"; +import { Row, Col, Button, Tabs, Table, Space, Radio, Select } from "antd"; import { ContainerOutlined, SearchOutlined } from "@ant-design/icons"; import { stores_Context } from "../config"; import { Column } from "@ant-design/charts"; @@ -40,17 +40,24 @@ const Sale = () => { - + - sale_store.onChange_datetype(e)}> - 下单日期 - 走团日期 - + - +