dingxin 5 年前
父节点
当前提交
49d4467c91
共有 3 个文件被更改,包括 92 次插入8 次删除
  1. 87
    7
      src/pages/activity/SignList.jsx
  2. 0
    1
      src/pages/activity/helpActivity/helpRecord.jsx
  3. 5
    0
      src/services/apis.js

+ 87
- 7
src/pages/activity/SignList.jsx 查看文件

@@ -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="2">已签到</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} />

+ 0
- 1
src/pages/activity/helpActivity/helpRecord.jsx 查看文件

@@ -68,7 +68,6 @@ class InviteTable extends React.Component {
68 68
 
69 69
   // eslint-disable-next-line class-methods-use-this
70 70
   exportHelp() {
71
-    console.log('this.state.25252464122', this.state.visibleData)
72 71
     request({ ...apis.helpActivity.gethelpRecordExport, responseType: 'blob', params: { helpRecordInitiateId: this.state.visibleData.helpId } })
73 72
       .then(data => {
74 73
         if (!data) {

+ 5
- 0
src/services/apis.js 查看文件

@@ -436,6 +436,11 @@ export default {
436 436
         method: 'GET',
437 437
         action: 'admin.SignList.get',
438 438
       },
439
+      getTaActivityDynamicEnlistExport: {
440
+        url: `${prefix}/activityDynamicEnlist/export`,
441
+        method: 'GET',
442
+        action: 'admin.SignList.get',
443
+      },
439 444
       taDrainage: {
440 445
         url: `${prefix}/taDrainage`,
441 446
         method: 'GET',