baozhangchao il y a 3 ans
Parent
révision
ef571e29a0

+ 1
- 1
config/routes.js Voir le fichier

@@ -516,7 +516,7 @@ export default [
516 516
             component: '../layouts/BlankLayout',
517 517
             routes: [
518 518
               {
519
-                path: '/home/recommend/home',
519
+                path: '/home/recommend',
520 520
                 name: '找房需求',
521 521
                 component: './home/recommend/index',
522 522
               },

+ 82
- 51
src/pages/building/Developers/Edit.jsx Voir le fichier

@@ -1,12 +1,14 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Input, Button, Card, Form,  notification } from 'antd';
2
+import { Input, Button, Card, Form,  notification,message } from 'antd';
3 3
 import router from 'umi/router';
4 4
 // import Styles from './style.less';
5 5
 import ImageUploader from '../../../components/XForm/ImageUpload';
6 6
 import request from '../../../utils/request';
7 7
 import apis from '../../../services/apis';
8
+import { fetch } from '@/utils/request';
8 9
 
9
-const formItemLayout = {
10
+
11
+  const formItemLayout = {
10 12
     labelCol: {
11 13
       xs: { span: 24 },
12 14
       sm: { span: 8 },
@@ -31,35 +33,69 @@ const formItemLayout = {
31 33
 
32 34
 function Edit(props) {
33 35
   const { getFieldDecorator } = props.form;
36
+  const { form, history } = props;
37
+  const updateBrandData = fetch(apis.brand.alterBrand);
38
+  const saveBrandData=fetch(apis.brand.addBrand);
39
+  const goBack = () => router.goBack(-1);
40
+  const {validateFields}=form;
41
+
34 42
 
35 43
   // eslint-disable-next-line react-hooks/rules-of-hooks
36 44
   let data = {};
37
-  const { id } = props.location.query;
45
+  const { brandId } = props.location.query;
38 46
 
39
-  useEffect(() => {
40
-    if (id) {
41
-      getById(id);
47
+
48
+  useEffect(()=>{
49
+    if (brandId) {
50
+      getById({brandId})
42 51
     }
43
-  }, [id]);
52
+  },[brandId])
53
+
44 54
 
55
+//增+改
45 56
   function handleSubmit(e) {
46 57
     e.preventDefault();
47
-    props.form.validateFields((err, values) => {
48
-      if (!err) {
49
-        // 提交数据
50
-        submitData(values);
58
+    validateFields((err, values) => {
59
+      if (err) {
60
+        return;
61
+        //字符验证未填写---返回
62
+      }
63
+      if (brandId) {
64
+        updateBrandData({
65
+          data: {
66
+            ...values,
67
+          },
68
+          urlData: { id: brandId }
69
+        }).then(() => {
70
+          // setLoading(false);
71
+          message.success('数据更新成功');
72
+          goBack()
73
+        }).catch((err) => {
74
+          // setLoading(false);//loading消失
75
+          message.error(err.message || err);
76
+        })
77
+      } else {
78
+        saveBrandData({ data: values }).then(() => {
79
+          // setLoading(false);
80
+          message.success('数据保存成功');
81
+          goBack()
82
+        }).catch((err) => {
83
+          // setLoading(false);//loading消失
84
+          message.error(err.message || err);
85
+        })
51 86
       }
52 87
     });
53
-  }
54 88
 
89
+
90
+
91
+  }
55 92
   // 获取详情信息
56
-  function getById(currentId) {
57
-    request({ ...apis.buildingType.getById, urlData: { id: currentId } }).then(res => {
93
+  function getById(res) {
94
+    request({ ...apis.brand.getBrand, urlData: { id: res.brandId } }).then(res => {
58 95
       data = res;
59 96
       props.form.setFieldsValue(res);
60 97
     });
61 98
   }
62
-
63 99
   const openNotificationWithIcon = (type, message) => {
64 100
     notification[type]({
65 101
       message,
@@ -67,46 +103,41 @@ function Edit(props) {
67 103
     });
68 104
   };
69 105
 
70
-  function submitData(dataSources) {
71
-    if (id !== '') {
72
-      // 修改
73
-      updateType(dataSources);
74
-      return;
75
-    }
76 106
 
77
-    dataSources.status = 1;
78
-    dataSources.createDate = new Date();
79
-    request({ ...apis.buildingType.add, data: { ...dataSources } })
80
-      .then(() => {
81
-        // eslint-disable-next-line no-unused-expressions
82
-        openNotificationWithIcon('success', '操作成功');
83
-        router.go(-1);
84
-      })
85
-      .catch(err => {});
86
-  }
107
+//修改
108
+  // function submitData(dataSources) {
109
+  //   if (id !== '') {
110
+  //     // 修改
111
+  //     updateType(dataSources);
112
+  //     return;
113
+  //   }
114
+  //   dataSources.status = 1;
115
+  //   dataSources.createDate = new Date();
116
+  //   request({ ...apis.brand.alterBrand, data: { ...dataSources } })
117
+  //     .then(() => {
118
+  //       // eslint-disable-next-line no-unused-expressions
119
+  //       openNotificationWithIcon('success', '操作成功');
120
+  //       router.go(-1);
121
+  //     })
122
+  //     .catch(err => {});
123
+  // }
87 124
 
88
-  // 修改
89
-  function updateType(row) {
90
-    // const { url, method } = apis.buildingType.update
91
-    // const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(row.buildingTypeId)
92
-
93
-    // request({ url: tempUrl, method, data: { ...row } }).then(() => {
94
-    //   router.go(-1)
95
-    // })
96
-    request({ ...apis.buildingType.update, urlData: { id: row.buildingTypeId }, data: { ...row } })
97
-      .then(() => {
98
-        // eslint-disable-next-line no-unused-expressions
99
-        openNotificationWithIcon('success', '操作成功');
100
-        router.go(-1);
101
-      })
102
-      .catch(err => {});
103
-  }
125
+  //新增
126
+  // function updateType(row) {
127
+  //   request({ ...apis.brand.addBrand, urlData: { id: row.brandId }, data: { ...row } })
128
+  //     .then(() => {
129
+  //       // eslint-disable-next-line no-unused-expressions
130
+  //       openNotificationWithIcon('success', '操作成功');
131
+  //       router.go(-1);
132
+  //     })
133
+  //     .catch(err => {});
134
+  // }
104 135
 
105 136
   return (
106 137
     <Card>
107 138
       <Form {...formItemLayout} onSubmit={handleSubmit}>
108 139
       <Form.Item label="开发商名称">
109
-          {getFieldDecorator('name', {
140
+          {getFieldDecorator('brandName', {
110 141
             rules: [
111 142
               {
112 143
                 required: true,
@@ -116,17 +147,17 @@ function Edit(props) {
116 147
           })(<Input style={{width:200}}/>)}
117 148
         </Form.Item>
118 149
         <Form.Item label="开发商索引">
119
-          {getFieldDecorator('ind', {
150
+          {getFieldDecorator('indexLetter', {
120 151
             rules: [{ required: true, message: '请输入开发商索引' }],
121 152
           })(<Input style={{width:200}}/>)}
122 153
         </Form.Item>
123 154
         <Form.Item label="品牌宣传图">
124
-          {getFieldDecorator('img', {
155
+          {getFieldDecorator('brandImg', {
125 156
             rules: [{ required: true, message: '请上传品牌宣传图' }],
126 157
         })(<ImageUploader />)}
127 158
         </Form.Item>
128 159
         <Form.Item label="开发商简介">
129
-          {getFieldDecorator('buildingTypeName', {
160
+          {getFieldDecorator('brandRemark', {
130 161
             rules: [{ required: true, message: '请输入开发商简介' }],
131 162
           })(<Input.TextArea style={{width:400}} placeholder="120字内的简介"/>)}
132 163
         </Form.Item>

+ 39
- 13
src/pages/building/Developers/index.jsx Voir le fichier

@@ -1,40 +1,66 @@
1
-import React, { useMemo, useRef, useCallback, useState } from 'react'
2
-import {Button} from 'antd'
1
+import React, { useMemo, useRef, useCallback, useState, useEffect } from 'react'
2
+import {Button,message} from 'antd'
3 3
 import apis from '@/services/apis'
4 4
 import AuthButton from '@/components/AuthButton';
5 5
 import QueryTable from '@/components/QueryTable'
6 6
 import getTableColumns from './tableColumns'
7 7
 import { router } from 'umi';
8
+import { fetch} from '@/utils/request';
9
+import request from '@/utils/request'
8 10
 import getSearchFields from './searchFields'//searchbox
9 11
 
10 12
 export default (props) => {
11 13
   const ref = useRef()
12 14
   const [page, setPage] = useState({current: 1, pageSize: 10})
13 15
   const toEdit = useCallback((row) => {
14
-    //
15 16
     router.push({
16 17
       pathname: '/building/Developers/Edit',
17 18
       query: {
18
-        id: row?.id || undefined,
19
+        brandId: row?.brandId || undefined,
19 20
       },
20
-    });
21
+    });            
21 22
   }, [])
22 23
 
23
-  const onDelete = useCallback((row) => {}, [])//格式
24
-  const searchFields = useMemo(getSearchFields, [])//搜索框
24
+ 
25
+
26
+//编辑
27
+  // const onEdit =useCallback((row,brandId)=>{
28
+  //   request({
29
+  //     ...apis.brand.alterBrand,
30
+  //     urlData: { id: brandId },
31
+  //     data:{ ...row}
32
+  // }).then((data) => {
33
+  //     setNewsData(data)
34
+  // }).catch((err) => {
35
+  //   message.error(err.msg || err.message)
36
+  // })
37
+  // },[])
25 38
 
39
+//删除
40
+  const onDelete = useCallback((row,brandId) => {
41
+    request({ ...apis.brand.deleBrand, urlData: { id: brandId }, data: { ...row, } }).then((data) => {
42
+      ref.current.reload();//调用ref对象都有current对象
43
+      message.info('操作成功!')
44
+    }).catch((err) => {
45
+      console.log(err)
46
+      message.info(err.msg || err.message)
47
+    })
48
+  }, [])//格式
49
+  const searchFields = useMemo(getSearchFields, [])//搜索框
50
+    
26 51
   const tableColumns = useMemo(() => {
27 52
     return getTableColumns({
28
-      page,//可无
53
+      page,//
29 54
       onEdit:(e)=>toEdit(e),
30 55
       onDelete,
56
+      // onEdit,
31 57
     })
32 58
   }, [page])
33 59
 
34 60
   const actionRender = () => {
35 61
     return (
36
-      //name 名字错误
37
-      <AuthButton name="admin.tdBuildingType.add" noRight={null}>
62
+      //name
63
+      <AuthButton name="admin.brand.addBrand" noRight={null}>
38 64
         <Button type="primary" icon="plus" onClick={toEdit} >
39 65
           新增
40 66
         </Button>
@@ -45,9 +71,9 @@ export default (props) => {
45 71
   return (
46 72
     <>
47 73
       <QueryTable
48
-      //搜索组件
49
-        rowKey="buildingId"
50
-        api={apis.building.getList}
74
+        ref={ref}//绑定到table
75
+        rowKey="brandId"
76
+        api={apis.brand.list}
51 77
         columns={tableColumns}
52 78
         actionRender={actionRender}
53 79
         searchFields={searchFields}

+ 1
- 1
src/pages/building/Developers/searchFields.js Voir le fichier

@@ -2,7 +2,7 @@
2 2
 export default () => [
3 3
 
4 4
   {
5
-    name: 'name',
5
+    name: 'brandName',
6 6
     label: '开发商名称',
7 7
     placeholder: '请输入开发商名称',
8 8
   },

+ 17
- 31
src/pages/building/Developers/tableColumns.js Voir le fichier

@@ -1,53 +1,39 @@
1 1
 import { router } from 'umi'
2
-import { Button, Badge } from 'antd'
2
+import React, { useState, useEffect } from 'react';
3
+
4
+import { Button, Badge, message } from 'antd'
3 5
 import moment from 'moment'
4 6
 import OperButton from '@/components/OperButton'
5 7
 import AuthButton from '@/components/AuthButton'
6 8
 import withActions from '@/components/ActionList'
9
+import { getImgURL } from '@/utils/image';
10
+import request, { apis } from '@/utils/request'
7 11
 
8
-export default ({page, onEdit, onDelete}) => [
12
+export default ({page,getBrandData, onEdit, onDelete}) => [
9 13
   {
10 14
     title: '开发商索引字母',
11
-    key: '#',
15
+    dataIndex:'indexLetter',
16
+    key: 'indexLetter',
12 17
     align: 'center',
13
-    render: (t, r, index) => (page.current - 1) * page.pageSize + index + 1,//可无
14 18
   },
15 19
   {
16 20
     title: '开发商名称',
17
-    dataIndex: 'name',
18
-    key: 'name',
21
+    dataIndex: 'brandName',
22
+    key: 'brandName',
19 23
     align: 'center',
20 24
   },
21 25
   {
22 26
     title: '品牌宣传图',
23
-    dataIndex: 'image',
24
-    key: 'image',
27
+    dataIndex: 'brandImg',
28
+    key: 'brandImg',
25 29
     align: 'center',
26
-    render: (_, row) => {
27
-      if (row.image) {
28
-        return <img src={row.image} width={128} height={72} style={{borderRadius: '4px'}} alt="" />
29
-      }
30
-      return null
31
-    }
30
+    render:(_,record)=> <img src={getImgURL(record.brandImg)} style={{width:'165px',height:'104px'}}/>,
32 31
   },
33 32
   {
34 33
     title: '简介',
35
-    dataIndex: 'buildingName',
36
-    key: 'buildingName',
34
+    dataIndex: 'brandRemark',
35
+    key: 'brandRemark',
37 36
     align: 'center',
38
-    // render: (t, row) => (
39
-    //   <AuthButton name="admin.building.update" noRight={t}>
40
-    //     <Button
41
-    //       type="link"
42
-    //       onClick={() => router.push({
43
-    //         pathname: '/building/list/add',
44
-    //         query: {
45
-    //           id: row.buildingId,
46
-    //         },
47
-    //       })}
48
-    //     >{t}</Button>
49
-    //   </AuthButton>
50
-    // )
51 37
   },
52 38
   {
53 39
     title: '操作',
@@ -57,11 +43,11 @@ export default ({page, onEdit, onDelete}) => [
57 43
       <AuthButton name="admin.building.public" noRight={null}>
58 44
         <OperButton onClick={() => onEdit(row)}>编辑</OperButton>
59 45
       </AuthButton>,
60
-      <AuthButton name="admin.building.delete" noRight={null}>
46
+      <AuthButton name="admin.brabd.delete" noRight={null}>
61 47
         <OperButton.Confirm
62 48
           title="确认删除?"
63 49
           content="删除之后不可恢复"
64
-          onClick={() => onDelete(row)}
50
+          onClick={()=>onDelete(row,row.brandId)}
65 51
         >删除</OperButton.Confirm>
66 52
       </AuthButton>
67 53
     ], {noMargin: true})

+ 22
- 32
src/pages/home/Recommend/index.jsx Voir le fichier

@@ -14,22 +14,16 @@ import { fromPairs } from 'lodash';
14 14
 import { backgroundColor } from 'echarts/lib/theme/dark';
15 15
 
16 16
 
17
-// const a={
18
-//   /**
19
-//  *
20
-//  *
21
-//  * @param {*} props
22
-//  * @returns
23
-//  */
24
-
25
-// }
26
-// let(dataIndex){
27
-//   render(){
28
-//     return(
29
-//       <h1><input type="datetime-local" name="ckassname" id="" /></h1>
30
-//     )
31
-//   }
32
-// }
17
+
18
+/**
19
+ *
20
+ *
21
+ * @param {*} props
22
+ * @returns
23
+ */
24
+
25
+
26
+
33 27
 
34 28
 function Recommend() {
35 29
   const [exportLoding,setExportLoding] = useState(false)
@@ -70,6 +64,9 @@ function Recommend() {
70 64
 
71 65
     })
72 66
   }
67
+  function back(){
68
+    window.history.back(-1)
69
+  }
73 70
 
74 71
   function download(data) {
75 72
     if (!data) {
@@ -165,13 +162,7 @@ function Recommend() {
165 162
 
166 163
 
167 164
  const searchFields=[
168
-  // {
169
-  //   name:'builidingId',
170
-  //   label:'用户',
171
-  //   placeholder:'选择用户',
172
-  //   render:()=><BuildSelect style={{width:160}}/>
173 165
 
174
-  // },
175 166
   {
176 167
     name: 'project',
177 168
     label: '意向项目',
@@ -193,12 +184,11 @@ function Recommend() {
193 184
     label: '类型',
194 185
     placeholder: '类型',
195 186
     type: 'select',
196
-    placeholder:'全部',//错误
197 187
     options: [
198
-      {label: '全部'},
199
-      {label: '买房',value:1},
200
-      {label: '租房', value: 2},
201
-      {label: '海外', value: 3}
188
+      {label: '全部',value:''},
189
+      {label: '买房',value: '1'},
190
+      {label: '租房', value: '2'},
191
+      {label: '海外', value: '3'}
202 192
     ]
203 193
   },
204 194
   {
@@ -208,10 +198,10 @@ function Recommend() {
208 198
     type: 'select',
209 199
     placeholder:'全部',//错误
210 200
     options: [
211
-      {label: '全部'},
212
-      {label: '待回访', value: 0},
213
-      {label: '已回访', value: 1},
214
-      {label: '无效', value: 2}
201
+      {label: '全部',value:''},
202
+      {label: '待回访', value: '0'},
203
+      {label: '已回访', value: '1'},
204
+      {label: '无效', value: '2'}
215 205
     ]
216 206
   },
217 207
   ]
@@ -228,7 +218,7 @@ function Recommend() {
228 218
       <QueryTable
229 219
           rowKey="recommendCustomer"
230 220
           // recommendCustomer
231
-          api={apis.homeload.houseSchr}
221
+          api={apis.searchHouse.list}
232 222
           searchFields={searchFields}
233 223
           columns={columns}
234 224
           actionRender={actionRender}

+ 0
- 0
src/pages/staff/Organization/form.jsx Voir le fichier


+ 122
- 126
src/pages/staff/Organization/index.jsx Voir le fichier

@@ -1,144 +1,140 @@
1
-import React, { Component } from 'react';
2
-import { Card, Tree } from 'antd';
3
-const { DirectoryTree } = Tree;
4
-
5
-// function Organization(props) {
6
-  
7
-
8
-
9
-//   return (
10
-//     <>
11
-//      组织架构
12
-//     </>
13
-//   );
14
-// }
15
-
16
-
17
-// export default Organization
18
-
19 1
 
2
+import React, { Component,useState } from 'react';
3
+import { Card, Tree,Icon } from 'antd';
4
+import { render } from 'preact';
5
+import { turn } from 'cli-table';
6
+const { DirectoryTree,TreeNode } = Tree;
20 7
 const treeData = [
21 8
   {
22
-    title: '江苏XX软件集团',
23
-    key: '0-0',
24
-    children: [
25
-      {
26
-        title: '南京123电子科技有限公司',
27
-        key: '0-0-1',
28
-
29
-        // isLeaf: true,
30
-        children: [
31
-          {
32
-            title: '秦淮区分公司',
33
-            key: '0-0-1-0',
34
-            // isLeaf: true,
35
-            children: [
36
-              {
37
-                title: '制造一区',
38
-                key: '0-0-1-1',
39
-                isLeaf: true,
40
-              },
41
-              {
42
-                title: '总裁办公室',
43
-                key: '0-0-1-2',
44
-                isLeaf: true,
45
-              },
46
-              {
47
-                title: '工艺部',
48
-                key: '0-0-1-3',
49
-                isLeaf: true,
50
-              },
51
-              {
52
-                title: '技术部',
53
-                key: '0-0-1-4',
54
-                isLeaf: true,
55
-              },
56
-            ]
57
-          },
58
-        ]
59
-      },
60
-      {
61
-        title: '苏州¥¥科技股份有限公司',
62
-        key: '0-0-0',
63
-        isLeaf: true,
64
-      },
65
-      {
66
-        title: '宿迁ABC电商服务有限公司',
67
-        key: '0-0-0-1',
68
-        isLeaf: true,
69
-      },
70
-    ],
71
-  },
72
-  //---------------
73
-  {
74
-    title: '系统管理',
75
-    key: '0-2',
76
-    children: [
77
-      {
78
-        title: '机器设置',
79
-        key: '0-2-0',
80
-        isLeaf: true,
81
-      },
9
+    value:'江苏省公安厅',
10
+    defaultValue:'0',
11
+    parentKey:'0',
12
+    isEditable:false,
13
+    key:'0',
14
+    children:[
82 15
       {
83
-        title: '散热设置',
84
-        key: '0-2-1',
85
-        // isLeaf: true,
86
-        children:[
87
-          {
88
-            title:'一号风扇',
89
-            key:'0-2-1-0'
90
-          },
91
-          {
92
-            title:'二号风扇',
93
-            key:'0-2-1-1'
94
-          },
95
-        ]
16
+        value:'南京分局',
17
+        key:'0-1',
18
+        defaultValue: "0-1",
19
+        isEditable: false,
96 20
       },
97 21
       {
98
-        title: '广播设置',
99
-        key: '0-2-2',
100
-        isLeaf: true,
22
+        value:'苏州分局',
23
+        key:'0-2',
24
+        defaultValue: "0-2",
25
+        isEditable: false,
101 26
       },
102 27
     ],
103 28
   },
104 29
 ];
105 30
 
106
-const Demo = () => {
107
-  const onSelect = (keys, info) => {
108
-    console.log('Trigger Select', keys, info);
109
-  };
110 31
 
111
-  const onExpand = () => {
112
-    console.log('Trigger Expand');
32
+const expandedKeyArr=['0'];
33
+
34
+
35
+export default function TreeDemo() {
36
+  const[data,setData]=useState(treeData)//获取值,及时更新被修改的值。变量
37
+  const renderTreeNodes=(data)=>{
38
+    let nodeArr=data.map((item)=>{//遍历数据
39
+      item.title=(//修改
40
+        <div style={{display:'flex', minWidth: '100px'}}>
41
+          <span style={{ flex: 'auto' }}>{item.value}</span>
42
+          <span style={{ width: '6em', flex: 'none',marginLeft:'20px' }}>
43
+            {/* 编辑 */}
44
+            <Icon type="edit" onClick={()=>onDelete(item.key)} /> 
45
+            {/* 添加 */}
46
+            <Icon type="diff" onClick={()=>onAdd(item.key)} />
47
+            {/* 删除 */}
48
+            <Icon type="delete"  onClick={()=>onEdit(item.key)}/>
49
+          </span>
50
+        </div>
51
+      )
52
+      if(item.children){//如果有子项就返回下面组件
53
+        return(
54
+          <TreeNode title={item.title} key={item.key} dataRef={item}>
55
+            {renderTreeNodes(item.children)}
56
+            {/* 重新渲染节点 */}
57
+          </TreeNode>//title 接收的 ReactNode类型数据 自定义
58
+        )
59
+      }
60
+      //返回
61
+      return <TreeNode title={item.title} key={item.key} />
62
+    })
63
+      return nodeArr
64
+  };
65
+//添加
66
+  const onAdd=(key)=>{
67
+    // useState 里面数据是不能变的对象。需要slice返回一个新的数组
68
+    addNode(key.treeData);//添加节点 树形
69
+    setData(treeData.slice()) //设置 子项
70
+  }
71
+  //编辑
72
+  const onEdit=(key)=>{
73
+    editNode(key,treeData);
74
+    setData(treeData.slice());
113 75
   };
76
+  const editNode=(key,data)=>
77
+    data.forEach((item)=>{
78
+      if (item.key===key) {
79
+        item.isEditable=true;//可编辑状态更改
80
+      }else{
81
+        item.isEditable=false;
82
+      }
83
+      item.value=item.defaultValue;//当某子项处于编辑状态,改变数据,点击其他时候,此项变成不可编辑
84
+      if (item.children) {
85
+        editNode(key,item.children);
86
+      }
87
+    })  
114 88
 
89
+    //删除
90
+    const onDelete = (key) => {
91
+      deleteNode(key, treeData);
92
+      setData(treeData.slice());
93
+    };
94
+    const deleteNode = (key, data) =>
95
+      data.forEach((item, index) => {
96
+        if (item.key === key) {
97
+          data.splice(index, 1);//从某个位置开始删除元素
98
+          return;
99
+        } else {
100
+          if (item.children) {
101
+            deleteNode(key, item.children);
102
+          }
103
+        }
104
+      });
105
+
106
+  const addNode=(key,data)=>
107
+    data.forEach((item)=>{
108
+      if(item.key===key){//如果拿到的key相同则判断子项
109
+        if (item.children) {
110
+          item.children.push({
111
+            value:"请输入内容",
112
+            key:key+Math.random(100),//随机唯一的key
113
+          });
114
+        }
115
+        return;
116
+      }
117
+      if (item.children) {
118
+        addNode(key,item.children)//子项
119
+      }
120
+    })
115 121
   return (
116
-    <DirectoryTree
117
-      multiple
118
-      defaultExpandAll
119
-      onSelect={onSelect}
120
-      onExpand={onExpand}
121
-      treeData={treeData}
122
-    />
122
+    <div>
123
+      <Card style={{width:'90%'}}>
124
+        <Tree 
125
+        switcherIcon={<Icon type="down-square" theme="filled" />}
126
+        // icon={<Icon type="carry-out" />}
127
+        style={{paddingLeft:'60px'}} 
128
+        treeData={treeData}  >
129
+        {renderTreeNodes(data)}
130
+        </Tree>
131
+        {/* 渲染被更新 */}
132
+      </Card>
133
+    </div>
123 134
   );
124
-};
135
+}
136
+
137
+
138
+
125 139
 
126 140
 
127
-class Treetest extends Component {
128
-    // constructor(props) {
129
-    //     super(props);
130
-    //     //react定义数据
131
-    //     this.state = {
132
-    //     }
133
-    // }
134
-    render() {
135
-        return (
136
-          <div>
137
-            <Card style={{width:'60%'}}>
138
-              <DirectoryTree  treeData={treeData} />
139
-            </Card>
140
-          </div>
141
-        )
142
-    }
143
-}
144
-export default  Treetest;

+ 61
- 13
src/services/apis.js Voir le fichier

@@ -44,6 +44,42 @@ export default {
44 44
       logout: true,
45 45
       action: 'signout',
46 46
     },
47
+  },
48
+  //品牌开发商
49
+  brand:{
50
+    //查询
51
+    list:{
52
+      method:'GET',
53
+      url:`${prefix}/brand`,
54
+      action:'admin.brand.get'
55
+    },
56
+    //添加
57
+    addBrand:{
58
+      method:'POST',
59
+      url:`${prefix}/brand`,
60
+      action:'admin.brand.post'
61
+    },
62
+    //shanchu
63
+    deleBrand:{
64
+      method:'DELETE',
65
+      url:`${prefix}/brand/:id`,
66
+      action:'admin.brand.id.delete',
67
+    },
68
+    // 获取详情数据
69
+    getBrand:{
70
+      method:'GET',
71
+      url:`${prefix}/brand/:id`,
72
+      action:'admin.brand.id.get',
73
+    },
74
+    //修改
75
+    alterBrand:{
76
+      method:'PUT',
77
+      url:`${prefix}/brand/:id`,
78
+      action:'admin.brand.id.put'
79
+    }
80
+    
81
+    
82
+
47 83
   },
48 84
   building: {
49 85
     getList: {
@@ -208,15 +244,33 @@ export default {
208 244
       action: 'admin.taNewsType.get',
209 245
     }
210 246
   },
211
-  //预加 帮我找房
212
-  homeload: {
213
-    houseSchr:{
247
+  // 帮我找房
248
+  searchHouse: {
249
+    //查询
250
+    list:{
214 251
       method: 'GET',
215
-      url: `${prefix}/home/Recommend/searchHouse`,
216
-      action: 'admin.home.Recommend.searchHouse.get',
217
-      // action: 'admin.customer.recommend.recommender.get',
218
-
252
+      url: `${prefix}/searchHouse`,
253
+      action: 'admin.searchHouse.get',
254
+    },
255
+    //根据ID查询
256
+    IdHouse:{
257
+      method:'GET',
258
+      url:`${prefix}/searchHouse/:id`,
259
+      action:'admin.searchHouse.id.get',  
260
+    },
261
+    //修改
262
+    alterHouse:{
263
+      method:'PUT',
264
+      url:`${prefix}/searchHouse/:id`,
265
+      action:'admin.searchHouse.id.put',
266
+    },
267
+    //回访
268
+    savingHouse:{
269
+      method:'POST',
270
+      url:`${prefix}/searchHouse`,
271
+      action:''
219 272
     }
273
+
220 274
   },
221 275
 
222 276
   customer: {
@@ -311,12 +365,6 @@ export default {
311 365
       action: 'admin.customer.recommend.recommender.export.get',
312 366
     },
313 367
 
314
-    // //recommender
315
-    // homeRecommendrecommenderExport: { // 导出数据(home   推荐客户 预加)
316
-    //   method: 'GET',
317
-    //   url: `${prefix}/home/recommend/recommender/export`,
318
-    //   action: 'admin.home.recommend.recommender.export.get',
319
-    // },
320 368
     customerRecommendReportExport: { // 导出数据(报备客户)
321 369
       method: 'GET',
322 370
       url: `${prefix}/customer/recommend/report/export`,