Commit c88d0c6b7e56deba98fdd51b86c7b2a1bd65fa25
1 parent
33bc0462
二级表头
Showing
2 changed files
with
109 additions
and
90 deletions
src/pages/order3/SaleTask/components/EntryTaskPreview.tsx
@@ -5,8 +5,8 @@ import * as API from "../api"; | @@ -5,8 +5,8 @@ import * as API from "../api"; | ||
5 | import { OrderTaskApprovalType } from "../entity"; | 5 | import { OrderTaskApprovalType } from "../entity"; |
6 | import useInitial from "@/hooks/useInitail"; | 6 | import useInitial from "@/hooks/useInitail"; |
7 | import ModifiedTableCell from "./ModifiedTableCell"; | 7 | import ModifiedTableCell from "./ModifiedTableCell"; |
8 | +import { ColumnsType } from "antd/es/table"; | ||
8 | 9 | ||
9 | -const { Column } = Table; | ||
10 | const RadioButton = Radio.Button; | 10 | const RadioButton = Radio.Button; |
11 | const RadioGroup = Radio.Group; | 11 | const RadioGroup = Radio.Group; |
12 | 12 | ||
@@ -67,6 +67,102 @@ const EntryTaskPreview = ({ | @@ -67,6 +67,102 @@ const EntryTaskPreview = ({ | ||
67 | showSeriesModal(record, type); | 67 | showSeriesModal(record, type); |
68 | }; | 68 | }; |
69 | 69 | ||
70 | + const columns: ColumnsType<API.TaskListItem> = [ | ||
71 | + { | ||
72 | + title: type === OrderTaskApprovalType.门店维度 ? "门店" : "姓名", | ||
73 | + width: type === OrderTaskApprovalType.门店维度 ? 150 : 100, | ||
74 | + dataIndex: "dataName", | ||
75 | + filterSearch: true, | ||
76 | + onFilter: ( | ||
77 | + value: string | number | boolean, | ||
78 | + record: API.TaskListItem | ||
79 | + ) => { | ||
80 | + return record.dataName.startsWith(value.toString()); | ||
81 | + }, | ||
82 | + }, | ||
83 | + { | ||
84 | + title: "零售任务(台)", | ||
85 | + children: [ | ||
86 | + { | ||
87 | + title: "合计", | ||
88 | + dataIndex: "taskCount", | ||
89 | + key: "taskCount", | ||
90 | + render: (text: string, record: API.TaskListItem) => { | ||
91 | + return ModifiedTableCell(record, "taskCount"); | ||
92 | + }, | ||
93 | + }, | ||
94 | + { | ||
95 | + title: "新能源车", | ||
96 | + dataIndex: "newEnergyTaskCount", | ||
97 | + key: "newEnergyTaskCount", | ||
98 | + render: (text: string, record: API.TaskListItem) => { | ||
99 | + return ModifiedTableCell(record, "newEnergyTaskCount"); | ||
100 | + }, | ||
101 | + }, | ||
102 | + { | ||
103 | + title: "传统燃油车", | ||
104 | + dataIndex: "fuelVehicleTaskCount", | ||
105 | + key: "fuelVehicleTaskCount", | ||
106 | + render: (text: string, record: API.TaskListItem) => { | ||
107 | + return ModifiedTableCell(record, "fuelVehicleTaskCount"); | ||
108 | + }, | ||
109 | + }, | ||
110 | + ], | ||
111 | + }, | ||
112 | + { | ||
113 | + title: "单车毛利任务(元)", | ||
114 | + dataIndex: "vehicleGrossProfitTask", | ||
115 | + render: (text: string, record: API.TaskListItem) => { | ||
116 | + return ModifiedTableCell(record, "vehicleGrossProfitTask"); | ||
117 | + }, | ||
118 | + }, | ||
119 | + { | ||
120 | + title: "线索到店成交(台)", | ||
121 | + width: 100, | ||
122 | + dataIndex: "clueDealTaskCount", | ||
123 | + render: (text: string, record: API.TaskListItem) => { | ||
124 | + return ModifiedTableCell(record, "clueDealTaskCount"); | ||
125 | + }, | ||
126 | + }, | ||
127 | + { | ||
128 | + title: "首客试驾成交(台)", | ||
129 | + width: 100, | ||
130 | + dataIndex: "testDriveTaskCount", | ||
131 | + render: (text: string, record: API.TaskListItem) => { | ||
132 | + return ModifiedTableCell(record, "testDriveTaskCount"); | ||
133 | + }, | ||
134 | + }, | ||
135 | + { | ||
136 | + title: "攻坚车任务(台)", | ||
137 | + width: 100, | ||
138 | + dataIndex: "tackCarTaskCount", | ||
139 | + render: (text: string, record: API.TaskListItem) => { | ||
140 | + return ModifiedTableCell(record, "tackCarTaskCount"); | ||
141 | + }, | ||
142 | + }, | ||
143 | + { | ||
144 | + title: "车系任务(台)", | ||
145 | + width: 100, | ||
146 | + dataIndex: "seriesTaskCount", | ||
147 | + render: (text: string, record: API.TaskListItem) => { | ||
148 | + if (record.dataId === -999) return text; | ||
149 | + return <a onClick={() => handlePreviewSeriesTask(record)}>{text}</a>; | ||
150 | + }, | ||
151 | + }, | ||
152 | + ]; | ||
153 | + | ||
154 | + const extraColumns: ColumnsType<API.TaskListItem> = [ | ||
155 | + { | ||
156 | + title: "销顾任务", | ||
157 | + render: (text: string, record: API.TaskListItem) => { | ||
158 | + if (record.dataId === -999) { | ||
159 | + return "-"; | ||
160 | + } | ||
161 | + return <a onClick={() => handlePreviewAdviserTask(record)}>查看</a>; | ||
162 | + }, | ||
163 | + }, | ||
164 | + ]; | ||
165 | + | ||
70 | return ( | 166 | return ( |
71 | <Card | 167 | <Card |
72 | title={ | 168 | title={ |
@@ -102,94 +198,18 @@ const EntryTaskPreview = ({ | @@ -102,94 +198,18 @@ const EntryTaskPreview = ({ | ||
102 | } | 198 | } |
103 | > | 199 | > |
104 | <Table | 200 | <Table |
201 | + bordered | ||
105 | rowKey="dataId" | 202 | rowKey="dataId" |
203 | + columns={ | ||
204 | + type === OrderTaskApprovalType.门店维度 | ||
205 | + ? columns.concat(extraColumns) | ||
206 | + : columns | ||
207 | + } | ||
106 | loading={loading} | 208 | loading={loading} |
107 | dataSource={data.taskList} | 209 | dataSource={data.taskList} |
108 | pagination={false} | 210 | pagination={false} |
109 | scroll={{ y: 450 }} | 211 | scroll={{ y: 450 }} |
110 | - > | ||
111 | - <Column | ||
112 | - title={type === OrderTaskApprovalType.门店维度 ? "门店" : "姓名"} | ||
113 | - dataIndex="dataName" | ||
114 | - filterSearch | ||
115 | - onFilter={( | ||
116 | - value: string | number | boolean, | ||
117 | - record: API.TaskListItem | ||
118 | - ) => { | ||
119 | - return record.dataName.startsWith(value.toString()); | ||
120 | - }} | ||
121 | - /> | ||
122 | - <Column | ||
123 | - title="零售任务(台)" | ||
124 | - dataIndex="taskCount" | ||
125 | - render={(text: string, record: API.TaskListItem) => { | ||
126 | - return ModifiedTableCell(record, "taskCount"); | ||
127 | - }} | ||
128 | - /> | ||
129 | - <Column | ||
130 | - title="新能源车任务(台)" | ||
131 | - dataIndex="newEnergyTaskCount" | ||
132 | - render={(text: string, record: API.TaskListItem) => { | ||
133 | - return ModifiedTableCell(record, "newEnergyTaskCount"); | ||
134 | - }} | ||
135 | - /> | ||
136 | - <Column | ||
137 | - title="传统燃油车任务(台)" | ||
138 | - dataIndex="fuelVehicleTaskCount" | ||
139 | - render={(text: string, record: API.TaskListItem) => { | ||
140 | - return ModifiedTableCell(record, "fuelVehicleTaskCount"); | ||
141 | - }} | ||
142 | - /> | ||
143 | - <Column | ||
144 | - title="单车毛利任务(元)" | ||
145 | - dataIndex="vehicleGrossProfitTask" | ||
146 | - render={(text: string, record: API.TaskListItem) => { | ||
147 | - return ModifiedTableCell(record, "vehicleGrossProfitTask"); | ||
148 | - }} | ||
149 | - /> | ||
150 | - <Column | ||
151 | - title="线索到店零售台数(台)" | ||
152 | - dataIndex="clueDealTaskCount" | ||
153 | - render={(text: string, record: API.TaskListItem) => { | ||
154 | - return ModifiedTableCell(record, "clueDealTaskCount"); | ||
155 | - }} | ||
156 | - /> | ||
157 | - <Column | ||
158 | - title="首客试驾成交任务数(台)" | ||
159 | - dataIndex="testDriveTaskCount" | ||
160 | - render={(text: string, record: API.TaskListItem) => { | ||
161 | - return ModifiedTableCell(record, "testDriveTaskCount"); | ||
162 | - }} | ||
163 | - /> | ||
164 | - <Column | ||
165 | - title="攻坚车任务数(台)" | ||
166 | - dataIndex="tackCarTaskCount" | ||
167 | - render={(text: string, record: API.TaskListItem) => { | ||
168 | - return ModifiedTableCell(record, "tackCarTaskCount"); | ||
169 | - }} | ||
170 | - /> | ||
171 | - <Column | ||
172 | - title="车系任务数(台)" | ||
173 | - dataIndex="seriesTaskCount" | ||
174 | - render={(text: string, record: API.TaskListItem) => { | ||
175 | - if (record.dataId === -999) return text; | ||
176 | - return ( | ||
177 | - <a onClick={() => handlePreviewSeriesTask(record)}>{text}</a> | ||
178 | - ); | ||
179 | - }} | ||
180 | - /> | ||
181 | - {type === OrderTaskApprovalType.门店维度 && ( | ||
182 | - <Column | ||
183 | - title="销顾" | ||
184 | - render={(text: string, record: API.TaskListItem) => { | ||
185 | - if (record.dataId === -999) return "-"; | ||
186 | - return ( | ||
187 | - <a onClick={() => handlePreviewAdviserTask(record)}>查看</a> | ||
188 | - ); | ||
189 | - }} | ||
190 | - /> | ||
191 | - )} | ||
192 | - </Table> | 212 | + /> |
193 | </Card> | 213 | </Card> |
194 | ); | 214 | ); |
195 | }; | 215 | }; |
src/pages/order3/SaleTask/subpages/TaskEdit/components/AdviserTask.tsx
@@ -121,30 +121,28 @@ export default function AdviserTask({ form }: AdviserTaskProps) { | @@ -121,30 +121,28 @@ export default function AdviserTask({ form }: AdviserTaskProps) { | ||
121 | title: "线索到店成交(台)", | 121 | title: "线索到店成交(台)", |
122 | width: 100, | 122 | width: 100, |
123 | dataIndex: "clueDealTaskCount", | 123 | dataIndex: "clueDealTaskCount", |
124 | - key: "clueDealTaskCount", | ||
125 | }, | 124 | }, |
126 | { | 125 | { |
127 | title: "首客试驾成交(台)", | 126 | title: "首客试驾成交(台)", |
128 | width: 100, | 127 | width: 100, |
129 | dataIndex: "testDriveTaskCount", | 128 | dataIndex: "testDriveTaskCount", |
130 | - key: "testDriveTaskCount", | ||
131 | }, | 129 | }, |
132 | { | 130 | { |
133 | title: "攻坚车任务(台)", | 131 | title: "攻坚车任务(台)", |
134 | width: 100, | 132 | width: 100, |
135 | dataIndex: "tackCarTaskCount", | 133 | dataIndex: "tackCarTaskCount", |
136 | - key: "tackCarTaskCount", | ||
137 | }, | 134 | }, |
138 | { | 135 | { |
139 | title: "车系任务(台)", | 136 | title: "车系任务(台)", |
140 | width: 100, | 137 | width: 100, |
141 | dataIndex: "seriesTaskCount", | 138 | dataIndex: "seriesTaskCount", |
142 | - key: "seriesTaskCount", | ||
143 | }, | 139 | }, |
140 | + ]; | ||
141 | + | ||
142 | + const extraColumns: ColumnsType<API.StaffTaskItem> = [ | ||
144 | { | 143 | { |
145 | title: "操作", | 144 | title: "操作", |
146 | render: (text: string, record: API.StaffTaskItem) => { | 145 | render: (text: string, record: API.StaffTaskItem) => { |
147 | - if (isReadOnly) return "-"; | ||
148 | return ( | 146 | return ( |
149 | <a | 147 | <a |
150 | onClick={() => { | 148 | onClick={() => { |
@@ -174,7 +172,8 @@ export default function AdviserTask({ form }: AdviserTaskProps) { | @@ -174,7 +172,8 @@ export default function AdviserTask({ form }: AdviserTaskProps) { | ||
174 | /> | 172 | /> |
175 | </Row> | 173 | </Row> |
176 | <Table | 174 | <Table |
177 | - columns={columns} | 175 | + bordered |
176 | + columns={isReadOnly ? columns : columns.concat(extraColumns)} | ||
178 | dataSource={[...advisersFiltered]} | 177 | dataSource={[...advisersFiltered]} |
179 | pagination={false} | 178 | pagination={false} |
180 | rowKey="id" | 179 | rowKey="id" |