|
@@ -15,25 +15,31 @@ import request from '../../../utils/request';
|
15
|
15
|
|
16
|
16
|
// import RaiseHelpDoc from '../edit/components/RaiseHelpDoc';
|
17
|
17
|
|
|
18
|
+
|
18
|
19
|
const { RangePicker } = DatePicker
|
19
|
20
|
|
20
|
21
|
const qrcodelist = props => {
|
21
|
22
|
const { id, name, customerNum } = props.location.query
|
22
|
23
|
const [data, setData] = useState([])
|
23
|
24
|
const [showHelp, setShowHelp] = useState(false)
|
|
25
|
+ const [endDate, setEndDate] = useState(new Date())
|
|
26
|
+ const [startDate, setStartDate] = useState(moment().subtract(7, 'day').toDate())
|
|
27
|
+
|
24
|
28
|
|
25
|
29
|
// 查询列表
|
26
|
|
- const getList = params => {
|
27
|
|
- request({ ...apis.channelList.getIntroductionList, params: { ...params,channelId: id } }).then(data => {
|
28
|
|
- console.log(data)
|
29
|
|
- setData(data)
|
|
30
|
+ const getList = params => {
|
|
31
|
+ request({ ...apis.channelList.getIntroductionList, params: { ...params, channelId: id } }).then(data => {
|
|
32
|
+ console.log(data)
|
|
33
|
+ setData(data)
|
30
|
34
|
})
|
31
|
|
- }
|
|
35
|
+ }
|
32
|
36
|
|
33
|
37
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
34
|
|
- useEffect(() => {
|
35
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
36
|
|
- }, [])
|
|
38
|
+ useEffect(() => {
|
|
39
|
+ setEndDate(new Date())
|
|
40
|
+ setStartDate(moment().subtract(7, 'day').toDate())
|
|
41
|
+ getList({ pageNum: 1, pageSize: 10, startDate, endDate });
|
|
42
|
+ }, [])
|
37
|
43
|
|
38
|
44
|
|
39
|
45
|
const toNewuser = (record) => {
|
|
@@ -46,7 +52,7 @@ const qrcodelist = props => {
|
46
|
52
|
targetType: record.targetType,
|
47
|
53
|
buildingId: record.buildingId,
|
48
|
54
|
newCustomers: record.newCustomers,
|
49
|
|
- },
|
|
55
|
+ },
|
50
|
56
|
});
|
51
|
57
|
}
|
52
|
58
|
|
|
@@ -60,7 +66,7 @@ const qrcodelist = props => {
|
60
|
66
|
targetType: record.targetType,
|
61
|
67
|
buildingId: record.buildingId,
|
62
|
68
|
visitNum: record.visitNum,
|
63
|
|
- },
|
|
69
|
+ },
|
64
|
70
|
});
|
65
|
71
|
}
|
66
|
72
|
|
|
@@ -74,7 +80,7 @@ const qrcodelist = props => {
|
74
|
80
|
targetType: record.targetType,
|
75
|
81
|
buildingId: record.buildingId,
|
76
|
82
|
visitPersons: record.visitPersons,
|
77
|
|
- },
|
|
83
|
+ },
|
78
|
84
|
});
|
79
|
85
|
}
|
80
|
86
|
|
|
@@ -131,18 +137,19 @@ const qrcodelist = props => {
|
131
|
137
|
];
|
132
|
138
|
|
133
|
139
|
|
134
|
|
- const changePageNum = pageNumber => {
|
|
140
|
+ const changePageNum = pageNumber => {
|
135
|
141
|
getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
|
136
|
|
- }
|
|
142
|
+ }
|
137
|
143
|
|
138
|
144
|
|
139
|
145
|
// 提交事件
|
140
|
146
|
const handleSubmit = e => {
|
141
|
147
|
e.preventDefault();
|
|
148
|
+
|
142
|
149
|
props.form.validateFields((err, values) => {
|
143
|
150
|
if (!err) {
|
144
|
151
|
console.log(values, 'values')
|
145
|
|
- getList({ pageNum: 1, pageSize: 10, ...values })
|
|
152
|
+ getList({ pageNum: 1, pageSize: 10, ...values, startDate, endDate })
|
146
|
153
|
}
|
147
|
154
|
});
|
148
|
155
|
}
|
|
@@ -150,10 +157,30 @@ const qrcodelist = props => {
|
150
|
157
|
// // 重置搜索
|
151
|
158
|
function handleReset() {
|
152
|
159
|
props.form.resetFields();
|
153
|
|
- setTime('')
|
154
|
|
- getList({ pageNum: 1, pageSize: 10 })
|
|
160
|
+ setEndDate(new Date())
|
|
161
|
+ setStartDate(moment().subtract(7, 'day').toDate())
|
|
162
|
+ getList({ pageNum: 1, pageSize: 10, startDate: moment().subtract(7, 'day').toDate(), endDate: new Date() })
|
|
163
|
+ }
|
|
164
|
+
|
|
165
|
+ function onChangetime(dates, dateStrings) {
|
|
166
|
+ setEndDate(`${moment(dateStrings[1]).format('YYYY-MM-DDT00:00:00.000')}Z`)
|
|
167
|
+ setStartDate(`${moment(dateStrings[0]).format('YYYY-MM-DDT00:00:00.000')}Z`)
|
|
168
|
+ // daterange[1] = `${moment(dateStrings[1]).format('YYYY-MM-DDT00:00:00.000')}Z`
|
|
169
|
+ // daterange[0] = `${moment(dateStrings[0]).format('YYYY-MM-DDT00:00:00.000')}Z`
|
|
170
|
+
|
|
171
|
+ }
|
|
172
|
+
|
|
173
|
+ const getDataOf = days => {
|
|
174
|
+
|
|
175
|
+ setEndDate(new Date())
|
|
176
|
+ setStartDate(moment().subtract(days, 'day').toDate())
|
|
177
|
+
|
|
178
|
+ getList({ pageNum: 1, pageSize: 10, startDate: moment().subtract(days, 'day').toDate(), endDate: new Date() })
|
|
179
|
+ // userResource({ startDate: moment().subtract(days, 'day').toDate(), endDate: new Date() })
|
155
|
180
|
}
|
156
|
181
|
|
|
182
|
+ const dateRange = [moment(startDate), moment(endDate)]
|
|
183
|
+
|
157
|
184
|
const { getFieldDecorator } = props.form
|
158
|
185
|
return (
|
159
|
186
|
|
|
@@ -184,34 +211,40 @@ const qrcodelist = props => {
|
184
|
211
|
</Modal>
|
185
|
212
|
<Form layout="inline" style={{ marginBottom: '10px' }} onSubmit={e => handleSubmit(e)}>
|
186
|
213
|
<Form.Item>
|
187
|
|
- <Radio.Group buttonStyle="solid" value="a">
|
|
214
|
+ {getFieldDecorator('state', {
|
|
215
|
+ initialValue: 'a'
|
|
216
|
+ })(
|
|
217
|
+ <Radio.Group buttonStyle="solid" defaultValue="a" >
|
|
218
|
+ <Radio.Button value="a" onClick={() => getDataOf(7)}>最近7天</Radio.Button>
|
|
219
|
+ <Radio.Button value="b" onClick={() => getDataOf(30)}>最近1月</Radio.Button>
|
|
220
|
+ </Radio.Group>,
|
|
221
|
+ )}
|
188
|
222
|
|
189
|
|
- <Radio.Button value="a" onClick={e => handleSubmit(e)}>最近7天</Radio.Button>
|
190
|
|
- <Radio.Button value="b" onClick={e => handleSubmit(e)}>最近1月</Radio.Button>
|
191
|
|
- </Radio.Group>
|
192
|
223
|
</Form.Item>
|
|
224
|
+ {/* <Form.Item>
|
|
225
|
+ <RangePicker value={dateRange} onChange={handleDateChange} placeholder={['开始日期', '结束日期']} />
|
|
226
|
+ </Form.Item> */}
|
193
|
227
|
<Form.Item>
|
194
|
|
- {getFieldDecorator('time', {
|
195
|
|
- initialValue: [],
|
196
|
|
- })(
|
197
|
|
- <RangePicker
|
198
|
|
- style={{ paddingLeft: '30px' }}
|
199
|
|
- ranges={{
|
200
|
|
- Today: [moment(), moment()],
|
201
|
|
- 'This Month': [moment().startOf('month'), moment().endOf('month')],
|
202
|
|
- }}
|
203
|
|
- // onChange={(_dates, dateStrings) => onChangetime(_dates, dateStrings)}
|
204
|
|
- />,
|
205
|
|
- )}
|
|
228
|
+
|
|
229
|
+ <RangePicker
|
|
230
|
+ ranges={{
|
|
231
|
+ Today: [moment(), moment()],
|
|
232
|
+ 'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
233
|
+ }}
|
|
234
|
+ value={dateRange}
|
|
235
|
+ onChange={(_dates, dateStrings) => onChangetime(_dates, dateStrings)}
|
|
236
|
+ allowClear={false}
|
|
237
|
+ />,
|
|
238
|
+
|
206
|
239
|
</Form.Item>
|
207
|
240
|
<Form.Item>
|
208
|
|
- {getFieldDecorator('build')(
|
|
241
|
+ {getFieldDecorator('buildingId')(
|
209
|
242
|
<BuildSelect style={{ width: '200px' }} />,
|
210
|
243
|
)}
|
211
|
244
|
</Form.Item>
|
212
|
245
|
<Form.Item>
|
213
|
|
- {getFieldDecorator('qrcodetype')(
|
214
|
|
- <QrcodeType all visible/>,
|
|
246
|
+ {getFieldDecorator('targetType')(
|
|
247
|
+ <QrcodeType all visible />,
|
215
|
248
|
)}
|
216
|
249
|
</Form.Item>
|
217
|
250
|
<Form.Item>
|
|
@@ -222,8 +255,8 @@ const qrcodelist = props => {
|
222
|
255
|
<Button type="primary" style={{ float: 'right', marginBottom: '20px', zIndex: 1 }} onClick={() => { }}>导出</Button>
|
223
|
256
|
<Table dataSource={data.records} columns={columns} pagination={false} rowKey={r => r.serialNo} />
|
224
|
257
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
225
|
|
- <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
|
226
|
|
- </div>
|
|
258
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
|
|
259
|
+ </div>
|
227
|
260
|
</>
|
228
|
261
|
)
|
229
|
262
|
}
|