|
@@ -1,6 +1,6 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
2
|
import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
3
|
|
-import { Form, Pagination, Card, Button, Icon, Tooltip, message, notification, Modal, Table } from 'antd';
|
|
3
|
+import { Form, Pagination, Card, Button, Icon, Tooltip, message, notification, Modal, Table, Select, Input, DatePicker } from 'antd';
|
4
|
4
|
import router from 'umi/router';
|
5
|
5
|
import moment from 'moment';
|
6
|
6
|
import className from 'classnames';
|
|
@@ -10,11 +10,12 @@ import { fetch, apis } from '../../../utils/request';
|
10
|
10
|
import request from '../../../utils/request';
|
11
|
11
|
import AuthButton from '@/components/AuthButton';
|
12
|
12
|
|
13
|
|
-
|
|
13
|
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
14
|
14
|
|
15
|
15
|
function header(props) {
|
16
|
16
|
// 获取初始化数据
|
17
|
17
|
const [ data, setData ] = useState({})
|
|
18
|
+ const [demandIdList, setDemandIdList] = useState([])
|
18
|
19
|
|
19
|
20
|
useEffect(() => {
|
20
|
21
|
getList({ pageNum: 1, pageSize: 10 });
|
|
@@ -22,7 +23,7 @@ function header(props) {
|
22
|
23
|
|
23
|
24
|
// 查询列表
|
24
|
25
|
const getList = (params) => {
|
25
|
|
- request({ ...apis.channel.list, params: { ...params } }).then((data) => {
|
|
26
|
+ request({ ...apis.sample.list, params: { ...params } }).then((data) => {
|
26
|
27
|
console.log(data)
|
27
|
28
|
setData(data)
|
28
|
29
|
})
|
|
@@ -34,7 +35,16 @@ function header(props) {
|
34
|
35
|
e.preventDefault();
|
35
|
36
|
props.form.validateFields((err, values) => {
|
36
|
37
|
if (!err) {
|
37
|
|
- getList({ pageNum: 1, pageSize: 10, ...values })
|
|
38
|
+ let {createDate, ...submitValue} = values
|
|
39
|
+ if(null != createDate && createDate.length > 0){
|
|
40
|
+ const [startCreateDate, endCreateDate] = createDate
|
|
41
|
+ submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
|
|
42
|
+ submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
|
|
43
|
+ }else{
|
|
44
|
+ submitValue.startCreateDate = null
|
|
45
|
+ submitValue.endCreateDate = null
|
|
46
|
+ }
|
|
47
|
+ getList({ pageNum: 1, pageSize: 10, ...submitValue })
|
38
|
48
|
}
|
39
|
49
|
});
|
40
|
50
|
}
|
|
@@ -43,11 +53,18 @@ function header(props) {
|
43
|
53
|
getList({ pageNum: pageNumber, pageSize: 10 })
|
44
|
54
|
}
|
45
|
55
|
|
|
56
|
+ const rowSelection = {
|
|
57
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
58
|
+ console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
|
59
|
+ setDemandIdList(selectedRows)
|
|
60
|
+ },
|
|
61
|
+ };
|
|
62
|
+
|
46
|
63
|
|
47
|
64
|
// 跳转到编辑资讯
|
48
|
|
- const toEditNews = (id) => () => {
|
|
65
|
+ const toEditDemand = (id) => () => {
|
49
|
66
|
router.push({
|
50
|
|
- pathname: '/channel/edit',
|
|
67
|
+ pathname: '/sample/demand/edit',
|
51
|
68
|
query: {
|
52
|
69
|
id
|
53
|
70
|
},
|
|
@@ -55,31 +72,25 @@ function header(props) {
|
55
|
72
|
}
|
56
|
73
|
|
57
|
74
|
|
58
|
|
- const changeNewsStatus = (row, newsId) => () => {
|
59
|
|
- const title = row.status === 0 ? '确定启用吗': '停用后,此账号将无法登录渠道代理商后台'
|
|
75
|
+ const changeStatus = () => {
|
|
76
|
+ if(demandIdList.length < 1){
|
|
77
|
+ message.error('请先选择要删除的数据!')
|
|
78
|
+ return
|
|
79
|
+ }
|
|
80
|
+ const title = '确认将所选的' + demandIdList.length + '条数据删除?可删除条件:需求单阶段 为 作废。'
|
60
|
81
|
Modal.confirm({
|
61
|
82
|
title: title,
|
62
|
83
|
okText: '确认',
|
63
|
84
|
cancelText: '取消',
|
64
|
85
|
onOk() {
|
65
|
|
- if(row.status === 0){
|
66
|
|
- request({ ...apis.channel.put, urlData: { id: newsId }, data: { ...row, status: 1 } }).then((data) => {
|
67
|
|
- message.info('操作成功!')
|
68
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
69
|
|
- }).catch((err) => {
|
70
|
|
- console.log(err)
|
71
|
|
- message.info(err.msg || err.message)
|
72
|
|
- })
|
73
|
|
- }else{
|
74
|
|
- request({ ...apis.channel.put, urlData: { id: newsId }, data: { ...row, status: 0 } }).then((data) => {
|
75
|
|
- message.info('操作成功!')
|
76
|
|
- getList({ pageNum: 1, pageSize: 10 });
|
77
|
|
- }).catch((err) => {
|
78
|
|
- console.log(err)
|
79
|
|
- message.info(err.msg || err.message)
|
80
|
|
- })
|
81
|
|
- }
|
82
|
|
-
|
|
86
|
+ request({ ...apis.sample.put, data: { ids: demandIdList.map(x => x.demandId) } }).then((data) => {
|
|
87
|
+ const resultMessage = '操作成功,其中'+data.successNum+'条成功删除,'+data.failNum+'条非作废状态未删除。'
|
|
88
|
+ message.info(resultMessage)
|
|
89
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
90
|
+ }).catch((err) => {
|
|
91
|
+ console.log(err)
|
|
92
|
+ message.info(err.msg || err.message)
|
|
93
|
+ })
|
83
|
94
|
}
|
84
|
95
|
});
|
85
|
96
|
}
|
|
@@ -91,45 +102,43 @@ function header(props) {
|
91
|
102
|
*/
|
92
|
103
|
const columns = [
|
93
|
104
|
{
|
94
|
|
- title: '渠道代理',
|
95
|
|
- dataIndex: 'channelProxyName',
|
96
|
|
- key: 'channelProxyName',
|
|
105
|
+ title: '样例名',
|
|
106
|
+ dataIndex: 'sampleName',
|
|
107
|
+ key: 'sampleName',
|
97
|
108
|
align: 'center',
|
98
|
109
|
},
|
99
|
110
|
{
|
100
|
|
- title: '账号名',
|
101
|
|
- dataIndex: 'userName',
|
102
|
|
- key: 'userName',
|
|
111
|
+ title: '下单组织',
|
|
112
|
+ dataIndex: 'orgName',
|
|
113
|
+ key: 'orgName',
|
103
|
114
|
align: 'center',
|
104
|
|
- render: (x, row) => <span>{row.userName === null || row.userName === '' ? row.channelTel : row.userName}</span>,
|
105
|
115
|
},
|
106
|
116
|
{
|
107
|
|
- title: '小程序总数',
|
108
|
|
- dataIndex: 'appMaxNum',
|
109
|
|
- key: 'appMaxNum',
|
|
117
|
+ title: '下单人',
|
|
118
|
+ dataIndex: 'orderer',
|
|
119
|
+ key: 'orderer',
|
110
|
120
|
align: 'center',
|
111
|
121
|
|
112
|
122
|
},
|
113
|
123
|
{
|
114
|
|
- title: '现有小程序',
|
115
|
|
- dataIndex: 'appCurrentNum',
|
116
|
|
- key: 'appCurrentNum',
|
|
124
|
+ title: '联系方式',
|
|
125
|
+ dataIndex: 'phone',
|
|
126
|
+ key: 'phone',
|
117
|
127
|
align: 'center',
|
118
|
|
- render: (appCurrentNum) => <span>{appCurrentNum === 0 || appCurrentNum == null ? 0 : appCurrentNum}</span>,
|
119
|
128
|
},
|
120
|
129
|
{
|
121
|
|
- title: '服务到期时间',
|
122
|
|
- dataIndex: 'expireDate',
|
123
|
|
- key: 'expireDate',
|
|
130
|
+ title: '下单时间',
|
|
131
|
+ dataIndex: 'createDate',
|
|
132
|
+ key: 'createDate',
|
124
|
133
|
align: 'center',
|
125
|
|
- render: (x, row) => <><span>{`${moment(row.expireDate).format('YYYY-MM-DD')}`}</span></>,
|
|
134
|
+ render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span></>,
|
126
|
135
|
},
|
127
|
136
|
{
|
128
|
|
- title: '状态',
|
129
|
|
- dataIndex: 'status',
|
130
|
|
- key: 'status',
|
|
137
|
+ title: '需求单状态',
|
|
138
|
+ dataIndex: 'demandStatus',
|
|
139
|
+ key: 'demandStatus',
|
131
|
140
|
align: 'center',
|
132
|
|
- render: (status) => <span>{status === 1 ? '启动' : '停用'}</span>,
|
|
141
|
+ render: (demandStatus) => <span>{demandStatus === 1 ? '已提交' : demandStatus === 2 ? '处理中' : demandStatus === 3 ? '已交付' : demandStatus === 4 ? '作废' : ''}</span>,
|
133
|
142
|
},
|
134
|
143
|
{
|
135
|
144
|
title: '操作',
|
|
@@ -137,18 +146,9 @@ function header(props) {
|
137
|
146
|
key: 'handle',
|
138
|
147
|
align: 'center',
|
139
|
148
|
render: (x, row) => (
|
140
|
|
- <>
|
141
|
|
- <AuthButton name="admin.taNewsType.id.delete" noRight={null}>
|
142
|
|
- <span style={{ color: '#EF273A', marginRight: '20px', cursor: 'pointer' }} onClick={changeNewsStatus(row, row.channelId)}>
|
143
|
|
- {row.status == 1 ? '停用' : '启用'}<Icon type="shopping-cart" className={styles.shoppingCart} />
|
144
|
|
- </span>
|
145
|
|
- </AuthButton>
|
146
|
|
- <AuthButton name="admin.taNewsType.id.put" noRight={null}>
|
147
|
|
- <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditNews(row.channelId)}>
|
148
|
|
- 编辑<Icon type="form" className={styles.edit} />
|
149
|
|
- </span>
|
150
|
|
- </AuthButton>
|
151
|
|
- </>
|
|
149
|
+ <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditDemand(row.demandId)}>
|
|
150
|
+ 查看详情<Icon type="form" className={styles.edit} />
|
|
151
|
+ </span>
|
152
|
152
|
),
|
153
|
153
|
},
|
154
|
154
|
];
|
|
@@ -161,10 +161,68 @@ function header(props) {
|
161
|
161
|
return (
|
162
|
162
|
|
163
|
163
|
<>
|
|
164
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
|
165
|
+ <Form.Item>
|
|
166
|
+ {getFieldDecorator('sampleName')(
|
|
167
|
+ <Input
|
|
168
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
169
|
+ placeholder="样例名"
|
|
170
|
+ />,
|
|
171
|
+ )}
|
|
172
|
+ </Form.Item>
|
|
173
|
+ <Form.Item>
|
|
174
|
+ {getFieldDecorator('orgName')(
|
|
175
|
+ <Input
|
|
176
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
177
|
+ placeholder="下单组织"
|
|
178
|
+ />,
|
|
179
|
+ )}
|
|
180
|
+ </Form.Item>
|
|
181
|
+ <Form.Item>
|
|
182
|
+ {getFieldDecorator('orderer')(
|
|
183
|
+ <Input
|
|
184
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
185
|
+ placeholder="下单人"
|
|
186
|
+ />,
|
|
187
|
+ )}
|
|
188
|
+ </Form.Item>
|
|
189
|
+ <Form.Item>
|
|
190
|
+ {getFieldDecorator('phone')(
|
|
191
|
+ <Input
|
|
192
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
193
|
+ placeholder="联系方式"
|
|
194
|
+ />,
|
|
195
|
+ )}
|
|
196
|
+ </Form.Item>
|
|
197
|
+ <Form.Item>
|
|
198
|
+ <span style={{marginRight:'10px'}}>下单时间段:</span>
|
|
199
|
+ {getFieldDecorator('createDate')(
|
|
200
|
+ <RangePicker placeholder={['开始时间','结束时间']} />
|
|
201
|
+ )}
|
|
202
|
+ </Form.Item>
|
|
203
|
+ <Form.Item>
|
|
204
|
+ {getFieldDecorator('demandStatus')(
|
|
205
|
+ <Select style={{ width: '180px' }} placeholder="需求单状态">
|
|
206
|
+ <Select.Option value="1">已提交</Select.Option>
|
|
207
|
+ <Select.Option value="2">处理中</Select.Option>
|
|
208
|
+ <Select.Option value="3">已交付</Select.Option>
|
|
209
|
+ <Select.Option value="4">作废</Select.Option>
|
|
210
|
+ </Select>,
|
|
211
|
+ )}
|
|
212
|
+ </Form.Item>
|
|
213
|
+ <Form.Item>
|
|
214
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
|
215
|
+ 搜索
|
|
216
|
+ </Button>
|
|
217
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
218
|
+ 重置
|
|
219
|
+ </Button>
|
|
220
|
+ </Form.Item>
|
|
221
|
+ </Form>
|
164
|
222
|
<AuthButton name="admin.taNewsType.post" noRight={null}>
|
165
|
|
- <Button type="danger" className={styles.addBtn} onClick={toEditNews()}>新增</Button>
|
|
223
|
+ <Button type="danger" className={styles.addBtn} onClick={changeStatus}>删除</Button>
|
166
|
224
|
</AuthButton>
|
167
|
|
- <Table rowKey="newsType" dataSource={data.records} columns={columns} pagination={false} />
|
|
225
|
+ <Table rowSelection={rowSelection} rowKey="newsType" dataSource={data.records} columns={columns} pagination={false} />
|
168
|
226
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
169
|
227
|
<Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
|
170
|
228
|
</div>
|