baozhangchao hace 3 años
padre
commit
631c25bed8

+ 0
- 0
src/pages/staff/Organization/addForm.jsx Ver fichero


+ 3
- 3
src/pages/staff/Organization/form.jsx Ver fichero

@@ -60,7 +60,7 @@ const TreedataFrom = React.forwardRef((props, ref) => {
60 60
   //     }
61 61
   //   });
62 62
   // }
63
-  //挂载 我先看看
63
+  //挂载 
64 64
   const componentDidMount = () => {
65 65
     console.log(this.props.FromValue)
66 66
 
@@ -71,7 +71,7 @@ const TreedataFrom = React.forwardRef((props, ref) => {
71 71
   return (
72 72
 
73 73
     <Form   {...formItemLayout} ref={formRef}
74
-      // onChange={onChange}  onSubmit只有一个 随便写个不行吗onDelete
74
+      // onChange={onChange}  
75 75
       onSubmit={e => handleChange(e, props)}
76 76
 
77 77
 
@@ -171,7 +171,7 @@ const TreedataFrom = React.forwardRef((props, ref) => {
171 171
               { required: true, message: '请选择出生日期' }
172 172
             ]
173 173
           })(
174
-            // <RangePicker style={{width: '255px'}} 还是有点问题0.0为啥 />
174
+            // <RangePicker style={{width: '255px'}}  />
175 175
             <DatePicker onChange={onChange} />
176 176
           )
177 177
         }

+ 22
- 9
src/pages/staff/Organization/index.jsx Ver fichero

@@ -1,5 +1,5 @@
1 1
 
2
-import { Row, Col, Card, Tree, Form, TreeSelect, Input, InputNumber, Modal, Button, message } from 'antd'
2
+import { Row, Col, Card, Tree, Form, Tabs, TreeSelect, Input, InputNumber, Modal, Button, message } from 'antd'
3 3
 import React, { useState, useEffect } from 'react';
4 4
 import request from '@/utils/request';
5 5
 import apis from '@/services/apis';
@@ -8,6 +8,7 @@ import TreedataFrom from './form';
8 8
 const { TreeNode, DirectoryTree } = Tree;
9 9
 const FormItem = Form.Item;
10 10
 const { Search } = Input;
11
+const { TabPane } = Tabs;
11 12
 
12 13
 const treeData =
13 14
   [
@@ -55,6 +56,12 @@ class TreeDemo extends React.Component {
55 56
       testarr: []
56 57
     };
57 58
   }
59
+  // --------标签页
60
+  callback = (key) => {
61
+    console.log(key);
62
+  }
63
+
64
+
58 65
 
59 66
 
60 67
   onExpand = expandedKeys => {
@@ -278,14 +285,20 @@ class TreeDemo extends React.Component {
278 285
           </Col>
279 286
           <Col xs={{ span: 10, offset: 10 }} lg={{ span: 10, offset: 4 }}>
280 287
             <Card>
281
-              <TreedataFrom
282
-                ref={this.formRef}
283
-                triggerRef={this.bindRef}
284
-                onChangethis={this.onChangethis}
285
-                onSubmit={this.onChangethis}
286
-
287
-
288
-              />
288
+              <Tabs defaultActiveKey='1' onChange={this.callback}  >
289
+                <TabPane tab='编辑' key='1'>
290
+                  <TreedataFrom
291
+                    ref={this.formRef}
292
+                    triggerRef={this.bindRef}
293
+                    onChangethis={this.onChangethis}
294
+                    onSubmit={this.onChangethis}
295
+                  />
296
+                </TabPane>
297
+                <TabPane tab='新增' key='2'>
298
+                  <div>You cannot set a form field before rendering a field associated with the value. </div>
299
+                </TabPane>
300
+
301
+              </Tabs>
289 302
             </Card>
290 303
           </Col>
291 304
         </Row>

+ 0
- 110
src/pages/staff/Organization/tree.jsx Ver fichero

@@ -1,110 +0,0 @@
1
-
2
-
3
-
4
-// import { Tree } from 'antd';
5
-
6
-// const { TreeNode } = Tree;
7
-
8
-// const treeData = [
9
-//   {
10
-//     title: '0-0',
11
-//     key: '0-0',
12
-//     children: [
13
-//       {
14
-//         title: '0-0-0',
15
-//         key: '0-0-0',
16
-//         children: [
17
-//           { title: '0-0-0-0', key: '0-0-0-0' },
18
-//           { title: '0-0-0-1', key: '0-0-0-1' },
19
-//           { title: '0-0-0-2', key: '0-0-0-2' },
20
-//         ],
21
-//       },
22
-//       {
23
-//         title: '0-0-1',
24
-//         key: '0-0-1',
25
-//         children: [
26
-//           { title: '0-0-1-0', key: '0-0-1-0' },
27
-//           { title: '0-0-1-1', key: '0-0-1-1' },
28
-//           { title: '0-0-1-2', key: '0-0-1-2' },
29
-//         ],
30
-//       },
31
-//       {
32
-//         title: '0-0-2',
33
-//         key: '0-0-2',
34
-//       },
35
-//     ],
36
-//   },
37
-//   {
38
-//     title: '0-1',
39
-//     key: '0-1',
40
-//     children: [
41
-//       { title: '0-1-0-0', key: '0-1-0-0' },
42
-//       { title: '0-1-0-1', key: '0-1-0-1' },
43
-//       { title: '0-1-0-2', key: '0-1-0-2' },
44
-//     ],
45
-//   },
46
-//   {
47
-//     title: '0-2',
48
-//     key: '0-2',
49
-//   },
50
-// ];
51
-
52
-// class Demo extends React.Component {
53
-//   state = {
54
-//     expandedKeys: ['0-0-0', '0-0-1'],
55
-//     autoExpandParent: true,
56
-//     checkedKeys: ['0-0-0'],
57
-//     selectedKeys: [],
58
-//   };
59
-
60
-//   onExpand = expandedKeys => {
61
-//     console.log('onExpand', expandedKeys);
62
-//     // if not set autoExpandParent to false, if children expanded, parent can not collapse.
63
-//     // or, you can remove all expanded children keys.
64
-//     this.setState({
65
-//       expandedKeys,
66
-//       autoExpandParent: false,
67
-//     });
68
-//   };
69
-
70
-//   onCheck = checkedKeys => {
71
-//     console.log('onCheck', checkedKeys);
72
-//     this.setState({ checkedKeys });
73
-//   };
74
-
75
-//   onSelect = (selectedKeys, info) => {
76
-//     console.log('onSelect', info);
77
-//     this.setState({ selectedKeys });
78
-//   };
79
-
80
-//   renderTreeNodes = data =>
81
-//     data.map(item => {
82
-//       if (item.children) {
83
-//         return (
84
-//           <TreeNode title={item.title} key={item.key} dataRef={item}>
85
-//             {this.renderTreeNodes(item.children)}
86
-//           </TreeNode>
87
-//         );
88
-//       }
89
-//       return <TreeNode key={item.key} {...item} />;
90
-//     });
91
-
92
-//   render() {
93
-//     return (
94
-//       <Tree
95
-//         checkable
96
-//         onExpand={this.onExpand}
97
-//         expandedKeys={this.state.expandedKeys}
98
-//         autoExpandParent={this.state.autoExpandParent}
99
-//         onCheck={this.onCheck}
100
-//         checkedKeys={this.state.checkedKeys}
101
-//         onSelect={this.onSelect}
102
-//         selectedKeys={this.state.selectedKeys}
103
-//       >
104
-//         {this.renderTreeNodes(treeData)}
105
-//       </Tree>
106
-//     );
107
-//   }
108
-// }
109
-
110
-// export default Demo