Преглед на файлове

Merge branch 'master' of http://git.ycjcjy.com/nanyang/machinery-admin

李志伟 преди 3 години
родител
ревизия
05854e6031

+ 8
- 0
config/routes.js Целия файл

@@ -204,6 +204,14 @@ export default [
204 204
         icon: 'smile',
205 205
         component: './SystemManagement/Administrator',
206 206
       },
207
+      {
208
+        path: '/SystemManagement/Administrator/AdminEdit',
209
+        name: '管理员编辑页',
210
+        icon: 'smile',
211
+        component: './SystemManagement/Administrator/AdminEdit',
212
+        hideInMenu: true,
213
+
214
+      },
207 215
       {
208 216
         path: '/SystemManagement/UserRights',
209 217
         name: '角色权限',

+ 1
- 0
package.json Целия файл

@@ -51,6 +51,7 @@
51 51
     "@ant-design/pro-descriptions": "^1.10.0",
52 52
     "@ant-design/pro-form": "^1.52.0",
53 53
     "@ant-design/pro-layout": "^6.32.0",
54
+    "@ant-design/pro-list": "^1.21.32",
54 55
     "@ant-design/pro-table": "^2.61.0",
55 56
     "@umijs/route-utils": "^2.0.0",
56 57
     "antd": "^4.17.0",

+ 13
- 4
src/pages/PlatformMessageManagement/MessageEdit/index.jsx Целия файл

@@ -1,10 +1,10 @@
1
-import { Input, Card, InputNumber, Button, message } from "antd"
1
+import { Input, Card, Select, Button, message } from "antd"
2 2
 import { useEffect, useState } from 'react'
3 3
 import { Form } from "antd";
4 4
 import { history } from 'umi';
5 5
 import ProCard from '@ant-design/pro-card'
6 6
 
7
-
7
+const { Option } = Select;
8 8
 const goBack = () => {
9 9
   history.goBack()
10 10
 }
@@ -37,8 +37,17 @@ export default (props) => {
37 37
             <FormItem label="农户" name="title" rules={[{ required: true, message: '请输入' }]}>
38 38
               <Input placeholder="请输入" style={{ width: '350px' }} />
39 39
             </FormItem>
40
-            <FormItem label="推送方式" name="phone" >
41
-              <Input placeholder="请输入" style={{ width: '350px' }} />
40
+            <FormItem label="推送方式" name="phone" rules={[{ required: true, message: '请输入' }]} >
41
+              <Select
42
+                placeholder="请选择方式"
43
+                // onChange={onGenderChange}
44
+                allowClear
45
+                style={{ width: '350px' }}
46
+              >
47
+                <Option value="male">通知栏推送</Option>
48
+                <Option value="female">APP内消息中心推送</Option>
49
+                <Option value="other">短信推送</Option>
50
+              </Select>
42 51
             </FormItem>
43 52
             <FormItem label=" " colon={false} >
44 53
               <Button type='default' onClick={() => goBack()} >返回</Button>

+ 8
- 11
src/pages/PlatformMessageManagement/MessageManageList/index.jsx Целия файл

@@ -8,20 +8,17 @@ import ProTable from '@ant-design/pro-table';
8 8
 export default (props) => {
9 9
   const dataSource = [
10 10
     {
11
-      id: 9,
12
-      key: '1',
11
+      id: 2121329,
12
+      title: '这是是一个标题标题',
13 13
       name: '胡彦斌',
14
-      age: 32,
15
-      address: '西湖区湖底公园1号',
16
-    },
17
-    {
18
-      id: 10,
19
-      key: '2',
20
-      name: '胡彦祖',
21
-      age: 42,
22
-      address: '西湖区湖底公园1号',
14
+      pushPerson: '农机手',
15
+      status: 'APP内消息中心推送',
23 16
     },
17
+
24 18
   ];
19
+  const gotoDetail = (id) => {
20
+    history.push(`./MessageEdit`)
21
+  }
25 22
 
26 23
   const actions = () => [
27 24
     <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>

+ 75
- 0
src/pages/SystemManagement/Administrator/AdminEdit/index.jsx Целия файл

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

+ 137
- 41
src/pages/SystemManagement/Administrator/index.jsx Целия файл

@@ -1,52 +1,148 @@
1
-import { Input, Card, InputNumber, 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'
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';
5
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
6
+import ProTable, { TableDropdown } from '@ant-design/pro-table';
6 7
 
7 8
 
8
-const goBack = () => {
9
-  history.goBack()
10
-}
11
-const FormItem = Form.Item
12 9
 export default (props) => {
10
+  const dataSource = [
11
+    {
12
+      id: 9,
13
+      key: '1',
14
+      name: '胡彦斌',
15
+      age: 32,
16
+      zz: '西湖区湖底公园1号',
17
+    },
18
+
19
+  ];
20
+
21
+
22
+  // 测试内容👆-------------------------
23
+
24
+  const actionRef = useRef();
25
+  const gotoDetail = (id) => {
26
+    history.push(`Administrator/AdminEdit`)
27
+  }
28
+
29
+
30
+  const handleDelete = (e) => {
31
+    deleteNote(e.noteId).then(res => {
32
+      message.success('删除成功');
33
+      actionRef.current.reload();
34
+    })
35
+  }
13 36
 
14
-  const [form] = Form.useForm()
15
-  const [loading, setLoading] = useState(false)
37
+  const handleOK = (record, data) => {
38
+    const titleCourse = record.status ? '您确定要禁用该用户吗? 禁用后该用户不能在后台登陆!' : '您确定要启用该用户吗? 启用后该用户将允许在后台登陆!';
39
+    Modal.confirm({
40
+      title: titleCourse,
41
+      okText: '确认',
42
+      cancelText: '取消',
43
+      onOk () {
44
+        publishNote(record.noteId, record.status ? 'off' : 'on').then(res => {
45
+          message.success('操作成功');
46
+          actionRef.current.reload()
47
+        })
48
+      },
49
+    });
50
+  }
51
+  const actions = () => [
52
+    <Button key='add' type="primary" icon={<PlusOutlined />} onClick={() => gotoDetail()}>新增</Button>,
53
+  ]
54
+  const columns = [
55
+    {
56
+      title: '账号',
57
+      key: 'zz',
58
+      dataIndex: 'zz',
59
+    },
60
+    {
61
+      title: '姓名',
62
+      dataIndex: 'name',
63
+      key: 'name',
64
+      search: false,
16 65
 
17
-  const formItemLayout = {
18
-    //布局
19
-    labelCol: { span: 6 },
20
-    wrapperCol: { span: 14 },
21
-  };
22 66
 
23
-  const Submit = values => {
24
-    console.log("🚀 ~ file: index.jsx ~ line 21 ~ values", values)
67
+    },
68
+    {
69
+      title: '邮箱',
70
+      dataIndex: 'a',
71
+      key: 'a',
72
+      search: false,
73
+    },
74
+    {
75
+      title: '角色',
76
+      dataIndex: 'weight',
77
+      key: 'weight',
78
+      valueType: 'select',
79
+      render: (t, record) => record.noteType === 'peseng' ? '农户' : '农机手',
80
+      valueEnum: {
81
+        'peseng': { text: '农户', },
82
+        'peseng': { text: '农机手', },
83
+      }
84
+    },
85
+    {
86
+      title: '状态',
87
+      dataIndex: 'status',
88
+      key: 'status',
89
+      render: (t, record) => record.noteType === 1 ? '已启用' : '已禁用',
90
+      initialValue: 'Success',
91
+      valueEnum: {
92
+        online: { text: '已启用', status: 'Success' },
93
+        error: { text: '已禁用', status: 'Error' },
94
+      }
95
+    },
25 96
 
26
-  };
97
+    {
98
+      title: (
99
+        <>
100
+          创建时间
101
+          <Tooltip placement="top">
102
+            <QuestionCircleOutlined style={{ marginLeft: 4 }} />
103
+          </Tooltip>
104
+        </>
105
+      ),
106
+      hideInTable: true,
107
+      key: 'createdAt',
108
+      dataIndex: 'createdAt',
109
+      valueType: 'date',
110
+      // render: (t) => formatterTime(t),
111
+      sorter: (a, b) => a.createdAt - b.createdAt,
112
+    },
113
+    {
114
+      title: '操作',
115
+      valueType: 'option',
116
+      key: 'option',
117
+      ellipsis: true,
118
+      width: 200,
119
+      render: (_, record) => [
120
+        <Button type="link" key={1} onClick={() => handleOK(record)}>{record.status === 0 ? '启用' : '禁用'}</Button>,
121
+        <Link key={2} to={`Administrator/AdminEdit`}>编辑</Link>,
122
+        <Popconfirm
123
+          key={3}
124
+          title="您是否确认删除 ?"
125
+          onConfirm={() => handleDelete(record)}
126
+          okText="确定"
127
+          cancelText="取消"
128
+        >
129
+          <a href="#"  >删除</a>
130
+        </Popconfirm>,
131
+      ]
132
+    },
133
+  ]
27 134
 
28 135
   return (
29
-    <Card >
30
-      <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}
31
-      >
32
-        <ProCard.TabPane key={1} tab="基本信息">
33
-          <Form {...formItemLayout} onFinish={Submit} form={form} >
34
-            <FormItem label="农机手" name="shopName" rules={[{ required: true, message: '请输入' }]}>
35
-              <Input placeholder="请输入" style={{ width: '350px' }} />
36
-            </FormItem>
37
-            <FormItem label="农户" name="title" rules={[{ required: true, message: '请输入' }]}>
38
-              <Input placeholder="请输入" style={{ width: '350px' }} />
39
-            </FormItem>
40
-            <FormItem label="推送方式" name="phone" >
41
-              <Input placeholder="请输入" style={{ width: '350px' }} />
42
-            </FormItem>
43
-            <FormItem label=" " colon={false} >
44
-              <Button type='default' onClick={() => goBack()} >返回</Button>
45
-              <Button type='primary' loading={loading} htmlType="Submit" style={{ marginLeft: '4em' }}>保存</Button>
46
-            </FormItem>
47
-          </Form>
48
-        </ProCard.TabPane>
49
-      </ProCard>
50
-    </Card>
136
+    <PageHeaderWrapper>
137
+      <ProTable
138
+        dataSource={dataSource}
139
+        columns={columns}
140
+        // request={getNoteList} 请求
141
+        // rowKey="noteId"
142
+        options={false}
143
+        toolBarRender={actions}
144
+        actionRef={actionRef}
145
+      />
146
+    </PageHeaderWrapper>
51 147
   )
52 148
 }

+ 43
- 2
src/pages/SystemManagement/BasicParameters/index.jsx Целия файл

@@ -1,5 +1,46 @@
1
+import { Input, Card, InputNumber, 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
+
8
+const goBack = () => {
9
+  history.goBack()
10
+}
11
+const FormItem = Form.Item
1 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
+    console.log("🚀 ~ file: index.jsx ~ line 21 ~ values", values)
25
+
26
+  };
27
+
2 28
   return (
3
-    <div>基本参数</div>
29
+    <Card >
30
+      <ProCard tabs={{ type: 'card' }} style={{ marginTop: '16px' }}
31
+      >
32
+        <ProCard.TabPane key={1} tab="基本参数">
33
+          <Form {...formItemLayout} onFinish={Submit} form={form} >
34
+            <FormItem label="平台联系电话" name="shopName" rules={[{ required: true, message: '请输入' }]}>
35
+              <Input placeholder="请输入" type={"number"} maxLength={11} style={{ width: '350px' }} />
36
+            </FormItem>
37
+
38
+            <FormItem label=" " colon={false} >
39
+              <Button type='primary' loading={loading} htmlType="Submit" style={{ marginLeft: '4em' }}>保存</Button>
40
+            </FormItem>
41
+          </Form>
42
+        </ProCard.TabPane>
43
+      </ProCard>
44
+    </Card>
4 45
   )
5
-}
46
+}

+ 116
- 4
src/pages/SystemManagement/MapExtent/index.jsx Целия файл

@@ -1,7 +1,119 @@
1
+import React, { useState } from 'react';
2
+import { Tag, Space, Button, Popconfirm, Form, Modal, Input } from 'antd';
3
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
4
+import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
1 5
 
6
+import ProList from '@ant-design/pro-list';
2 7
 
3
-export default (props) => {
8
+const FormItem = Form.Item
9
+const defaultData = [
10
+  {
11
+    id: '1',
12
+    name: '赵村',
13
+    desc: '赵村较大,多人协作',
14
+  },
15
+  {
16
+    id: '2',
17
+    name: '钱村',
18
+    desc: '钱村头以南二百米',
19
+  },
20
+  {
21
+    id: '3',
22
+    name: '孙孙村',
23
+    desc: '',
24
+  },
25
+  {
26
+    id: '4',
27
+    name: '李村',
28
+    desc: '村民拒不配合,暂停',
29
+  },
30
+];
31
+export default () => {
32
+  const [form2] = Form.useForm()
33
+  const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 }, };
34
+  const [dataSource, setDataSource] = useState(defaultData);
35
+  const [editModal, setEditModal] = useState(false)
36
+  const [editdetail, setEditDetail] = useState()
37
+
38
+  const changeWeight = (record) => {
39
+    setEditDetail(record)
40
+    setEditModal(true)
41
+  }
42
+  const Submit = (values) => {
43
+    console.log('editdetail', editdetail, values);
44
+    message.success(`修改成功`);
45
+    setLoading2(false)
46
+    onCancel()
47
+
48
+  }
49
+
50
+  const onCancel = () => {
51
+    form2.resetFields()
52
+    setEditModal(false)
53
+  }
54
+  const actions = () => [
55
+    <Button key='add' type="primary" icon={<PlusOutlined />} onClick={() => setEditModal(true)}>新增</Button>,
56
+  ]
4 57
   return (
5
-    <div>区域范围</div>
6
-  )
7
-}
58
+    <PageHeaderWrapper>
59
+      <ProList
60
+        toolBarRender={actions}
61
+        rowKey="id" headerTitle="区域范围" dataSource={dataSource} showActions="hover" editable={{
62
+          onSave: async (key, record, originRow) => {
63
+            console.log(key, record, originRow);
64
+            return true;
65
+          },
66
+        }} onDataSourceChange={setDataSource} metas={{
67
+          title: {
68
+            dataIndex: 'name',
69
+          },
70
+          // avatar: {
71
+          //   dataIndex: 'image',
72
+          //   editable: false,
73
+          // },
74
+          description: {
75
+            dataIndex: 'desc',
76
+          },
77
+          subTitle: {
78
+            render: () => {
79
+              return (<Space size={0}>
80
+                {/* <Tag color="blue"></Tag> */}
81
+                <Tag color="#5BD8A6">区域名称</Tag>
82
+              </Space>);
83
+            },
84
+          },
85
+          actions: {
86
+            render: (text, row, index, action) => [
87
+              <a onClick={() => {
88
+                action === null || action === void 0 ? void 0 : action.startEditable(row.id);
89
+              }} key="link">
90
+                编辑
91
+              </a>,
92
+              <Popconfirm
93
+                key={3}
94
+                title="您是否确认删除 ?"
95
+                onConfirm={() => handleDelete(record)}
96
+                okText="确定"
97
+                cancelText="取消"
98
+              >
99
+                <a href="#"  >删除</a>
100
+              </Popconfirm>,
101
+            ],
102
+          },
103
+        }} />,
104
+      <Modal title="套餐权重修改" visible={editModal} onCancel={onCancel} destroyOnClose={true} footer={null}>
105
+        < Form {...formItemLayout} onFinish={Submit} form={form2} >
106
+          <FormItem label="范围名称" name="shopNam12e" rules={[{ required: true, message: '请输入' }]}>
107
+            <Input placeholder="请输入" style={{ width: '350px' }} />
108
+          </FormItem>
109
+          <FormItem label="备注" name="shopName" rules={[{ required: true, message: '请输入' }]}>
110
+            <Input placeholder="请输入" style={{ width: '350px' }} />
111
+          </FormItem>
112
+          <FormItem label=" " colon={false} >
113
+            <Button type='default' onClick={onCancel} >取消</Button>
114
+            <Button type='primary' htmlType="Submit" style={{ marginLeft: '4em' }}>修改</Button>
115
+          </FormItem>
116
+        </Form>
117
+      </Modal>
118
+    </PageHeaderWrapper>);
119
+};