|
@@ -0,0 +1,217 @@
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
|
|
3
|
+import { Form, Pagination, Card, Button, Icon, Tooltip, message, notification, Modal, Table, Select, Input, DatePicker } from 'antd';
|
|
4
|
+import router from 'umi/router';
|
|
5
|
+import moment from 'moment';
|
|
6
|
+import className from 'classnames';
|
|
7
|
+import Cell from '../../../components/Cell';
|
|
8
|
+import styles from './style.less';
|
|
9
|
+import { fetch, apis } from '../../../utils/request';
|
|
10
|
+import request from '../../../utils/request';
|
|
11
|
+import AuthButton from '@/components/AuthButton';
|
|
12
|
+
|
|
13
|
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
|
14
|
+
|
|
15
|
+function header(props) {
|
|
16
|
+ // 获取初始化数据
|
|
17
|
+ const [ data, setData ] = useState({})
|
|
18
|
+ const [demandIdList, setDemandIdList] = useState([])
|
|
19
|
+
|
|
20
|
+ useEffect(() => {
|
|
21
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
22
|
+ },[])
|
|
23
|
+
|
|
24
|
+ // 查询列表
|
|
25
|
+ const getList = (params) => {
|
|
26
|
+ request({ ...apis.sample.list, params: { ...params } }).then((data) => {
|
|
27
|
+ console.log(data)
|
|
28
|
+ setData(data)
|
|
29
|
+ })
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+ // 提交事件
|
|
34
|
+ const handleSubmit = (e, props) => {
|
|
35
|
+ e.preventDefault();
|
|
36
|
+ props.form.validateFields((err, values) => {
|
|
37
|
+ if (!err) {
|
|
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 })
|
|
48
|
+ }
|
|
49
|
+ });
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ const changePageNum = (pageNumber) => {
|
|
53
|
+ let {createDate, ...submitValue} = props.form.getFieldsValue()
|
|
54
|
+ if(null != createDate && createDate.length > 0){
|
|
55
|
+ const [startCreateDate, endCreateDate] = createDate
|
|
56
|
+ submitValue.startCreateDate = moment(startCreateDate).format('YYYY-MM-DD');
|
|
57
|
+ submitValue.endCreateDate = moment(endCreateDate).format('YYYY-MM-DD');
|
|
58
|
+ }else{
|
|
59
|
+ submitValue.startCreateDate = null
|
|
60
|
+ submitValue.endCreateDate = null
|
|
61
|
+ }
|
|
62
|
+ getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
|
|
63
|
+ }
|
|
64
|
+
|
|
65
|
+ const rowSelection = {
|
|
66
|
+ onChange: (selectedRowKeys, selectedRows) => {
|
|
67
|
+ console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
|
68
|
+ setDemandIdList(selectedRows)
|
|
69
|
+ },
|
|
70
|
+ };
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+ // 跳转到编辑资讯
|
|
74
|
+ const toEditDemand = (id) => () => {
|
|
75
|
+ router.push({
|
|
76
|
+ pathname: '/sample/demand/edit',
|
|
77
|
+ query: {
|
|
78
|
+ id
|
|
79
|
+ },
|
|
80
|
+ });
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+ const changeStatus = () => {
|
|
85
|
+ if(demandIdList.length < 1){
|
|
86
|
+ message.error('请先选择要删除的数据!')
|
|
87
|
+ return
|
|
88
|
+ }
|
|
89
|
+ const title = '确认将所选的' + demandIdList.length + '条数据删除?可删除条件:需求单状态 为 作废。'
|
|
90
|
+ Modal.confirm({
|
|
91
|
+ title: title,
|
|
92
|
+ okText: '确认',
|
|
93
|
+ cancelText: '取消',
|
|
94
|
+ onOk() {
|
|
95
|
+ request({ ...apis.sample.put, data: { ids: demandIdList.map(x => x.demandId) } }).then((data) => {
|
|
96
|
+ const resultMessage = '操作成功,其中'+data.successNum+'条成功删除,'+data.failNum+'条非作废状态未删除。'
|
|
97
|
+ message.info(resultMessage)
|
|
98
|
+ getList({ pageNum: 1, pageSize: 10 });
|
|
99
|
+ }).catch((err) => {
|
|
100
|
+ console.log(err)
|
|
101
|
+ message.info(err.msg || err.message)
|
|
102
|
+ })
|
|
103
|
+ }
|
|
104
|
+ });
|
|
105
|
+ }
|
|
106
|
+ /**
|
|
107
|
+ *
|
|
108
|
+ *
|
|
109
|
+ * @param {*} props
|
|
110
|
+ * @returns
|
|
111
|
+ */
|
|
112
|
+ const columns = [
|
|
113
|
+ {
|
|
114
|
+ title: '企业名称',
|
|
115
|
+ dataIndex: 'sampleName',
|
|
116
|
+ key: 'sampleName',
|
|
117
|
+ align: 'center',
|
|
118
|
+ },
|
|
119
|
+ {
|
|
120
|
+ title: '企业编号',
|
|
121
|
+ dataIndex: 'orgName',
|
|
122
|
+ key: 'orgName',
|
|
123
|
+ align: 'center',
|
|
124
|
+ },
|
|
125
|
+ {
|
|
126
|
+ title: '法大大客户编号',
|
|
127
|
+ dataIndex: 'orderer',
|
|
128
|
+ key: 'orderer',
|
|
129
|
+ align: 'center',
|
|
130
|
+
|
|
131
|
+ },
|
|
132
|
+ {
|
|
133
|
+ title: '实名认证状态',
|
|
134
|
+ dataIndex: 'phone',
|
|
135
|
+ key: 'phone',
|
|
136
|
+ align: 'center',
|
|
137
|
+ },
|
|
138
|
+ {
|
|
139
|
+ title: '企业管理员身份',
|
|
140
|
+ dataIndex: 'createDate',
|
|
141
|
+ key: 'createDate',
|
|
142
|
+ align: 'center',
|
|
143
|
+ render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
|
|
144
|
+ },
|
|
145
|
+ {
|
|
146
|
+ title: '操作',
|
|
147
|
+ dataIndex: 'handle',
|
|
148
|
+ key: 'handle',
|
|
149
|
+ align: 'center',
|
|
150
|
+ render: (x, row) => (
|
|
151
|
+ <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditDemand(row.demandId)}>
|
|
152
|
+ 查看详情<Icon type="form" className={styles.edit} />
|
|
153
|
+ </span>
|
|
154
|
+ ),
|
|
155
|
+ },
|
|
156
|
+ ];
|
|
157
|
+ function handleReset() {
|
|
158
|
+ props.form.resetFields();
|
|
159
|
+ getList({ pageNum: 1, pageSize: 10 })
|
|
160
|
+ }
|
|
161
|
+
|
|
162
|
+ const { getFieldDecorator } = props.form
|
|
163
|
+ return (
|
|
164
|
+
|
|
165
|
+ <>
|
|
166
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
|
167
|
+ <Form.Item>
|
|
168
|
+ {getFieldDecorator('sampleName')(
|
|
169
|
+ <Input
|
|
170
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
171
|
+ placeholder="企业名称"
|
|
172
|
+ />,
|
|
173
|
+ )}
|
|
174
|
+ </Form.Item>
|
|
175
|
+ <Form.Item>
|
|
176
|
+ {getFieldDecorator('orgName')(
|
|
177
|
+ <Input
|
|
178
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
179
|
+ placeholder="企业编号"
|
|
180
|
+ />,
|
|
181
|
+ )}
|
|
182
|
+ </Form.Item>
|
|
183
|
+ <Form.Item>
|
|
184
|
+ {getFieldDecorator('demandStatus')(
|
|
185
|
+ <Select style={{ width: '180px' }} placeholder="实名认证状态">
|
|
186
|
+ <Select.Option value="1">未认证</Select.Option>
|
|
187
|
+ <Select.Option value="2">管理员资料已提交</Select.Option>
|
|
188
|
+ <Select.Option value="3">企业基本资料(没有申请表)已提交</Select.Option>
|
|
189
|
+ <Select.Option value="4">已提交待审核</Select.Option>
|
|
190
|
+ <Select.Option value="5">审核通过</Select.Option>
|
|
191
|
+ <Select.Option value="6">审核不通过</Select.Option>
|
|
192
|
+ <Select.Option value="7">人工初审通过</Select.Option>
|
|
193
|
+ </Select>,
|
|
194
|
+ )}
|
|
195
|
+ </Form.Item>
|
|
196
|
+ <Form.Item>
|
|
197
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
|
198
|
+ 搜索
|
|
199
|
+ </Button>
|
|
200
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
201
|
+ 重置
|
|
202
|
+ </Button>
|
|
203
|
+ </Form.Item>
|
|
204
|
+ </Form>
|
|
205
|
+ <AuthButton name="admin.taNewsType.post" noRight={null}>
|
|
206
|
+ <Button type="danger" className={styles.addBtn} onClick={changeStatus}>删除</Button>
|
|
207
|
+ </AuthButton>
|
|
208
|
+ <Table rowSelection={rowSelection} rowKey="newsType" dataSource={data.records} columns={columns} pagination={false} />
|
|
209
|
+ <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
|
210
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
|
|
211
|
+ </div>
|
|
212
|
+ </>
|
|
213
|
+ )
|
|
214
|
+}
|
|
215
|
+const WrappedHeader = Form.create({ name: 'header' })(header);
|
|
216
|
+
|
|
217
|
+export default WrappedHeader
|