张延森 4 jaren geleden
bovenliggende
commit
aebedc2935
30 gewijzigde bestanden met toevoegingen van 604 en 75 verwijderingen
  1. 1
    1
      config/defaultSettings.js
  2. 11
    1
      config/routes.js
  3. 56
    0
      src/components/CommunitySelect/index.jsx
  4. 0
    1
      src/components/XForm/WrapperForm.jsx
  5. 2
    2
      src/models/user.js
  6. 4
    0
      src/pages/dashboard/index.jsx
  7. 2
    0
      src/pages/property/building/BatchImport.jsx
  8. 2
    1
      src/pages/property/building/components/Building.jsx
  9. 1
    0
      src/pages/property/building/components/BuildingLevelCell.jsx
  10. 3
    0
      src/pages/property/building/components/BuildingLevelRow.jsx
  11. 1
    0
      src/pages/property/building/components/BuildingRoomCell.jsx
  12. 2
    0
      src/pages/property/building/components/BuildingUnit.jsx
  13. 2
    1
      src/pages/property/building/components/BuildingUnitCell.jsx
  14. 17
    8
      src/pages/property/building/list.jsx
  15. 123
    0
      src/pages/property/community/index.jsx
  16. 135
    0
      src/pages/property/contact/PublicServ.jsx
  17. 8
    9
      src/pages/property/contact/components/Editor.jsx
  18. 30
    8
      src/pages/property/contact/index.jsx
  19. 15
    3
      src/pages/property/lifeConsultant/index.jsx
  20. 14
    1
      src/pages/property/notice/Edit.jsx
  21. 18
    3
      src/pages/property/notice/index.jsx
  22. 8
    11
      src/pages/property/proprietor/Add.jsx
  23. 20
    4
      src/pages/property/proprietor/Audit.jsx
  24. 25
    1
      src/pages/property/proprietor/BatchImport.jsx
  25. 21
    7
      src/pages/property/proprietor/index.jsx
  26. 18
    3
      src/pages/property/ticket/index.jsx
  27. 5
    3
      src/pages/property/utils/hooks/useRoomSelect.js
  28. 30
    7
      src/pages/staff/list/editStaff.jsx
  29. 2
    0
      src/services/apis.js
  30. 28
    0
      src/services/community_api.js

+ 1
- 1
config/defaultSettings.js Bestand weergeven

@@ -12,5 +12,5 @@ export default {
12 12
   },
13 13
   title: '远道荟',
14 14
   pwa: false,
15
-  iconfontUrl: '',
15
+  iconfontUrl: ''
16 16
 };

+ 11
- 1
config/routes.js Bestand weergeven

@@ -70,6 +70,11 @@ export default [
70 70
             name: '物业管理',
71 71
             component: '../layouts/BlankLayout',
72 72
             routes: [
73
+              {
74
+                path: 'community',
75
+                name: '社区管理',
76
+                component: './property/community'
77
+              },
73 78
               {
74 79
                 path: 'buildingInfo',
75 80
                 name: '楼栋管理',
@@ -142,6 +147,11 @@ export default [
142 147
                 component: './property/news/Edit',
143 148
                 hideInMenu: true,
144 149
               },
150
+              {
151
+                path: 'public-service',
152
+                name: '公共服务',
153
+                component: './property/contact/PublicServ'
154
+              },
145 155
               {
146 156
                 path: 'bill/management',
147 157
                 name: '收费组管理',
@@ -200,7 +210,7 @@ export default [
200 210
               },
201 211
               {
202 212
                 path: 'contact',
203
-                name: '联系方式',
213
+                name: '联系物业',
204 214
                 component: './property/contact'
205 215
               },
206 216
               {

+ 56
- 0
src/components/CommunitySelect/index.jsx Bestand weergeven

@@ -0,0 +1,56 @@
1
+import React, { useEffect, useState, useRef } from 'react'
2
+import { connect } from 'dva'
3
+import { Select } from 'antd'
4
+
5
+const CommunitySelect = props => {
6
+  const [value, setValue] = useState()
7
+  const inited = useRef(false)
8
+
9
+  const { communityList, user, dispatch, autoInited, ...selectProps } = props
10
+
11
+  const dataList = ((user || {}).isAdmin ? communityList : (user || {}).communityList) || []
12
+
13
+  const handleChange = val => {
14
+    if (props.onChange) {
15
+      props.onChange(val)
16
+    } else {
17
+      setValue(val)
18
+    }
19
+  }
20
+
21
+  useEffect(() => {
22
+    if (!user || !user.userId) {
23
+      return
24
+    }
25
+
26
+    // 初始化逻辑
27
+    if (!inited.current) {
28
+      // 如果有默认值, 则使用默认值
29
+      if (props.value) {
30
+        setValue(props.value)
31
+        inited.current = true
32
+      } else if (autoInited) {
33
+        // 如果没有默认值, 但是需要设置默认值
34
+        // 那么默认使用第一个
35
+        const first = (dataList[0] || {}).id
36
+        if (first) {
37
+          handleChange(props.mode === 'multiple' ? [first] : first)
38
+        }
39
+
40
+        inited.current = true
41
+      }
42
+    } else {
43
+      setValue(props.value)
44
+    }
45
+  }, [user, autoInited, dataList, props.value])
46
+
47
+  return (
48
+    <Select {...selectProps} value={value} onChange={handleChange}>
49
+      {
50
+        dataList.map(community => (<Select.Option key={community.id} value={community.id}>{community.name}</Select.Option>))
51
+      }
52
+    </Select>
53
+  )
54
+}
55
+
56
+export default connect(s => ({ communityList: (s.user || {}).communityList, user: (s.user || {}).currentUser }))(CommunitySelect)

+ 0
- 1
src/components/XForm/WrapperForm.jsx Bestand weergeven

@@ -61,7 +61,6 @@ class WrapperForm extends React.Component {
61 61
 
62 62
   render () {
63 63
     const {fields, form, children, submitBtn, cancelBtn, ...formProps} = this.props;
64
-    console.log('fields:', fields)
65 64
     const FeildItems = (fields || []).filter(x => x).map((props, inx) => (<WrapperItem key={inx} {...props} form={form} />))
66 65
     
67 66
     return (

+ 2
- 2
src/models/user.js Bestand weergeven

@@ -30,13 +30,13 @@ const UserModel = {
30 30
   },
31 31
   reducers: {
32 32
     saveCurrentUser(state, { payload }) {
33
-      const { taUser = {} , menuList = [], buttonList = [] } = payload || {}
33
+      const { taUser = {} , menuList = [], buttonList = [], ...others } = payload || {}
34 34
       const currentUser = { ...taUser, roles: (taUser.roles || []).map(x => x.roleId) }
35 35
 
36 36
       setAllBtnAuth(buttonList)
37 37
       setUserBtnAuth(currentUser.buttons)
38 38
 
39
-      return { ...state, currentUser, menuList, buttonList };
39
+      return { ...state, currentUser, menuList, buttonList, ...others };
40 40
     },
41 41
     changeNotifyCount(
42 42
       state = {

+ 4
- 0
src/pages/dashboard/index.jsx Bestand weergeven

@@ -1,5 +1,6 @@
1 1
 import React, { useEffect, useState } from 'react'
2 2
 import { PageHeader, Row, Col, Card, Icon } from 'antd'
3
+import CommunitySelect from '@/components/CommunitySelect'
3 4
 import ABPart from './components/ABPart'
4 5
 import BuildingStatic from './components/BuildingStatic'
5 6
 import ShortCut from './components/ShortCut'
@@ -24,6 +25,9 @@ export default props => {
24 25
         title="工作台"
25 26
         backIcon={false}
26 27
         ghost={false}
28
+        extra={[
29
+          <CommunitySelect key="1" style={{minWidth: 200}} autoInited />
30
+        ]}
27 31
       >
28 32
         <ABPart
29 33
           align="middle"

+ 2
- 0
src/pages/property/building/BatchImport.jsx Bestand weergeven

@@ -32,6 +32,7 @@ export default props => {
32 32
         excelRef.current = files[0]
33 33
         const formData = new FormData()
34 34
         formData.append('file', excelRef.current)
35
+        formData.append("communityId", props.community)
35 36
         
36 37
         setLoading(true)
37 38
         uploadBuildingTreeExcel({ data: formData }).then(res => {
@@ -58,6 +59,7 @@ export default props => {
58 59
 
59 60
     const formData = new FormData()
60 61
     formData.append('file', excelRef.current)
62
+    formData.append("communityId", props.community)
61 63
 
62 64
     setLoading(true)
63 65
     submitBuildingTreeExcel({ data: formData }).then(res => {

+ 2
- 1
src/pages/property/building/components/Building.jsx Bestand weergeven

@@ -19,6 +19,7 @@ export default props => {
19 19
       name: props.phase.name,
20 20
       type: 'building',
21 21
       nodeNumber: v,
22
+      communityId: props.community,
22 23
     }}).then((res) => {
23 24
       notification.success({message: '添加成功'})
24 25
       setBuildingList(buildingList.concat(res))
@@ -71,7 +72,7 @@ export default props => {
71 72
                 key={`${index}`}
72 73
                 tab={<span>{building.name} <Icon type="close" style={{fontSize: '0.8em', color: '#888', marginLeft: 8}} onClick={() => handleDeleteBuilding(building)} /></span>}
73 74
               >
74
-                <BuildingUnit building={building} phase={props.phase} />
75
+                <BuildingUnit building={building} phase={props.phase} community={props.community} />
75 76
               </Tabs.TabPane>
76 77
             )
77 78
           })

+ 1
- 0
src/pages/property/building/components/BuildingLevelCell.jsx Bestand weergeven

@@ -50,6 +50,7 @@ export default props => {
50 50
       name: roomInfo.levelName,
51 51
       type: 'roomNo',
52 52
       nodeNumber: val,
53
+      communityId: props.community,
53 54
     }}).then((res) => {
54 55
       if (props.onHouseAdd) {
55 56
         props.onHouseAdd(res)

+ 3
- 0
src/pages/property/building/components/BuildingLevelRow.jsx Bestand weergeven

@@ -32,6 +32,7 @@ export default props => {
32 32
         render: (t, row) => (
33 33
           <BuildingLevelCell
34 34
             dataSource={row}
35
+            community={props.community}
35 36
             onHouseAdd={props.onHouseAdd}
36 37
             onEdit={props.onLevelEdit}
37 38
             onDelete={props.onLevelDelete}
@@ -50,6 +51,7 @@ export default props => {
50 51
               id: row[`id-${index}`],
51 52
               name: row[`name-${index}`]
52 53
             }}
54
+            community={props.community}
53 55
             onEdit={props.onHouseEdit}
54 56
             onDelete={props.onHouseDelete}
55 57
           />
@@ -94,6 +96,7 @@ export default props => {
94 96
     <div>
95 97
       <BuildingUnitCell
96 98
         dataSource={anyRoom}
99
+        community={props.community}
97 100
         onLevelAdd={props.onLevelAdd}
98 101
         onEdit={props.onUnitEdit}
99 102
         onDelete={props.onUnitDelete}

+ 1
- 0
src/pages/property/building/components/BuildingRoomCell.jsx Bestand weergeven

@@ -32,6 +32,7 @@ export default props => {
32 32
         name: roomInfo.levelName,
33 33
         type: 'roomNo',
34 34
         nodeNumber: val,
35
+        communityId: props.community,
35 36
       }}).then((res) => {
36 37
         if (props.onEdit) {
37 38
           props.onEdit(res)

+ 2
- 0
src/pages/property/building/components/BuildingUnit.jsx Bestand weergeven

@@ -48,6 +48,7 @@ export default props => {
48 48
       name: props.building.name,
49 49
       type: 'unit',
50 50
       nodeNumber: v,
51
+      communityId: props.community,
51 52
     }}).then((res) => {
52 53
       // 构造房间数据
53 54
       const roomInfo = {
@@ -214,6 +215,7 @@ export default props => {
214 215
               <div style={{flex: 'none', marginLeft: 48}} key={key}>
215 216
                 <BuildingLevelRow
216 217
                   dataSource={roomGroup[key]}
218
+                  community={props.community}
217 219
                   onUnitDelete={handleDeleteUnit}
218 220
                   onHouseAdd={handleHouseAdd}
219 221
                   onHouseEdit={handleHouseEdit}

+ 2
- 1
src/pages/property/building/components/BuildingUnitCell.jsx Bestand weergeven

@@ -50,6 +50,7 @@ export default props => {
50 50
       name: roomInfo.unitName,
51 51
       type: 'level',
52 52
       nodeNumber: val,
53
+      communityId: props.community,
53 54
     }}).then((res) => {
54 55
       // 构造房间数据
55 56
       const room = {
@@ -97,7 +98,7 @@ export default props => {
97 98
   return (
98 99
     <div style={{textAlign: 'center', fontSize: '1.2em', lineHeight: '3.5em'}} >
99 100
       <Dropdown overlay={menu} trigger={['contextMenu']} placement="topCenter">
100
-        <div style={{cursor: 'pointer'}}>{roomInfo.unitName}</div>
101
+        <div style={{cursor: 'pointer', height: 60}}>{roomInfo.unitName}</div>
101 102
       </Dropdown>
102 103
       <Prompt visible={unitVisible} onOk={handleEdit} onCancel={() => setUnitVisible(false)} placeholder="请填写单元名称" />
103 104
       <Prompt visible={levelVisible} onOk={handleLevelAdd} onCancel={() => setLevelVisible(false)} placeholder="请填写楼层名称" />

+ 17
- 8
src/pages/property/building/list.jsx Bestand weergeven

@@ -4,6 +4,7 @@ import router from 'umi/router'
4 4
 import { fetch, fetchList, apis } from '@/utils/request'
5 5
 import Prompt from '@/components/Prompt'
6 6
 import Building from './components/Building'
7
+import CommunitySelect from '@/components/CommunitySelect'
7 8
 
8 9
 const fetchPhaseList = fetch(apis.buildingOwnerInfo.getPhaseList)
9 10
 const addNode = fetch(apis.buildingOwnerInfo.addNode)
@@ -13,6 +14,7 @@ export default props => {
13 14
   const [phaseList, setPhaseList] = useState([])
14 15
   const [loading, setLoading] = useState(false)
15 16
   const [phaseVisible, setPhaseVisible] = useState(false)
17
+  const [community, setCommunity] = useState()
16 18
 
17 19
   const handleEdit = (key, act) => {
18 20
     const phase = phaseList[key - 0]
@@ -38,13 +40,14 @@ export default props => {
38 40
   }
39 41
 
40 42
   const handleBatchImport = () => {
41
-    router.push('/property/buildingInfo/importExcel')
43
+    router.push(`/property/buildingInfo/importExcel?community=${community}`)
42 44
   }
43 45
 
44 46
   const handleAddPhase = v => {
45 47
     addNode({ data: {
46 48
       type: 'phase',
47 49
       nodeNumber: v,
50
+      communityId: community,
48 51
     }}).then((res) => {
49 52
       notification.success({message: '添加成功'})
50 53
       setPhaseList(phaseList.concat(res))
@@ -54,12 +57,14 @@ export default props => {
54 57
 
55 58
   // 获取期
56 59
   useEffect(() => {
57
-    setLoading(true)
58
-    fetchPhaseList().then(res => {
59
-      setPhaseList(res)
60
-      setLoading(false)
61
-    }).catch(() => setLoading(false))
62
-  }, [])
60
+    if (community) {
61
+      setLoading(true)
62
+      fetchPhaseList({params: {communityId: community}}).then(res => {
63
+        setPhaseList(res)
64
+        setLoading(false)
65
+      }).catch(() => setLoading(false))
66
+    }
67
+  }, [community])
63 68
 
64 69
   return (
65 70
     <div>
@@ -68,6 +73,10 @@ export default props => {
68 73
         backIcon={false}
69 74
         extra={<Button type="link" onClick={handleBatchImport}><Icon type="upload"/>批量导入</Button>}
70 75
       />
76
+      <div style={{marginTop: 16}}>
77
+        <span style={{display: 'inline-block', marginRight: '1em'}}>选择小区: </span>
78
+        <CommunitySelect style={{minWidth: 200}} value={community} autoInited onChange={v => setCommunity(v)} />
79
+      </div>
71 80
       <div style={{marginTop: 16}}>
72 81
         <Spin spinning={loading}>
73 82
           <Tabs
@@ -81,7 +90,7 @@ export default props => {
81 90
             phaseList.map((phase, index) => {
82 91
               return (
83 92
                 <Tabs.TabPane tab={phase.name} key={`${index}`}>
84
-                  <Building phase={phase} />
93
+                  <Building phase={phase} community={community} />
85 94
                 </Tabs.TabPane>
86 95
               )
87 96
             })

+ 123
- 0
src/pages/property/community/index.jsx Bestand weergeven

@@ -0,0 +1,123 @@
1
+import React, { useEffect, useRef, useState } from 'react'
2
+import { fetchList, fetch, apis } from '@/utils/request'
3
+import moment from 'moment'
4
+import { Icon, Table, Button, Popconfirm, Divider, notification } from 'antd'
5
+import Prompt from '@/components/Prompt'
6
+
7
+const getList = fetchList(apis.community.list)
8
+const updateCommunity = fetch(apis.community.update)
9
+const saveCommunity = fetch(apis.community.save)
10
+const deleteCommunity = fetch(apis.community.delete)
11
+
12
+export default props => {
13
+  const [loading, setLoading] = useState(false)
14
+  const [showPrompt, setShowPrompt] = useState(false)
15
+  const [listData, setListData] = useState([])
16
+  const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 100 })
17
+  const selectedRow = useRef()
18
+
19
+  const handleRowPrepare = row => {
20
+    selectedRow.current = row
21
+    setShowPrompt(true)
22
+  }
23
+
24
+  const handleStatusTrigger = row => {
25
+    // 发布 -> 取消发布
26
+    // 取消发布 -> 发布
27
+    const status = Math.abs(row.status - 1)
28
+    const data = { ...row, status }
29
+    updateCommunity({data, urlData: {id: row.id}}).then(res => {
30
+      notification.success({message: "操作成功"})
31
+      // 触发数据刷新
32
+      setQueryParams({...queryParams})
33
+    })
34
+  }
35
+
36
+  const handleRowEdit = v => {
37
+    if (!selectedRow.current) {
38
+      // 新增
39
+      const data = {name: v}
40
+      saveCommunity({data}).then(res => {
41
+        // 刷新页面
42
+        setQueryParams({...queryParams})
43
+      })
44
+    } else {
45
+      // 修改
46
+      const data = {
47
+        ...selectedRow.current,
48
+        name: v
49
+      }
50
+      updateCommunity({data, urlData: {id: data.id}}).then(res => {
51
+        // 刷新页面
52
+        setQueryParams({...queryParams})
53
+      })
54
+    }
55
+
56
+    setShowPrompt(false)
57
+  }
58
+
59
+  const handleDeleteRow = row => {
60
+    deleteCommunity({ urlData: {id: row.id} }).then(res => {
61
+      Modal.success({
62
+        content: '删除内容成功',
63
+        onOk: () => {
64
+          // 触发数据刷新
65
+          setQueryParams({...queryParams})
66
+        }
67
+      })
68
+    })
69
+  }
70
+
71
+  useEffect(() => {
72
+    setLoading(true)
73
+    getList(queryParams).then(res => {
74
+      const [list] = res
75
+      setListData(list)
76
+      setLoading(false)
77
+    }).catch(e => console.error(e) || setLoading(false))
78
+  }, [queryParams])
79
+
80
+  return (
81
+    <div>
82
+      <div style={{marginBottom: 16}}>
83
+        <Button type="primary" onClick={() => handleRowPrepare()}><Icon type="plug" />新增社区</Button>
84
+      </div>
85
+      <Table loading={loading} dataSource={listData} rowKey="id">
86
+        <Table.Column title="名称" dataIndex="name" key="name" width={480} />
87
+        <Table.Column title="状态" dataIndex="status" key="status" render={t => t === 1 ? '正常' : '未发布'} />
88
+        <Table.Column title="创建时间" dataIndex="createDate" key="createDate" render={t => moment(t).format('YYYY-MM-DD HH:mm')} />
89
+        <Table.Column
90
+          title="操作"
91
+          key="action"
92
+          align="center"
93
+          render={(_, row) => {
94
+            return (
95
+              <>
96
+                <Popconfirm
97
+                  title="确认进行删除操作?"
98
+                  onConfirm={() => handleDeleteRow(row)}
99
+                  okText="删除"
100
+                  cancelText="取消"
101
+                >
102
+                  <Button type="link">删除</Button>
103
+                </Popconfirm>
104
+                <Divider type="vertical" />
105
+                {/* <Popconfirm
106
+                  title={`确认进行${row.status === 1? '取消发布' : '发布'}操作`}
107
+                  onConfirm={() => handleStatusTrigger(row)}
108
+                  okText={row.status === 1? '取消发布' : '发布'}
109
+                  cancelText="取消"
110
+                >
111
+                  <Button type="link">{row.status === 1? '取消发布' : '发布'}</Button>
112
+                </Popconfirm>
113
+                <Divider type="vertical" /> */}
114
+                <Button type="link" onClick={() => handleRowPrepare(row) }>编辑</Button>
115
+              </>
116
+            )
117
+          }}
118
+        />
119
+      </Table>
120
+      <Prompt visible={showPrompt} onOk={handleRowEdit} placeholder="请输入小区名称" />
121
+    </div>
122
+  )
123
+}

+ 135
- 0
src/pages/property/contact/PublicServ.jsx Bestand weergeven

@@ -0,0 +1,135 @@
1
+import React, { useState, useEffect } from 'react'
2
+import { Select, Spin, Table, Button, Form, Input, Divider, Typography, Popconfirm, notification } from 'antd'
3
+import NavLink from 'umi/navlink'
4
+import { fetchList, apis, fetch } from '@/utils/request'
5
+import Search from '../components/Search'
6
+import List from '../components/List'
7
+import Editor from './components/Editor'
8
+
9
+const listTel = fetch(apis.announcement.getTelList)
10
+const deleteTel = fetch(apis.announcement.deleteTel)
11
+const saveTel = fetch(apis.announcement.saveTel)
12
+const updateTel = fetch(apis.announcement.updateTel)
13
+
14
+const Condition = props => {
15
+  return (
16
+    <Search
17
+      onSearch={props.onSearch}
18
+      onReset={props.onReset}
19
+      render={form => {
20
+        const { getFieldDecorator, setFieldsValue } = form
21
+        
22
+        return (
23
+          <>
24
+            <Form.Item label="名称">
25
+            {
26
+              getFieldDecorator('name')(<Input placeholder="名称" />)
27
+            }
28
+            </Form.Item>
29
+            <Form.Item label="电话">
30
+            {
31
+              getFieldDecorator('tel')(<Input placeholder="电话" />)
32
+            }
33
+            </Form.Item>
34
+          </>
35
+        )
36
+      }}
37
+    />
38
+  )
39
+}
40
+
41
+export default props => {
42
+  const telType = "common"
43
+  const [loading, setLoading] = useState(false)
44
+  const [listData, setListData] = useState([])
45
+  const [pagination, setPagination] = useState({})
46
+  const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10, type: telType })
47
+  const [showEditor, setShowEditor] = useState(false)
48
+  const [currentRow, setCurrentRow] = useState()
49
+
50
+  const handleSearch = vals => {
51
+    setQueryParams({
52
+      ...queryParams,
53
+      ...vals,
54
+      pageNum: 1,
55
+    })
56
+  }
57
+
58
+  const handlePageChange = (pageNum, pageSize) => {
59
+    setQueryParams({
60
+      ...queryParams,      
61
+      pageNum,
62
+      pageSize,
63
+    })
64
+  }
65
+
66
+  const triggerShowEditor = row => {
67
+    setShowEditor(!showEditor)
68
+    setCurrentRow({...(row || {})})
69
+  }
70
+
71
+  const handleEditor = vals => {
72
+    if (vals.id) {
73
+      updateTel({data: vals}).then(res => {
74
+        notification.success({message: '信息更新成功'})
75
+        triggerShowEditor()
76
+        setQueryParams({...queryParams})
77
+      })
78
+    } else {
79
+      saveTel({data: vals}).then(res => {
80
+        notification.success({message: '信息保存成功'})
81
+        triggerShowEditor()
82
+        setQueryParams({...queryParams})
83
+      })
84
+    }
85
+  }
86
+
87
+  const handleDeleteRow = row => {
88
+    deleteTel({data: [row.id]}).then(res => {
89
+      notification.success({ message: '删除成功' })
90
+      setQueryParams({...queryParams})
91
+    })
92
+  }
93
+
94
+  useEffect(() => {
95
+    setLoading(true)
96
+    listTel({params: queryParams}).then(res => {
97
+      const {list, ...pagi} = res
98
+      setListData(list)
99
+      setPagination(pagi)
100
+      setLoading(false)
101
+    }).catch(e => setLoading(false))
102
+  }, [queryParams])
103
+
104
+  return (
105
+    <div>
106
+      <Condition onSearch={handleSearch} onReset={handleSearch} />
107
+      <div style={{ margin: '24px 0' }}>
108
+        <Button type="primary" onClick={() => triggerShowEditor()}>添加</Button>
109
+      </div>
110
+      <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="id">
111
+        <Table.Column title="名称" dataIndex="name" key="name" />
112
+        <Table.Column title="电话" dataIndex="tel" key="tel" />
113
+        {/* <Table.Column title="物业类型" dataIndex="type" key="type" render={(item, row) => (
114
+          <span>{item == "prop" ? "物业电话" : "公共服务电话"}</span>
115
+        )}/> */}
116
+        <Table.Column title="备注" dataIndex="remark" key="remark" />
117
+        <Table.Column title="操作" dataIndex="id" key="id" width="200px" render={(_, row) => (
118
+          <>
119
+            <Popconfirm
120
+              title="确认进行删除操作?"
121
+              onConfirm={() => handleDeleteRow(row)}
122
+              okText="删除"
123
+              cancelText="取消"
124
+            >
125
+              <Button type="link">删除</Button>
126
+            </Popconfirm>
127
+            <Divider type="vertical" />
128
+            <Button type="link" onClick={() => triggerShowEditor(row)}>编辑</Button>
129
+          </>
130
+        )} />
131
+      </List>
132
+      <Editor visible={showEditor} type={telType} dataSource={currentRow} onSubmit={handleEditor} onCancel={triggerShowEditor} />
133
+    </div>
134
+  )
135
+}

+ 8
- 9
src/pages/property/contact/components/Editor.jsx Bestand weergeven

@@ -33,7 +33,8 @@ export default Form.create()(props => {
33 33
       if (!err) {
34 34
         props.onSubmit({
35 35
           ...(props.dataSource || {}),
36
-          ...values
36
+          ...values,
37
+          type: props.type,
37 38
         })
38 39
       }
39 40
     })
@@ -67,14 +68,12 @@ export default Form.create()(props => {
67 68
             props.form.getFieldDecorator('remark')(<Input placeholder="请填写备注" />)
68 69
           }
69 70
         </Form.Item>
70
-        <Form.Item label="物业类型">
71
-          {props.form.getFieldDecorator('type')(
72
-            <Select defaultValue="prop" placeholder="物业类型">
73
-              <Option value="prop">物业电话</Option>
74
-              <Option value="common">公共服务</Option>
75
-            </Select>,
76
-          )}
77
-        </Form.Item>
71
+        {/* <Form.Item label="类型">
72
+          <Select value={props.type} disabled placeholder="物业类型">
73
+            <Option value="prop">物业电话</Option>
74
+            <Option value="common">公共服务</Option>
75
+          </Select>,
76
+        </Form.Item> */}
78 77
         <Form.Item {...tailFormItemLayout}>
79 78
           <Button type="primary" htmlType="submit">确定</Button>
80 79
           <Button onClick={props.onCancel} style={{ marginLeft: '48px' }}>取消</Button>

+ 30
- 8
src/pages/property/contact/index.jsx Bestand weergeven

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
2 2
 import { Select, Spin, Table, Button, Form, Input, Divider, Typography, Popconfirm, notification } from 'antd'
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetchList, apis, fetch } from '@/utils/request'
5
+import CommunitySelect from '@/components/CommunitySelect'
5 6
 import Search from '../components/Search'
6 7
 import List from '../components/List'
7 8
 import Editor from './components/Editor'
@@ -12,6 +13,14 @@ const saveTel = fetch(apis.announcement.saveTel)
12 13
 const updateTel = fetch(apis.announcement.updateTel)
13 14
 
14 15
 const Condition = props => {
16
+  const [communityId, setCommunityId] = useState()
17
+
18
+  const handleCommunityChange = v => {
19
+    setCommunityId(v)
20
+
21
+    props.onCommunityChange(v)
22
+  }
23
+
15 24
   return (
16 25
     <Search
17 26
       onSearch={props.onSearch}
@@ -21,6 +30,9 @@ const Condition = props => {
21 30
         
22 31
         return (
23 32
           <>
33
+            <Form.Item label="小区">
34
+              <CommunitySelect value={communityId} onChange={handleCommunityChange} autoInited />
35
+            </Form.Item>
24 36
             <Form.Item label="名称">
25 37
             {
26 38
               getFieldDecorator('name')(<Input placeholder="名称" />)
@@ -39,12 +51,14 @@ const Condition = props => {
39 51
 }
40 52
 
41 53
 export default props => {
54
+  const telType = "prop"
42 55
   const [loading, setLoading] = useState(false)
43 56
   const [listData, setListData] = useState([])
44 57
   const [pagination, setPagination] = useState({})
45
-  const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
58
+  const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10, type: telType })
46 59
   const [showEditor, setShowEditor] = useState(false)
47 60
   const [currentRow, setCurrentRow] = useState()
61
+  const [communityId, setCommunityId] = useState()
48 62
 
49 63
   const handleSearch = vals => {
50 64
     setQueryParams({
@@ -68,6 +82,11 @@ export default props => {
68 82
   }
69 83
 
70 84
   const handleEditor = vals => {
85
+    if (!communityId) {
86
+      notification.warn({message: '请选择小区'})
87
+      return
88
+    }
89
+
71 90
     if (vals.id) {
72 91
       updateTel({data: vals}).then(res => {
73 92
         notification.success({message: '信息更新成功'})
@@ -75,7 +94,7 @@ export default props => {
75 94
         setQueryParams({...queryParams})
76 95
       })
77 96
     } else {
78
-      saveTel({data: vals}).then(res => {
97
+      saveTel({data: {...vals, communityId}}).then(res => {
79 98
         notification.success({message: '信息保存成功'})
80 99
         triggerShowEditor()
81 100
         setQueryParams({...queryParams})
@@ -91,27 +110,30 @@ export default props => {
91 110
   }
92 111
 
93 112
   useEffect(() => {
113
+    if (!communityId) {
114
+      return
115
+    }
94 116
     setLoading(true)
95
-    listTel({params: queryParams}).then(res => {
117
+    listTel({params: {...queryParams, communityId}}).then(res => {
96 118
       const {list, ...pagi} = res
97 119
       setListData(list)
98 120
       setPagination(pagi)
99 121
       setLoading(false)
100 122
     }).catch(e => setLoading(false))
101
-  }, [queryParams])
123
+  }, [queryParams, communityId])
102 124
 
103 125
   return (
104 126
     <div>
105
-      <Condition onSearch={handleSearch} onReset={handleSearch} />
127
+      <Condition onSearch={handleSearch} onReset={handleSearch} onCommunityChange={v => setCommunityId(v)} />
106 128
       <div style={{ margin: '24px 0' }}>
107 129
         <Button type="primary" onClick={() => triggerShowEditor()}>添加</Button>
108 130
       </div>
109 131
       <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="id">
110 132
         <Table.Column title="名称" dataIndex="name" key="name" />
111 133
         <Table.Column title="电话" dataIndex="tel" key="tel" />
112
-        <Table.Column title="物业类型" dataIndex="type" key="type" render={(item, row) => (
134
+        {/* <Table.Column title="物业类型" dataIndex="type" key="type" render={(item, row) => (
113 135
           <span>{item == "prop" ? "物业电话" : "公共服务电话"}</span>
114
-        )}/>
136
+        )}/> */}
115 137
         <Table.Column title="备注" dataIndex="remark" key="remark" />
116 138
         <Table.Column title="操作" dataIndex="id" key="id" width="200px" render={(_, row) => (
117 139
           <>
@@ -128,7 +150,7 @@ export default props => {
128 150
           </>
129 151
         )} />
130 152
       </List>
131
-      <Editor visible={showEditor} dataSource={currentRow} onSubmit={handleEditor} onCancel={triggerShowEditor} />
153
+      <Editor visible={showEditor} type={telType} dataSource={currentRow} onSubmit={handleEditor} onCancel={triggerShowEditor} />
132 154
     </div>
133 155
   )
134 156
 }

+ 15
- 3
src/pages/property/lifeConsultant/index.jsx Bestand weergeven

@@ -2,12 +2,20 @@ import React, { useState, useEffect } from 'react'
2 2
 import { Select, Spin, Table, Button, Form, Input, Divider, Modal, Rate, Popconfirm } from 'antd'
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetchList, apis, fetch } from '@/utils/request'
5
+import CommunitySelect from '@/components/CommunitySelect'
5 6
 import Search from '../components/Search'
6 7
 import List from '../components/List'
7 8
 
8 9
 const lifeConsultant = fetchList(apis.propUser.lifeConsultant)
9 10
 
10 11
 const Condition = props => {
12
+  const [communityId, setCommunityId] = useState()
13
+
14
+  const handleCommunityChange = v => {
15
+    setCommunityId(v)
16
+
17
+    props.onCommunityChange(v)
18
+  }
11 19
   return (
12 20
     <Search
13 21
       onSearch={props.onSearch}
@@ -17,6 +25,9 @@ const Condition = props => {
17 25
         
18 26
         return (
19 27
           <>
28
+            <Form.Item label="小区">
29
+              <CommunitySelect value={communityId} onChange={handleCommunityChange} autoInited />
30
+            </Form.Item>
20 31
             <Form.Item label="管家名称">
21 32
             {
22 33
               getFieldDecorator('userName')(<Input placeholder="管家名称" />)
@@ -39,6 +50,7 @@ export default props => {
39 50
   const [listData, setListData] = useState([])
40 51
   const [pagination, setPagination] = useState({})
41 52
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
53
+  const [communityId, setCommunityId] = useState()
42 54
 
43 55
   const handleSearch = vals => {
44 56
     setQueryParams({
@@ -58,17 +70,17 @@ export default props => {
58 70
 
59 71
   useEffect(() => {
60 72
     setLoading(true)
61
-    lifeConsultant(queryParams).then(res => {
73
+    lifeConsultant({...queryParams, communityId}).then(res => {
62 74
       const [list, pageInfo] = res || {}
63 75
       setListData(list)
64 76
       setPagination(pageInfo)
65 77
       setLoading(false)
66 78
     }).catch(() => setLoading(false))
67
-  }, [queryParams])
79
+  }, [queryParams, communityId])
68 80
 
69 81
   return (
70 82
     <div>
71
-      <Condition onSearch={handleSearch} onReset={handleSearch} />
83
+      <Condition onSearch={handleSearch} onReset={handleSearch} onCommunityChange={v => setCommunityId(v)} />
72 84
       <div style={{ margin: '24px 0' }}>
73 85
         {/* <NavLink to={`/staff/editStaff`}>
74 86
           <Button type="primary">添加管家</Button>

+ 14
- 1
src/pages/property/notice/Edit.jsx Bestand weergeven

@@ -1,9 +1,10 @@
1 1
 import React, { useEffect, useState } from 'react'
2 2
 import router from 'umi/router'
3 3
 import { fetch, apis } from '@/utils/request'
4
-import { Button, Form, Input, InputNumber, Modal, Radio, Select } from 'antd'
4
+import { Button, Form, Input, InputNumber, Modal, notification, Radio, Select } from 'antd'
5 5
 import Wangedit from '@/components/Wangedit/Wangedit'
6 6
 import ImageUpload from '@/components/uploadImage/ImageUpload'
7
+import CommunitySelect from '@/components/CommunitySelect'
7 8
 
8 9
 const formItemLayout = {
9 10
   labelCol: {
@@ -86,6 +87,18 @@ export default Form.create()(props => {
86 87
   return (
87 88
     <div>
88 89
       <Form {...formItemLayout} onSubmit={handleSubmit}>
90
+        <Form.Item label="小区">
91
+        {
92
+          getFieldDecorator('communityId', {
93
+            rules: [
94
+              {
95
+                required: true,
96
+                message: '请选择小区',
97
+              },
98
+            ],
99
+          })(<CommunitySelect />)
100
+        }
101
+        </Form.Item>
89 102
         <Form.Item label="类型">
90 103
         {
91 104
           getFieldDecorator('annType')(

+ 18
- 3
src/pages/property/notice/index.jsx Bestand weergeven

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
2 2
 import { Select, Spin, Table, Button, Form, Input, Divider, Modal,Popconfirm, notification } from 'antd'
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetch, apis } from '@/utils/request'
5
+import CommunitySelect from '@/components/CommunitySelect'
5 6
 import Search from '../components/Search'
6 7
 import List from '../components/List'
7 8
 
@@ -10,6 +11,14 @@ const deleteAnnouncement = fetch(apis.announcement.deleteAnnouncement)
10 11
 const updateannouncement = fetch(apis.announcement.updateannouncement)
11 12
 
12 13
 const Condition = props => {
14
+  const [communityId, setCommunityId] = useState()
15
+  
16
+  const handleCommunityChange = v => {
17
+    setCommunityId(v)
18
+
19
+    props.onCommunityChange(v)
20
+  }
21
+
13 22
   return (
14 23
     <Search
15 24
       onSearch={props.onSearch}
@@ -19,6 +28,11 @@ const Condition = props => {
19 28
         
20 29
         return (
21 30
           <>
31
+            <Form.Item label="小区">
32
+            {
33
+              <CommunitySelect value={communityId} onChange={handleCommunityChange} autoInited />
34
+            }
35
+            </Form.Item>
22 36
             <Form.Item label="公告编号">
23 37
             {
24 38
               getFieldDecorator('announcementNumber')(<Input placeholder="公告编号" />)
@@ -55,6 +69,7 @@ const StatusDict = {
55 69
 export default props => {
56 70
   const [loading, setLoading] = useState(false)
57 71
   const [listData, setListData] = useState([])
72
+  const [communityId, setCommunityId] = useState()
58 73
   const [pagination, setPagination] = useState({})
59 74
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
60 75
 
@@ -95,17 +110,17 @@ export default props => {
95 110
 
96 111
   useEffect(() => {
97 112
     setLoading(true)
98
-    listAnnouncement({ data: queryParams }).then(res => {
113
+    listAnnouncement({ data: {...queryParams, communityId} }).then(res => {
99 114
       const { list, ...pageInfo } = res || {}
100 115
       setListData(list)
101 116
       setPagination(pageInfo)
102 117
       setLoading(false)
103 118
     }).catch(() => setLoading(false))
104
-  }, [queryParams])
119
+  }, [queryParams, communityId])
105 120
 
106 121
   return (
107 122
     <div>
108
-      <Condition onSearch={handleSearch} onReset={handleSearch} />
123
+      <Condition onSearch={handleSearch} onReset={handleSearch} onCommunityChange={v => setCommunityId(v)} />
109 124
       <div style={{ margin: '24px 0' }}>
110 125
         <NavLink to={`/property/notice/edit`}>
111 126
           <Button type="primary">添加</Button>

+ 8
- 11
src/pages/property/proprietor/Add.jsx Bestand weergeven

@@ -3,6 +3,7 @@ import { Form, Input, Select, Button, Radio, Modal, Descriptions } from 'antd'
3 3
 import router from 'umi/router'
4 4
 import { fetch, apis } from '@/utils/request'
5 5
 import useRoomSelect from '../utils/hooks/useRoomSelect'
6
+import CommunitySelect from '@/components/CommunitySelect'
6 7
 
7 8
 const addPerson = fetch(apis.buildingOwnerInfo.addBuilding)
8 9
 const taUserHasOwner = fetch(apis.propUser.taUserHasOwner)
@@ -35,6 +36,7 @@ const tailFormItemLayout = {
35 36
 const isEmpty = o => !o || (Array.isArray(o) && !o.length) || (typeof o === 'object' && !Object.keys(o).length)
36 37
 
37 38
 export default Form.create()(props => {
39
+  const [communityId, setCommunityId] = useState()
38 40
   const {
39 41
     phaseId,
40 42
     setPhaseId,
@@ -51,7 +53,7 @@ export default Form.create()(props => {
51 53
     unitList,
52 54
     levelList,
53 55
     roomNoList
54
-  } = useRoomSelect()
56
+  } = useRoomSelect(communityId)
55 57
 
56 58
   const [owerExist, setOwnerExist] = useState(false)
57 59
   const [telAccUser, setTelAccUser] = useState()
@@ -74,21 +76,12 @@ export default Form.create()(props => {
74 76
 
75 77
   useEffect(() => {
76 78
     if (roomNoId) {
77
-      taUserHasOwner({ params: {phaseId, buildingId, unitId, levelId, roomNoId} }).then(res => {
79
+      taUserHasOwner({ params: {communityId, phaseId, buildingId, unitId, levelId, roomNoId} }).then(res => {
78 80
         setOwnerExist(res.boolRole)
79 81
       })
80 82
     }
81 83
   }, [roomNoId])
82 84
   
83
-  useEffect(() => {
84
-    if (roomNoId) {
85
-      taUserHasOwner({ params: {phaseId, buildingId, unitId, levelId, roomNoId} }).then(res => {
86
-        setOwnerExist(res.boolRole)
87
-      })
88
-    }
89
-  }, [roomNoId])
90
-
91
-
92 85
   const handleSubmit = e => {
93 86
     e.preventDefault();
94 87
     if (!isEmpty(telAccUser)) {
@@ -99,6 +92,7 @@ export default Form.create()(props => {
99 92
       if (!err) {
100 93
         const data = {
101 94
           ...values,
95
+          communityId,
102 96
           phaseId,
103 97
           buildingId,
104 98
           unitId,
@@ -121,6 +115,9 @@ export default Form.create()(props => {
121 115
   return (
122 116
     <div>
123 117
       <Form {...formItemLayout} onSubmit={handleSubmit}>
118
+        <Form.Item label="小区" required>
119
+          <CommunitySelect value={communityId} onChange={v => setCommunityId(v)} autoInited />
120
+        </Form.Item>
124 121
         <Form.Item label="期/区" required>
125 122
           <Select value={phaseId} onChange={handlePhaseChange} style={{ minWidth: '120px' }} placeholder="期/区">
126 123
             {

+ 20
- 4
src/pages/property/proprietor/Audit.jsx Bestand weergeven

@@ -4,8 +4,16 @@ import { fetch, fetchList, apis } from '@/utils/request'
4 4
 import Search from '../components/Search'
5 5
 import List from '../components/List'
6 6
 import AuditNot from './components/AuditNot'
7
+import CommunitySelect from '@/components/CommunitySelect'
7 8
 
8 9
 const Condition = props => {
10
+  const [communityId, setCommunityId] = useState()
11
+
12
+  const handleCommunityChange = v => {
13
+    props.onCommunityChange(v)
14
+    setCommunityId(v)
15
+  }
16
+
9 17
   return (
10 18
     <Search
11 19
       onSearch={props.onSearch}
@@ -15,6 +23,11 @@ const Condition = props => {
15 23
 
16 24
         return (
17 25
           <>
26
+            <Form.Item label="小区">
27
+            {
28
+              <CommunitySelect autoInited value={communityId} onChange={handleCommunityChange} />
29
+            }
30
+            </Form.Item>
18 31
             <Form.Item label="姓名">
19 32
             {
20 33
               getFieldDecorator('userName')(<Input style={{ width: '160px' }} placeholder="姓名" />)
@@ -53,6 +66,7 @@ export default props => {
53 66
   const [selectedKeys, setSelectedKeys] = useState([])
54 67
   const [pagination, setPagination] = useState({})
55 68
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
69
+  const [communityId, setCommunityId] = useState()
56 70
 
57 71
   const currentRow = useRef()
58 72
   
@@ -60,13 +74,14 @@ export default props => {
60 74
     setQueryParams({
61 75
       ...queryParams,
62 76
       ...vals,
77
+      communityId,
63 78
       pageNum: 1
64 79
     })
65 80
   }
66 81
 
67 82
   const rowSelection = {
68 83
     onChange: (selectedRowKeys, selectedRows) => {
69
-      console.log('------>', selectedRowKeys)
84
+      // console.log('------>', selectedRowKeys)
70 85
       setSelectedKeys(selectedRowKeys)
71 86
     }
72 87
   }
@@ -107,6 +122,7 @@ export default props => {
107 122
     const row = {
108 123
       ...currentRow.current,
109 124
       ...vals,
125
+      communityId,
110 126
     }
111 127
 
112 128
     handleVerfiy(row, false)
@@ -143,17 +159,17 @@ export default props => {
143 159
 
144 160
   useEffect(() => {
145 161
     setLoading(true)
146
-    userVerifyAll(queryParams).then(res => {
162
+    userVerifyAll({...queryParams, communityId}).then(res => {
147 163
       const [records, pagi] = res || []
148 164
       setListData(records)
149 165
       setPagination({total: pagi.total, pageSize: pagi.size, pageNum: pagi.current})
150 166
       setLoading(false)
151 167
     }).catch(() => setLoading(false))
152
-  }, [queryParams])
168
+  }, [queryParams, communityId])
153 169
 
154 170
   return (
155 171
     <div>
156
-      <Condition onSearch={handleSearch} onSearch={handleSearch} />
172
+      <Condition onSearch={handleSearch} onSearch={handleSearch} onCommunityChange={v => setCommunityId(v)} />
157 173
       <div style={{ margin: '24px 0' }}>
158 174
         <div style={{marginLeft: 16, display: 'inline-block'}}>
159 175
           <Popconfirm

+ 25
- 1
src/pages/property/proprietor/BatchImport.jsx Bestand weergeven

@@ -15,10 +15,24 @@ export default props => {
15 15
   const [dataList, setDataList] = useState([])
16 16
   const [pagenavi, setPagenavi] = useState({ pageSize: 10, total: 0 })
17 17
 
18
+  const communityId = props.location.query.community
18 19
   const excelRef = useRef()
19 20
 
21
+  const checkCommunity = () => {
22
+    if (!communityId) {
23
+      notification.warn({message: '没有选择小区'})
24
+      return false
25
+    }
26
+
27
+    return true
28
+  }
29
+
20 30
   const downloadExcel = () => {
21
-    buildingDownloadExcel().then(res => {
31
+    if (!checkCommunity()) {
32
+      return
33
+    }
34
+
35
+    buildingDownloadExcel({params: {communityId}}).then(res => {
22 36
       const url = window.URL.createObjectURL(new Blob([res]))
23 37
       const link = document.createElement('a')
24 38
       link.href = url
@@ -28,6 +42,10 @@ export default props => {
28 42
   }
29 43
 
30 44
   const importExcel = () => {
45
+    if (!checkCommunity()) {
46
+      return
47
+    }
48
+
31 49
     const input = document.createElement('input')
32 50
     input.setAttribute('type', 'file')
33 51
     input.addEventListener('input', e => {
@@ -36,6 +54,7 @@ export default props => {
36 54
         excelRef.current = files[0]
37 55
         const formData = new FormData()
38 56
         formData.append('file', excelRef.current)
57
+        formData.append('communityId', communityId)
39 58
         
40 59
         setLoading(true)
41 60
         uploadBuildingExcel({ data: formData }).then(res => {
@@ -55,6 +74,10 @@ export default props => {
55 74
   }
56 75
 
57 76
   const submitExcel = () => {
77
+    if (!checkCommunity()) {
78
+      return
79
+    }
80
+
58 81
     if (!excelRef.current) {
59 82
       notification.warning({ message: '没有选择文件' })
60 83
       return
@@ -62,6 +85,7 @@ export default props => {
62 85
 
63 86
     const formData = new FormData()
64 87
     formData.append('file', excelRef.current)
88
+    formData.append('communityId', communityId)
65 89
 
66 90
     setLoading(true)
67 91
     submitBuildingExcel({ data: formData }).then(res => {

+ 21
- 7
src/pages/property/proprietor/index.jsx Bestand weergeven

@@ -3,6 +3,7 @@ import { Select, Spin, Table, Button, Form, Input, Icon, Modal, Popconfirm } fro
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetch, fetchList, apis } from '@/utils/request'
5 5
 import { exportExcel } from '@/utils/utils'
6
+import CommunitySelect from '@/components/CommunitySelect'
6 7
 import Search from '../components/Search'
7 8
 import List from '../components/List'
8 9
 import useRoomSelect from '../utils/hooks/useRoomSelect'
@@ -12,6 +13,8 @@ const buildingInfoListExport = fetch(apis.buildingOwnerInfo.buildingListExport)
12 13
 const deleteBuilding = fetch(apis.buildingOwnerInfo.deleteBuilding)
13 14
 
14 15
 const Condition = props => {
16
+  const [communityId, setCommunityId] = useState()
17
+
15 18
   const {
16 19
     phaseId,
17 20
     setPhaseId,
@@ -28,11 +31,12 @@ const Condition = props => {
28 31
     unitList,
29 32
     levelList,
30 33
     roomNoList
31
-  } = useRoomSelect()
34
+  } = useRoomSelect(communityId)
32 35
 
33 36
   const handleSearch = vals => {
34 37
     const data = {
35 38
       ...vals,
39
+      communityId,
36 40
       phaseId,
37 41
       buildingId,
38 42
       unitId,
@@ -66,6 +70,12 @@ const Condition = props => {
66 70
     }
67 71
   }
68 72
 
73
+  const handleCommunityChange = v => {
74
+    setCommunityId(v)
75
+
76
+    props.onCommunityChange(v)
77
+  }
78
+
69 79
   return (
70 80
     <Search
71 81
       onSearch={handleSearch}
@@ -81,6 +91,9 @@ const Condition = props => {
81 91
 
82 92
         return (
83 93
           <>
94
+            <Form.Item>
95
+              <CommunitySelect value={communityId} onChange={handleCommunityChange} autoInited />
96
+            </Form.Item>
84 97
             <Form.Item>
85 98
               <Select value={phaseId} onChange={handlePhaseChange} style={{ minWidth: '120px' }} placeholder="期/区">
86 99
                 {
@@ -160,11 +173,12 @@ export default props => {
160 173
   const [listData, setListData] = useState([])
161 174
   const [selectedKeys, setSelectedKeys] = useState([])
162 175
   const [pagination, setPagination] = useState({})
176
+  const [communityId, setCommunityId] = useState()
163 177
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
164 178
 
165 179
   const rowSelection = {
166 180
     onChange: (selectedRowKeys, selectedRows) => {
167
-      console.log('------>', selectedRowKeys)
181
+      // console.log('------>', selectedRowKeys)
168 182
       setSelectedKeys(selectedRowKeys)
169 183
     }
170 184
   }
@@ -209,7 +223,7 @@ export default props => {
209 223
 
210 224
   const handleExport = () => {
211 225
     setLoading(true)
212
-    buildingInfoListExport({ data: {...queryParams, pageNum: 1, pageSize: 9999} }).then(res => {
226
+    buildingInfoListExport({ data: {...queryParams, communityId, pageNum: 1, pageSize: 9999} }).then(res => {
213 227
       setLoading(false)
214 228
       exportExcel(res, "业主列表")
215 229
     }).catch(() => setLoading(false))
@@ -217,17 +231,17 @@ export default props => {
217 231
 
218 232
   useEffect(() => {
219 233
     setLoading(true)
220
-    buildingInfoList({ data: queryParams }).then(res => {
234
+    buildingInfoList({ data: {...queryParams, communityId} }).then(res => {
221 235
       const { list, ...pageInfo } = res || {}
222 236
       setListData(list)
223 237
       setPagination(pageInfo)
224 238
       setLoading(false)
225 239
     }).catch(() => setLoading(false))
226
-  }, [queryParams])
240
+  }, [queryParams, communityId])
227 241
 
228 242
   return (
229 243
     <div>
230
-      <Condition onSearch={handleSearch} onReset={handleSearch} />
244
+      <Condition onSearch={handleSearch} onReset={handleSearch} onCommunityChange={v => setCommunityId(v)} />
231 245
       <div style={{ margin: '24px 0' }}>
232 246
         <NavLink to={`/property/proprietor/add`}>
233 247
           <Button type="primary">添加</Button>
@@ -245,7 +259,7 @@ export default props => {
245 259
         <div style={{marginLeft: 16, display: 'inline-block'}}>
246 260
           <Button onClick={handleExport}>导出</Button>
247 261
         </div>
248
-        <NavLink to={`/property/proprietor/batch`}>
262
+        <NavLink to={`/property/proprietor/batch?community=${communityId}`}>
249 263
           <Button type="link"><Icon type="upload"/>批量导入业主资料</Button>
250 264
         </NavLink>
251 265
       </div>

+ 18
- 3
src/pages/property/ticket/index.jsx Bestand weergeven

@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
2 2
 import { Select, Spin, Table, Button, Form, Input, Divider, Typography } from 'antd'
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetchList, apis, fetch } from '@/utils/request'
5
+import CommunitySelect from '@/components/CommunitySelect'
5 6
 import Search from '../components/Search'
6 7
 import List from '../components/List'
7 8
 
@@ -52,6 +53,14 @@ const getDictValue = (dict, val) => (dict.filter(x => x.value === val)[0] || {})
52 53
 const listTicket = fetch(apis.ticket.listTicket)
53 54
 
54 55
 const Condition = props => {
56
+  const [communityId, setCommunityId] = useState()
57
+  
58
+  const handleCommunityChange = v => {
59
+    setCommunityId(v)
60
+
61
+    props.onCommunityChange(v)
62
+  }
63
+
55 64
   return (
56 65
     <Search
57 66
       onSearch={props.onSearch}
@@ -61,6 +70,11 @@ const Condition = props => {
61 70
         
62 71
         return (
63 72
           <>
73
+            <Form.Item label="小区">
74
+            {
75
+              <CommunitySelect value={communityId} onChange={handleCommunityChange} autoInited />
76
+            }
77
+            </Form.Item>
64 78
             <Form.Item label="工单编号">
65 79
             {
66 80
               getFieldDecorator('id')(<Input placeholder="工单编号" />)
@@ -113,6 +127,7 @@ const Condition = props => {
113 127
 export default props => {
114 128
   const [loading, setLoading] = useState(false)
115 129
   const [listData, setListData] = useState([])
130
+  const [communityId, setCommunityId] = useState()
116 131
   const [pagination, setPagination] = useState({})
117 132
   const [queryParams, setQueryParams] = useState({ pageNum: 1, pageSize: 10 })
118 133
 
@@ -134,17 +149,17 @@ export default props => {
134 149
 
135 150
   useEffect(() => {
136 151
     setLoading(true)
137
-    listTicket({data: queryParams}).then(res => {
152
+    listTicket({data: {...queryParams, communityId}}).then(res => {
138 153
       const {list, ...pagi} = res
139 154
       setListData(list)
140 155
       setPagination(pagi)
141 156
       setLoading(false)
142 157
     }).catch(e => setLoading(false))
143
-  }, [queryParams])
158
+  }, [queryParams, communityId])
144 159
 
145 160
   return (
146 161
     <div>
147
-      <Condition onSearch={handleSearch} onReset={handleSearch} />
162
+      <Condition onSearch={handleSearch} onReset={handleSearch} onCommunityChange={v => setCommunityId(v)} />
148 163
       <div style={{ margin: '24px 0' }}>
149 164
         {/* <NavLink to={`/property/notice/edit`}>
150 165
           <Button type="primary">添加</Button>

+ 5
- 3
src/pages/property/utils/hooks/useRoomSelect.js Bestand weergeven

@@ -7,7 +7,7 @@ const fetchUnitList = fetch(apis.buildingOwnerInfo.getUnitList)
7 7
 const fetchLevelList = fetch(apis.buildingOwnerInfo.getLevelList)
8 8
 const fetchRoomNoList = fetch(apis.buildingOwnerInfo.getRoomNoList)
9 9
 
10
-export default function useRoomSelect() {
10
+export default function useRoomSelect(communityId) {
11 11
   const [phaseList, setPhaseList] = useState([])
12 12
   const [buildingList, setBuildingList] = useState([])
13 13
   const [unitList, setUnitList] = useState([])
@@ -22,8 +22,10 @@ export default function useRoomSelect() {
22 22
 
23 23
   // 获取期
24 24
   useEffect(() => {
25
-    fetchPhaseList().then(res => setPhaseList(res))
26
-  }, [])
25
+    if (communityId) {
26
+      fetchPhaseList({params: {communityId}}).then(res => setPhaseList(res))
27
+    }
28
+  }, [communityId])
27 29
 
28 30
   // 楼栋
29 31
   useEffect(() => {

+ 30
- 7
src/pages/staff/list/editStaff.jsx Bestand weergeven

@@ -2,16 +2,17 @@ import React, { useState, useEffect } from 'react';
2 2
 
3 3
 import { Input, Menu, Dropdown, Button, Icon, message, Table, Tooltip, Tabs, Radio, Divider, Tag, Select, Form, Alert, Modal } from 'antd';
4 4
 import { FormattedMessage } from 'umi-plugin-react/locale';
5
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
5
+import BuildSelect from '@/components/SelectButton/BuildSelect'
6 6
 import router from 'umi/router';
7
-import styles from '../../style/GoodsList.less';
8
-import { FieldTypes, createForm } from '../../../components/XForm';
9
-import Wangedit from '../../../components/Wangedit/Wangedit'
7
+import { FieldTypes, createForm } from '@/components/XForm';
8
+import Wangedit from '@/components/Wangedit/Wangedit'
9
+import CommunitySelect from '@/components/CommunitySelect';
10 10
 import channels from './channelList.less';
11 11
 import Tagss from '../components/Tagss.jsx';
12 12
 import apis from '../../../services/apis';
13 13
 import request from '../../../utils/request'
14 14
 import BuildingSelection from '../components/BuildingSelection'
15
+import styles from '../../style/GoodsList.less';
15 16
 
16 17
 const { TextArea } = Input;
17 18
 const { Option } = Select;
@@ -27,6 +28,22 @@ const handleFormValueChange = (props, changedValues, allValues) => {
27 28
 
28 29
 const XForm = createForm({ onValuesChange: handleFormValueChange })
29 30
 
31
+const AuthCommunity = props => {
32
+  const value = (props.value || []).map(x => x.id)
33
+  const handleChange = vals => {
34
+    const data = (vals || []).map(x => ({id: x}))
35
+    props.onChange(data)
36
+  }
37
+
38
+  return (
39
+    <CommunitySelect
40
+      mode="multiple"
41
+      value={value}
42
+      onChange={handleChange}
43
+    />
44
+  )
45
+}
46
+
30 47
 /**
31 48
  *
32 49
  *
@@ -251,12 +268,20 @@ const Edit = (props) => {
251 268
         { required: true, message: '请选择头像' },
252 269
       ]
253 270
     },
271
+    {
272
+      label: '授权小区',
273
+      name: 'communityList',
274
+      render: <AuthCommunity />,
275
+      value: userData.communityList,
276
+      rules: [
277
+        { required: true, message: '请选择授权小区' },
278
+      ]
279
+    },
254 280
     {
255 281
       label: '简介',
256 282
       name: 'description',
257 283
       render: <TextArea className={channels.inpuitTxt} placeholder="生活管家请在此填写服务范围" ></TextArea>,
258 284
       value: userData.description
259
-
260 285
     },
261 286
     {
262 287
       label: '状态',
@@ -336,8 +361,6 @@ const Edit = (props) => {
336 361
     // },
337 362
   ]
338 363
 
339
-  console.log('--------->', fields)
340
-
341 364
   return <div>
342 365
             <XForm onChange={console.log} onSubmit={handleSubmit} fields={fields.filter(Boolean)} onCancel={() => router.go(-1)}></XForm>
343 366
             {/* <Modal

+ 2
- 0
src/services/apis.js Bestand weergeven

@@ -6,6 +6,7 @@ import announcement from './announcement_api'
6 6
 import ticket from './ticket_api'
7 7
 import propNews from './prop_news_api'
8 8
 import dashboard from './dashboard_api'
9
+import community from './community_api'
9 10
 
10 11
 const prefix = `${APIBaseURL}api/admin`
11 12
 
@@ -21,6 +22,7 @@ export default {
21 22
   ticket: ticket(prefix),
22 23
   propNews: propNews(prefix),
23 24
   dashboard: dashboard(prefix),
25
+  community: community(prefix),
24 26
   mp: {
25 27
     detail: {
26 28
       url: `${prefix}/taMpInfo`,

+ 28
- 0
src/services/community_api.js Bestand weergeven

@@ -0,0 +1,28 @@
1
+
2
+export default prefix => ({
3
+  list: {
4
+    url: `${prefix}/tpCommunity`,
5
+    method: 'GET',
6
+    action: 'admin.community.list'
7
+  },
8
+  detail: {
9
+    url: `${prefix}/tpCommunity/:id`,
10
+    method: 'GET',
11
+    action: 'admin.community.detail'
12
+  },
13
+  update: {
14
+    url: `${prefix}/tpCommunity/:id`,
15
+    method: 'PUT',
16
+    action: 'admin.community.update'
17
+  },
18
+  save: {
19
+    url: `${prefix}/tpCommunity`,
20
+    method: 'POST',
21
+    action: 'admin.community.save'
22
+  },
23
+  delete: {
24
+    url: `${prefix}/tpCommunity/:id`,
25
+    method: 'DELETE',
26
+    action: 'admin.community.delete'
27
+  },
28
+})