Yansen 2 年之前
父節點
當前提交
8019d3e18c
共有 5 個文件被更改,包括 169 次插入0 次删除
  1. 7
    0
      src/pages/roles/index.jsx
  2. 49
    0
      src/pages/roles/list.jsx
  3. 0
    0
      src/pages/roles/menus.jsx
  4. 105
    0
      src/pages/user/Role.jsx
  5. 8
    0
      src/routes/routes.jsx

+ 7
- 0
src/pages/roles/index.jsx 查看文件

@@ -0,0 +1,7 @@
1
+import React from 'react'
2
+
3
+export default (props) => {
4
+  return (
5
+    <div></div>
6
+  )
7
+}

+ 49
- 0
src/pages/roles/list.jsx 查看文件

@@ -0,0 +1,49 @@
1
+import React from 'react';
2
+import { Button, Input, List, Popconfirm, Tree, Space, Modal } from 'antd';
3
+
4
+export default (props) => {
5
+  const data = [
6
+    'Racing car sprays burning fuel into crowd.',
7
+    'Japanese princess to wed commoner.',
8
+    'Australian walks 100km after outback crash.',
9
+    'Man charged over missing wedding girl.',
10
+    'Los Angeles battles huge wildfires.',
11
+  ];
12
+
13
+  const [visible, setVisible] = React.useState(false);
14
+  const [inText, setInText] = React.useState();
15
+
16
+  return (
17
+    <>
18
+      <List
19
+        header='角色列表'
20
+        style={{ background: '#fff' }}
21
+        bordered
22
+        dataSource={data}
23
+        renderItem={item => (
24
+          <List.Item
25
+            style={{ width: '100%' }}
26
+            actions={[
27
+              <Button key='edit' type='link' onClick={() => onEdit(item)}>编辑</Button>,
28
+              <Popconfirm key='delete' title="确认删除?" onConfirm={() => onDelete(item)}>
29
+                <Button type='link' danger>删除</Button>
30
+              </Popconfirm>
31
+            ]}
32
+          >
33
+            <div onClick={() => props.onChange(item)}>
34
+              {item}
35
+            </div>
36
+          </List.Item>
37
+        )}
38
+      />
39
+      <Modal
40
+        title="Basic Modal"
41
+        open={visible}
42
+        onOk={handleOk}
43
+        onCancel={() => setVisible(false)}
44
+      >
45
+        <Input value={inText} onChange={e => setInText(e.target.value)} />
46
+      </Modal>
47
+    </>
48
+  )
49
+}

+ 0
- 0
src/pages/roles/menus.jsx 查看文件


+ 105
- 0
src/pages/user/Role.jsx 查看文件

@@ -0,0 +1,105 @@
1
+import React from 'react';
2
+import { Button, Row, Col, Card, List, Popconfirm, Tree, Space, Modal } from 'antd';
3
+
4
+export default (props) => {
5
+  const data = [
6
+    'Racing car sprays burning fuel into crowd.',
7
+    'Japanese princess to wed commoner.',
8
+    'Australian walks 100km after outback crash.',
9
+    'Man charged over missing wedding girl.',
10
+    'Los Angeles battles huge wildfires.',
11
+  ];
12
+
13
+  const treeData = [
14
+    {
15
+      title: 'parent 1',
16
+      key: '0-0',
17
+      children: [
18
+        {
19
+          title: 'parent 1-0',
20
+          key: '0-0-0',
21
+          disabled: true,
22
+          children: [
23
+            {
24
+              title: 'leaf',
25
+              key: '0-0-0-0',
26
+              disableCheckbox: true,
27
+            },
28
+            {
29
+              title: 'leaf',
30
+              key: '0-0-0-1',
31
+            },
32
+          ],
33
+        },
34
+        {
35
+          title: 'parent 1-1',
36
+          key: '0-0-1',
37
+          children: [
38
+            {
39
+              title: (
40
+                <span
41
+                  style={{
42
+                    color: '#1890ff',
43
+                  }}
44
+                >
45
+                  sss
46
+                </span>
47
+              ),
48
+              key: '0-0-1-0',
49
+            },
50
+          ],
51
+        },
52
+      ],
53
+    },
54
+  ];
55
+
56
+  const onSelect = (selectedKeys, info) => {
57
+    console.log('selected', selectedKeys, info);
58
+  };
59
+  const onCheck = (checkedKeys, info) => {
60
+    console.log('onCheck', checkedKeys, info);
61
+  };
62
+
63
+  return (
64
+    <div>
65
+      <Row gutter={24}>
66
+        <Col span={8}>
67
+          <List
68
+            header='角色列表'
69
+            style={{ background: '#fff' }}
70
+            bordered
71
+            dataSource={data}
72
+            renderItem={item => (
73
+              <List.Item
74
+                style={{ width: '100%' }}
75
+                actions={[
76
+                  <Button key='edit' type='link' onClick={() => onEdit(item)}>编辑</Button>,
77
+                  <Popconfirm key='delete' title="确认删除?" onConfirm={() => onDelete(item)}>
78
+                    <Button type='link' danger>删除</Button>
79
+                  </Popconfirm>
80
+                ]}
81
+              >
82
+                <div onClick={() => setCurrent(item)}>
83
+                  {item}
84
+                </div>
85
+              </List.Item>
86
+            )}
87
+          />
88
+        </Col>
89
+        <Col span={16}>
90
+          <Card title='授权菜单' extra={<Button type='primary' ghost>保存</Button>}>
91
+            <Tree
92
+              checkable
93
+              defaultExpandedKeys={['0-0-0', '0-0-1']}
94
+              defaultSelectedKeys={['0-0-0', '0-0-1']}
95
+              defaultCheckedKeys={['0-0-0', '0-0-1']}
96
+              onSelect={onSelect}
97
+              onCheck={onCheck}
98
+              treeData={treeData}
99
+            />
100
+          </Card>
101
+        </Col>
102
+      </Row>
103
+    </div>
104
+  )
105
+}

+ 8
- 0
src/routes/routes.jsx 查看文件

@@ -29,6 +29,7 @@ import StockClassificationList from '@/pages/stockClassification/list';
29 29
 import StockClassificationEdit from '@/pages/stockClassification/edit';
30 30
 import RotationChartList from '@/pages/rotationChart/list';
31 31
 import RotationChartEdit from '@/pages/rotationChart/edit';
32
+import Roles from '@/pages/user/Role';
32 33
 
33 34
 /**
34 35
  * meta 用来扩展自定义数据数据
@@ -225,6 +226,13 @@ export default [
225 226
               title: '库存分类维护',
226 227
               hideInMenu: true,
227 228
             },
229
+          },
230
+          {
231
+            path: 'roles',
232
+            element: <Roles />,
233
+            meta: {
234
+              title: '系统角色管理',
235
+            },
228 236
           }
229 237
         ],
230 238
       },