|
@@ -41,7 +41,7 @@ const columns = [
|
41
|
41
|
dataIndex: 'createDate',
|
42
|
42
|
key: 'createDate',
|
43
|
43
|
align: 'center',
|
44
|
|
- render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span></>
|
|
44
|
+ render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD')}`}</span></>,
|
45
|
45
|
},
|
46
|
46
|
{
|
47
|
47
|
title: '推广人',
|
|
@@ -55,20 +55,32 @@ const columns = [
|
55
|
55
|
key: 'orgName',
|
56
|
56
|
align: 'center',
|
57
|
57
|
},
|
|
58
|
+ {
|
|
59
|
+ title: '状态',
|
|
60
|
+ dataIndex: 'isCheckin',
|
|
61
|
+ key: 'isCheckin',
|
|
62
|
+ align: 'center',
|
|
63
|
+ render: (x, row) => <><span>{row.isCheckin === 1 ? '已签到' : '未签到'}</span></>,
|
|
64
|
+ },
|
58
|
65
|
];
|
59
|
66
|
|
60
|
67
|
|
61
|
68
|
|
62
|
|
-const header = (props) => {
|
63
|
|
- const [ data, setData ] = useState({list: {}})
|
|
69
|
+const header = props => {
|
|
70
|
+ const [data, setData] = useState({list: {}})
|
64
|
71
|
// const [page, changePage] = useState({})
|
|
72
|
+// 存入导入数据的值
|
|
73
|
+const { getFieldDecorator, getFieldsValue } = props.form
|
|
74
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
65
|
75
|
useEffect(() => {
|
66
|
|
- getSignList({pageNum: 1,pageSize: 10, dynamicId: props.location.query.dynamicId });
|
67
|
|
- },[])
|
|
76
|
+ // eslint-disable-next-line no-use-before-define
|
|
77
|
+ getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId });
|
|
78
|
+ }, [])
|
68
|
79
|
|
69
|
80
|
// 查询列表
|
70
|
|
- const getSignList = (params) => {
|
71
|
|
- request({ ...apis.activity.signList, params: { ...params },}).then((data) => {
|
|
81
|
+ const getSignList = params => {
|
|
82
|
+ // eslint-disable-next-line no-shadow
|
|
83
|
+ request({ ...apis.activity.signList, params: { ...params } }).then(data => {
|
72
|
84
|
console.log(data)
|
73
|
85
|
setData(data)
|
74
|
86
|
})
|
|
@@ -83,10 +95,78 @@ const header = (props) => {
|
83
|
95
|
pathname: '/activity/ActivityList',
|
84
|
96
|
});
|
85
|
97
|
}
|
|
98
|
+ // 提交事件
|
|
99
|
+// eslint-disable-next-line no-shadow
|
|
100
|
+const handleSubmit = (e, props) => {
|
|
101
|
+ e.preventDefault();
|
|
102
|
+ props.form.validateFields((err, values) => {
|
|
103
|
+ getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId, isCheckin: values.isCheckin, name: values.name, phone: values.phone })
|
|
104
|
+ });
|
|
105
|
+ }
|
|
106
|
+ // 重置搜索
|
|
107
|
+ function handleReset() {
|
|
108
|
+ props.form.resetFields();
|
|
109
|
+ getSignList({ pageNum: 1, pageSize: 10, dynamicId: props.location.query.dynamicId })
|
|
110
|
+ }
|
|
111
|
+ // eslint-disable-next-line class-methods-use-this
|
|
112
|
+ function exportHelp() {
|
|
113
|
+ const fieldsValue = getFieldsValue()
|
|
114
|
+ console.log('fieldsValue', fieldsValue)
|
|
115
|
+ request({ ...apis.activity.getTaActivityDynamicEnlistExport, params: { ...fieldsValue, dynamicId: props.location.query.dynamicId } })
|
|
116
|
+ .then(data => {
|
|
117
|
+ if (!data) {
|
|
118
|
+ return
|
|
119
|
+ }
|
|
120
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
121
|
+ const link = document.createElement('a')
|
|
122
|
+ link.style.display = 'none'
|
|
123
|
+ link.href = url
|
|
124
|
+ link.setAttribute('download', '助力者记录.xlsx')
|
|
125
|
+ document.body.append(link)
|
|
126
|
+ link.click()
|
|
127
|
+ }).catch(() => {
|
|
128
|
+
|
|
129
|
+ })
|
|
130
|
+ }
|
86
|
131
|
|
87
|
132
|
return (
|
88
|
133
|
<>
|
|
134
|
+ <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
|
135
|
+ <Form.Item>
|
|
136
|
+ {getFieldDecorator('isCheckin')(
|
|
137
|
+ <Select style={{ width: '180px' }} placeholder="签到状态">
|
|
138
|
+ <Option value="0">未签到</Option>
|
|
139
|
+ <Option value="1">已签到</Option>
|
|
140
|
+ </Select>,
|
|
141
|
+ )}
|
|
142
|
+ </Form.Item>
|
|
143
|
+ <Form.Item>
|
|
144
|
+ {getFieldDecorator('name')(
|
|
145
|
+ <Input
|
|
146
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
147
|
+ placeholder="用户姓名"
|
|
148
|
+ />,
|
|
149
|
+ )}
|
|
150
|
+ </Form.Item>
|
|
151
|
+ <Form.Item>
|
|
152
|
+ {getFieldDecorator('phone')(
|
|
153
|
+ <Input
|
|
154
|
+ prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
|
155
|
+ placeholder="手机号"
|
|
156
|
+ />,
|
|
157
|
+ )}
|
|
158
|
+ </Form.Item>
|
|
159
|
+ <Form.Item>
|
|
160
|
+ <Button type="primary" htmlType="submit" className={styles.searchBtn}>
|
|
161
|
+ 搜索
|
|
162
|
+ </Button>
|
|
163
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
164
|
+ 重置
|
|
165
|
+ </Button>
|
|
166
|
+ </Form.Item>
|
|
167
|
+ </Form>
|
89
|
168
|
<Button type="primary" className={styles.addBtn} onClick={toActivityList}>返回</Button>
|
|
169
|
+ <Button type="primary" style={{ marginLeft: '85%' }} onClick={exportHelp}>导出</Button>
|
90
|
170
|
<Table dataSource={data.list.data} columns={columns} pagination={false} rowKey="activity"/>
|
91
|
171
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
92
|
172
|
<Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
|