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 | 5 | import { OrderTaskApprovalType } from "../entity"; |
6 | 6 | import useInitial from "@/hooks/useInitail"; |
7 | 7 | import ModifiedTableCell from "./ModifiedTableCell"; |
8 | +import { ColumnsType } from "antd/es/table"; | |
8 | 9 | |
9 | -const { Column } = Table; | |
10 | 10 | const RadioButton = Radio.Button; |
11 | 11 | const RadioGroup = Radio.Group; |
12 | 12 | |
... | ... | @@ -67,6 +67,102 @@ const EntryTaskPreview = ({ |
67 | 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 | 166 | return ( |
71 | 167 | <Card |
72 | 168 | title={ |
... | ... | @@ -102,94 +198,18 @@ const EntryTaskPreview = ({ |
102 | 198 | } |
103 | 199 | > |
104 | 200 | <Table |
201 | + bordered | |
105 | 202 | rowKey="dataId" |
203 | + columns={ | |
204 | + type === OrderTaskApprovalType.门店维度 | |
205 | + ? columns.concat(extraColumns) | |
206 | + : columns | |
207 | + } | |
106 | 208 | loading={loading} |
107 | 209 | dataSource={data.taskList} |
108 | 210 | pagination={false} |
109 | 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 | 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 | 121 | title: "线索到店成交(台)", |
122 | 122 | width: 100, |
123 | 123 | dataIndex: "clueDealTaskCount", |
124 | - key: "clueDealTaskCount", | |
125 | 124 | }, |
126 | 125 | { |
127 | 126 | title: "首客试驾成交(台)", |
128 | 127 | width: 100, |
129 | 128 | dataIndex: "testDriveTaskCount", |
130 | - key: "testDriveTaskCount", | |
131 | 129 | }, |
132 | 130 | { |
133 | 131 | title: "攻坚车任务(台)", |
134 | 132 | width: 100, |
135 | 133 | dataIndex: "tackCarTaskCount", |
136 | - key: "tackCarTaskCount", | |
137 | 134 | }, |
138 | 135 | { |
139 | 136 | title: "车系任务(台)", |
140 | 137 | width: 100, |
141 | 138 | dataIndex: "seriesTaskCount", |
142 | - key: "seriesTaskCount", | |
143 | 139 | }, |
140 | + ]; | |
141 | + | |
142 | + const extraColumns: ColumnsType<API.StaffTaskItem> = [ | |
144 | 143 | { |
145 | 144 | title: "操作", |
146 | 145 | render: (text: string, record: API.StaffTaskItem) => { |
147 | - if (isReadOnly) return "-"; | |
148 | 146 | return ( |
149 | 147 | <a |
150 | 148 | onClick={() => { |
... | ... | @@ -174,7 +172,8 @@ export default function AdviserTask({ form }: AdviserTaskProps) { |
174 | 172 | /> |
175 | 173 | </Row> |
176 | 174 | <Table |
177 | - columns={columns} | |
175 | + bordered | |
176 | + columns={isReadOnly ? columns : columns.concat(extraColumns)} | |
178 | 177 | dataSource={[...advisersFiltered]} |
179 | 178 | pagination={false} |
180 | 179 | rowKey="id" | ... | ... |