Commit d0ec8e1686fef52ea3e724fb31eb0e2b48c49157

Authored by Shinner
1 parent 90c2447f

二级表头

src/pages/order3/SaleTask/components/SaleTaskAutoAssign.tsx
@@ -61,7 +61,7 @@ const defaultColumns: (ColumnTypes[number] & { @@ -61,7 +61,7 @@ const defaultColumns: (ColumnTypes[number] & {
61 editable: false, 61 editable: false,
62 }, 62 },
63 { 63 {
64 - title: "攻坚车任务(台)", 64 + title: "攻坚车任务(台)",
65 dataIndex: "tackCarTaskCount", 65 dataIndex: "tackCarTaskCount",
66 editable: true, 66 editable: true,
67 }, 67 },
@@ -184,9 +184,19 @@ export default function SaleTaskAutoAssign(props: SaleTaskAutoAssignProps) { @@ -184,9 +184,19 @@ export default function SaleTaskAutoAssign(props: SaleTaskAutoAssignProps) {
184 184
185 const autoAssignSaleTask = (isAssignToAdviser: boolean) => { 185 const autoAssignSaleTask = (isAssignToAdviser: boolean) => {
186 Modal.confirm({ 186 Modal.confirm({
187 - title: isAssignToAdviser  
188 - ? "确认分配到门店和顾问吗?"  
189 - : "确认分配到门店吗?", 187 + title: isAssignToAdviser ? (
  188 + <span>
  189 + 确认分配到
  190 + <span className="tip">全部门店和顾问</span>
  191 + 吗?
  192 + </span>
  193 + ) : (
  194 + <span>
  195 + 确认分配到
  196 + <span className="tip">全部门店</span>
  197 + 吗?
  198 + </span>
  199 + ),
190 zIndex: 1002, 200 zIndex: 1002,
191 onOk: async () => { 201 onOk: async () => {
192 const hide = message.loading("分配中,请稍候", 0); 202 const hide = message.loading("分配中,请稍候", 0);
src/pages/order3/SaleTask/components/SaleTaskBatchSet.tsx
@@ -33,6 +33,10 @@ export default function SaleTaskBatchSet(props: SaleTaskBatchSetProps) { @@ -33,6 +33,10 @@ export default function SaleTaskBatchSet(props: SaleTaskBatchSetProps) {
33 const batchSetSaleTask = async (isAssignToAdviser: boolean) => { 33 const batchSetSaleTask = async (isAssignToAdviser: boolean) => {
34 await form.validateFields(); 34 await form.validateFields();
35 const values = form.getFieldsValue(); 35 const values = form.getFieldsValue();
  36 + if (Object.values(values).every((item) => !item)) {
  37 + message.warn("请设置任务后再进行分配");
  38 + return;
  39 + }
36 const newValues = {}; 40 const newValues = {};
37 Array.from(Object.keys(values)).forEach((valueKey: any) => { 41 Array.from(Object.keys(values)).forEach((valueKey: any) => {
38 if (values[valueKey]) { 42 if (values[valueKey]) {
src/pages/order3/SaleTask/components/index.less
@@ -5,3 +5,7 @@ @@ -5,3 +5,7 @@
5 border: 1px solid transparent; 5 border: 1px solid transparent;
6 cursor: pointer; 6 cursor: pointer;
7 } 7 }
  8 +.tip {
  9 + color: #ff4d4f;
  10 + font-weight: bold;
  11 +}
src/pages/order3/SaleTask/index.tsx
@@ -233,11 +233,11 @@ function SaleTaskList() { @@ -233,11 +233,11 @@ function SaleTaskList() {
233 const columns: ColumnsType<API.ShopTaskItem> = [ 233 const columns: ColumnsType<API.ShopTaskItem> = [
234 { 234 {
235 title: "门店", 235 title: "门店",
  236 + width: 150,
236 dataIndex: "shopName", 237 dataIndex: "shopName",
237 }, 238 },
238 { 239 {
239 title: "零售任务(台)", 240 title: "零售任务(台)",
240 - width: 100,  
241 children: [ 241 children: [
242 { 242 {
243 title: "合计", 243 title: "合计",
@@ -254,54 +254,53 @@ function SaleTaskList() { @@ -254,54 +254,53 @@ function SaleTaskList() {
254 dataIndex: "fuelVehicleTaskCount", 254 dataIndex: "fuelVehicleTaskCount",
255 key: "fuelVehicleTaskCount", 255 key: "fuelVehicleTaskCount",
256 }, 256 },
257 - {  
258 - title: "毛利任务(元)",  
259 - children: [  
260 - {  
261 - title: "单车",  
262 - dataIndex: "vehicleGrossProfitTask",  
263 - key: "vehicleGrossProfitTask",  
264 - },  
265 - {  
266 - title: "合计",  
267 - dataIndex: "grossProfitTaskTotal",  
268 - key: "grossProfitTaskTotal",  
269 - render: (text: string, record: API.ShopTaskItem) => {  
270 - return (  
271 - record.taskCount * record.vehicleGrossProfitTask  
272 - ).toFixed(2);  
273 - },  
274 - },  
275 - ],  
276 - },  
277 ], 257 ],
278 }, 258 },
279 { 259 {
280 - title: "其中(台)", 260 + title: "毛利任务(元)",
281 children: [ 261 children: [
282 { 262 {
283 - title: "线索到店零售",  
284 - dataIndex: "clueDealTaskCount",  
285 - key: "clueDealTaskCount",  
286 - },  
287 - {  
288 - title: "首客试驾成交",  
289 - dataIndex: "testDriveTaskCount",  
290 - key: "testDriveTaskCount",  
291 - },  
292 - {  
293 - title: "攻坚车",  
294 - dataIndex: "tackCarTaskCount",  
295 - key: "tackCarTaskCount", 263 + title: "合计",
  264 + dataIndex: "grossProfitTaskTotal",
  265 + key: "grossProfitTaskTotal",
  266 + render: (text: string, record: API.ShopTaskItem) => {
  267 + return (record.taskCount * record.vehicleGrossProfitTask).toFixed(
  268 + 2
  269 + );
  270 + },
296 }, 271 },
297 { 272 {
298 - title: "车系",  
299 - dataIndex: "seriesTaskCount",  
300 - key: "seriesTaskCount", 273 + title: "单车",
  274 + dataIndex: "vehicleGrossProfitTask",
  275 + key: "vehicleGrossProfitTask",
301 }, 276 },
302 ], 277 ],
303 }, 278 },
304 { 279 {
  280 + title: "线索到店成交(台)",
  281 + width: 100,
  282 + dataIndex: "clueDealTaskCount",
  283 + key: "clueDealTaskCount",
  284 + },
  285 + {
  286 + title: "首客试驾成交(台)",
  287 + width: 100,
  288 + dataIndex: "testDriveTaskCount",
  289 + key: "testDriveTaskCount",
  290 + },
  291 + {
  292 + title: "攻坚车任务(台)",
  293 + width: 100,
  294 + dataIndex: "tackCarTaskCount",
  295 + key: "tackCarTaskCount",
  296 + },
  297 + {
  298 + title: "车系任务(台)",
  299 + width: 100,
  300 + dataIndex: "seriesTaskCount",
  301 + key: "seriesTaskCount",
  302 + },
  303 + {
305 title: "销顾任务", 304 title: "销顾任务",
306 render: (text: string, record: API.ShopTaskItem) => { 305 render: (text: string, record: API.ShopTaskItem) => {
307 return ( 306 return (
src/pages/order3/SaleTask/subpages/TaskEdit/components/AdviserTask.tsx
@@ -5,8 +5,7 @@ import * as API from &quot;../../../api&quot;; @@ -5,8 +5,7 @@ import * as API from &quot;../../../api&quot;;
5 import AdviserTaskEdit from "./AdviserTaskEdit"; 5 import AdviserTaskEdit from "./AdviserTaskEdit";
6 import { history, useRequest } from "umi"; 6 import { history, useRequest } from "umi";
7 import { cloneDeep } from "lodash"; 7 import { cloneDeep } from "lodash";
8 -  
9 -const { Column } = Table; 8 +import { ColumnsType } from "antd/es/table";
10 9
11 interface AdviserTaskEditForm { 10 interface AdviserTaskEditForm {
12 submit: (callback: (data: any) => void) => void; 11 submit: (callback: (data: any) => void) => void;
@@ -72,6 +71,94 @@ export default function AdviserTask({ form }: AdviserTaskProps) { @@ -72,6 +71,94 @@ export default function AdviserTask({ form }: AdviserTaskProps) {
72 }); 71 });
73 }; 72 };
74 73
  74 + const columns: ColumnsType<API.StaffTaskItem> = [
  75 + {
  76 + title: "销售顾问",
  77 + width: 100,
  78 + dataIndex: "staffName",
  79 + },
  80 + {
  81 + title: "零售任务(台)",
  82 + children: [
  83 + {
  84 + title: "合计",
  85 + dataIndex: "taskCount",
  86 + key: "taskCount",
  87 + },
  88 + {
  89 + title: "新能源车",
  90 + dataIndex: "newEnergyTaskCount",
  91 + key: "newEnergyTaskCount",
  92 + },
  93 + {
  94 + title: "传统燃油车",
  95 + dataIndex: "fuelVehicleTaskCount",
  96 + key: "fuelVehicleTaskCount",
  97 + },
  98 + ],
  99 + },
  100 + {
  101 + title: "毛利任务(元)",
  102 + children: [
  103 + {
  104 + title: "合计",
  105 + dataIndex: "grossProfitTaskTotal",
  106 + key: "grossProfitTaskTotal",
  107 + render: (text: string, record: API.StaffTaskItem) => {
  108 + return (record.taskCount * record.vehicleGrossProfitTask).toFixed(
  109 + 2
  110 + );
  111 + },
  112 + },
  113 + {
  114 + title: "单车",
  115 + dataIndex: "vehicleGrossProfitTask",
  116 + key: "vehicleGrossProfitTask",
  117 + },
  118 + ],
  119 + },
  120 + {
  121 + title: "线索到店成交(台)",
  122 + width: 100,
  123 + dataIndex: "clueDealTaskCount",
  124 + key: "clueDealTaskCount",
  125 + },
  126 + {
  127 + title: "首客试驾成交(台)",
  128 + width: 100,
  129 + dataIndex: "testDriveTaskCount",
  130 + key: "testDriveTaskCount",
  131 + },
  132 + {
  133 + title: "攻坚车任务(台)",
  134 + width: 100,
  135 + dataIndex: "tackCarTaskCount",
  136 + key: "tackCarTaskCount",
  137 + },
  138 + {
  139 + title: "车系任务(台)",
  140 + width: 100,
  141 + dataIndex: "seriesTaskCount",
  142 + key: "seriesTaskCount",
  143 + },
  144 + {
  145 + title: "操作",
  146 + render: (text: string, record: API.StaffTaskItem) => {
  147 + if (isReadOnly) return "-";
  148 + return (
  149 + <a
  150 + onClick={() => {
  151 + setEditAdviser(cloneDeep(record)); // 注意对象引用
  152 + setVisible(true);
  153 + }}
  154 + >
  155 + 编辑
  156 + </a>
  157 + );
  158 + },
  159 + },
  160 + ];
  161 +
75 return ( 162 return (
76 <> 163 <>
77 <Row 164 <Row
@@ -87,39 +174,12 @@ export default function AdviserTask({ form }: AdviserTaskProps) { @@ -87,39 +174,12 @@ export default function AdviserTask({ form }: AdviserTaskProps) {
87 /> 174 />
88 </Row> 175 </Row>
89 <Table 176 <Table
  177 + columns={columns}
90 dataSource={[...advisersFiltered]} 178 dataSource={[...advisersFiltered]}
91 pagination={false} 179 pagination={false}
92 rowKey="id" 180 rowKey="id"
93 loading={false} 181 loading={false}
94 - >  
95 - <Column title="销售顾问" dataIndex="staffName" width={100} />  
96 - <Column title="零售任务(台)" dataIndex="taskCount" />  
97 - <Column title="新能源车任务(台)" dataIndex="newEnergyTaskCount" />  
98 - <Column title="传统燃油车任务(台)" dataIndex="fuelVehicleTaskCount" />  
99 - <Column title="单车毛利任务(元)" dataIndex="vehicleGrossProfitTask" />  
100 - <Column title="线索到店零售台数(台)" dataIndex="clueDealTaskCount" />  
101 - <Column title="攻坚车任务数(台)" dataIndex="tackCarTaskCount" />  
102 - <Column title="首客试驾成交任务数(台)" dataIndex="testDriveTaskCount" />  
103 - <Column title="车系任务数(台)" dataIndex="seriesTaskCount" />  
104 - {!isReadOnly && (  
105 - <Column  
106 - title="操作"  
107 - width={100}  
108 - render={(text: string, record: API.StaffTaskItem) => {  
109 - return (  
110 - <a  
111 - onClick={() => {  
112 - setEditAdviser(cloneDeep(record)); // 注意对象引用  
113 - setVisible(true);  
114 - }}  
115 - >  
116 - 编辑  
117 - </a>  
118 - );  
119 - }}  
120 - />  
121 - )}  
122 - </Table> 182 + />
123 <Row align="middle" justify="center" style={{ marginTop: 50 }}> 183 <Row align="middle" justify="center" style={{ marginTop: 50 }}>
124 <Button onClick={handleGoBack}>返回列表</Button> 184 <Button onClick={handleGoBack}>返回列表</Button>
125 {!isReadOnly && ( 185 {!isReadOnly && (