[baozhangchao] 3 年前
父节点
当前提交
96458fe1b4

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

@@ -252,12 +252,6 @@ export default [
252 252
         access: 'org',
253 253
         component: './SystemManagement/Cooperative',
254 254
       },
255
-      {
256
-        path: '/SystemManagement/Cooperative/edit.jsx',
257
-        name: '机构编辑',
258
-        component: './SystemManagement/Cooperative/edit.jsx',
259
-        hideInMenu: true,
260
-      },
261 255
       {
262 256
         path: '/SystemManagement/UserRights',
263 257
         name: '角色管理',
@@ -270,12 +264,6 @@ export default [
270 264
         access: 'user',
271 265
         component: './SystemManagement/Administrator',
272 266
       },
273
-      {
274
-        path: '/SystemManagement/Administrator/AdminEdit',
275
-        name: '人员编辑',
276
-        component: './SystemManagement/Administrator/AdminEdit',
277
-        hideInMenu: true,
278
-      },
279 267
       {
280 268
         path: '/SystemManagement/BasicParameters',
281 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
+};

+ 11
- 0
src/components/ScreenBox/ScreenHeader/index.jsx 查看文件

@@ -0,0 +1,11 @@
1
+import Styles from './style.less';
2
+
3
+export default () => {
4
+  return (
5
+    <div className={Styles['screen-header-box']}>
6
+      <div className={Styles['screen-header-left']}></div>
7
+      <div className={Styles['screen-header-content']}></div>
8
+      <div className={Styles['screen-header-right']}></div>
9
+    </div>
10
+  );
11
+};

+ 12
- 0
src/components/ScreenBox/ScreenHeader/style.less 查看文件

@@ -0,0 +1,12 @@
1
+.screen-header-box {
2
+  display: flex;
3
+
4
+  .screen-header-left,
5
+  .screen-header-right {
6
+    flex: 1;
7
+  }
8
+
9
+  .screen-header-content {
10
+    flex: 6;
11
+  }
12
+}

+ 10
- 10
src/pages/MonitoringScreen/index.jsx 查看文件

@@ -11,6 +11,7 @@ import DateCommponetsBottomRight from './DateCommponetsBottomRight';
11 11
 import DateCommponetsBottomLeft from './DateCommponetsBottomLeft';
12 12
 import Styles from './style.less';
13 13
 import SquareBox from '@/components/ScreenBox/SquareBox';
14
+import ScreenHeader from '@/components/ScreenBox/ScreenHeader';
14 15
 
15 16
 export default (props) => {
16 17
   const { style, isFullScreen, onFullScreen } = useFullScreen();
@@ -23,25 +24,24 @@ export default (props) => {
23 24
         </Button>
24 25
       }
25 26
     >
26
-
27
-
28 27
       <div
29 28
         className={classNames(Styles['screen-page'], { [Styles['full-screen']]: isFullScreen })}
30 29
         style={style}
31 30
       >
32 31
         <div className={Styles['grail-layout']}>
33 32
           <div className={Styles['grail-header']}>
34
-            {/* <SquareBox>asdfasdf</SquareBox> */}
33
+            <ScreenHeader weather="多云 21-28 °C" />
35 34
           </div>
36 35
           <div className={Styles['grail-container']}>
37
-            <div className={Styles['grail-left']}></div>
38
-            <div className={Styles['grail-content']} >
39
-
40
-              <DateCommponetsLeft />
41
-              <DateCommponetsBottomRight />
42
-              <DateCommponetsBottomLeft />
36
+            <div className={Styles['grail-left']}>
37
+              <SquareBox>asdfasdf</SquareBox>
38
+            </div>
39
+            <div className={Styles['grail-content']}>
40
+              <DateCommponets />
41
+            </div>
42
+            <div className={Styles['grail-right']}>
43
+              <SquareBox>asdfasdf</SquareBox>
43 44
             </div>
44
-            <div className={Styles['grail-right']}></div>
45 45
           </div>
46 46
           <div className={Styles['grail-footer']}></div>
47 47
         </div>

+ 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
-}

+ 242
- 99
src/pages/SystemManagement/Administrator/index.jsx 查看文件

@@ -1,149 +1,292 @@
1
-import { history, Link } from 'umi';
2
-import { useRef } from 'react';
3
-import { Button, Modal, message, Popconfirm, Tooltip } from 'antd';
4
-import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
1
+import React, { useState, useEffect, useRef } from 'react';
2
+import { Button, Popconfirm, Modal, Form, Input, message, Radio, Select } from 'antd';
3
+import { PlusOutlined } from '@ant-design/icons';
4
+import { getCooperativeList } from '@/services/cooperative';
5
+import {
6
+  getUserList,
7
+  addUser,
8
+  deleteUser,
9
+  updateUser,
10
+  getDefaultPassword,
11
+  getUserDetail,
12
+} from '@/services/user';
5 13
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
-import ProTable, { TableDropdown } from '@ant-design/pro-table';
14
+import PageTable from '@/components/PageTable';
15
+import Search from '@/components/CooperativeSearch';
7 16
 
17
+const FormItem = Form.Item;
18
+const { Option } = Select;
8 19
 
9 20
 export default (props) => {
10
-  const dataSource = [
11
-    {
12
-      id: 9,
13
-      key: '1',
14
-      name: '胡彦斌',
15
-      age: 32,
16
-      status: 0,
17
-      zz: '西湖区湖底公园1号',
18
-    },
19
-
20
-  ];
21
-
22
-
23
-  // 测试内容👆-------------------------
21
+  //编辑弹窗
22
+  const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
23
+  const [form] = Form.useForm();
24
+  const [editModal, setEditModal] = useState(false);
25
+  const [loading, setLoading] = useState(false);
26
+  const [userId, setuserId] = useState();
27
+  const [password, setPassWord] = useState('');
28
+  const [cooperativeList, setCooperativeList] = useState([]);
24 29
 
30
+  //列表数据
25 31
   const actionRef = useRef();
26
-  const gotoDetail = (id) => {
27
-    history.push(`Administrator/AdminEdit`)
28
-  }
29
-
30 32
 
31
-  const handleDelete = (e) => {
32
-    deleteNote(e.noteId).then(res => {
33
-      message.success('删除成功');
34
-      actionRef.current.reload();
35
-    })
36
-  }
33
+  // 编辑弹窗的表单提交
34
+  const Submit = (values) => {
35
+    const newData = { ...values };
36
+    if (!newData.sex && newData.sex !== 0) {
37
+      newData.sex = 1;
38
+    }
39
+    setLoading(true);
40
+    if (!/^1[0-9]{10}$/.test(newData.phone)) {
41
+      message.warning('请输入正确的十一位手机号');
42
+      setLoading(false);
43
+      return false;
44
+    }
45
+    if (userId) {
46
+      updateUser(userId, newData).then(() => {
47
+        setLoading(false);
48
+        message.success(`修改成功`);
49
+        onCancel();
50
+        actionRef.current.reload();
51
+      });
52
+    } else {
53
+      addUser(newData)
54
+        .then(() => {
55
+          setLoading(false);
56
+          message.success(`保存成功`);
57
+          onCancel();
58
+          actionRef.current.reload();
59
+        })
60
+        .catch((err) => {
61
+          setLoading(false);
62
+          message.error(err.message || err);
63
+        });
64
+    }
65
+  };
66
+  //表单点击取消按钮
67
+  const onCancel = () => {
68
+    setuserId();
69
+    form.resetFields();
70
+    setEditModal(false);
71
+  };
72
+  // 弹窗表单中机构搜索框改变事件目前没用
73
+  const handelChange = () => {};
37 74
 
75
+  // 列表点击编辑按钮
76
+  const handelEdit = (val) => {
77
+    setuserId(val.userId);
78
+    setEditModal(true);
79
+  };
80
+  //列表点击删除按钮
81
+  const handleDelete = (id) => {
82
+    deleteUser(id)
83
+      .then(() => {
84
+        message.success('删除成功');
85
+        actionRef.current.reload();
86
+      })
87
+      .catch((err) => {
88
+        message.error(err);
89
+      });
90
+  };
91
+  //列表切换人员状态方法
38 92
   const handleOK = (record, data) => {
39
-    const titleCourse = record.status ? '您确定要禁用该用户吗? 禁用后该用户不能在后台登陆!' : '您确定要启用该用户吗? 启用后该用户将允许在后台登陆!';
93
+    const title = record.status
94
+      ? '您确定要将该人员状态变更为禁用吗? 禁用后该人员将不能登录'
95
+      : '您确定要将该人员状态变更为启用吗? 启用后该人员可以登录!';
40 96
     Modal.confirm({
41
-      title: titleCourse,
97
+      title: title,
42 98
       okText: '确认',
43 99
       cancelText: '取消',
44
-      onOk () {
45
-        publishNote(record.noteId, record.status ? 'off' : 'on').then(res => {
46
-          message.success('操作成功');
47
-          actionRef.current.reload()
48
-        })
100
+      onOk() {
101
+        updateUser(record.userId, { ...record, status: record.status === 1 ? 0 : 1 })
102
+          .then((res) => {
103
+            message.success('操作成功');
104
+            actionRef.current.reload();
105
+          })
106
+          .catch((err) => {
107
+            message.error(err);
108
+          });
49 109
       },
50 110
     });
51
-  }
111
+  };
112
+  useEffect(() => {
113
+    //获取账号默认密码
114
+    getDefaultPassword().then((res) => {
115
+      setPassWord(res);
116
+    });
117
+    //获取机构列表数据
118
+    getCooperativeList().then((res) => {
119
+      setCooperativeList(res.records);
120
+    });
121
+    if (userId) {
122
+      getUserDetail(userId).then((res) => {
123
+        if (res.orgId === '-1') {
124
+          form.setFieldsValue({ ...res, orgId: cooperativeList[0].orgId });
125
+        } else {
126
+          form.setFieldsValue(res);
127
+        }
128
+      });
129
+    } else {
130
+      form.resetFields();
131
+    }
132
+  }, [userId]);
133
+
52 134
   const actions = () => [
53
-    <Button key='add' type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>新增</Button>,
54
-  ]
135
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => setEditModal(true)}>
136
+      新增
137
+    </Button>,
138
+  ];
55 139
   const columns = [
56 140
     {
57
-      title: '账号',
58
-      key: 'zz',
59
-      dataIndex: 'zz',
141
+      title: '用户名',
142
+      dataIndex: 'userName',
143
+      key: 'userName',
60 144
     },
61 145
     {
62
-      title: '姓名',
63
-      dataIndex: 'name',
64
-      key: 'name',
146
+      title: '性别',
147
+      dataIndex: 'sex',
148
+      key: 'sex',
149
+      width: 80,
150
+      render: (_, record) => {
151
+        return record.sex === 1 ? '男' : record.sex === 0 ? '女' : '未知';
152
+      },
65 153
       search: false,
66 154
     },
67 155
     {
68
-      title: '邮箱',
69
-      dataIndex: 'a',
70
-      key: 'a',
71
-      search: false,
156
+      title: '手机号',
157
+      dataIndex: 'phone',
158
+      key: 'phone',
159
+      width: 120,
72 160
     },
73 161
     {
74
-      title: '角色',
75
-      dataIndex: 'weight',
76
-      key: 'weight',
77
-      valueType: 'select',
78
-      render: (t, record) => record.noteType === 'peseng' ? '农户' : '农机手',
79
-      valueEnum: {
80
-        'peseng': { text: '农户', },
81
-        'peseng': { text: '农机手', },
82
-      }
162
+      title: '邮箱',
163
+      dataIndex: 'email',
164
+      key: 'email',
83 165
     },
84 166
     {
85 167
       title: '状态',
86 168
       dataIndex: 'status',
87
-      // initialValue: 'all',
88 169
       key: 'status',
89
-      valueEnum: {
90
-        0: { text: '已启用', status: 'Success' },
91
-        1: { text: '已禁用', status: 'Error' },
92
-      }
93
-    },
94
-
95
-    {
96
-      title: (
97
-        <>
98
-          创建时间
99
-          <Tooltip placement="top">
100
-            <QuestionCircleOutlined style={{ marginLeft: 4 }} />
101
-          </Tooltip>
102
-        </>
103
-      ),
104
-      hideInTable: true,
105
-      key: 'createdAt',
106
-      dataIndex: 'createdAt',
107
-      valueType: 'date',
108
-      // render: (t) => formatterTime(t),
109
-      sorter: (a, b) => a.createdAt - b.createdAt,
170
+      renderFormItem: () => {
171
+        return (
172
+          <Select placeholder="请选择">
173
+            <Option value={1}>启用</Option>
174
+            <Option value={0}>禁用</Option>
175
+          </Select>
176
+        );
177
+      },
178
+      render: (_, record) => {
179
+        return record.status === 1 ? '启用' : '未启用';
180
+      },
110 181
     },
111 182
     {
112 183
       title: '操作',
113 184
       valueType: 'option',
114
-      key: 'option',
115
-      ellipsis: true,
116
-      width: 200,
117 185
       render: (_, record) => [
118
-        <Button type="link" key={1} onClick={() => handleOK(record)}>{record.status === 0 ? '启用' : '禁用'}</Button>,
119
-        <Link key={2} to={`Administrator/AdminEdit`}>编辑</Link>,
186
+        <Button type="link" key={1} onClick={() => handleOK(record)}>
187
+          {record.status === 0 ? '启用' : '禁用'}
188
+        </Button>,
189
+        <a key={2} onClick={() => handelEdit(record)}>
190
+          编辑
191
+        </a>,
120 192
         <Popconfirm
121 193
           key={3}
122 194
           title="您是否确认删除 ?"
123
-          onConfirm={() => handleDelete(record)}
195
+          onConfirm={() => handleDelete(record.userId)}
124 196
           okText="确定"
125 197
           cancelText="取消"
126 198
         >
127
-          <a href="#"  >删除</a>
199
+          <a href="#">删除</a>
128 200
         </Popconfirm>,
129
-      ]
201
+      ],
130 202
     },
131
-  ]
132
-
133
-
134
-
203
+  ];
135 204
 
136 205
   return (
137 206
     <PageHeaderWrapper>
138
-      <ProTable
139
-        dataSource={dataSource}
207
+      <PageTable
208
+        request={getUserList}
209
+        // expfunc={exportPersonList}
140 210
         columns={columns}
141
-        // request={getNoteList} 请求
142
-        // rowKey="noteId"
211
+        actionRef={actionRef}
212
+        rowKey="userId"
143 213
         options={false}
144 214
         toolBarRender={actions}
145
-        actionRef={actionRef}
215
+        scroll={{ x: 1000 }}
146 216
       />
217
+      <Modal
218
+        title={userId ? '人员编辑' : '人员新增'}
219
+        visible={editModal}
220
+        onCancel={onCancel}
221
+        keyboard={false}
222
+        maskClosable={false}
223
+        destroyOnClose={true}
224
+        footer={null}
225
+      >
226
+        <Form {...formItemLayout} onFinish={Submit} form={form}>
227
+          <FormItem label="登录账号">
228
+            <Input.Group compact>
229
+              <Form.Item
230
+                name="loginName"
231
+                noStyle
232
+                rules={[{ required: true, message: '请输入登录账号' }]}
233
+              >
234
+                <Input placeholder="请输入" />
235
+              </Form.Item>
236
+              <span style={{ opacity: '0.7' }}>默认密码{password}</span>
237
+            </Input.Group>
238
+          </FormItem>
239
+          <FormItem label="用户名" name="userName" rules={[{ required: true, message: '请输入' }]}>
240
+            <Input placeholder="请输入" />
241
+          </FormItem>
242
+          <FormItem label="性别" name="sex">
243
+            <Radio.Group name="sex" defaultValue={1}>
244
+              <Radio value={1}>男</Radio>
245
+              <Radio value={0}>女</Radio>
246
+            </Radio.Group>
247
+          </FormItem>
248
+          <FormItem label="手机号" name="phone" rules={[{ required: true, message: '请输入' }]}>
249
+            <Input maxLength="11" placeholder="请输入" />
250
+          </FormItem>
251
+          <FormItem label="邮箱" name="email" rules={[{ required: true, message: '请输入' }]}>
252
+            <Input placeholder="请输入" />
253
+          </FormItem>
254
+          <FormItem label="所属机构" name="orgId" rules={[{ required: true, message: '请输入' }]}>
255
+            <Search placeholder="请选择机构" onChange={handelChange} />
256
+            {/* <Select
257
+              placeholder="请选择机构"
258
+              showSearch
259
+              onSearch={handelFormSearch}
260
+              onChange={handelFormSearch}
261
+            >
262
+              {cooperativeList.map((item) => (
263
+                <Option value={item.orgId} key={item.orgId}>
264
+                  {item.name}
265
+                </Option>
266
+              ))}
267
+            </Select> */}
268
+          </FormItem>
269
+          <FormItem label="状态" name="status" rules={[{ required: true, message: '请选择' }]}>
270
+            <Select placeholder="请选择是否启用">
271
+              <Option value={1}>启用</Option>
272
+              <Option value={0}>禁用</Option>
273
+            </Select>
274
+          </FormItem>
275
+          <FormItem label=" " colon={false}>
276
+            <Button type="default" onClick={onCancel}>
277
+              取消
278
+            </Button>
279
+            <Button
280
+              type="primary"
281
+              loading={loading}
282
+              htmlType="Submit"
283
+              style={{ marginLeft: '4em' }}
284
+            >
285
+              确认
286
+            </Button>
287
+          </FormItem>
288
+        </Form>
289
+      </Modal>
147 290
     </PageHeaderWrapper>
148
-  )
149
-}
291
+  );
292
+};

+ 0
- 182
src/pages/SystemManagement/Cooperative/edit.jsx 查看文件

@@ -1,182 +0,0 @@
1
-import { Form, Input, Card, Select, message, Button } from 'antd';
2
-import { history } from 'umi';
3
-import ProCard from '@ant-design/pro-card';
4
-import { useState, useEffect } from 'react';
5
-import POI from '@/components/POI/POI';
6
-
7
-import { getRegionList } from '@/services/region';
8
-import { addCooperative, getCooperativeDetail, updateCooperative } from '@/services/cooperative';
9
-
10
-const { TextArea } = Input;
11
-const { Option } = Select;
12
-const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
13
-
14
-const goBack = () => {
15
-  history.goBack();
16
-};
17
-const FormItem = Form.Item;
18
-export default (props) => {
19
-  const { location } = props;
20
-  const { id } = location.query;
21
-  const [form] = Form.useForm();
22
-  const [listForm, setListForm] = useState({});
23
-  const [loading, setLoading] = useState(false);
24
-  const [newLocName, setLocName] = useState('');
25
-  const [newAddress, setAddress] = useState('');
26
-  const [regionList, setRegionList] = useState([]);
27
-
28
-  const Submit = (data) => {
29
-    console.log(data);
30
-    setLoading(true);
31
-    if (id) {
32
-      updateCooperative(id, {
33
-        ...listForm,
34
-        ...data,
35
-        lng: data.location.split(',')[0],
36
-        lat: data.location.split(',')[1],
37
-      })
38
-        .then(() => {
39
-          setLoading(false);
40
-          message.success('数据更新成功');
41
-          goBack();
42
-        })
43
-        .catch((err) => {
44
-          setLoading(false);
45
-          message.error(err.message || err);
46
-        });
47
-    } else {
48
-      addCooperative({
49
-        ...data,
50
-        lng: data.location.split(',')[0],
51
-        lat: data.location.split(',')[1],
52
-      })
53
-        .then((res) => {
54
-          setLoading(false);
55
-          message.success('数据保存成功');
56
-          history.goBack();
57
-        })
58
-        .catch((err) => {
59
-          setLoading(false);
60
-          message.error(err.message || err);
61
-        });
62
-    }
63
-  };
64
-
65
-  useEffect(() => {
66
-    getRegionList()
67
-      .then((res) => {
68
-        setRegionList(res.records || []);
69
-      })
70
-      .catch((err) => {});
71
-  }, []);
72
-  useEffect(() => {
73
-    if (id) {
74
-      getCooperativeDetail(id)
75
-        .then((res) => {
76
-          setListForm(res || []);
77
-          form.setFieldsValue({ ...res, location: res.lng + ',' + res.lat });
78
-        })
79
-        .catch((err) => {
80
-          message.error(err.message || err);
81
-        });
82
-    }
83
-  }, [id]);
84
-
85
-  return (
86
-    <Card>
87
-      <ProCard tabs={{ type: 'card' }}>
88
-        <ProCard.TabPane key={1} tab="合作社编辑">
89
-          <Form {...formItemLayout} onFinish={Submit} form={form}>
90
-            <FormItem
91
-              label="机构名"
92
-              name="name"
93
-              rules={[{ required: true, message: '请输入机构名称16个字符以内' }]}
94
-            >
95
-              <Input
96
-                placeholder="请输入机构名称16个字符以内"
97
-                maxLength="16"
98
-                style={{ width: '350px' }}
99
-              />
100
-            </FormItem>
101
-            <FormItem
102
-              label="信用代码"
103
-              name="creditCode"
104
-              rules={[{ required: true, message: '请输入信用代码' }]}
105
-            >
106
-              <Input placeholder="请输入信用代码" style={{ width: '350px' }} />
107
-            </FormItem>
108
-            <FormItem
109
-              label="联系人"
110
-              name="contactPerson"
111
-              rules={[{ required: true, message: '请输入联系人' }]}
112
-            >
113
-              <Input placeholder="请输入联系人" rows={4} style={{ width: '350px' }} />
114
-            </FormItem>
115
-            <FormItem
116
-              label="联系方式"
117
-              name="phone"
118
-              rules={[{ required: true, message: '请输入联系方式' }]}
119
-            >
120
-              <Input placeholder="请输入联系方式" style={{ width: '350px' }} />
121
-            </FormItem>
122
-            <FormItem
123
-              label="定位经纬"
124
-              name="location"
125
-              rules={[{ required: true, message: '请定位' }]}
126
-            >
127
-              <POI
128
-                placeholder="定位"
129
-                setLocName={setLocName}
130
-                setAddress={setAddress}
131
-                roomBoole={true}
132
-              />
133
-            </FormItem>
134
-            <FormItem
135
-              label="地址"
136
-              name="address"
137
-              rules={[{ required: true, message: '请输入地址' }]}
138
-            >
139
-              <TextArea placeholder="请输入地址" style={{ width: '350px' }} />
140
-            </FormItem>
141
-            <FormItem
142
-              label="区域"
143
-              name="regionId"
144
-              rules={[{ required: true, message: '请输入区域' }]}
145
-            >
146
-              <Select placeholder="请选择区域" style={{ width: '350px' }}>
147
-                {regionList.map((item) => (
148
-                  <Option value={item.regionId} key={item.regionId}>
149
-                    {item.name}
150
-                  </Option>
151
-                ))}
152
-              </Select>
153
-            </FormItem>
154
-            <FormItem label="身份" name="role" rules={[{ required: true, message: '请选择身份' }]}>
155
-              <Select placeholder="请选择身份" style={{ width: '350px' }}>
156
-                <Option value="合作社" key="合作社" />
157
-                <Option value="个体户" key="个体户" />
158
-              </Select>
159
-            </FormItem>
160
-            <FormItem label="员工数">{listForm?.workerNum || 0}</FormItem>
161
-            <FormItem label="农机数">{listForm?.machineryNum || 0}</FormItem>
162
-            <FormItem label="订单完成数">{listForm?.orderNum || 0}</FormItem>
163
-            <FormItem label="评分">{listForm?.score || 0}</FormItem>
164
-            <FormItem label=" " colon={false}>
165
-              <Button type="default" onClick={() => goBack()}>
166
-                返回
167
-              </Button>
168
-              <Button
169
-                type="primary"
170
-                loading={loading}
171
-                htmlType="submit"
172
-                style={{ marginLeft: '4em' }}
173
-              >
174
-                保存
175
-              </Button>
176
-            </FormItem>
177
-          </Form>
178
-        </ProCard.TabPane>
179
-      </ProCard>
180
-    </Card>
181
-  );
182
-};

+ 1
- 2
src/pages/SystemManagement/Cooperative/index.jsx 查看文件

@@ -38,7 +38,6 @@ export default (props) => {
38 38
 
39 39
   //选中左侧列表右侧显示详情
40 40
   const handleslect = (val) => {
41
-    console.log(666);
42 41
     setOrgId(val);
43 42
   };
44 43
   const handleDelete = (val) => {
@@ -78,7 +77,7 @@ export default (props) => {
78 77
           okText="确定"
79 78
           cancelText="取消"
80 79
         >
81
-          <CloseOutlined style={{ color: 'red', marginTop: '6px' }} />
80
+          <CloseOutlined style={{ color: 'red', display: 'grid', placeItems: 'center' }} />
82 81
         </Popconfirm>
83 82
       </div>
84 83
     );

+ 1
- 1
src/pages/SystemManagement/Region/index.jsx 查看文件

@@ -120,7 +120,7 @@ export default (props) => {
120 120
         scroll={{ x: 1000 }}
121 121
       />
122 122
       <Modal
123
-        title="区域新增"
123
+        title={regionId ? '区域编辑' : '区域新增'}
124 124
         visible={editModal}
125 125
         onCancel={onCancel}
126 126
         keyboard={false}

+ 38
- 0
src/services/user.js 查看文件

@@ -3,3 +3,41 @@ import request from '@/utils/request';
3 3
 export const currentUser = () => request('/currentUser', { showType: 0 });
4 4
 
5 5
 export const changePassword = (data) => request('/change-password', { data, method: 'PUT' });
6
+
7
+/**
8
+ * 保存用户
9
+ * @param {*} data
10
+ * @returns
11
+ */
12
+export const addUser = (data) => request('/user', { method: 'post', data });
13
+
14
+/**
15
+ * 修改用户
16
+ * @param {*} data
17
+ * @returns
18
+ */
19
+export const updateUser = (id, data) => request(`/user/${id}`, { method: 'put', data });
20
+
21
+/**
22
+ * 查询用户列表
23
+ * @param {*} params
24
+ * @returns
25
+ */
26
+export const getUserList = (params) => request('/user', { params });
27
+
28
+/**
29
+ * 删除用户
30
+ * @param {*} data
31
+ * @returns
32
+ */
33
+export const deleteUser = (id) => request(`/user/${id}`, { method: 'delete' });
34
+
35
+/**
36
+ * 查询用户详情
37
+ */
38
+export const getUserDetail = (id) => request(`/user/${id}`);
39
+
40
+/**
41
+ * 查询默认密码
42
+ */
43
+export const getDefaultPassword = () => request('/user/default/password');