dingxin 5 年前
父节点
当前提交
663eaa8f67
共有 1 个文件被更改,包括 50 次插入31 次删除
  1. 50
    31
      src/pages/channel/brokerList.jsx

+ 50
- 31
src/pages/channel/brokerList.jsx 查看文件

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } from 'antd';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import channels from './channelList.less';
5 5
 import router from 'umi/router';
@@ -125,45 +125,64 @@ const header = props => {
125 125
       // eslint-disable-next-line react-hooks/rules-of-hooks
126 126
       getListBroker({ pageNum: pageNumber, pageSize: 10 })
127 127
     }
128
-    // 获取input的值
129
-    function onInputChangeName (e) {
130
-      // const InputValue = e.target.name.x.value;
131
-      setQueryData({ ...queryData, name: e.target.value })
132
-   }
128
+  //   // 获取input的值
129
+  //   function onInputChangeName (e) {
130
+  //     // const InputValue = e.target.name.x.value;
131
+  //     setQueryData({ ...queryData, name: e.target.value })
132
+  //  }
133 133
 
134
-   function onInputChangePhone (e) {
135
-    // const InputValue = e.target.name.x.value;
136
-    setQueryData({ ...queryData, phone: e.target.value })
137
-  }
138
-  function refurbishList () {
139
-    getListBroker({ pageNum: 1, pageSize: 10 })
140
-  }
134
+  //  function onInputChangePhone (e) {
135
+  //   // const InputValue = e.target.name.x.value;
136
+  //   setQueryData({ ...queryData, phone: e.target.value })
137
+  // }
138
+  // function refurbishList () {
139
+  //   getListBroker({ pageNum: 1, pageSize: 10 })
140
+  // }
141 141
   // eslint-disable-next-line no-undef
142
-  function handleClick() {
143
-    alert('11', this)
144
-    console.log('this is:', this);
142
+  // function handleClick() {
143
+  //   alert('11', this)
144
+  //   console.log('this is:', this);
145
+  // }
146
+
147
+  function handleSubmit(e) {
148
+    e.preventDefault();
149
+    props.form.validateFields((err, values) => {
150
+      console.log('values', values)
151
+      if (!err) {
152
+        console.log('values', values)
153
+        getListBroker({ ...queryData, pageNum: 1, pageSize: 10, channelId: props.location.query.id, name: values.name, phone: values.phone })
154
+      }
155
+    });
145 156
   }
157
+
158
+  function handleReset() {
159
+    props.form.resetFields();
160
+    getListBroker({ pageNum: 1, pageSize: 10, channelId: props.location.query.id })
161
+  }
162
+  const { getFieldDecorator } = props.form;
146 163
 return (
147 164
   <>
148
-    <div className={ channels.searchBox }>
149
-      <div style = {{ marginLeft: '-5px' }}>
150
-        <span className={ channels.selectName }>姓名</span>
151
-        <Input onChange = { onInputChangeName } style ={{ width: 150 }} />
152
-        <span className={ channels.selectName }>电话</span>
153
-        <Input onChange = { onInputChangePhone } style ={{ width: 150 }} />
154
-      </div>
155
-      <div>
156
-      <Button type="primary" onClick={() => queryList() }>查询</Button>
157
-      {/* <Button onClick={() => refurbishList() }>重置</Button> */}
158
-    </div>
159
-    </div>
160
-    <Table style={{marginTop:'40px'}} dataSource={data.list} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} rowKey="brokerList"/>
165
+   <Form layout="inline" onSubmit={handleSubmit}>
166
+   <Form.Item label="姓名">
167
+          {getFieldDecorator('name', {
168
+          })(<Input/>)}
169
+        </Form.Item>
170
+    <Form.Item label="电话">
171
+      {getFieldDecorator('phone', {
172
+      })(<Input/>)}
173
+    </Form.Item>
174
+    <Form.Item >
175
+   <Button type="primary" htmlType="submit" >保存</Button>
176
+     <Button onClick={handleReset} style={{ marginLeft: 18 }}>重置</Button>
177
+    </Form.Item>
178
+   </Form>
179
+    <Table style={{ marginTop: '40px' }} dataSource={data.list} columns={columns} pagination={{ pageSize: 10, total: data.total, onChange }} rowKey="brokerList"/>
161 180
   </>
162 181
 )
163 182
 }
164
-
183
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
165 184
 function handleMenuClick(e) {
166 185
   message.info('Click on menu item.');
167 186
   console.log('click', e);
168 187
 }
169
-export default header
188
+export default WrappedNormalLoginForm