|
@@ -0,0 +1,237 @@
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
|
|
3
|
+import { FormattedMessage } from 'umi-plugin-react/locale';
|
|
4
|
+import styles from '../../style/GoodsList.less';
|
|
5
|
+import router from 'umi/router';
|
|
6
|
+import moment from 'moment';
|
|
7
|
+import SelectCity from '../../../components/SelectButton/CitySelect'
|
|
8
|
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
|
|
9
|
+import apis from '../../../services/apis';
|
|
10
|
+import request from '../../../utils/request';
|
|
11
|
+import AuthButton from '@/components/AuthButton';
|
|
12
|
+
|
|
13
|
+const { Option } = Select;
|
|
14
|
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
|
15
|
+
|
|
16
|
+const header = props => {
|
|
17
|
+ const [data, setData] = useState({})
|
|
18
|
+ const [demend, setDemend] = useState({})
|
|
19
|
+
|
|
20
|
+ useEffect(() => {
|
|
21
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
22
|
+ }, [])
|
|
23
|
+
|
|
24
|
+ // 查询列表
|
|
25
|
+ const getList = (params) => {
|
|
26
|
+ console.log(params);
|
|
27
|
+ request({ ...apis.taH5SampleManager.tataH5Demand, params: { ...params } }).then((data) => {
|
|
28
|
+ console.log(data)
|
|
29
|
+ setData(data)
|
|
30
|
+ })
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+ // 跳转到拼团活动新增
|
|
35
|
+ const toEditActivity = (groupActivityId) => () => {
|
|
36
|
+ router.push({
|
|
37
|
+ pathname: '/activity/groupActivity/editGroupActivity',
|
|
38
|
+ query: {
|
|
39
|
+ groupActivityId
|
|
40
|
+ },
|
|
41
|
+ });
|
|
42
|
+ }
|
|
43
|
+
|
|
44
|
+ const getActivityDetail = (groupActivityId) => () => {
|
|
45
|
+ router.push({
|
|
46
|
+ pathname: '/activity/groupActivity/detailActivity',
|
|
47
|
+ query: {
|
|
48
|
+ groupActivityId,
|
|
49
|
+ },
|
|
50
|
+ });
|
|
51
|
+ }
|
|
52
|
+
|
|
53
|
+ const getJoinPeople = (groupActivityId) => () => {
|
|
54
|
+ router.push({
|
|
55
|
+ pathname: '/activity/groupActivity/helpRecord',
|
|
56
|
+ query: {
|
|
57
|
+ groupActivityId,
|
|
58
|
+ },
|
|
59
|
+ });
|
|
60
|
+ }
|
|
61
|
+
|
|
62
|
+ // 跳转到编辑
|
|
63
|
+ const toDetail = rowData => () => {
|
|
64
|
+ if(rowData) {
|
|
65
|
+ router.push({
|
|
66
|
+ pathname: '/h5SampleManager/h5Demand/detail',
|
|
67
|
+ query: {
|
|
68
|
+ id: rowData.demandId,
|
|
69
|
+ },
|
|
70
|
+ });
|
|
71
|
+ return
|
|
72
|
+ }
|
|
73
|
+ }
|
|
74
|
+
|
|
75
|
+ /**
|
|
76
|
+ *
|
|
77
|
+ *
|
|
78
|
+ * @param {*} props
|
|
79
|
+ * @returns
|
|
80
|
+ */
|
|
81
|
+
|
|
82
|
+ const columns = [
|
|
83
|
+ {
|
|
84
|
+ title: '样例名',
|
|
85
|
+ dataIndex: 'sampleName',
|
|
86
|
+ key: 'sampleName',
|
|
87
|
+ align: 'center',
|
|
88
|
+ },
|
|
89
|
+ {
|
|
90
|
+ title: '下单人',
|
|
91
|
+ dataIndex: 'orderer',
|
|
92
|
+ key: 'orderer',
|
|
93
|
+ align: 'center',
|
|
94
|
+
|
|
95
|
+ },
|
|
96
|
+ {
|
|
97
|
+ title: '联系方式',
|
|
98
|
+ dataIndex: 'phone',
|
|
99
|
+ key: 'phone',
|
|
100
|
+ align: 'center',
|
|
101
|
+ },
|
|
102
|
+ {
|
|
103
|
+ title: '下单时间',
|
|
104
|
+ dataIndex: 'createDate',
|
|
105
|
+ key: 'createDate',
|
|
106
|
+ align: 'center',
|
|
107
|
+ render: (x, row) => <><span>{`${moment(row.startTime).format('YYYY-MM-DD HH:mm:ss')} —— ${moment(row.endTime).format('YYYY-MM-DD HH:mm:ss')}`}</span></>
|
|
108
|
+ },
|
|
109
|
+ {
|
|
110
|
+ title: '需求单状态',
|
|
111
|
+ dataIndex: 'demandStatus',
|
|
112
|
+ key: 'demandStatus',
|
|
113
|
+ align: 'center',
|
|
114
|
+ render: (text, records) => {
|
|
115
|
+ if (records.demandStatus === 1) { return '已提交' }
|
|
116
|
+ if (records.demandStatus === 2) { return '处理中' }
|
|
117
|
+ if (records.demandStatus === 3) { return '已交付' }
|
|
118
|
+ if (records.demandStatus === 4) { return '作废' }
|
|
119
|
+ },
|
|
120
|
+ },
|
|
121
|
+ {
|
|
122
|
+ title: '操作',
|
|
123
|
+ dataIndex: 'handle',
|
|
124
|
+ key: 'handle',
|
|
125
|
+ align: 'center',
|
|
126
|
+ render: (text, record) => (
|
|
127
|
+ <AuthButton name="admin.raise.detail.get" noRight={null}>
|
|
128
|
+ <a style={{ color: '#66B3FF' }} onClick={toDetail(record)} >查看详情</a>
|
|
129
|
+ </AuthButton>
|
|
130
|
+ ),
|
|
131
|
+ },
|
|
132
|
+ ];
|
|
133
|
+
|
|
134
|
+ const rowSelection = {
|
|
135
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
136
|
+ console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
|
137
|
+ setDemend(selectedRows)
|
|
138
|
+ },
|
|
139
|
+ };
|
|
140
|
+
|
|
141
|
+ const changePageNum = pageNumber => {
|
|
142
|
+ getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
|
|
143
|
+ }
|
|
144
|
+
|
|
145
|
+ // 提交事件
|
|
146
|
+ const handleSubmit = (e, props) => {
|
|
147
|
+ e.preventDefault();
|
|
148
|
+ props.form.validateFields((err, values) => {
|
|
149
|
+ if (!err) {
|
|
150
|
+ console.log('提交数据: ', values)
|
|
151
|
+ getList({ pageNum: 1, pageSize: 10, ...values })
|
|
152
|
+ }
|
|
153
|
+ });
|
|
154
|
+ }
|
|
155
|
+
|
|
156
|
+ //重置搜索
|
|
157
|
+ function handleReset () {
|
|
158
|
+ props.form.resetFields();
|
|
159
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
160
|
+ }
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+ const { getFieldDecorator } = props.form
|
|
164
|
+ return (
|
|
165
|
+
|
|
166
|
+ <>
|
|
167
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
|
168
|
+ <Form.Item>
|
|
169
|
+ {getFieldDecorator('sampleName')(
|
|
170
|
+ <Input
|
|
171
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
172
|
+ placeholder="样例名"
|
|
173
|
+ />,
|
|
174
|
+ )}
|
|
175
|
+ </Form.Item>
|
|
176
|
+ <Form.Item>
|
|
177
|
+ {getFieldDecorator('orderer')(
|
|
178
|
+ <Input
|
|
179
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
180
|
+ placeholder="下单人"
|
|
181
|
+ />,
|
|
182
|
+ )}
|
|
183
|
+ </Form.Item>
|
|
184
|
+ <Form.Item>
|
|
185
|
+ {getFieldDecorator('phone')(
|
|
186
|
+ <Input
|
|
187
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
188
|
+ placeholder="联系方式1"
|
|
189
|
+ />,
|
|
190
|
+ )}
|
|
191
|
+ </Form.Item>
|
|
192
|
+ <Form.Item>
|
|
193
|
+ {getFieldDecorator('createDate')(
|
|
194
|
+ <RangePicker placeholder={['开始时间','结束时间']}/>
|
|
195
|
+ )}
|
|
196
|
+ </Form.Item>
|
|
197
|
+ <Form.Item>
|
|
198
|
+ {getFieldDecorator('createDate')(
|
|
199
|
+ <Select style={{ width: '180px' }} placeholder="需求单状态">
|
|
200
|
+ <option value="">全部</option>
|
|
201
|
+ <option value="1">已提交</option>
|
|
202
|
+ <option value="2">处理中</option>
|
|
203
|
+ <option value="3">已交付</option>
|
|
204
|
+ <option value="4">作废</option>
|
|
205
|
+ </Select>
|
|
206
|
+ )}
|
|
207
|
+ </Form.Item>
|
|
208
|
+ <Form.Item>
|
|
209
|
+ <AuthButton name="admin.taShareActivity.search" noRight={null}>
|
|
210
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
|
211
|
+ 搜索
|
|
212
|
+ </Button>
|
|
213
|
+ </AuthButton>
|
|
214
|
+ <AuthButton name="admin.taShareActivity.search" noRight={null}>
|
|
215
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
216
|
+ 重置
|
|
217
|
+ </Button>
|
|
218
|
+ </AuthButton>
|
|
219
|
+ </Form.Item>
|
|
220
|
+ </Form>
|
|
221
|
+ <AuthButton name="admin.taShareActivity.post" noRight={null}>
|
|
222
|
+ <Button type="danger" className={styles.addBtn} onClick={toEditActivity()}>新增</Button>
|
|
223
|
+ </AuthButton>
|
|
224
|
+ <AuthButton name="admin.taShareActivity.post" noRight={null}>
|
|
225
|
+ <Button type="primary" className={styles.addBtn} onClick={toEditActivity()} style={{marginLeft:'30px'}}>删除</Button>
|
|
226
|
+ </AuthButton>
|
|
227
|
+ <Table rowSelection={rowSelection}
|
|
228
|
+ style={{marginTop:'30px'}} dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
|
|
229
|
+ <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
|
230
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
|
|
231
|
+ </div>
|
|
232
|
+ </>
|
|
233
|
+ )
|
|
234
|
+}
|
|
235
|
+const WrappedHeader = Form.create({ name: 'header' })(header);
|
|
236
|
+
|
|
237
|
+export default WrappedHeader
|