zlisen 3 年之前
父節點
當前提交
d1e68c108a

+ 35
- 35
config/routes.js 查看文件

@@ -398,7 +398,29 @@ export default [
398 398
                 hideInMenu: true,
399 399
                 component: './news/list/Edit',
400 400
               },
401
-
401
+              //+购房百科
402
+              {
403
+                path: '/news/Sellhouse/index',
404
+                name: '购房百科',
405
+                component: './system/Sellhouse/index',
406
+              },
407
+              {
408
+                path: '/news/houseTypes/index',
409
+                name: '购房百百科类型',
410
+                component: './system/Sellhouse/houseTypes/index',
411
+              },
412
+              {
413
+                path: '/news/Sellhouse/Edit',
414
+                name: '编辑购房百科',
415
+                hideInMenu: true,
416
+                component: './system/Sellhouse/Edit',
417
+              },
418
+              {
419
+                path: '/news/Sellhouse/houseTypes/Newindex',
420
+                name: '编辑购房百百科类型',
421
+                hideInMenu: true,
422
+                component: './system/Sellhouse/houseTypes/Newindex',
423
+              },
402 424
               // {
403 425
               //   path: '/news/list/NewsList',
404 426
               //   name: '资讯列表',
@@ -505,7 +527,7 @@ export default [
505 527
           {
506 528
             //帮我找房页面+
507 529
             path: '/findRoom',
508
-            name: '帮我找房',
530
+            name: '需求反馈',
509 531
             component: '../layouts/BlankLayout',
510 532
             routes: [
511 533
               {
@@ -644,44 +666,22 @@ export default [
644 666
             name: '系统管理',
645 667
             component: '../layouts/BlankLayout',
646 668
             routes: [
647
-              {
648
-                path: '/system/messageList',
649
-                name: '客户留言',
650
-                component: './system/messageList',
651
-              },
652
-              {
653
-                path: '/system/report',
654
-                name: '报表数据',
655
-                component: './system/report',
656
-              },
669
+              // {
670
+              //   path: '/system/messageList',
671
+              //   name: '客户留言',
672
+              //   component: './system/messageList',
673
+              // },
674
+              // {
675
+              //   path: '/system/report',
676
+              //   name: '报表数据',
677
+              //   component: './system/report',
678
+              // },
657 679
               {
658 680
                 path: '/system/intention',
659 681
                 name: '意向值',
660 682
                 component: './system/intention',
661 683
               },
662
-              //+购房百科
663
-              {
664
-                path: '/system/Sellhouse/index',
665
-                name: '购房百科',
666
-                component: './system/Sellhouse/index',
667
-              },
668
-              {
669
-                path: '/system/houseTypes/index',
670
-                name: '购房百百科类型',
671
-                component: './system/Sellhouse/houseTypes/index',
672
-              },
673
-              {
674
-                path: '/system/Sellhouse/Edit',
675
-                name: '编辑购房百科',
676
-                hideInMenu: true,
677
-                component: './system/Sellhouse/Edit',
678
-              },
679
-              {
680
-                path: '/system/Sellhouse/houseTypes/Newindex',
681
-                name: '编辑购房百百科类型',
682
-                hideInMenu: true,
683
-                component: './system/Sellhouse/houseTypes/Newindex',
684
-              },
684
+
685 685
               // {
686 686
               //   path: '/system/housingPolicy/list',
687 687
               //   name: '购房百科',

+ 37
- 9
src/models/user.js 查看文件

@@ -1,8 +1,8 @@
1 1
 import { fetch, apis } from '@/utils/request';
2
-import { setAuthority } from '@/utils/authority'
2
+import { setAuthority } from '@/utils/authority';
3 3
 import { setAllBtnAuth, setUserBtnAuth } from '@/components/AuthButton';
4 4
 
5
-const getCurrentUser = fetch(apis.user.current)
5
+const getCurrentUser = fetch(apis.user.current);
6 6
 
7 7
 const UserModel = {
8 8
   namespace: 'user',
@@ -15,25 +15,38 @@ const UserModel = {
15 15
     *fetchCurrent(_, { call, put }) {
16 16
       try {
17 17
         const response = yield call(getCurrentUser);
18
-  
18
+
19 19
         yield put({
20 20
           type: 'saveCurrentUser',
21 21
           payload: response,
22 22
         });
23 23
       } catch (err) {
24
-        console.error(err)
24
+        console.error(err);
25
+      }
26
+    },
27
+    *fetchOrganization(payload, { call, put }) {
28
+      console.log('-------');
29
+      try {
30
+        // const response = yield call(getCurrentUser);
31
+
32
+        yield put({
33
+          type: 'saveOrganization',
34
+          payload: payload,
35
+        });
36
+      } catch (err) {
37
+        console.error(err);
25 38
       }
26 39
     },
27 40
   },
28 41
   reducers: {
29 42
     saveCurrentUser(state, { payload }) {
30
-      const { taUser = {} , menuList = [], buttonList = [] } = payload || {}
31
-      const currentUser = { ...taUser, roles: (taUser.roles || []).map(x => x.roleId) }
43
+      const { taUser = {}, menuList = [], buttonList = [] } = payload || {};
44
+      const currentUser = { ...taUser, roles: (taUser.roles || []).map(x => x.roleId) };
32 45
 
33
-      setAllBtnAuth(buttonList)
34
-      setUserBtnAuth(currentUser.buttons)
46
+      setAllBtnAuth(buttonList);
47
+      setUserBtnAuth(currentUser.buttons);
35 48
 
36
-      setAuthority(currentUser.roles)
49
+      setAuthority(currentUser.roles);
37 50
 
38 51
       return { ...state, currentUser, menuList, buttonList };
39 52
     },
@@ -52,6 +65,21 @@ const UserModel = {
52 65
         },
53 66
       };
54 67
     },
68
+    // institutionList
69
+    saveOrganization(
70
+      state = {
71
+        currentUser: {},
72
+      },
73
+      { payload },
74
+    ) {
75
+      return {
76
+        ...state,
77
+        currentUser: {
78
+          ...state.currentUser,
79
+          institutionList: payload,
80
+        },
81
+      };
82
+    },
55 83
   },
56 84
 };
57 85
 export default UserModel;

+ 251
- 0
src/pages/staff/Organization/index copy.jsx 查看文件

@@ -0,0 +1,251 @@
1
+
2
+import { Row, Col, Card, Tree, Form, Tabs, TreeSelect, Input, InputNumber, Modal, Button, message } from 'antd'
3
+import React, { useState, useEffect } from 'react';
4
+import request from '@/utils/request';
5
+import apis from '@/services/apis';
6
+import moment from 'moment';
7
+import TreedataFrom from './form';
8
+import TreedataAdd from './addForm';
9
+import { values } from 'lodash';
10
+const { TreeNode, DirectoryTree } = Tree;
11
+const FormItem = Form.Item;
12
+const { Search } = Input;
13
+const { TabPane } = Tabs;
14
+
15
+const treeData = []
16
+const updateTreeData = fetch(apis.Institution.instiAlert); //接口
17
+
18
+
19
+
20
+// const item = this.info.node.key 
21
+
22
+class TreeDemo extends React.Component {
23
+  formRef = React.createRef();
24
+
25
+  constructor(props) {
26
+    super(props)
27
+    this.state = {
28
+      // autoExpandParent: false,
29
+      // treeTitle: [info.node.props],
30
+      // checkedKeys: ['0-0-0'],
31
+      expandedKeys: [],//展开的key
32
+      checkedKeys: [],//选中的key
33
+      autoExpandParent: true,
34
+      searchValue: '',
35
+      selectedKeys: [],//搜索得key
36
+      checked: true,
37
+      treeData: [],
38
+      testarr: []
39
+    };
40
+  }
41
+
42
+
43
+  // onExpand = expandedKeys => {
44
+  //   this.setState({
45
+  //     expandedKeys,
46
+  //     autoExpandParent: false,
47
+  //   });
48
+  // };
49
+
50
+
51
+
52
+  // --------标签页
53
+  callback = (key) => {
54
+    console.log(key);
55
+  }
56
+
57
+
58
+  onExpand = expandedKeys => {
59
+    console.log('onExpand', expandedKeys);
60
+
61
+    // 如果没有将 autoExpandParent 设置为 false,如果子项展开,父项不能折叠。
62
+    // 或者,您可以删除所有扩展的子键。
63
+    this.setState({
64
+      expandedKeys,
65
+      autoExpandParent: false,
66
+    });
67
+  };
68
+
69
+  handelSex = e => {
70
+    this.setState({
71
+      sex: e.target.value
72
+    });
73
+    console.log(value);
74
+  };
75
+
76
+  //修改
77
+
78
+  onChangethis = async (value) => {
79
+    //获取tree的修改前数据
80
+    const testarr = this.state.treeData
81
+    //把tree的修改前数据赋修改代存数据
82
+    // let Data1 = this.state.treeData
83
+    console.log('value*********>>', value)
84
+    // console.log('Data1------------>', Data1)
85
+    // urlData: { id: value.institutionId }
86
+    // //修改树的数据存在Data1 
87
+    // for (var i = 0; i < testarr.length; i++) {
88
+    //   // console.log('ID------------>', Data1[i].key);
89
+    //   if (testarr[i].key == value.institutionId) {
90
+    //     Data1[i] = value
91
+    //     const res = request(`/api/admin/institution/${Data1[i].institutionId}`, {
92
+    //       method: 'PUT',
93
+    //       data: value,
94
+    //     })
95
+    //     console.log('*************', value)
96
+    //     // console.log('*institutionName*****', institutionName)
97
+
98
+    //     if (res.success) {
99
+    //       message.success("成功")
100
+    //     } else {
101
+    //       message.error("失败")
102
+    //     }
103
+    //   }
104
+    // }
105
+    // this.setState({
106
+    //   treeData1: Data1
107
+    // }, () => {
108
+    //   message.success('修改成功!')
109
+    // })
110
+
111
+  }
112
+
113
+
114
+  //单击赋值
115
+  onSelect = (values, info) => {
116
+    this.setState({ values }, () => {
117
+      this.formRef.current.setFieldsValue({
118
+        ...info.node.props,
119
+        // institutionId: info.node.props.institutionId,//event
120
+        // day: moment(info.node.props.day)
121
+      })
122
+      console.log(info.node.props);
123
+    })
124
+  }
125
+
126
+  //首次加载
127
+  async institutionTree(params) {
128
+    let arr = []
129
+    return request('/api/admin/institution/list', {
130
+      method: 'GET',
131
+      data: params,
132
+    }).then((testarr2) => {
133
+      this.setState({ testarr: testarr2 }, () => {
134
+        // console.log("testarr2")
135
+        // console.log(this.state.testarr)
136
+        // title: 'institutionId',
137
+        // name: 'institutionName',
138
+        // key: '0-0-0',
139
+        const arr2 = this.state.testarr
140
+        for (var i = 0; i < this.state.testarr.length; i++) {
141
+          let list = {
142
+            title: '',
143
+            institutionName: 'institutionName',
144
+            // name: 'institutionId',
145
+            institutionId: 'institutionId',
146
+            key: '0-0-0',
147
+          }
148
+          list.institutionName = arr2[i].institutionName
149
+          list.title = arr2[i].institutionName
150
+          list.institutionId = arr2[i].institutionId
151
+          list.key = arr2[i].institutionId
152
+          // '0' + i.toString
153
+          arr.push(list)
154
+        }
155
+        // console.log("arr")
156
+        // console.log(arr)
157
+        this.setState({
158
+          treeData: arr
159
+        })
160
+
161
+      })
162
+      // console.log(this.getTreeData)
163
+    })
164
+  }
165
+
166
+
167
+
168
+
169
+  UNSAFE_componentWillMount() {
170
+    this.institutionTree([])
171
+
172
+  }
173
+
174
+
175
+  renderTreeNodes = data =>
176
+    (data || []).map(item => {//初始化data
177
+      if (item.children) {
178
+        return (
179
+          <TreeNode title={item.title} key={item.key} dataRef={item}  >
180
+            {this.renderTreeNodes(item.children)}
181
+          </TreeNode >
182
+        );
183
+      }
184
+      return <TreeNode key={item.key} {...item} />;
185
+    });
186
+
187
+
188
+
189
+
190
+
191
+  render() {
192
+    const { searchValue, autoExpandParent, expandedKeys, checkedKeys } = this.state;
193
+    return (
194
+      <Card>
195
+        <Row >
196
+          <Col xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 0 }}>
197
+            <Card>
198
+              <FormItem
199
+                label="管辖部门"
200
+              >
201
+                <Search style={{ marginBottom: 8 }} placeholder="Search" onChange={this.onChange} />
202
+                <Tree
203
+                  // api={apis.Institution.instIist}
204
+                  // checkable
205
+                  onExpand={this.onExpand}
206
+                  expandedKeys={expandedKeys}
207
+                  autoExpandParent={autoExpandParent}
208
+                  // checkedKeys={checkedKeys}
209
+
210
+                  showLine
211
+                  // defaultExpandedKeys={['0-0']}
212
+                  onSelect={this.onSelect}
213
+                  treeData={this.state.treeData}
214
+                // treeData={loop(gData)}
215
+                // api={apis.Institution.instIist} 
216
+                >
217
+                  {this.renderTreeNodes(this.state.treeData)}
218
+                  {/* 动态渲染 */}
219
+                </Tree >
220
+              </FormItem>
221
+            </Card>
222
+          </Col>
223
+          <Col xs={{ span: 10, offset: 10 }} lg={{ span: 10, offset: 4 }}>
224
+            <Card>
225
+              <Tabs defaultActiveKey='1' onChange={this.callback}  >
226
+                <TabPane tab='编辑' key='1'>
227
+                  <TreedataFrom
228
+                    ref={this.formRef}
229
+                    api={apis.Institution.instiAlert}
230
+                    triggerRef={this.bindRef}
231
+                    onChangethis={this.onChangethis}
232
+                    onSubmit={this.onChangethis}
233
+                  />
234
+                </TabPane>
235
+                {/* <TabPane tab='新增' key='2'>
236
+                  <TreedataAdd
237
+                  >
238
+                  </TreedataAdd>
239
+                </TabPane> */}
240
+
241
+              </Tabs>
242
+            </Card>
243
+          </Col>
244
+        </Row>
245
+      </Card>
246
+    );
247
+  }
248
+
249
+}
250
+
251
+export default TreeDemo

+ 232
- 222
src/pages/staff/Organization/index.jsx 查看文件

@@ -1,251 +1,261 @@
1
-
2
-import { Row, Col, Card, Tree, Form, Tabs, TreeSelect, Input, InputNumber, Modal, Button, message } from 'antd'
1
+import {
2
+  Row,
3
+  Col,
4
+  Card,
5
+  Tree,
6
+  Form,
7
+  Tabs,
8
+  TreeSelect,
9
+  Input,
10
+  InputNumber,
11
+  Modal,
12
+  Button,
13
+  message,
14
+  Icon,
15
+} from 'antd';
3 16
 import React, { useState, useEffect } from 'react';
4 17
 import request from '@/utils/request';
5 18
 import apis from '@/services/apis';
6 19
 import moment from 'moment';
7 20
 import TreedataFrom from './form';
8 21
 import TreedataAdd from './addForm';
9
-import { values } from 'lodash';
22
+import { connect } from 'dva';
23
+import { add } from 'lodash';
24
+
10 25
 const { TreeNode, DirectoryTree } = Tree;
11 26
 const FormItem = Form.Item;
12 27
 const { Search } = Input;
13 28
 const { TabPane } = Tabs;
14 29
 
15
-const treeData = []
16
-const updateTreeData = fetch(apis.Institution.instiAlert); //接口
17
-
18
-
19
-
20
-// const item = this.info.node.key 
21
-
22
-class TreeDemo extends React.Component {
23
-  formRef = React.createRef();
24
-
25
-  constructor(props) {
26
-    super(props)
27
-    this.state = {
28
-      // autoExpandParent: false,
29
-      // treeTitle: [info.node.props],
30
-      // checkedKeys: ['0-0-0'],
31
-      expandedKeys: [],//展开的key
32
-      checkedKeys: [],//选中的key
33
-      autoExpandParent: true,
34
-      searchValue: '',
35
-      selectedKeys: [],//搜索得key
36
-      checked: true,
37
-      treeData: [],
38
-      testarr: []
30
+const getTreeFrom = arr => {
31
+  const copy = (arr || []).map(it => ({ ...it, children: undefined }));
32
+
33
+  const tree = [];
34
+  for (let inx in copy) {
35
+    const it = copy[inx];
36
+    const key = it.institutionCode;
37
+    const node = {
38
+      key,
39
+      value: it.institutionId,
40
+      title: it.institutionName,
41
+      children: it.children,
42
+      parent: it.parent,
39 43
     };
40
-  }
41
-
42
-
43
-  // onExpand = expandedKeys => {
44
-  //   this.setState({
45
-  //     expandedKeys,
46
-  //     autoExpandParent: false,
47
-  //   });
48
-  // };
49
-
50
-
44
+    const parent = key.length === 2 ? undefined : key.substring(0, key.length - 2);
45
+
46
+    if (parent) {
47
+      for (let cur of copy) {
48
+        if ((cur.institutionCode || cur.key) === parent) {
49
+          node.parent = cur;
50
+          cur.children = [...(cur.children || []), node];
51
+          break;
52
+        }
53
+      }
54
+    }
51 55
 
52
-  // --------标签页
53
-  callback = (key) => {
54
-    console.log(key);
56
+    copy[inx] = node;
57
+    tree.push(node);
55 58
   }
56
-
57
-
58
-  onExpand = expandedKeys => {
59
-    console.log('onExpand', expandedKeys);
60
-
61
-    // 如果没有将 autoExpandParent 设置为 false,如果子项展开,父项不能折叠。
62
-    // 或者,您可以删除所有扩展的子键。
63
-    this.setState({
64
-      expandedKeys,
65
-      autoExpandParent: false,
66
-    });
59
+  return tree.filter(x => !x.parent);
60
+};
61
+
62
+const Organization = props => {
63
+  const { user, ...leftProps } = props;
64
+
65
+  const [value, setValue] = useState('');
66
+  const [type, setType] = useState();
67
+  const [visible, setVisible] = useState(false);
68
+  const [institutionData, setInstitutionData] = useState({});
69
+  const [confirmLoading, setConfirmLoading] = useState(false);
70
+
71
+  const handleOk = () => {
72
+    setConfirmLoading(true);
73
+    try {
74
+      if (value) {
75
+        if (type == 'add') {
76
+          request({
77
+            ...apis.Institution.instSave,
78
+            data: { parentInstitutionId: institutionData.value, institutionName: value },
79
+          })
80
+            .then(data => {
81
+              props.dispatch({
82
+                type: 'user/saveOrganization',
83
+                payload: user.institutionList.concat(data),
84
+              });
85
+              setConfirmLoading(false);
86
+              setVisible(false);
87
+
88
+              message.info('操作成功');
89
+            })
90
+            .catch(err => {
91
+              message.info(err.msg || err.message);
92
+            });
93
+        } else {
94
+          request({
95
+            ...apis.Institution.instiAlert,
96
+            urlData: { id: institutionData.value },
97
+            data: { institutionName: value },
98
+          })
99
+            .then(data => {
100
+              props.dispatch({
101
+                type: 'user/saveOrganization',
102
+                payload: user.institutionList.map(x => {
103
+                  if (x.institutionId == institutionData.value) {
104
+                    return { ...x, institutionName: value };
105
+                  }
106
+                  return x;
107
+                }),
108
+              });
109
+              setConfirmLoading(false);
110
+              setVisible(false);
111
+              message.info('操作成功');
112
+            })
113
+            .catch(err => {
114
+              message.info(err.msg || err.message);
115
+            });
116
+        }
117
+      }
118
+    } catch (err) {
119
+      console.error(err);
120
+    }
67 121
   };
68 122
 
69
-  handelSex = e => {
70
-    this.setState({
71
-      sex: e.target.value
72
-    });
73
-    console.log(value);
123
+  const handleCancel = () => {
124
+    setVisible(false);
74 125
   };
75 126
 
76
-  //修改
77
-
78
-  onChangethis = async (value) => {
79
-    //获取tree的修改前数据
80
-    const testarr = this.state.treeData
81
-    //把tree的修改前数据赋修改代存数据
82
-    // let Data1 = this.state.treeData
83
-    console.log('value*********>>', value)
84
-    // console.log('Data1------------>', Data1)
85
-    // urlData: { id: value.institutionId }
86
-    // //修改树的数据存在Data1 
87
-    // for (var i = 0; i < testarr.length; i++) {
88
-    //   // console.log('ID------------>', Data1[i].key);
89
-    //   if (testarr[i].key == value.institutionId) {
90
-    //     Data1[i] = value
91
-    //     const res = request(`/api/admin/institution/${Data1[i].institutionId}`, {
92
-    //       method: 'PUT',
93
-    //       data: value,
94
-    //     })
95
-    //     console.log('*************', value)
96
-    //     // console.log('*institutionName*****', institutionName)
97
-
98
-    //     if (res.success) {
99
-    //       message.success("成功")
100
-    //     } else {
101
-    //       message.error("失败")
102
-    //     }
103
-    //   }
104
-    // }
105
-    // this.setState({
106
-    //   treeData1: Data1
107
-    // }, () => {
108
-    //   message.success('修改成功!')
109
-    // })
110
-
111
-  }
112
-
127
+  const add = row => {
128
+    setVisible(true);
129
+    setType('add');
130
+    setValue();
131
+    setInstitutionData(row);
132
+  };
113 133
 
114
-  //单击赋值
115
-  onSelect = (values, info) => {
116
-    this.setState({ values }, () => {
117
-      this.formRef.current.setFieldsValue({
118
-        ...info.node.props,
119
-        // institutionId: info.node.props.institutionId,//event
120
-        // day: moment(info.node.props.day)
121
-      })
122
-      console.log(info.node.props);
123
-    })
124
-  }
134
+  const edit = row => {
135
+    setVisible(true);
136
+    setType('edit');
137
+    setValue(row.title);
138
+    setInstitutionData(row);
139
+  };
125 140
 
126
-  //首次加载
127
-  async institutionTree(params) {
128
-    let arr = []
129
-    return request('/api/admin/institution/list', {
130
-      method: 'GET',
131
-      data: params,
132
-    }).then((testarr2) => {
133
-      this.setState({ testarr: testarr2 }, () => {
134
-        // console.log("testarr2")
135
-        // console.log(this.state.testarr)
136
-        // title: 'institutionId',
137
-        // name: 'institutionName',
138
-        // key: '0-0-0',
139
-        const arr2 = this.state.testarr
140
-        for (var i = 0; i < this.state.testarr.length; i++) {
141
-          let list = {
142
-            title: '',
143
-            institutionName: 'institutionName',
144
-            // name: 'institutionId',
145
-            institutionId: 'institutionId',
146
-            key: '0-0-0',
147
-          }
148
-          list.institutionName = arr2[i].institutionName
149
-          list.title = arr2[i].institutionName
150
-          list.institutionId = arr2[i].institutionId
151
-          list.key = arr2[i].institutionId
152
-          // '0' + i.toString
153
-          arr.push(list)
154
-        }
155
-        // console.log("arr")
156
-        // console.log(arr)
157
-        this.setState({
158
-          treeData: arr
141
+  const onDelete = row => {
142
+    Modal.confirm({
143
+      title: '确认要删除该组织吗?',
144
+      okText: '确认',
145
+      okType: 'danger',
146
+      cancelText: '取消',
147
+      onOk() {
148
+        request({
149
+          ...apis.Institution.instiDelete,
150
+          urlData: { id: row.value },
159 151
         })
152
+          .then(data => {
153
+            props.dispatch({
154
+              type: 'user/saveOrganization',
155
+              payload: user.institutionList.filter(x => x.institutionId != row.value),
156
+            });
157
+            setConfirmLoading(false);
158
+            setVisible(false);
159
+            message.info('删除成功');
160
+          })
161
+          .catch(err => {
162
+            console.log(err);
163
+            message.info(err.msg || err.message);
164
+          });
165
+      },
166
+      onCancel() {
167
+        console.log('Cancel');
168
+      },
169
+    });
170
+  };
160 171
 
161
-      })
162
-      // console.log(this.getTreeData)
163
-    })
164
-  }
165
-
166
-
167
-
168
-
169
-  UNSAFE_componentWillMount() {
170
-    this.institutionTree([])
171
-
172
-  }
173
-
174
-
175
-  renderTreeNodes = data =>
176
-    (data || []).map(item => {//初始化data
172
+  const getTitle = item => {
173
+    return (
174
+      <>
175
+        {item.title}{' '}
176
+        <Icon
177
+          type="plus"
178
+          onClick={e => {
179
+            e.stopPropagation(), add(item);
180
+          }}
181
+        />{' '}
182
+        <Icon
183
+          type="edit"
184
+          onClick={e => {
185
+            e.stopPropagation(), edit(item);
186
+          }}
187
+        />{' '}
188
+        <Icon
189
+          type="delete"
190
+          onClick={e => {
191
+            e.stopPropagation(), onDelete(item);
192
+          }}
193
+        />
194
+      </>
195
+    );
196
+  };
197
+  const renderTreeNodes = data =>
198
+    data.map(item => {
177 199
       if (item.children) {
178 200
         return (
179
-          <TreeNode title={item.title} key={item.key} dataRef={item}  >
180
-            {this.renderTreeNodes(item.children)}
181
-          </TreeNode >
201
+          <TreeNode title={getTitle(item)} key={item.key} dataRef={item}>
202
+            {renderTreeNodes(item.children)}
203
+          </TreeNode>
182 204
         );
183 205
       }
184
-      return <TreeNode key={item.key} {...item} />;
206
+      return <TreeNode key={item.key} {...item} title={getTitle(item)} />;
185 207
     });
186 208
 
187
-
188
-
189
-
190
-
191
-  render() {
192
-    const { searchValue, autoExpandParent, expandedKeys, checkedKeys } = this.state;
193
-    return (
194
-      <Card>
195
-        <Row >
196
-          <Col xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 0 }}>
197
-            <Card>
198
-              <FormItem
199
-                label="管辖部门"
200
-              >
201
-                <Search style={{ marginBottom: 8 }} placeholder="Search" onChange={this.onChange} />
202
-                <Tree
203
-                  // api={apis.Institution.instIist}
204
-                  // checkable
205
-                  onExpand={this.onExpand}
206
-                  expandedKeys={expandedKeys}
207
-                  autoExpandParent={autoExpandParent}
208
-                  // checkedKeys={checkedKeys}
209
-
210
-                  showLine
211
-                  // defaultExpandedKeys={['0-0']}
212
-                  onSelect={this.onSelect}
213
-                  treeData={this.state.treeData}
214
-                // treeData={loop(gData)}
215
-                // api={apis.Institution.instIist} 
216
-                >
217
-                  {this.renderTreeNodes(this.state.treeData)}
218
-                  {/* 动态渲染 */}
219
-                </Tree >
220
-              </FormItem>
221
-            </Card>
222
-          </Col>
223
-          <Col xs={{ span: 10, offset: 10 }} lg={{ span: 10, offset: 4 }}>
224
-            <Card>
225
-              <Tabs defaultActiveKey='1' onChange={this.callback}  >
226
-                <TabPane tab='编辑' key='1'>
227
-                  <TreedataFrom
228
-                    ref={this.formRef}
229
-                    api={apis.Institution.instiAlert}
230
-                    triggerRef={this.bindRef}
231
-                    onChangethis={this.onChangethis}
232
-                    onSubmit={this.onChangethis}
233
-                  />
234
-                </TabPane>
235
-                {/* <TabPane tab='新增' key='2'>
236
-                  <TreedataAdd
237
-                  >
238
-                  </TreedataAdd>
239
-                </TabPane> */}
240
-
241
-              </Tabs>
242
-            </Card>
243
-          </Col>
244
-        </Row>
209
+  return (
210
+    <>
211
+      <Card style={{ minHeight: '500px' }}>
212
+        <Tree
213
+          defaultExpandAll
214
+        >
215
+          {renderTreeNodes(getTreeFrom(user.institutionList) || [])}
216
+        </Tree>
245 217
       </Card>
246
-    );
247
-  }
248
-
249
-}
250
-
251
-export default TreeDemo
218
+      <Modal
219
+        title={type == 'add' ? '新增' : '编辑'}
220
+        visible={visible}
221
+        onOk={handleOk}
222
+        confirmLoading={confirmLoading}
223
+        onCancel={handleCancel}
224
+      >
225
+        {type == 'add' && <p>上级公司:{institutionData.title}</p>}
226
+        <Input value={value} onChange={e => setValue(e.target.value)}></Input>
227
+      </Modal>
228
+    </>
229
+  );
230
+};
231
+
232
+export default connect(({ user }) => ({
233
+  user: user.currentUser,
234
+}))(Organization);
235
+
236
+// import React, { useEffect, useMemo, useRef, useState } from 'react'
237
+// import { TreeSelect } from 'antd'
238
+// import { connect } from 'dva'
239
+
240
+// const InstitutionSelect = React.forwardRef((props, ref) => {
241
+
242
+//   const { user, ...leftProps } = props
243
+
244
+//   const [expandedKeys, setExpandedKeys] = useState([])
245
+
246
+//   const treeData = useMemo(() => {
247
+//     return getTreeFrom(user.institutionList) || []
248
+//   }, [user.institutionList])
249
+
250
+//   useEffect(() => {
251
+//     setExpandedKeys((user.institutionList || []).map((x) => x.institutionCode))
252
+//   }, [user.institutionList])
253
+
254
+//   return (
255
+//     <TreeSelect allowClear treeExpandedKeys={expandedKeys} onTreeExpand={setExpandedKeys} {...leftProps} treeData={treeData} />
256
+//   )
257
+// })
258
+
259
+// export default connect(({ user }) => ({
260
+//   user: user.currentUser,
261
+// }))(InstitutioSnelect)

+ 0
- 10
src/pages/staff/staff/Edit/index.jsx 查看文件

@@ -214,16 +214,6 @@ const StaffEdit = props => {
214 214
       hidden: () => !isConsultant,
215 215
       rules: [{ required: true, message: '请选择授权项目' }],
216 216
     },
217
-
218
-    {
219
-      label: '背景图',
220
-      name: 'photo',
221
-      type: FieldTypes.ImageUploader,
222
-      // extra: '建议图片尺寸:320*320px,比例1:1,格式:jpg,用于置业顾问头像,限制大小:100k',
223
-      value: userData.photo,
224
-      // beforeUpload: e => photoBeforeUpload(e),
225
-      rules: [{ required: true, message: '请选择图片' }],
226
-    },
227 217
     {
228 218
       label: '简介',
229 219
       name: 'description',

+ 3
- 3
src/pages/system/Sellhouse/NewsHouse.jsx 查看文件

@@ -82,7 +82,7 @@ function body(props) {
82 82
   // 跳转到编辑资讯列表
83 83
   const toEditList = (id) => () => {
84 84
     router.push({
85
-      pathname: '/system/Sellhouse/editNewsList',
85
+      pathname: '/news/Sellhouse/editNewsList',
86 86
       query: {
87 87
         id
88 88
       },
@@ -101,7 +101,7 @@ function body(props) {
101 101
     console.log(data);
102 102
     const cancelPage = () => {
103 103
       router.push({
104
-        pathname: '/system/Sellhouse/NewsHouse',
104
+        pathname: '/news/Sellhouse/NewsHouse',
105 105
       });
106 106
     }
107 107
 
@@ -126,7 +126,7 @@ function body(props) {
126 126
     // 跳转到编辑资讯列表
127 127
     const toEditList = (newsId) => () => {
128 128
       router.push({
129
-        pathname: '/system/Sellhouse/editNewsList',
129
+        pathname: '/news/Sellhouse/editNewsList',
130 130
         query: {
131 131
           newsId,
132 132
         },

+ 1
- 1
src/pages/system/Sellhouse/houseTypes/index.jsx 查看文件

@@ -15,7 +15,7 @@ const header = props => {
15 15
   function addHouseTypes(id) {
16 16
     console.log()
17 17
     router.push({
18
-      pathname: '/system/Sellhouse/houseTypes/Newindex',
18
+      pathname: '/news/Sellhouse/houseTypes/Newindex',
19 19
       query: {id:id},
20 20
     });
21 21
   }

+ 2
- 2
src/pages/system/Sellhouse/index.jsx 查看文件

@@ -30,7 +30,7 @@ const header = (props) => {
30 30
   // 跳转到编辑商品
31 31
   const toEditPolicy = (policyId) => () => {
32 32
     router.push({
33
-      pathname: '/system/Sellhouse/Edit',
33
+      pathname: '/news/Sellhouse/Edit',
34 34
       query: {
35 35
         policyId
36 36
       },
@@ -56,7 +56,7 @@ const header = (props) => {
56 56
       dataIndex: 'title',
57 57
       key: 'title',
58 58
       align: 'center',
59
-      render: (text, record) => <Navigate to={`/system/Sellhouse/Edit?policyId=${record.policyId}`}>{text}</Navigate>
59
+      render: (text, record) => <Navigate to={`/news/Sellhouse/Edit?policyId=${record.policyId}`}>{text}</Navigate>
60 60
     },
61 61
     {
62 62
       title: '副标题',

+ 14
- 9
src/pages/system/intention.jsx 查看文件

@@ -1,4 +1,4 @@
1
-import React, { useState } from 'react';
1
+import React, { useEffect, useState } from 'react';
2 2
 import { Input, Button, message, Checkbox, Row, Col, Card } from 'antd';
3 3
 import styles from '../style/GoodsList.less';
4 4
 import BuildSelect from '../../components/SelectButton/BuildSelect'
@@ -16,9 +16,10 @@ const Edit = (props) => {
16 16
   const [data, setData] = useState([])
17 17
   const [buildingIdValue, setBuildingIdData] = useState('')
18 18
 
19
+
19 20
   const changBuilding = (buildingId) => {
20 21
 
21
-    setBuildingIdData(buildingId)
22
+    // setBuildingIdData(buildingId)
22 23
     request({ ...apis.system.tdBizEventIntention, params: { pageNum: 1, pageSize: 999, buildingId } }).then((data) => {
23 24
       console.log(data)
24 25
       setData(data.records)
@@ -38,20 +39,24 @@ const Edit = (props) => {
38 39
   }
39 40
 
40 41
   const submitValue = () => {
41
-    console.log(buildingIdValue)
42
-    if (buildingIdValue === '') {
43
-      return
44
-    }
45
-    request({ ...apis.system.taBuildingIntentionAddOrUpdate, urlData: { id: buildingIdValue }, data, }).then((data) => {
42
+    // console.log(buildingIdValue)
43
+    // if (buildingIdValue === '') {
44
+    //   return
45
+    // }
46
+    request({ ...apis.system.taBuildingIntentionAddOrUpdate, urlData: { id: -1 }, data, }).then((data) => {
46 47
       message.info("保存成功")
47 48
     })
48 49
   }
49 50
 
51
+  useEffect(()=>{
52
+    changBuilding('-1')
53
+  },[])
54
+
50 55
   return (
51 56
     <Card>
52
-      <Row style={{minHeight:500}}>
57
+      <Row >
53 58
         <Col span={6}>
54
-          <BuildSelect onChange={changBuilding} value={buildingIdValue} />
59
+          {/* <BuildSelect onChange={changBuilding} value={buildingIdValue} /> */}
55 60
         </Col>
56 61
         <Col span={5} style={{ lineHeight: '30px' }}>
57 62
           用户操作