Commit 7314daa5862cca9e59c645c79ef276956565edc6
1 parent
d882d749
feat(fvm): 厂家促销条件配置页面交互调整
Showing
7 changed files
with
427 additions
and
187 deletions
src/pages/stock/ManufacturerPromotion/PromotionFile/index.tsx
... | ... | @@ -10,7 +10,10 @@ import type { ItemList, QueryParams } from './api'; |
10 | 10 | |
11 | 11 | const Option = Select.Option; |
12 | 12 | const Column = Table.Column; |
13 | -export default function Bill() { | |
13 | +interface Props { | |
14 | + onSelect: Function; | |
15 | +} | |
16 | +export default function Bill({ onSelect }: Props) { | |
14 | 17 | const { data: brandList } = useInitial<CommonApi.OptionVO[], {}>(getBrandFilterApi, [], {}); |
15 | 18 | const { list, paginationConfig, loading, setParams, innerParams } = usePagination(getPageListApi, {}); |
16 | 19 | const [visible, setVisible] = useState(false); |
... | ... | @@ -41,6 +44,13 @@ export default function Bill() { |
41 | 44 | ); |
42 | 45 | } |
43 | 46 | |
47 | + const rowSelection = { | |
48 | + onChange: (selectedRowKeys: React.Key[], selectedRows: DataType[]) => { | |
49 | + console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); | |
50 | + onSelect && onSelect(selectedRowKeys[0]) | |
51 | + }, | |
52 | + }; | |
53 | + | |
44 | 54 | return ( |
45 | 55 | <div style={{ width: 350 }}> |
46 | 56 | <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', marginBottom: 20 }}> |
... | ... | @@ -48,7 +58,6 @@ export default function Bill() { |
48 | 58 | allowClear |
49 | 59 | placeholder="搜索品牌" |
50 | 60 | notFoundContent="暂无数据" |
51 | - // style={{ minWidth: 250 }} | |
52 | 61 | onChange={(v) => filter({ brandId: (v && Number(v)) || undefined, current: 1 })} |
53 | 62 | > |
54 | 63 | {brandList && |
... | ... | @@ -78,6 +87,10 @@ export default function Bill() { |
78 | 87 | rowKey={(item) => String(item.id)} |
79 | 88 | dataSource={list} |
80 | 89 | onChange={(_pagination) => setParams({ ..._pagination }, true)} |
90 | + rowSelection={{ | |
91 | + type: 'radio', | |
92 | + ...rowSelection, | |
93 | + }} | |
81 | 94 | > |
82 | 95 | <Column title="厂家促销文件" dataIndex="fileName" /> |
83 | 96 | {/* <Column title="归属品牌" dataIndex="brandName" /> */} | ... | ... |
src/pages/stock/ManufacturerPromotion/api.ts
1 | -import { http } from '@/typing/http'; | |
1 | +import type { http } from '@/typing/http'; | |
2 | 2 | import request from '@/utils/request'; |
3 | 3 | import { FVM_HOST, FINANCE2_HOST, OOP_HOST } from '@/utils/host'; |
4 | -import * as IF from './interface'; | |
4 | +import type * as IF from './interface'; | |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * 查询列表 |
... | ... | @@ -25,7 +25,7 @@ export function getDetailApi(configId: number): http.PromiseResp<IF.SaveParams> |
25 | 25 | /**车系id批量查询车型列表 */ |
26 | 26 | export function getSpecListApi(seriesIdList?: string): http.PromiseResp<IF.Option[]> { |
27 | 27 | return request.get(`${OOP_HOST}/select/spec/batch/list`, { params: { saleStatus: 1, seriesIdList } }); |
28 | -} | |
28 | +} | |
29 | 29 | |
30 | 30 | // 配置发布 |
31 | 31 | export function publishReplacement(configId: number): http.PromiseResp<null> { |
... | ... | @@ -37,12 +37,12 @@ export function deleteApi(configId: number): http.PromiseResp<null> { |
37 | 37 | return request.get(`${FVM_HOST}/erp/factory/support/config/del`, { params: { configId } }); |
38 | 38 | } |
39 | 39 | |
40 | -// // 获取前置条件枚举 | |
41 | -// export function getPreConditionApi(): http.PromiseResp<IF.ConditionOption[]> { | |
42 | -// return request.get(`${FVM_HOST}/erp/factory/support/config/pre/condition`); | |
43 | -// } | |
44 | - | |
45 | 40 | // 获取前置条件枚举 |
41 | +export function getPreConditionApi(): http.PromiseResp<IF.ConditionOption[]> { | |
42 | + return request.get(`${FVM_HOST}/erp/factory/support/config/pre/condition`); | |
43 | +} | |
44 | + | |
45 | +// 获取支持条件枚举 | |
46 | 46 | export function getSupportConditionApi(): http.PromiseResp<IF.ConditionOption[]> { |
47 | 47 | return request.get(`${FVM_HOST}/erp/factory/support/config/support/condition`); |
48 | 48 | } | ... | ... |
src/pages/stock/ManufacturerPromotion/components/AddconditionsModal.tsx
... | ... | @@ -2,7 +2,7 @@ import React, { useState } from 'react'; |
2 | 2 | import { Modal, Form, Radio, Space, DatePicker, Select, InputNumber } from 'antd'; |
3 | 3 | import { StandardType, JudgeType } from '../entity'; |
4 | 4 | import moment from 'moment'; |
5 | -import * as IF from '../interface'; | |
5 | +import type * as IF from '../interface'; | |
6 | 6 | |
7 | 7 | const RangePicker = DatePicker.RangePicker; |
8 | 8 | const { Item } = Form; |
... | ... | @@ -11,7 +11,7 @@ interface Props { |
11 | 11 | onCancel: Function; |
12 | 12 | onOk: Function; |
13 | 13 | /**条件数据 */ |
14 | - conditionList: IF.ConditionOption[] | |
14 | + conditionList: IF.ConditionOption[]; | |
15 | 15 | } |
16 | 16 | export default function AddconditionsModal(props: Props) { |
17 | 17 | const [form] = Form.useForm(); |
... | ... | @@ -20,25 +20,36 @@ export default function AddconditionsModal(props: Props) { |
20 | 20 | const [type, setType] = useState(''); |
21 | 21 | |
22 | 22 | function submit(fields: any) { |
23 | + console.log('🚀 ~ submit ~ fields:', fields); | |
23 | 24 | const save_param: any = { |
24 | 25 | conditionType: fields.conditionType, |
25 | 26 | conditionValue: fields.conditionValue, |
26 | 27 | judgeType: fields.judgeType, |
27 | - supportCondition: '' | |
28 | + timeType: fields.timeType, | |
29 | + checkScope: fields.checkScope, | |
30 | + supportCondition: '', | |
28 | 31 | }; |
29 | - if (['1', '2', '3'].includes(type)) { | |
32 | + if (['1', '2', '3', '4'].includes(type)) { | |
33 | + // save_param.supportCondition = `${moment(fields.supportDate[0]).format('YYYY-MM-DD')},${moment(fields.supportDate[1]).format('YYYY-MM-DD')} `; | |
34 | + save_param.supportCondition = `${moment(fields.supportDate).format('YYYY-MM')}`; | |
35 | + } | |
36 | + if (['5', '6'].includes(type)) { | |
30 | 37 | save_param.supportCondition = `${moment(fields.supportDate[0]).format('YYYY-MM-DD')},${moment(fields.supportDate[1]).format('YYYY-MM-DD')} `; |
31 | 38 | } |
32 | - if (type === '4') { | |
39 | + if (type === '7') { | |
33 | 40 | save_param.supportCondition = fields.monthValue ? `${moment(fields.monthValue).format('YYYY-MM')};${fields.ratioMonth}` : ''; |
41 | + save_param.supportCondition = fields.rangeTime | |
42 | + ? `${moment(fields.rangeTime[0]).format('YYYY-MM-DD')},${moment(fields.rangeTime[1]).format('YYYY-MM-DD')};${moment( | |
43 | + fields.ratioRange[0]).format('YYYY-MM-DD')},${moment(fields.ratioRange[1]).format('YYYY-MM-DD')}` | |
44 | + : ''; | |
34 | 45 | } |
35 | - const newParams = { ...save_param, judgeType: fields.judgeType }; | |
46 | + const newParams = { ...save_param }; | |
36 | 47 | onOk(newParams); |
37 | 48 | setSelectMonth([]); |
38 | 49 | } |
39 | 50 | |
40 | 51 | function getComparMonth(v: any) { |
41 | - let monthList = []; | |
52 | + const monthList = []; | |
42 | 53 | if (v) { |
43 | 54 | const year = Number(moment(v).format('YYYY')); |
44 | 55 | const maxMonth = moment(v).format('MM'); |
... | ... | @@ -55,90 +66,137 @@ export default function AddconditionsModal(props: Props) { |
55 | 66 | setSelectMonth(monthList.reverse()); |
56 | 67 | } |
57 | 68 | return ( |
58 | - <Modal | |
59 | - title="条件选择" | |
60 | - visible={visible} | |
61 | - onOk={form.submit} | |
62 | - width={600} | |
63 | - afterClose={form.resetFields} | |
64 | - onCancel={() => onCancel()} | |
65 | - > | |
66 | - <Form form={form} wrapperCol={{ span: 15 }} labelCol={{ span: 5 }} onFinish={submit}> | |
67 | - <Item label="判断条件" name="conditionType" rules={[{ required: true, message: '请选择条件' }]}> | |
69 | + <Modal title="条件选择" visible={visible} onOk={form.submit} width={600} afterClose={form.resetFields} onCancel={() => onCancel()}> | |
70 | + <Form form={form} wrapperCol={{ span: 16 }} labelCol={{ span: 6 }} labelWrap onFinish={submit}> | |
71 | + <Item label="前置条件" name="conditionType" rules={[{ required: true, message: '请选择条件' }]}> | |
68 | 72 | <Radio.Group onChange={(e) => setType(e.target.value)}> |
69 | 73 | <Space direction="vertical"> |
70 | - {conditionList.map(item => <Radio value={item.code} key={item.code}>{item.desc}</Radio>)} | |
74 | + {conditionList.map((item) => ( | |
75 | + <Radio value={item.code} key={item.code}> | |
76 | + {item.desc} | |
77 | + </Radio> | |
78 | + ))} | |
71 | 79 | </Space> |
72 | 80 | </Radio.Group> |
73 | 81 | </Item> |
74 | - <Item | |
75 | - noStyle | |
76 | - shouldUpdate={(prevValues, curValues) => prevValues.conditionType !== curValues.conditionType} | |
77 | - > | |
78 | - {({ getFieldValue }) => { | |
79 | - const type = getFieldValue('conditionType'); | |
80 | - return (['1', '2', '3'].includes(type) && ( | |
81 | - <> | |
82 | - <Item label="支持日期" name="supportDate" rules={[{ required: true, message: '请选择' }]}> | |
83 | - <RangePicker format="YYYY-MM-DD" style={{ width: "100%" }} /> | |
84 | - </Item> | |
85 | - </> | |
86 | - )); | |
87 | - }} | |
88 | - </Item> | |
89 | - <Item | |
90 | - noStyle | |
91 | - shouldUpdate={(prevValues, curValues) => prevValues.conditionType !== curValues.conditionType} | |
92 | - > | |
82 | + <Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.conditionType !== curValues.conditionType}> | |
93 | 83 | {({ getFieldValue }) => { |
94 | 84 | const type = getFieldValue('conditionType'); |
95 | - return (type === '4' && ( | |
96 | - <> | |
97 | - <Item label="月度" name="monthValue" rules={[{ required: true, message: '请选择' }]}> | |
85 | + if (['1', '2', '3', '4'].includes(type)) { | |
86 | + return ( | |
87 | + <Item label="支持月度" name="supportDate" rules={[{ required: true, message: '请选择' }]}> | |
98 | 88 | <DatePicker |
99 | 89 | style={{ width: '100%' }} |
100 | 90 | picker="month" |
101 | - onChange={(v) => { getComparMonth(v); form.setFieldsValue({ ratioMonth: undefined }); }} | |
91 | + // onChange={(v) => { | |
92 | + // getComparMonth(v); | |
93 | + // form.setFieldsValue({ ratioMonth: undefined }); | |
94 | + // }} | |
102 | 95 | /> |
103 | 96 | </Item> |
104 | - <Item label="环比" name="ratioMonth" rules={[{ required: true, message: '请选择' }]} extra="*多选月份为月均值"> | |
105 | - <Select placeholder="请选择" mode="multiple" style={{ width: '100%' }}> | |
106 | - {selectMonth.map(item => <Select.Option value={item} key={item}>{item}</Select.Option>)} | |
107 | - </Select> | |
97 | + ); | |
98 | + } | |
99 | + if (['5', '6'].includes(type)) { | |
100 | + return ( | |
101 | + <Item label="支持日期" name="supportDate" rules={[{ required: true, message: '请选择' }]}> | |
102 | + <RangePicker format="YYYY-MM-DD" style={{ width: '100%' }} /> | |
108 | 103 | </Item> |
109 | - </> | |
110 | - )); | |
104 | + ); | |
105 | + } | |
106 | + return null; | |
111 | 107 | }} |
112 | 108 | </Item> |
109 | + <Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.conditionType !== curValues.conditionType}> | |
110 | + {({ getFieldValue }) => { | |
111 | + const type = getFieldValue('conditionType'); | |
112 | + return ( | |
113 | + type === '7' && ( | |
114 | + <> | |
115 | + <Form.Item name="timeType" label="时间类型" rules={[{ required: true, message: '请选择' }]}> | |
116 | + <Select placeholder="请选择"> | |
117 | + <Select.Option value={1} key={1}> | |
118 | + 月度 | |
119 | + </Select.Option> | |
120 | + <Select.Option value={2} key={2}> | |
121 | + 阶段时间 | |
122 | + </Select.Option> | |
123 | + </Select> | |
124 | + </Form.Item> | |
113 | 125 | |
114 | - {['1', '2', '4'].includes(type) && ( | |
115 | - <Form.Item required label="支持范围"> | |
116 | - <Space> | |
117 | - <span style={{ paddingTop: 5, paddingRight: 5, fontSize: 12 }}>{conditionList.find(i => i.code === type)?.desc}</span> | |
118 | - <Form.Item | |
119 | - name="judgeType" | |
120 | - noStyle | |
121 | - rules={[{ required: true, message: '请选择' }]} | |
122 | - > | |
123 | - <Select | |
124 | - placeholder="请选择" | |
125 | - style={{ width: 100, marginRight: 15 }} | |
126 | - > | |
127 | - {JudgeType.map((i) => ( | |
128 | - <Select.Option value={i.value} key={i.value}>{i.label}</Select.Option> | |
129 | - ))} | |
130 | - </Select> | |
131 | - </Form.Item> | |
132 | - <Form.Item | |
133 | - name="conditionValue" | |
134 | - noStyle | |
135 | - rules={[{ required: true, message: '请输入' }]} | |
136 | - > | |
137 | - <InputNumber placeholder="请输入" /> | |
138 | - </Form.Item> | |
139 | - <span style={{ paddingTop: 5, paddingLeft: 5 }}>%</span> | |
140 | - </Space> | |
141 | - </Form.Item> | |
126 | + <Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.timeType !== curValues.timeType}> | |
127 | + {({ getFieldValue }) => { | |
128 | + const timeType = getFieldValue('timeType'); | |
129 | + return timeType === 1 ? ( | |
130 | + <> | |
131 | + <Item label="月度" name="monthValue" rules={[{ required: true, message: '请选择' }]}> | |
132 | + <DatePicker | |
133 | + style={{ width: '100%' }} | |
134 | + picker="month" | |
135 | + onChange={(v) => { | |
136 | + getComparMonth(v); | |
137 | + form.setFieldsValue({ ratioMonth: undefined }); | |
138 | + }} | |
139 | + /> | |
140 | + </Item> | |
141 | + <Item label="环比月度" name="ratioMonth" rules={[{ required: true, message: '请选择' }]} extra="*多选月份为月均值"> | |
142 | + <Select placeholder="请选择" mode="multiple" style={{ width: '100%' }}> | |
143 | + {selectMonth.map((item) => ( | |
144 | + <Select.Option value={item} key={item}> | |
145 | + {item} | |
146 | + </Select.Option> | |
147 | + ))} | |
148 | + </Select> | |
149 | + </Item> | |
150 | + </> | |
151 | + ) : ( | |
152 | + <> | |
153 | + <Item label="阶段时间" name="rangeTime" rules={[{ required: true, message: '请选择' }]}> | |
154 | + <RangePicker format="YYYY-MM-DD" style={{ width: '100%' }} /> | |
155 | + </Item> | |
156 | + <Item label="环比时间" name="ratioRange" rules={[{ required: true, message: '请选择' }]}> | |
157 | + <RangePicker format="YYYY-MM-DD" style={{ width: '100%' }} /> | |
158 | + </Item> | |
159 | + </> | |
160 | + ); | |
161 | + }} | |
162 | + </Item> | |
163 | + </> | |
164 | + ) | |
165 | + ); | |
166 | + }} | |
167 | + </Item> | |
168 | + | |
169 | + {['1', '2', '3', '4', '7'].includes(type) && ( | |
170 | + <> | |
171 | + <Form.Item name="checkScope" label="支持范围" rules={[{ required: true, message: '请选择' }]}> | |
172 | + <Select placeholder="请选择"> | |
173 | + <Select.Option value={1} key={1}> | |
174 | + 考核主体范围 | |
175 | + </Select.Option> | |
176 | + <Select.Option value={2} key={2}> | |
177 | + 配置车系范围 | |
178 | + </Select.Option> | |
179 | + </Select> | |
180 | + </Form.Item> | |
181 | + {type != '7' ? ( | |
182 | + <> | |
183 | + <Form.Item required label={conditionList.find((i) => i.code === type)?.desc}> | |
184 | + <Form.Item name="judgeType" noStyle rules={[{ required: true, message: '请选择' }]}> | |
185 | + <Select placeholder="请选择" style={{ width: 100, marginRight: 15, marginLeft: 10 }}> | |
186 | + {JudgeType.map((i) => ( | |
187 | + <Select.Option value={i.value} key={i.value}> | |
188 | + {i.label} | |
189 | + </Select.Option> | |
190 | + ))} | |
191 | + </Select> | |
192 | + </Form.Item> | |
193 | + <Form.Item name="conditionValue" noStyle rules={[{ required: true, message: '请输入' }]}> | |
194 | + <InputNumber placeholder="请输入" addonAfter="%" min={0} /> | |
195 | + </Form.Item> | |
196 | + </Form.Item> | |
197 | + </> | |
198 | + ) : null} | |
199 | + </> | |
142 | 200 | )} |
143 | 201 | </Form> |
144 | 202 | </Modal> | ... | ... |
src/pages/stock/ManufacturerPromotion/components/CreateIndex.tsx
... | ... | @@ -28,7 +28,7 @@ export default function CreateIndex(props: Props) { |
28 | 28 | const { id, status } = match.params; |
29 | 29 | const { data: brandList } = useInitial<CommonApi.OptionVO[], {}>(getBrandFilterApi, [], {}); |
30 | 30 | const { data: companyList } = useInitial(API.getTradeCompanyApi, [], { types: 10 }); |
31 | - const { data: preConditionData } = useInitial(API.getSupportConditionApi, [], {}); | |
31 | + const { data: preConditionData } = useInitial(API.getPreConditionApi, [], {}); | |
32 | 32 | const [initLoading, setInitLoading] = useState(false); |
33 | 33 | const [form] = Form.useForm(); |
34 | 34 | const [seriesList, setSeriesList] = useState<CommonApi.OptionVO[]>([]); | ... | ... |
src/pages/stock/ManufacturerPromotion/components/PolicyConditions.tsx
... | ... | @@ -10,17 +10,17 @@ import moment from 'moment'; |
10 | 10 | const { RangePicker } = DatePicker; |
11 | 11 | |
12 | 12 | interface Props { |
13 | - value: IF.SupportCashCycleList, | |
14 | - onChange: Function, | |
15 | - form: FormInstance, | |
16 | - key: number, | |
17 | - disabled: boolean | undefined, | |
18 | - preConditionData: IF.ConditionOption[], | |
19 | - removeItem: () => any | |
13 | + value: IF.SupportCashCycleList; | |
14 | + onChange: Function; | |
15 | + form: FormInstance; | |
16 | + key: number; | |
17 | + disabled: boolean | undefined; | |
18 | + preConditionData: IF.ConditionOption[]; | |
19 | + removeItem: () => any; | |
20 | 20 | } |
21 | 21 | |
22 | 22 | interface itemProps { |
23 | - conditionValue?: number, | |
23 | + conditionValue?: number; | |
24 | 24 | } |
25 | 25 | |
26 | 26 | export default function PolicyConditions(props: Props) { |
... | ... | @@ -36,7 +36,7 @@ export default function PolicyConditions(props: Props) { |
36 | 36 | }, [value]); |
37 | 37 | |
38 | 38 | /**保存编辑条件修改 */ |
39 | - function handSave(pa?: { key: number, awardType?: number, supportStandard?: number }) { | |
39 | + function handSave(pa?: { key: number; awardType?: number; supportStandard?: number }) { | |
40 | 40 | const newItems = [...data]; |
41 | 41 | if (!pa) { |
42 | 42 | const mapKey = editKey.split('_'); |
... | ... | @@ -58,7 +58,7 @@ export default function PolicyConditions(props: Props) { |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @param type 1删除整个支持条件,2删除条件项 |
61 | - * @param index | |
61 | + * @param index | |
62 | 62 | */ |
63 | 63 | function _delete(type: number, itemKey: number, index?: number) { |
64 | 64 | const newItems = [...data]; |
... | ... | @@ -76,7 +76,7 @@ export default function PolicyConditions(props: Props) { |
76 | 76 | data.push({ |
77 | 77 | cycleConditionList: [], |
78 | 78 | awardType: 1, |
79 | - supportStandard: 0 | |
79 | + supportStandard: 0, | |
80 | 80 | }); |
81 | 81 | const newdata = { ...value, supportStandardList: [...data] }; |
82 | 82 | onChange(newdata); |
... | ... | @@ -86,7 +86,7 @@ export default function PolicyConditions(props: Props) { |
86 | 86 | /**编辑新增支持条件项 */ |
87 | 87 | function addNewJudgeItem(item: any) { |
88 | 88 | if (data[currentKey].cycleConditionList.find((i, index) => i.conditionType === item.conditionType)) { |
89 | - message.info("该支持条件已编辑不能重复添加"); | |
89 | + message.info('该支持条件已编辑不能重复添加'); | |
90 | 90 | return; |
91 | 91 | } |
92 | 92 | const currentValue = data.map((i, key) => { |
... | ... | @@ -103,87 +103,237 @@ export default function PolicyConditions(props: Props) { |
103 | 103 | |
104 | 104 | function conditionItem(item: any, index: number) { |
105 | 105 | return ( |
106 | - <Row key={`item_${index}`} style={{ flexDirection: "column", width: '100%' }}> | |
106 | + <Row key={`item_${index}`} style={{ flexDirection: 'column', width: '100%' }}> | |
107 | 107 | <div style={{ display: 'flex', alignItems: 'center' }}> |
108 | 108 | {/* <p style={{ width: 120, fontWeight: 'bold' }}>•支持条件{index + 1}:</p> */} |
109 | 109 | <div style={{ marginTop: -5 }}> |
110 | 110 | <Popconfirm placement="top" title="确认删除该支持条件?" onConfirm={() => _delete(1, index)}> |
111 | - {index !== 0 && !disabled && (<Button type="text" style={{ color: '#999' }} icon={<DeleteOutlined />} />)} | |
111 | + {index !== 0 && !disabled && <Button type="text" style={{ color: '#999' }} icon={<DeleteOutlined />} />} | |
112 | 112 | </Popconfirm> |
113 | 113 | </div> |
114 | 114 | </div> |
115 | 115 | |
116 | - {!disabled && ( | |
116 | + {/* {!disabled && ( | |
117 | 117 | <div> |
118 | - <span style={{ width: 120, paddingLeft: 30 }}>•前置条件:</span> | |
119 | - <Button icon={<PlusSquareOutlined />} type="link" onClick={() => { setVisible(true); setCurrentKey(index); }} /> | |
118 | + <span style={{ width: 120 }}>•前置条件:</span> | |
119 | + <Button | |
120 | + icon={<PlusSquareOutlined />} | |
121 | + type="link" | |
122 | + onClick={() => { | |
123 | + setVisible(true); | |
124 | + setCurrentKey(index); | |
125 | + }} | |
126 | + /> | |
120 | 127 | </div> |
121 | - )} | |
122 | - {item.cycleConditionList && item.cycleConditionList.map((i: IF.PoliceCondition, key: number) => ( | |
123 | - <> | |
124 | - <Row key={`${i.supportCondition}-${key}`} style={{ alignItems: "center", marginLeft: !disabled ? '10%' : 0, flex: 1, justifyContent: 'space-between' }}> | |
125 | - <div style={{ marginLeft: 30, display: 'flex', flexDirection: 'row', alignItems: 'center' }}> | |
126 | - <span>({key + 1})</span> | |
127 | - <div style={{ flex: 1, marginRight: 50, paddingLeft: 5 }}> | |
128 | - {i.conditionType != StandardTypeEnum['实销环比'] ? ( | |
129 | - i.conditionType != StandardTypeEnum['启票时间'] ? ( | |
130 | - <> | |
131 | - <span>({typeof i.supportCondition == 'string' && i.supportCondition.replace(',', ' ~ ').replace(/-/g, '.')})</span> | |
132 | - <span>{preConditionData.filter(com => com.code == i.conditionType)[0]?.desc || ''} {JudgeTypeEnum[i.judgeType]}</span> | |
133 | - </> | |
134 | - ) : <span>{`启票时间(${typeof i.supportCondition == 'string' && i.supportCondition.replace(',', ' ~ ').replace(/-/g, '.')})`}</span> | |
135 | - ) : ( | |
136 | - <span>{i.supportCondition.split(';')[0]} 环比 ({i.supportCondition && i.supportCondition.split(';')[1]}) {JudgeTypeEnum[i.judgeType]}</span> | |
137 | - )} | |
138 | - {editKey !== `${index}_${key}` ? | |
139 | - <span>{i.conditionValue}</span> : | |
140 | - <InputNumber min={0} precision={2} defaultValue={i.conditionValue} onChange={(v: any) => setCurrentItem({ conditionValue: v })} /> | |
141 | - } | |
142 | - {i.conditionType != StandardTypeEnum['启票时间'] && <span>%</span>} | |
143 | - </div> | |
144 | - </div> | |
128 | + )} */} | |
129 | + {/* <div style={{ fontWeight: 500 }}>•前置条件:</div> */} | |
130 | + <Row style={{ alignItems: 'baseline' }}> | |
131 | + <div style={{ fontWeight: 500 }}>•前置条件:</div> | |
132 | + <div style={{ flex: 1 }}> | |
133 | + {item.cycleConditionList && | |
134 | + item.cycleConditionList.map((i: IF.PoliceCondition, key: number) => ( | |
135 | + <> | |
136 | + <Row | |
137 | + key={`${i.supportCondition}-${key}`} | |
138 | + style={{ alignItems: 'center', flex: 1, justifyContent: 'space-between' }} | |
139 | + > | |
145 | 140 | |
146 | - {!disabled && ( | |
147 | - <div> | |
148 | - {editKey !== `${index}_${key}` ? ( | |
149 | - <> | |
150 | - {i.conditionType !== StandardTypeEnum['启票时间'] && <Button type="link" icon={<EditOutlined />} onClick={() => { setEditKey(`${index}_${key}`); }} />} | |
151 | - <Popconfirm placement="top" title="确认删除?" onConfirm={() => _delete(2, index, key)}> | |
152 | - <Button type="link" style={{ color: "red" }} icon={<DeleteOutlined />} /> | |
153 | - </Popconfirm> | |
154 | - </> | |
155 | - ) : ( | |
156 | - <> | |
157 | - <Button type="link" onClick={() => handSave()}>保存</Button> | |
158 | - <Button type="link" onClick={() => { setEditKey(''); setCurrentItem({}); }}>取消</Button> | |
159 | - </> | |
160 | - )} | |
161 | - </div> | |
162 | - )} | |
163 | - </Row> | |
164 | - </> | |
165 | - ))} | |
141 | + <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}> | |
142 | + <span>({key + 1})</span> | |
143 | + <div style={{ flex: 1, marginRight: 50, paddingLeft: 5 }}> | |
144 | + {i.conditionType != StandardTypeEnum['实销环比'] ? ( | |
145 | + i.conditionType != StandardTypeEnum['启票时间'] ? ( | |
146 | + <> | |
147 | + <span>({typeof i.supportCondition == 'string' && i.supportCondition.replace(',', ' ~ ').replace(/-/g, '.')})</span> | |
148 | + <span> | |
149 | + {preConditionData.filter((com) => com.code == i.conditionType)[0]?.desc || ''} {JudgeTypeEnum[i.judgeType]} | |
150 | + </span> | |
151 | + </> | |
152 | + ) : ( | |
153 | + <span>{`启票时间(${typeof i.supportCondition == 'string' && i.supportCondition.replace(',', ' ~ ').replace(/-/g, '.') | |
154 | + })`}</span> | |
155 | + ) | |
156 | + ) : ( | |
157 | + <span> | |
158 | + {i.supportCondition.split(';')[0]} 环比 ({i.supportCondition && i.supportCondition.split(';')[1]}){' '} | |
159 | + {JudgeTypeEnum[i.judgeType]} | |
160 | + </span> | |
161 | + )} | |
162 | + {editKey !== `${index}_${key}` ? ( | |
163 | + <span>{i.conditionValue}</span> | |
164 | + ) : ( | |
165 | + <InputNumber | |
166 | + min={0} | |
167 | + precision={2} | |
168 | + defaultValue={i.conditionValue} | |
169 | + onChange={(v: any) => setCurrentItem({ conditionValue: v })} | |
170 | + /> | |
171 | + )} | |
172 | + {i.conditionType != StandardTypeEnum['启票时间'] && <span>%</span>} | |
173 | + </div> | |
174 | + </div> | |
175 | + | |
176 | + {!disabled && ( | |
177 | + <div> | |
178 | + {editKey !== `${index}_${key}` ? ( | |
179 | + <> | |
180 | + {i.conditionType !== StandardTypeEnum['启票时间'] && ( | |
181 | + <Button | |
182 | + type="link" | |
183 | + icon={<EditOutlined />} | |
184 | + onClick={() => { | |
185 | + setEditKey(`${index}_${key}`); | |
186 | + }} | |
187 | + /> | |
188 | + )} | |
189 | + <Popconfirm placement="top" title="确认删除?" onConfirm={() => _delete(2, index, key)}> | |
190 | + <Button type="link" style={{ color: 'red' }} icon={<DeleteOutlined />} /> | |
191 | + </Popconfirm> | |
192 | + </> | |
193 | + ) : ( | |
194 | + <> | |
195 | + <Button type="link" onClick={() => handSave()}> | |
196 | + 保存 | |
197 | + </Button> | |
198 | + <Button | |
199 | + type="link" | |
200 | + onClick={() => { | |
201 | + setEditKey(''); | |
202 | + setCurrentItem({}); | |
203 | + }} | |
204 | + > | |
205 | + 取消 | |
206 | + </Button> | |
207 | + </> | |
208 | + )} | |
209 | + </div> | |
210 | + )} | |
211 | + </Row> | |
212 | + </> | |
213 | + ))} | |
214 | + </div> | |
215 | + </Row> | |
166 | 216 | |
167 | 217 | <div style={{ display: 'flex', flexDirection: 'row', marginTop: 30, marginBottom: 12, alignItems: 'center' }}> |
168 | - <span style={{ width: 120, paddingLeft: 30 }}>•支持标准:</span> | |
218 | + <span>支持标准:</span> | |
169 | 219 | {!disabled ? ( |
170 | 220 | <> |
171 | - <Select disabled={disabled} onChange={(v) => { handSave({ key: index, awardType: v }); }} defaultValue={item.awardType} style={{ width: 100, marginRight: 10 }}> | |
172 | - <Select.Option value={1} key={1}>正激励</Select.Option> | |
173 | - <Select.Option value={2} key={2}>负激励</Select.Option> | |
221 | + <Select | |
222 | + disabled={disabled} | |
223 | + onChange={(v) => { | |
224 | + handSave({ key: index, awardType: v }); | |
225 | + }} | |
226 | + defaultValue={item.awardType} | |
227 | + style={{ width: 100, marginRight: 10 }} | |
228 | + > | |
229 | + <Select.Option value={1} key={1}> | |
230 | + 正激励 | |
231 | + </Select.Option> | |
232 | + <Select.Option value={2} key={2}> | |
233 | + 负激励 | |
234 | + </Select.Option> | |
235 | + </Select> | |
236 | + <Select | |
237 | + disabled={disabled} | |
238 | + style={{ width: 200 }} | |
239 | + onChange={(v) => { | |
240 | + handSave({ key: index, standardType: v }); | |
241 | + }} | |
242 | + defaultValue={item.standardType} | |
243 | + > | |
244 | + <Select.Option value={1} key={1}> | |
245 | + 固定支持 | |
246 | + </Select.Option> | |
247 | + <Select.Option value={2} key={2}> | |
248 | + 阶梯方式一(台数递增) | |
249 | + </Select.Option> | |
250 | + <Select.Option value={3} key={3}> | |
251 | + 阶梯方式二(台数区间递增) | |
252 | + </Select.Option> | |
174 | 253 | </Select> |
175 | - {item.awardType === 2 && (<span style={{ marginRight: 10, marginLeft: 15 }}>缺口部分:</span>)} | |
176 | - <InputNumber defaultValue={item.supportStandard} onChange={(v) => { handSave({ key: index, supportStandard: v }); }} disabled={disabled} placeholder="请输入" /> | |
254 | + {/* {item.awardType === 2 && <span style={{ marginRight: 10, marginLeft: 15 }}>缺口部分:</span>} | |
255 | + <InputNumber | |
256 | + defaultValue={item.supportStandard} | |
257 | + onChange={(v) => { | |
258 | + handSave({ key: index, supportStandard: v }); | |
259 | + }} | |
260 | + disabled={disabled} | |
261 | + placeholder="请输入" | |
262 | + addonAfter="元/辆" | |
263 | + /> */} | |
177 | 264 | </> |
178 | 265 | ) : ( |
179 | - <span>{item.awardType == 1 ? "正激励" : `负激励 (缺口部分):`} {item.supportStandard || 0}</span> | |
266 | + <span> | |
267 | + {item.awardType == 1 ? '正激励' : `负激励 (缺口部分):`} {item.supportStandard || 0} | |
268 | + </span> | |
180 | 269 | )} |
181 | - <span style={{ paddingLeft: 5 }}>元/辆</span> | |
182 | 270 | </div> |
183 | - <Row> | |
184 | - <span style={{ width: 120, paddingLeft: 30 }}>实销台数:</span> | |
185 | - <InputNumber defaultValue={item.supportStandard} onChange={(v) => { handSave({ key: index, supportStandard: v }); }} disabled={disabled} placeholder="请输入" /> | |
186 | - </Row> | |
271 | + {/* <div style={{ marginBottom: 12 }}> | |
272 | + <span>支持条件类型:</span> | |
273 | + | |
274 | + </div> */} | |
275 | + {item.standardType == 1 ? ( | |
276 | + <Row style={{ alignItems: 'center' }}> | |
277 | + <span>实销台数:</span> | |
278 | + <InputNumber | |
279 | + defaultValue={item.supportStandard} | |
280 | + onChange={(v) => { | |
281 | + handSave({ key: index, supportStandard: v }); | |
282 | + }} | |
283 | + addonAfter="元/辆" | |
284 | + disabled={disabled} | |
285 | + placeholder="请输入" | |
286 | + /> | |
287 | + </Row> | |
288 | + ) : null} | |
289 | + {item.standardType == 2 ? ( | |
290 | + <Row style={{ alignItems: 'center', marginTop: 12 }}> | |
291 | + <span>开始保底</span> | |
292 | + <InputNumber | |
293 | + defaultValue={item.supportStandard} | |
294 | + onChange={(v) => { | |
295 | + handSave({ key: index, supportStandard: v }); | |
296 | + }} | |
297 | + style={{ width: 150 }} | |
298 | + addonAfter="元" | |
299 | + disabled={disabled} | |
300 | + placeholder="请输入" | |
301 | + /> | |
302 | + <span>从第</span> | |
303 | + <InputNumber | |
304 | + defaultValue={item.supportStandard} | |
305 | + onChange={(v) => { | |
306 | + handSave({ key: index, supportStandard: v }); | |
307 | + }} | |
308 | + addonAfter="台" | |
309 | + disabled={disabled} | |
310 | + style={{ width: 100 }} | |
311 | + placeholder="请输入" | |
312 | + /> | |
313 | + <span>开始每台递增</span> | |
314 | + <InputNumber | |
315 | + defaultValue={item.supportStandard} | |
316 | + onChange={(v) => { | |
317 | + handSave({ key: index, supportStandard: v }); | |
318 | + }} | |
319 | + addonAfter="元" | |
320 | + style={{ width: 150 }} | |
321 | + disabled={disabled} | |
322 | + placeholder="请输入" | |
323 | + /> | |
324 | + <span>递增封顶</span> | |
325 | + <InputNumber | |
326 | + defaultValue={item.supportStandard} | |
327 | + onChange={(v) => { | |
328 | + handSave({ key: index, supportStandard: v }); | |
329 | + }} | |
330 | + style={{ width: 150 }} | |
331 | + addonAfter="元" | |
332 | + disabled={disabled} | |
333 | + placeholder="请输入" | |
334 | + /> | |
335 | + </Row> | |
336 | + ) : null} | |
187 | 337 | </Row> |
188 | 338 | ); |
189 | 339 | } |
... | ... | @@ -192,36 +342,44 @@ export default function PolicyConditions(props: Props) { |
192 | 342 | <div> |
193 | 343 | <Card |
194 | 344 | style={{ width: '100%' }} |
195 | - title={<span>{value && `${moment(value.startTime).format('YYYY')}年(${moment(value.startTime).format('MM.DD')}~${moment(value.endTime).format('MM.DD')})`}</span>} | |
196 | - extra={disabled ? null : ( | |
197 | - <Row> | |
198 | - <Popconfirm placement="top" title="确认删除该范围支持条件?" onConfirm={removeItem}> | |
199 | - <Button danger type="text" icon={<DeleteOutlined />} /> | |
200 | - </Popconfirm> | |
201 | - {/* <Button icon={<PlusSquareOutlined />} type="link" onClick={addStanderListValue}> 添加前置条件</Button> */} | |
202 | - <Button icon={<PlusSquareOutlined />} type="link" onClick={() => { setVisible(true); setCurrentKey(0); }}> 添加前置条件</Button> | |
203 | - </Row> | |
204 | - )} | |
345 | + title={ | |
346 | + <span> | |
347 | + {value && | |
348 | + `${moment(value.startTime).format('YYYY')}年(${moment(value.startTime).format('MM.DD')}~${moment(value.endTime).format('MM.DD')})`} | |
349 | + </span> | |
350 | + } | |
351 | + extra={ | |
352 | + disabled ? null : ( | |
353 | + <Row> | |
354 | + <Popconfirm placement="top" title="确认删除该范围支持条件?" onConfirm={removeItem}> | |
355 | + <Button danger type="text" icon={<DeleteOutlined />} /> | |
356 | + </Popconfirm> | |
357 | + {/* <Button icon={<PlusSquareOutlined />} type="link" onClick={addStanderListValue}> 添加前置条件</Button> */} | |
358 | + <Button | |
359 | + icon={<PlusSquareOutlined />} | |
360 | + type="link" | |
361 | + onClick={() => { | |
362 | + setVisible(true); | |
363 | + setCurrentKey(0); | |
364 | + }} | |
365 | + > | |
366 | + {' '} | |
367 | + 添加前置条件 | |
368 | + </Button> | |
369 | + </Row> | |
370 | + ) | |
371 | + } | |
205 | 372 | > |
206 | 373 | {data && ( |
207 | 374 | <List |
208 | 375 | style={{ width: '100%' }} |
209 | 376 | dataSource={data || []} |
210 | 377 | key={value.id} |
211 | - renderItem={(item: any, index) => ( | |
212 | - <List.Item key={`list_${index}`}> | |
213 | - {conditionItem(item, index)} | |
214 | - </List.Item> | |
215 | - )} | |
378 | + renderItem={(item: any, index) => <List.Item key={`list_${index}`}>{conditionItem(item, index)}</List.Item>} | |
216 | 379 | /> |
217 | 380 | )} |
218 | 381 | </Card> |
219 | - <AddconditionsModal | |
220 | - visible={visible} | |
221 | - conditionList={preConditionData} | |
222 | - onCancel={() => setVisible(false)} | |
223 | - onOk={addNewJudgeItem} | |
224 | - /> | |
382 | + <AddconditionsModal visible={visible} conditionList={preConditionData} onCancel={() => setVisible(false)} onOk={addNewJudgeItem} /> | |
225 | 383 | </div> |
226 | 384 | ); |
227 | -} | |
228 | 385 | \ No newline at end of file |
386 | +} | ... | ... |
src/pages/stock/ManufacturerPromotion/entity.ts
... | ... | @@ -17,11 +17,20 @@ export const StandardType = [ |
17 | 17 | { value: '4', label: "实销环比" }, |
18 | 18 | ]; |
19 | 19 | |
20 | +// export enum StandardTypeEnum { | |
21 | +// "启票目标完成率" = '1', | |
22 | +// "实销目标完成率" = '2', | |
23 | +// "启票时间" = '3', | |
24 | +// "实销环比" = '4' | |
25 | +// } | |
20 | 26 | export enum StandardTypeEnum { |
21 | - "启票目标完成率" = '1', | |
22 | - "实销目标完成率" = '2', | |
23 | - "启票时间" = '3', | |
24 | - "实销环比" = '4' | |
27 | + "月度启票任务完成率" = '1', | |
28 | + "车系启票任务完成率" = '2', | |
29 | + "月度实销任务完成率" = '3', | |
30 | + "车系实销任务完成率" = '4', | |
31 | + "启票时间" = '5', | |
32 | + "实销时间" = '6', | |
33 | + "实销环比" = '7' | |
25 | 34 | } |
26 | 35 | |
27 | 36 | export enum PoliceTypeEnum { | ... | ... |
src/pages/stock/ManufacturerPromotion/index.tsx
1 | -import React from 'react'; | |
1 | +import React, { useState } from 'react'; | |
2 | 2 | import { PlusOutlined } from '@ant-design/icons'; |
3 | 3 | import { Button, Card, Divider, message, Popconfirm, Table, Select, Input, DatePicker, Row } from 'antd'; |
4 | 4 | import { PageHeaderWrapper } from '@ant-design/pro-layout'; |
... | ... | @@ -16,9 +16,11 @@ import moment from 'moment'; |
16 | 16 | const Column = Table.Column; |
17 | 17 | |
18 | 18 | export default function StorageList() { |
19 | + const [fileId, setFileId] = useState(); | |
19 | 20 | const { list, paginationConfig, loading, setLoading, setParams, innerParams } = usePagination<IF.Item>(getPageListApi, {}); |
20 | 21 | const { data: brandList } = useInitial<CommonApi.OptionVO[], {}>(getBrandFilterApi, [], {}); |
21 | 22 | |
23 | + | |
22 | 24 | /**删除 */ |
23 | 25 | function handleDelete(item: IF.Item) { |
24 | 26 | item.id && |
... | ... | @@ -48,7 +50,7 @@ export default function StorageList() { |
48 | 50 | <PageHeaderWrapper title="厂家促销"> |
49 | 51 | <Card title="厂家促销配置"> |
50 | 52 | <Row justify="space-between" style={{ flexWrap: 'nowrap' }} > |
51 | - <PromotionFile /> | |
53 | + <PromotionFile onSelect={(v: number) => { setFileId(v); setParams({ fileId: v }, true) }} /> | |
52 | 54 | <div style={{ backgroundColor: '#F4F4F4', width: '100%', padding: 20, overflow: 'scroll' }}> |
53 | 55 | <div style={{ marginBottom: 20 }}> |
54 | 56 | <div style={{ display: 'flex', flexDirection: 'row', flex: 1, marginBottom: 10 }}> | ... | ... |