李志伟 3 年之前
父節點
當前提交
613027f576

+ 0
- 6
config/routes.js 查看文件

@@ -264,12 +264,6 @@ export default [
264 264
         access: 'user',
265 265
         component: './SystemManagement/Administrator',
266 266
       },
267
-      {
268
-        path: '/SystemManagement/Administrator/AdminEdit',
269
-        name: '人员编辑',
270
-        component: './SystemManagement/Administrator/AdminEdit',
271
-        hideInMenu: true,
272
-      },
273 267
       {
274 268
         path: '/SystemManagement/BasicParameters',
275 269
         name: '基本参数',

+ 52
- 0
src/components/CooperativeSearch/index.jsx 查看文件

@@ -0,0 +1,52 @@
1
+import { useEffect, useState } from 'react';
2
+import { Select } from 'antd';
3
+import { getCooperativeList, getCooperativeDetail } from '@/services/cooperative';
4
+
5
+const Option = Select.Option;
6
+export default (props) => {
7
+  const { value, onChange, ...otherProps } = props;
8
+
9
+  const [list, setList] = useState([]);
10
+
11
+  const searchData = (val) => {
12
+    getCooperativeList({ name: val, pageSize: 9999 }).then((res) => {
13
+      setList(res.records || []);
14
+    });
15
+  };
16
+
17
+  const handleSearch = (text) => {
18
+    if (text) {
19
+      searchData(text);
20
+    }
21
+  };
22
+
23
+  useEffect(() => {
24
+    if (value) {
25
+      getCooperativeDetail(value).then((res) => {
26
+        setList([res]);
27
+      });
28
+    }
29
+  }, [value]);
30
+
31
+  return (
32
+    <Select
33
+      showSearch
34
+      value={value}
35
+      defaultActiveFirstOption={false}
36
+      showArrow={false}
37
+      filterOption={false}
38
+      onSearch={handleSearch}
39
+      onChange={onChange}
40
+      notFoundContent={null}
41
+      {...otherProps}
42
+    >
43
+      {list.map((item) => {
44
+        return (
45
+          <Option key={item.orgId} value={item.orgId}>
46
+            {item.name}
47
+          </Option>
48
+        );
49
+      })}
50
+    </Select>
51
+  );
52
+};

+ 0
- 76
src/pages/SystemManagement/Administrator/AdminEdit/index.jsx 查看文件

@@ -1,76 +0,0 @@
1
-import { Input, Card, Select, Button, message } from "antd"
2
-import { useEffect, useState } from 'react'
3
-import { Form } from "antd";
4
-import { history } from 'umi';
5
-import ProCard from '@ant-design/pro-card'
6
-
7
-const { Option } = Select
8
-const goBack = () => {
9
-  history.goBack()
10
-}
11
-const FormItem = Form.Item
12
-export default (props) => {
13
-
14
-  const [form] = Form.useForm()
15
-  const [loading, setLoading] = useState(false)
16
-
17
-  const formItemLayout = {
18
-    //布局
19
-    labelCol: { span: 6 },
20
-    wrapperCol: { span: 14 },
21
-  };
22
-
23
-  const Submit = values => {
24
-    // setLoading(true)
25
-    console.log("🚀 ~ file: index.jsx ~ line 21 ~ values", values)
26
-
27
-  };
28
-
29
-  return (
30
-    <Card >
31
-      <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}
32
-      >
33
-        <ProCard.TabPane key={1} tab="人员管理">
34
-          <Form {...formItemLayout} onFinish={Submit} form={form} >
35
-            <FormItem label="账号" name="shopName" rules={[{ required: true, message: '请输入' }]}>
36
-              <Input placeholder="请输入" style={{ width: '350px' }} />
37
-            </FormItem>
38
-            <FormItem label="姓名" name="title" rules={[{ required: true, message: '请输入' }]}>
39
-              <Input placeholder="请输入" style={{ width: '350px' }} />
40
-            </FormItem>
41
-            <FormItem label="邮箱" name="phone" rules={[{ required: true, message: '邮箱格式不正确或内容为空', pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/ }]}>
42
-              <Input placeholder="请输入" style={{ width: '350px' }} />
43
-            </FormItem>
44
-            <FormItem label="角色" name="user" rules={[{ required: true, message: '请选择' }]}>
45
-              <Select
46
-                placeholder="请选择角色"
47
-                // onChange={onGenderChange}
48
-                allowClear
49
-                style={{ width: '350px' }}
50
-              >
51
-                <Option value="nongji">农机手</Option>
52
-                <Option value="nonghu">农户</Option>
53
-              </Select>
54
-            </FormItem>
55
-            <FormItem label="状态" name="stry" rules={[{ required: true, message: '请选择', }]} >
56
-              <Select
57
-                placeholder="请选择状态"
58
-                // onChange={onGenderChange}
59
-                allowClear
60
-                style={{ width: '350px' }}
61
-              >
62
-                <Option value="0">启用</Option>
63
-                <Option value="1">禁用</Option>
64
-              </Select>
65
-            </FormItem>
66
-
67
-            <FormItem label=" " colon={false} >
68
-              <Button type='default' onClick={() => goBack()} >返回</Button>
69
-              <Button type='primary' loading={loading} htmlType="Submit" style={{ marginLeft: '4em' }}>保存</Button>
70
-            </FormItem>
71
-          </Form>
72
-        </ProCard.TabPane>
73
-      </ProCard>
74
-    </Card>
75
-  )
76
-}

+ 12
- 4
src/pages/SystemManagement/Administrator/index.jsx 查看文件

@@ -14,6 +14,7 @@ import {
14 14
 } from '@/services/user';
15 15
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
16 16
 import PageTable from '@/components/PageTable';
17
+import Search from '@/components/CooperativeSearch';
17 18
 
18 19
 const FormItem = Form.Item;
19 20
 const { Option } = Select;
@@ -76,6 +77,7 @@ export default (props) => {
76 77
     form.resetFields();
77 78
     setEditModal(false);
78 79
   };
80
+  const handelChange = () => {};
79 81
   const handleDelete = (id) => {
80 82
     deleteRegion(id)
81 83
       .then(() => {
@@ -197,14 +199,20 @@ export default (props) => {
197 199
           <FormItem label="邮箱" name="email" rules={[{ required: true, message: '请输入' }]}>
198 200
             <Input placeholder="请输入" />
199 201
           </FormItem>
200
-          <FormItem label="所属机构" name="orgId" rules={[{ required: true, message: '请输入' }]}>
201
-            <Select placeholder="请选择机构" showSearch>
202
+          <FormItem label="所属机构" name="orgId">
203
+            <Search placeholder="请选择机构" onChange={handelChange} />
204
+            {/* <Select
205
+              placeholder="请选择机构"
206
+              showSearch
207
+              onSearch={handelFormSearch}
208
+              onChange={handelFormSearch}
209
+            >
202 210
               {cooperativeList.map((item) => (
203
-                <Option value={item.name} key={item.orgId}>
211
+                <Option value={item.orgId} key={item.orgId}>
204 212
                   {item.name}
205 213
                 </Option>
206 214
               ))}
207
-            </Select>
215
+            </Select> */}
208 216
           </FormItem>
209 217
           <FormItem label=" " colon={false}>
210 218
             <Button type="default" onClick={onCancel}>