|
@@ -3,231 +3,325 @@ import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagina
|
3
|
3
|
import router from 'umi/router';
|
4
|
4
|
import { FormattedMessage } from 'umi-plugin-react/locale';
|
5
|
5
|
import styles from '../../style/GoodsList.less';
|
|
6
|
+import apis from '../../../services/apis';
|
|
7
|
+import request from '../../../utils/request';
|
|
8
|
+import XForm, { FieldTypes } from '../../../components/XForm';
|
|
9
|
+import moment from 'moment';
|
6
|
10
|
|
7
|
|
-const changeNewsListStatus = (newsId) => () => {
|
8
|
|
- Modal.confirm({
|
9
|
|
- title: '确认删除该引流?',
|
10
|
|
- okText: '确认',
|
11
|
|
- cancelText: '取消',
|
12
|
|
- onOk() {
|
13
|
|
-
|
14
|
|
-
|
15
|
|
- }
|
16
|
|
- });
|
17
|
|
-}
|
18
|
|
-
|
19
|
|
-const toEditList = (newsId) => () => {
|
|
11
|
+const toEditList = (drainageId) => () => {
|
|
12
|
+ console.log(drainageId,'12344567')
|
20
|
13
|
router.push({
|
21
|
14
|
pathname: '/activity/drainage/Detail',
|
22
|
|
- // query: {
|
23
|
|
- // newsId
|
24
|
|
- // },
|
|
15
|
+ query: {
|
|
16
|
+ drainageId
|
|
17
|
+ },
|
25
|
18
|
});
|
26
|
19
|
}
|
27
|
20
|
|
28
|
|
-const columns = [
|
29
|
|
- {
|
30
|
|
- title: 'H5项目编号',
|
31
|
|
- dataIndex: 'Id',
|
32
|
|
- key: 'Id',
|
33
|
|
-
|
34
|
|
- },
|
35
|
|
- {
|
36
|
|
- title: 'H5项目名称',
|
37
|
|
- dataIndex: 'name',
|
38
|
|
- key: 'name',
|
39
|
|
- },
|
40
|
|
- {
|
41
|
|
- title: '字段1',
|
42
|
|
- dataIndex: 'field1',
|
43
|
|
- key: 'field1',
|
44
|
|
- },
|
45
|
|
- {
|
46
|
|
- title: '字段2',
|
47
|
|
- dataIndex: 'field2',
|
48
|
|
- key: 'field2',
|
49
|
|
- },
|
50
|
|
- {
|
51
|
|
- title: '新建时间',
|
52
|
|
- dataIndex: 'StartTime',
|
53
|
|
- key: 'StartTime',
|
54
|
|
- // render:
|
55
|
|
- },
|
56
|
|
- {
|
57
|
|
- title: '截止时间',
|
58
|
|
- dataIndex: 'EndTime',
|
59
|
|
- key: 'EndTime',
|
60
|
|
- // render:
|
61
|
|
- },
|
62
|
|
- {
|
63
|
|
- title: '参与数',
|
64
|
|
- dataIndex: 'number',
|
65
|
|
- key: 'number',
|
66
|
|
- // render:
|
67
|
|
- },
|
68
|
|
- {
|
69
|
|
- title: '操作',
|
70
|
|
- key: 'action',
|
71
|
|
- render: (text, record) => (
|
72
|
|
- <>
|
73
|
|
- <span style={{ right: '20px', top: '20px', fontSize: ' 0.106rem',zIndex:1, color: '#FF7E48', cursor: 'pointer' }} onClick={toEditList()}>
|
74
|
|
- 查看详情
|
75
|
|
- </span>
|
76
|
|
-
|
77
|
|
- <span style={{ right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer', marginLeft:20}} onClick={changeNewsListStatus()}>
|
78
|
|
- 删除
|
79
|
|
- </span>
|
80
|
|
- </>
|
81
|
|
- ),
|
82
|
|
- },
|
83
|
|
-];
|
|
21
|
+
|
84
|
22
|
|
85
|
23
|
const data = [
|
86
|
24
|
|
87
|
25
|
{
|
88
|
|
- Id:'1',
|
89
|
|
- name:'zls',
|
|
26
|
+ Id: '1',
|
|
27
|
+ name: 'zls',
|
90
|
28
|
// StartTime:'',
|
91
|
29
|
// EndTime:'',
|
92
|
30
|
number: 33,
|
93
|
31
|
}
|
94
|
|
-
|
|
32
|
+
|
95
|
33
|
|
96
|
34
|
];
|
97
|
35
|
|
98
|
36
|
const header = (props) => {
|
99
|
37
|
// const [data, setData] = useState({ data: [] })
|
100
|
|
- const [ date, setDate ] = useState({})
|
|
38
|
+ const [datas, setDatas] = useState([])//表格数据
|
|
39
|
+ const [date, setDate] = useState({})
|
|
40
|
+ const [formsdate, setFormsDate] = useState({})
|
101
|
41
|
// const [page, changePage] = useState({})
|
102
|
|
- useEffect(() => {
|
103
|
|
- setDate({
|
104
|
|
- ModalText: 'Content of the modal',
|
105
|
|
- visible: false,
|
106
|
|
- confirmLoading: false,
|
107
|
|
- })
|
108
|
|
- },[])
|
|
42
|
+ useEffect(() => {
|
109
|
43
|
|
110
|
|
- const handleSubmit = (e, props) => {
|
111
|
|
- e.preventDefault();
|
112
|
|
- props.form.validateFields((err, values) => {
|
113
|
|
- // if (!err) {
|
114
|
|
- // console.log('提交数据: ', values)
|
115
|
|
- // getList({ pageNum: 1, pageSize: 10, ...values })
|
116
|
|
- // }
|
|
44
|
+
|
|
45
|
+ gettaDrainage({ pageNum: 1, pageSize: 10 })
|
|
46
|
+ setDate({
|
|
47
|
+ ModalText: 'Content of the modal',
|
|
48
|
+ visible: false,
|
|
49
|
+ confirmLoading: false,
|
|
50
|
+ })
|
|
51
|
+
|
|
52
|
+ }, [])
|
|
53
|
+
|
|
54
|
+ function gettaDrainage (params) {
|
|
55
|
+ request({ ...apis.activity.taDrainage, params: params }).then((data) => {
|
|
56
|
+ setDatas(data)
|
|
57
|
+ console.log(data.records, '_213_')
|
|
58
|
+ }).catch((err) => {
|
|
59
|
+ console.log(err)
|
|
60
|
+ message.info(err.msg || err.message)
|
|
61
|
+ })
|
|
62
|
+ }
|
|
63
|
+
|
|
64
|
+ const deleteDrainage = (drainageIid) => () => {
|
|
65
|
+ Modal.confirm({
|
|
66
|
+ title: '确认删除该引流?',
|
|
67
|
+ okText: '确认',
|
|
68
|
+ cancelText: '取消',
|
|
69
|
+ onOk() {
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+ request({ ...apis.activity.deletetaDrainage,urlData: { id: drainageIid }, }).then((data) => {
|
|
73
|
+ message.info('操作成功!')
|
|
74
|
+ gettaDrainage({ pageNum: 1, pageSize: 10 })
|
|
75
|
+ }).catch((err) => {
|
|
76
|
+ console.log('111111',err)
|
|
77
|
+ message.info(err.msg || err.message)
|
|
78
|
+ })
|
|
79
|
+ }
|
117
|
80
|
});
|
118
|
81
|
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+ const columns = [
|
|
85
|
+ // title: '活动标题',
|
|
86
|
+ // dataIndex: 'title',
|
|
87
|
+ // key: 'title',
|
|
88
|
+ // align: 'center',
|
|
89
|
+ {
|
|
90
|
+ title: 'H5项目编号',
|
|
91
|
+ dataIndex: 'drainageId',
|
|
92
|
+ key: 'drainageId',
|
|
93
|
+ align: 'center',
|
|
94
|
+ },
|
|
95
|
+ {
|
|
96
|
+ title: 'H5项目名称',
|
|
97
|
+ dataIndex: 'name',
|
|
98
|
+ key: 'name',
|
|
99
|
+ align: 'center',
|
|
100
|
+ render: (text, datas) => <div style={ { color: '#66B3FF' } } onClick= {() => addshowModal(datas)} >{ datas.name }</div>,
|
|
101
|
+ },
|
|
102
|
+ {
|
|
103
|
+ title: '新建时间',
|
|
104
|
+ dataIndex: 'createDate',
|
|
105
|
+ key: 'createDate',
|
|
106
|
+ align: 'center',
|
|
107
|
+ render: (x, row) => (
|
|
108
|
+ <>
|
|
109
|
+ <span>{ row.createDate && moment(row.createDate).format('YYYY-MM-DD hh:mm:ss') }</span>
|
|
110
|
+ </>
|
|
111
|
+ ),
|
|
112
|
+ },
|
|
113
|
+ {
|
|
114
|
+ title: '截止时间',
|
|
115
|
+ dataIndex: 'endDate',
|
|
116
|
+ key: 'endDate',
|
|
117
|
+ align: 'center',
|
|
118
|
+ render: (x, row) => (
|
|
119
|
+ <>
|
|
120
|
+ <span>{ row.endDate && moment(row.endDate).format('YYYY-MM-DD hh:mm:ss') }</span>
|
|
121
|
+ </>
|
|
122
|
+ ),
|
|
123
|
+ },
|
|
124
|
+ {
|
|
125
|
+ title: '参与数',
|
|
126
|
+ dataIndex: 'enlistNum',
|
|
127
|
+ key: 'enlistNum',
|
|
128
|
+ align: 'center',
|
|
129
|
+ // render:
|
|
130
|
+ },
|
|
131
|
+ {
|
|
132
|
+ title: '操作',
|
|
133
|
+ key: 'action',
|
|
134
|
+ align: 'center',
|
|
135
|
+ render: (text, datas) => (
|
|
136
|
+ <>
|
|
137
|
+ <span style={{ right: '20px', top: '20px', fontSize: ' 0.106rem', zIndex: 1, color: '#FF7E48', cursor: 'pointer' }} onClick={toEditList(datas.drainageId)}>
|
|
138
|
+ 查看详情
|
|
139
|
+ </span>
|
|
140
|
+
|
|
141
|
+ <span style={{ right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer', marginLeft: 20 }} onClick={deleteDrainage(datas.drainageId)}>
|
|
142
|
+ 删除
|
|
143
|
+ </span>
|
|
144
|
+ </>
|
|
145
|
+ ),
|
|
146
|
+ },
|
|
147
|
+ ];
|
|
148
|
+ const Forms = props => {
|
|
149
|
+ // const drainageId=props.props.location.query.drainageId
|
|
150
|
+ console.log(date,'---------------')
|
|
151
|
+ console.log(formsdate,'---------------')
|
|
152
|
+ console.log(formsdate,'22222222')
|
|
153
|
+ const fields = [
|
|
154
|
+ {
|
|
155
|
+ label: 'H5项目名称',
|
|
156
|
+ name: 'name',
|
|
157
|
+ type: FieldTypes.Text,
|
|
158
|
+ // placeholder:"H5项目名称",
|
|
159
|
+ value: formsdate.name,
|
|
160
|
+
|
|
161
|
+ },
|
|
162
|
+ {
|
|
163
|
+ label: '截止时间',
|
|
164
|
+ name: 'endDate',
|
|
165
|
+ type: FieldTypes.DatePicker,
|
|
166
|
+ value: moment(formsdate.endDate, 'YYYY-MM-DD HH:mm')
|
|
167
|
+ // render: <DatePicker placeholder="截止时间" value= {formsdate.endDate} />,
|
|
168
|
+ },
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+ ]
|
|
172
|
+
|
|
173
|
+ const handleSubmit = val => {
|
|
174
|
+ console.log(date,'111---------------')
|
|
175
|
+ console.log(formsdate,'111---------------')
|
|
176
|
+ console.log(formsdate,'11122222222')
|
|
177
|
+ // data: { ...submitValue }
|
|
178
|
+ alert(val)
|
|
179
|
+ console.log(formsdate.drainageId,'9999999999999')
|
|
180
|
+ if (formsdate.drainageId) {
|
|
181
|
+ // { ...apis.activity.deletetaDrainage,urlData: { id: drainageIid }, }
|
|
182
|
+ request({ ...apis.activity.updatetaDrainage, urlData: { id: formsdate.drainageId }, data: val}).then((data) => {
|
|
183
|
+ message.info('操作成功!')
|
|
184
|
+ // gettaDrainage({ pageNum: 1, pageSize: 10 })
|
|
185
|
+ }).catch((err) => {
|
|
186
|
+ console.log('111111',err)
|
|
187
|
+ message.info(err.msg || err.message)
|
|
188
|
+ })
|
|
189
|
+
|
|
190
|
+ } else {
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+ request({ ...apis.activity.addtaDrainage, data: val }).then((data) => {
|
|
195
|
+ message.info("保存成功")
|
|
196
|
+ console.log(data, '22222')
|
|
197
|
+
|
|
198
|
+ }).catch((err) => {
|
|
199
|
+ message.error(err.msg || err.message)
|
|
200
|
+ })
|
|
201
|
+ }
|
|
202
|
+ }
|
|
203
|
+
|
|
204
|
+ return <XForm onSubmit={handleSubmit} fields={fields}></XForm>
|
|
205
|
+
|
|
206
|
+ }
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
119
|
210
|
|
120
|
211
|
//重置搜索
|
121
|
|
- function handleReset() {
|
|
212
|
+ function handleReset () {
|
122
|
213
|
props.form.resetFields();
|
123
|
214
|
}
|
124
|
215
|
|
125
|
|
-const toEditGoods = (dynamicId) => () => {
|
126
|
|
- // router.push({
|
127
|
|
- // pathname: '/activity/editActivity',
|
128
|
|
- // query: {
|
129
|
|
- // dynamicId
|
130
|
|
- // },
|
131
|
|
- // });
|
132
|
|
-}
|
|
216
|
+
|
133
|
217
|
|
|
218
|
+ function addshowModal (datas) {
|
|
219
|
+
|
|
220
|
+ // alert(datas.drainageId)
|
|
221
|
+console.log(datas,'22222222')
|
|
222
|
+ setFormsDate({
|
|
223
|
+ drainageId:datas.drainageId,
|
|
224
|
+ name:datas.name,
|
|
225
|
+ endDate:datas.endDate,
|
|
226
|
+ })
|
|
227
|
+ console.log(formsdate,'22222222')
|
|
228
|
+ setDate({
|
|
229
|
+ visible: true,
|
|
230
|
+ });
|
|
231
|
+ };
|
|
232
|
+ function showModal () {
|
|
233
|
+ setFormsDate({
|
|
234
|
+ drainageId:'',
|
|
235
|
+ name:'',
|
|
236
|
+ endDate:'',
|
|
237
|
+ })
|
|
238
|
+ setDate({
|
|
239
|
+ visible: true,
|
|
240
|
+ });
|
|
241
|
+ };
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+ function handleOk () {
|
134
|
245
|
|
135
|
|
-function showModal () {
|
136
|
|
- setDate({
|
137
|
|
- visible: true,
|
138
|
|
- });
|
139
|
|
-};
|
140
|
246
|
|
141
|
|
-function handleOk () {
|
142
|
|
- setDate({
|
143
|
|
- ModalText: 'The modal will be closed after two seconds',
|
144
|
|
- confirmLoading: true,
|
145
|
|
- });
|
146
|
|
- function setTimeout() {
|
|
247
|
+ setDate({
|
|
248
|
+ ModalText: 'The modal will be closed after two seconds',
|
|
249
|
+ confirmLoading: true,
|
|
250
|
+ });
|
|
251
|
+ function setTimeout () {
|
|
252
|
+ setDate({
|
|
253
|
+ visible: false,
|
|
254
|
+ confirmLoading: false,
|
|
255
|
+ });
|
|
256
|
+ };
|
|
257
|
+ };
|
|
258
|
+
|
|
259
|
+ function handleCancel () {
|
|
260
|
+ console.log('Clicked cancel button');
|
147
|
261
|
setDate({
|
148
|
262
|
visible: false,
|
149
|
|
- confirmLoading: false,
|
150
|
263
|
});
|
151
|
264
|
};
|
152
|
|
-};
|
|
265
|
+ function handleSubmit(e) {
|
|
266
|
+ e.preventDefault();
|
|
267
|
+ props.form.validateFields((err, values) => {
|
|
268
|
+ console.log('values', values)
|
|
269
|
+ if (!err) {
|
|
270
|
+ console.log('values', values)
|
|
271
|
+ gettaDrainage({ pageNum: 1, pageSize: 10, ...values })
|
|
272
|
+ }
|
|
273
|
+ });
|
|
274
|
+ }
|
153
|
275
|
|
154
|
|
-function handleCancel (){
|
155
|
|
- console.log('Clicked cancel button');
|
156
|
|
- setDate({
|
157
|
|
- visible: false,
|
158
|
|
- });
|
159
|
|
-};
|
160
|
|
-
|
161
|
|
- const { getFieldDecorator } = props.form
|
|
276
|
+ const { getFieldDecorator } = props.form;
|
162
|
277
|
const { visible, confirmLoading, ModalText } = date;
|
163
|
278
|
return (
|
164
|
279
|
<>
|
165
|
280
|
<div>
|
166
|
|
- <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
167
|
|
- <Form.Item>
|
168
|
|
- {getFieldDecorator('Id')(
|
169
|
|
- <Input
|
170
|
|
- // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
171
|
|
- placeholder="H5项目编号"
|
172
|
|
- />,
|
173
|
|
- )}
|
174
|
|
- </Form.Item>
|
175
|
|
- <Form.Item>
|
176
|
|
- {getFieldDecorator('name')(
|
177
|
|
- <Input
|
178
|
|
- // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
179
|
|
- placeholder="H5项目名称"
|
180
|
|
- />,
|
181
|
|
- )}
|
182
|
|
- </Form.Item>
|
183
|
|
- <Form.Item>
|
184
|
|
- <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
185
|
|
- 搜索
|
|
281
|
+ <Form layout="inline" onSubmit={handleSubmit}>
|
|
282
|
+ <Form.Item>
|
|
283
|
+ {getFieldDecorator('drainageId')(
|
|
284
|
+ <Input
|
|
285
|
+ // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
286
|
+ placeholder="H5项目编号"
|
|
287
|
+ />,
|
|
288
|
+
|
|
289
|
+ // {getFieldDecorator('name', {
|
|
290
|
+ // })(<Input/>)}
|
|
291
|
+ )}
|
|
292
|
+ </Form.Item>
|
|
293
|
+ <Form.Item>
|
|
294
|
+ {getFieldDecorator('name')(
|
|
295
|
+ <Input
|
|
296
|
+ // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
297
|
+ placeholder="H5项目名称"
|
|
298
|
+ />,
|
|
299
|
+ )}
|
|
300
|
+ </Form.Item>
|
|
301
|
+ <Form.Item>
|
|
302
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn} onClick>
|
|
303
|
+ 搜索
|
186
|
304
|
</Button>
|
187
|
|
- <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
305
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
188
|
306
|
重置
|
189
|
307
|
</Button>
|
190
|
|
- </Form.Item>
|
191
|
|
- </Form>
|
192
|
|
- {/* <AuthButton name="admin.buildingDynamic.add.post" noRight={null}> */}
|
|
308
|
+ </Form.Item>
|
|
309
|
+ </Form>
|
|
310
|
+ {/* <AuthButton name="admin.buildingDynamic.add.post" noRight={null}> */}
|
193
|
311
|
<Button type="danger" className={styles.addBtn} onClick={showModal}>新增</Button>
|
194
|
312
|
|
195
|
313
|
<Modal
|
196
|
|
- title="新建H5项目"
|
197
|
|
- visible={visible}
|
198
|
|
- onOk={handleOk}
|
199
|
|
- confirmLoading={confirmLoading}
|
200
|
|
- onCancel={handleCancel}
|
|
314
|
+ title="新建H5项目"
|
|
315
|
+ visible={visible}
|
|
316
|
+ // onOk={handleOk}
|
|
317
|
+ confirmLoading={confirmLoading}
|
|
318
|
+ onCancel={handleCancel}
|
|
319
|
+ footer={null}
|
201
|
320
|
>
|
202
|
|
- <Form>
|
203
|
|
- <Form.Item>
|
204
|
|
- {getFieldDecorator('name')(
|
205
|
|
- <Input
|
206
|
|
- // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
207
|
|
- placeholder="H5项目名称"
|
208
|
|
- />,
|
209
|
|
- )}
|
210
|
|
- </Form.Item>
|
211
|
|
- <Form.Item>
|
212
|
|
- {getFieldDecorator('endtime')(
|
213
|
|
- <Input
|
214
|
|
- // prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
215
|
|
- placeholder="截止时间"
|
216
|
|
- />,
|
217
|
|
- )}
|
218
|
|
- </Form.Item>
|
219
|
|
- </Form>
|
|
321
|
+ <Forms />
|
220
|
322
|
</Modal>
|
221
|
|
-
|
222
|
|
-
|
223
|
|
-
|
224
|
|
- {/* </AuthButton> */}
|
225
|
|
- {/* <Table dataSource={data.list} columns={columns} pagination={false} rowKey="activityList"/> */}
|
226
|
|
- <Table columns={columns} dataSource={data} pagination={false} />
|
227
|
|
- {/* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
228
|
|
- <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
|
229
|
|
- </div> */}
|
230
|
|
-
|
|
323
|
+ <Table columns={columns} dataSource={datas.records} pagination={false} rowKey="drainageList"/>
|
|
324
|
+
|
231
|
325
|
</div>
|
232
|
326
|
</>
|
233
|
327
|
)
|