SaleTaskBatchSet.tsx
8.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
import { PlusOutlined } from "@ant-design/icons";
import { Button, Card, Col, Form, InputNumber, Row, Select } from "antd";
import styles from "./index.less";
import React from "react";
import { MAX_NUM } from "../entity";
export default function SaleTaskBatchSet() {
const [form] = Form.useForm();
const assignToShop = async () => {
await form.validateFields();
const values = form.getFieldsValue();
console.log(values);
};
const assignToBoth = async () => {
await form.validateFields();
const values = form.getFieldsValue();
console.log(values);
};
return (
<Form form={form} name="sale-task-batch-set-form" autoComplete="off">
<Form.List name="vehicleGrossProfitTask">
{(fields, { add, remove }) => (
<Card>
<Row
align="middle"
justify="space-between"
style={{ marginBottom: 15 }}
>
<h4 className={styles.title}>单车毛利任务</h4>
<Button type="link" onClick={() => add()} icon={<PlusOutlined />}>
新增
</Button>
</Row>
{fields.map(({ key, name, ...restField }) => (
<Row gutter={16} key={key}>
<Col className="gutter-row" span={6}>
<Form.Item
{...restField}
name={[name, "vehicleGrossProfitTask"]}
rules={[{ required: true, message: "请填写单车毛利任务" }]}
>
<InputNumber
formatter={(value) => `${value}元`}
parser={(value: any) => value.replace("元", "")}
min={0}
max={MAX_NUM}
style={{ width: "100%" }}
precision={2}
placeholder="请填写单车毛利任务"
/>
</Form.Item>
</Col>
<Col className="gutter-row" span={15}>
<Form.Item
{...restField}
name={[name, "shop"]}
rules={[{ required: true, message: "请选择适用门店" }]}
>
<Select
showSearch
allowClear
labelInValue
loading={false}
placeholder="请选择适用门店"
style={{ width: "100%" }}
fieldNames={{ value: "id", label: "name" }}
options={[]}
/>
</Form.Item>
</Col>
<Col className="gutter-row" span={3}>
<Button
type="link"
style={{ color: "#999" }}
onClick={() => remove(name)}
>
删除
</Button>
</Col>
</Row>
))}
</Card>
)}
</Form.List>
<Form.List name="testDriveTaskCount">
{(fields, { add, remove }) => (
<Card style={{ marginTop: 20 }}>
<Row
align="middle"
justify="space-between"
style={{ marginBottom: 15 }}
>
<h4 className={styles.title}>首客试驾成交</h4>
<Button type="link" onClick={() => add()} icon={<PlusOutlined />}>
新增
</Button>
</Row>
{fields.map(({ key, name, ...restField }) => (
<Row gutter={16} key={key}>
<Col className="gutter-row" span={6}>
<Form.Item
{...restField}
name={[name, "testDriveTaskCount"]}
rules={[{ required: true, message: "请填写首客试驾成交" }]}
>
<InputNumber
formatter={(value) => `${value}台`}
parser={(value: any) => value.replace("台", "")}
min={0}
max={MAX_NUM}
style={{ width: "100%" }}
precision={0}
placeholder="请填写首客试驾成交"
/>
</Form.Item>
</Col>
<Col className="gutter-row" span={15}>
<Form.Item
{...restField}
name={[name, "shop"]}
rules={[{ required: true, message: "请选择适用门店" }]}
>
<Select
showSearch
allowClear
labelInValue
loading={false}
placeholder="请选择适用门店"
style={{ width: "100%" }}
fieldNames={{ value: "id", label: "name" }}
options={[]}
/>
</Form.Item>
</Col>
<Col className="gutter-row" span={3}>
<Button
type="link"
style={{ color: "#999" }}
onClick={() => remove(name)}
>
删除
</Button>
</Col>
</Row>
))}
</Card>
)}
</Form.List>
<Form.List name="tackCarTaskCount">
{(fields, { add, remove }) => (
<Card style={{ marginTop: 20 }}>
<Row
align="middle"
justify="space-between"
style={{ marginBottom: 15 }}
>
<h4 className={styles.title}>攻坚车任务</h4>
<Button type="link" onClick={() => add()} icon={<PlusOutlined />}>
新增
</Button>
</Row>
{fields.map(({ key, name, ...restField }) => (
<Row gutter={16} key={key}>
<Col className="gutter-row" span={6}>
<Form.Item
{...restField}
name={[name, "tackCarTaskCount"]}
rules={[{ required: true, message: "请填写攻坚车任务" }]}
>
<InputNumber
formatter={(value) => `${value}台`}
parser={(value: any) => value.replace("台", "")}
min={0}
max={MAX_NUM}
style={{ width: "100%" }}
precision={0}
placeholder="请填写攻坚车任务"
/>
</Form.Item>
</Col>
<Col className="gutter-row" span={15}>
<Form.Item
{...restField}
name={[name, "shop"]}
rules={[{ required: true, message: "请选择适用门店" }]}
>
<Select
showSearch
allowClear
labelInValue
loading={false}
placeholder="请选择适用门店"
style={{ width: "100%" }}
fieldNames={{ value: "id", label: "name" }}
options={[]}
/>
</Form.Item>
</Col>
<Col className="gutter-row" span={3}>
<Button
type="link"
style={{ color: "#999" }}
onClick={() => remove(name)}
>
删除
</Button>
</Col>
</Row>
))}
</Card>
)}
</Form.List>
<Row align="middle" justify="center" style={{ marginTop: 20 }}>
<Button onClick={() => {}}>取消</Button>
<Button
type="primary"
style={{ marginLeft: 10 }}
onClick={assignToShop}
>
分配到门店
</Button>
<Button
type="primary"
style={{ marginLeft: 10 }}
onClick={assignToBoth}
>
分配到门店和顾问
</Button>
</Row>
</Form>
);
}