张延森 преди 4 години
родител
ревизия
1ce6b7491f

+ 6
- 0
config/routes.js Целия файл

@@ -619,6 +619,12 @@ export default [
619 619
                 component: './property/bill/info',
620 620
                 hideInMenu: true,
621 621
               },
622
+              {
623
+                path: 'bill/management/info/add',
624
+                name: '新增收费',
625
+                component: './property/bill/info/Add',
626
+                hideInMenu: true,
627
+              },
622 628
               {
623 629
                 path: 'bill/order',
624 630
                 name: '订单管理',

+ 18
- 4
src/pages/property/bill/info/Add.jsx Целия файл

@@ -1,5 +1,5 @@
1
-import React, { useEffect, useState } from 'react'
2
-import { Button, Icon, Modal, Table, Popconfirm } from 'antd'
1
+import React, { useEffect, useState, useCallback } from 'react'
2
+import { Button, Icon, Modal, Table, Popconfirm, notification } from 'antd'
3 3
 import { fetch, fetchList, apis } from '@/utils/request'
4 4
 import NavLink from 'umi/navlink'
5 5
 import List from '../../components/List'
@@ -8,6 +8,7 @@ import AddOne from './components/AddOne'
8 8
 const getTempBillInvoice = fetch(apis.bill.getTempBillInvoice)
9 9
 const addTempBillInvoice = fetch(apis.bill.addTempBillInvoice)
10 10
 const deleteTempBillInvoice = fetch(apis.bill.deleteTempBillInvoice)
11
+const updateBillInvoiceStatus = fetch(apis.bill.updateBillInvoiceStatus)
11 12
 
12 13
 export default props => {
13 14
   const [loading, setLoading] = useState(false)
@@ -46,6 +47,19 @@ export default props => {
46 47
     })
47 48
   }
48 49
 
50
+  const handleCommitAll = () => {
51
+    if (!listData.length) {
52
+      notification.warn({ message: '没有需要提交的数据' })
53
+      return
54
+    }
55
+
56
+    setLoading(true)
57
+    updateBillInvoiceStatus({data: listData.map(x => x.id)}).then(res => {
58
+      notification.success({ message: '全部提交成功' })
59
+      setLoading(false)
60
+    }).catch(e => setLoading(false))
61
+  }
62
+
49 63
   useEffect(() => {
50 64
     if (id) {
51 65
       getListData()
@@ -56,9 +70,9 @@ export default props => {
56 70
 
57 71
   return (
58 72
     <div>
59
-      <div>
73
+      <div style={{marginBottom: '24PX'}}>
60 74
         <Button type="primary" onClick={() => setShowAdd(true)}><Icon type="plus"/>新增记录</Button>
61
-        <Button type="danger" style={{marginLeft: '48px'}} onClick={}><Icon type="save"/>提交全部</Button>
75
+        <Button type="danger" style={{marginLeft: '48px'}} onClick={handleCommitAll}><Icon type="save"/>提交全部</Button>
62 76
       </div>
63 77
       <List dataSource={listData} loading={loading} rowKey="id">
64 78
         <Table.Column title="房屋信息" dataIndex="roomNo" key="roomNo" render={(_, row) => row.phase + row.building + row.unit + row.roomNo} />

+ 14
- 8
src/pages/property/bill/info/components/AddOne.jsx Целия файл

@@ -90,29 +90,35 @@ export default Form.create()(props => {
90 90
       })
91 91
     }
92 92
   }
93
+  
94
+  const handlePhaseChange = e => setPhaseId(e)
95
+  const handleBuildingChange = e => setBuildingId(e)
96
+  const handleUnitChange = e => setUnitId(e)
97
+  const handleLevelChange = e => setLevelId(e)
98
+  const handleRoomChange = e => setRoomNoId(e)
93 99
 
94 100
   useEffect(() => {
95 101
     props.form.setFieldsValue(formData)
96 102
   }, [formData])
97 103
 
98 104
   useEffect(() => {
99
-    setPhaseErr(phaseId ? '请选择期数': undefined)
105
+    setPhaseErr(!phaseId ? '请选择期数': undefined)
100 106
   }, [phaseId])
101 107
 
102 108
   useEffect(() => {
103
-    setBuildingErr(buildingId ? '请选择楼栋': undefined)
109
+    setBuildingErr(!buildingId ? '请选择楼栋': undefined)
104 110
   }, [buildingId])
105 111
 
106 112
   useEffect(() => {
107
-    setUnitErr(setUnitId ? '请选择单元': undefined)
108
-  }, [setUnitId])
113
+    setUnitErr(!unitId ? '请选择单元': undefined)
114
+  }, [unitId])
109 115
 
110 116
   useEffect(() => {
111
-    setLevelErr(levelId ? '请选择层数': undefined)
117
+    setLevelErr(!levelId ? '请选择层数': undefined)
112 118
   }, [levelId])
113 119
 
114 120
   useEffect(() => {
115
-    setRoomNoErr(roomNoId ? '请选择户号': undefined)
121
+    setRoomNoErr(!roomNoId ? '请选择户号': undefined)
116 122
   }, [roomNoId])
117 123
 
118 124
   return (
@@ -154,7 +160,7 @@ export default Form.create()(props => {
154 160
       </Form.Item>
155 161
       <Form.Item label="收费单说明">
156 162
       {
157
-        getFieldDecorator('billInvoiceExplain', {
163
+        props.form.getFieldDecorator('billInvoiceExplain', {
158 164
           rules: [
159 165
             {required: true, message: '请填写收费单说明'}
160 166
           ]
@@ -163,7 +169,7 @@ export default Form.create()(props => {
163 169
       </Form.Item>
164 170
       <Form.Item label="收费金额(元)">
165 171
       {
166
-        getFieldDecorator('payPrice', {
172
+        props.form.getFieldDecorator('payPrice', {
167 173
           rules: [
168 174
             {required: true, message: '请填写收费金额'}
169 175
           ]

+ 1
- 1
src/pages/property/bill/info/index.jsx Целия файл

@@ -295,7 +295,7 @@ export default props => {
295 295
       </div>
296 296
 
297 297
       <div style={{margin: '24px 0'}}>
298
-        <NavLink to=""><Button type="primary"><Icon type="plus" />添加更多收费单</Button></NavLink>
298
+        <NavLink to="/property/bill/management/info/add"><Button type="primary"><Icon type="plus" />添加更多收费单</Button></NavLink>
299 299
         <Button type="link" onClick={exportExcel}><Icon type="export" />导出数据</Button>
300 300
         <div style={{height: '40px', lineHeight: '40px', marginLeft: '10px', fontSize: '14px', color: '#888' }}>未缴户主费用可以直接点击 收费金额数字 修改,已缴费户主无法修改,需要线下多退少补</div>
301 301
       </div>

+ 2
- 2
src/pages/property/bill/order/index.jsx Целия файл

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react'
2
-import { Select, Spin, Table, Button, Form, Input, Divider } from 'antd'
2
+import { Select, Spin, Table, Button, Form, Input, Divider, Icon } from 'antd'
3 3
 import NavLink from 'umi/navlink'
4 4
 import { fetchList, apis, fetch } from '@/utils/request'
5 5
 import Search from '../../components/Search'
@@ -108,7 +108,7 @@ export default props => {
108 108
     <div>
109 109
       <Condition onSearch={handleSearch} onReset={handleSearch} />
110 110
       <div style={{ margin: '24px 0' }}>
111
-        <Button type="primary" onClick={exportExcel}>导出数据</Button>
111
+        <Button type="link" onClick={exportExcel}><Icon type="download"/>导出数据</Button>
112 112
       </div>
113 113
       <List dataSource={listData} loading={loading} pagination={pagination} onPageChange={handlePageChange} rowKey="id">
114 114
         <Table.Column

+ 3
- 3
src/pages/property/building/BatchImport.jsx Целия файл

@@ -72,10 +72,10 @@ export default props => {
72 72
   return (
73 73
     <div>
74 74
       <div style={{ marginBottom: '24px' }}>
75
-        <Button onClick={downloadExcel}><Icon type="download" />下载模板</Button>
76
-        <Button onClick={importExcel} style={spaceStyle}><Icon type="upload" />选取文件并预览</Button>
77
-        <Button type="primary" onClick={submitExcel} style={spaceStyle}>提交</Button>
75
+        <Button type="primary" onClick={importExcel}><Icon type="upload" />选取文件并预览</Button>
76
+        <Button type="danger" onClick={submitExcel} style={spaceStyle}>提交</Button>
78 77
         <Button style={spaceStyle} onClick={() => router.go(-1)}>取消</Button>
78
+        <Button type="link" onClick={downloadExcel} style={spaceStyle}><Icon type="download" />下载模板</Button>
79 79
       </div>
80 80
 
81 81
       <Table dataSource={dataList} pagination={pagenavi} loading={loading}>

+ 1
- 1
src/pages/property/building/index.jsx Целия файл

@@ -142,7 +142,7 @@ export default props => {
142 142
     <>
143 143
       <div style={{ marginBottom: '24px' }}>
144 144
         <Button onClick={() => showPrompt({ type: 'phase' })}><Icon type="plus" />增加顶级节点</Button>
145
-        <Button type="link" onClick={handleBatchImport} style={{ marginLeft: '24px' }}>批量导入小区楼栋信息</Button>
145
+        <Button type="link" onClick={handleBatchImport} style={{ marginLeft: '24px' }}><Icon type="upload"/>批量导入小区楼栋信息</Button>
146 146
       </div>
147 147
       {
148 148
         treeData && treeData.length ? (

+ 18
- 53
src/pages/property/proprietor/Add.jsx Целия файл

@@ -2,12 +2,8 @@ import React, { useRef, useState, useEffect } from 'react'
2 2
 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
+import useRoomSelect from '../utils/hooks/useRoomSelect'
5 6
 
6
-const fetchPhaseList = fetch(apis.buildingOwnerInfo.getPhaseList)
7
-const fetchBuildingList = fetch(apis.buildingOwnerInfo.getBuildingList)
8
-const fetchUnitList = fetch(apis.buildingOwnerInfo.getUnitList)
9
-const fetchLevelList = fetch(apis.buildingOwnerInfo.getLevelList)
10
-const fetchRoomNoList = fetch(apis.buildingOwnerInfo.getRoomNoList)
11 7
 const addPerson = fetch(apis.buildingOwnerInfo.addBuilding)
12 8
 const taUserHasOwner = fetch(apis.propUser.taUserHasOwner)
13 9
 const taUserHas = fetch(apis.propUser.taUserHas)
@@ -37,17 +33,23 @@ const tailFormItemLayout = {
37 33
 }
38 34
 
39 35
 export default Form.create()(props => {
40
-  const [phaseList, setPhaseList] = useState([])
41
-  const [buildingList, setBuildingList] = useState([])
42
-  const [unitList, setUnitList] = useState([])
43
-  const [levelList, setLevelList] = useState([])
44
-  const [roomNoList, setRoomNoList] = useState([])
45
-
46
-  const [phaseId, setPhaseId] = useState()
47
-  const [buildingId, setBuildingId] = useState()
48
-  const [unitId, setUnitId] = useState()
49
-  const [levelId, setLevelId] = useState()
50
-  const [roomNoId, setRoomNoId] = useState()
36
+  const {
37
+    phaseId,
38
+    setPhaseId,
39
+    buildingId,
40
+    setBuildingId,
41
+    unitId,
42
+    setUnitId,
43
+    levelId,
44
+    setLevelId,
45
+    roomNoId,
46
+    setRoomNoId,
47
+    phaseList,
48
+    buildingList,
49
+    unitList,
50
+    levelList,
51
+    roomNoList
52
+  } = useRoomSelect()
51 53
 
52 54
   const [owerExist, setOwnerExist] = useState(false)
53 55
   const [telAccUser, setTelAccUser] = useState()
@@ -66,43 +68,6 @@ export default Form.create()(props => {
66 68
     }
67 69
   }
68 70
 
69
-  // 获取期
70
-  useEffect(() => {
71
-    fetchPhaseList().then(res => setPhaseList(res))
72
-  }, [])
73
-
74
-  // 楼栋
75
-  useEffect(() => {
76
-    if (phaseId) {
77
-      fetchBuildingList({params: {phaseId}}).then(res => setBuildingList(res))
78
-    }
79
-    setBuildingId()
80
-  }, [phaseId])
81
-
82
-  // 单元
83
-  useEffect(() => {
84
-    if (phaseId && buildingId) {
85
-      fetchUnitList({params: {phaseId, buildingId}}).then(res => setUnitList(res))
86
-    }
87
-    setUnitId()
88
-  }, [phaseId, buildingId])
89
-
90
-  // 楼层
91
-  useEffect(() => {
92
-    if (phaseId && buildingId && unitId) {
93
-      fetchLevelList({params: {phaseId, buildingId, unitId}}).then(res => setLevelList(res))
94
-    }
95
-    setLevelId()
96
-  }, [phaseId, buildingId, unitId])
97
-
98
-  // 房号
99
-  useEffect(() => {
100
-    if (phaseId && buildingId && unitId && levelId) {
101
-      fetchRoomNoList({params: {phaseId, buildingId, unitId, levelId}}).then(res => setRoomNoList(res))
102
-    }
103
-    setRoomNoId()
104
-  }, [phaseId, buildingId, unitId, levelId])
105
-
106 71
   useEffect(() => {
107 72
     if (roomNoId) {
108 73
       taUserHasOwner({ params: {phaseId, buildingId, unitId, levelId, roomNoId} }).then(res => {

+ 3
- 3
src/pages/property/proprietor/BatchImport.jsx Целия файл

@@ -76,10 +76,10 @@ export default props => {
76 76
   return (
77 77
     <div>
78 78
       <div style={{ marginBottom: '24px' }}>
79
-        <Button onClick={downloadExcel}><Icon type="download" />下载模板</Button>
80
-        <Button onClick={importExcel} style={spaceStyle}><Icon type="upload" />选取文件并预览</Button>
81
-        <Button type="primary" onClick={submitExcel} style={spaceStyle}>提交</Button>
79
+        <Button type="primary" onClick={importExcel} style={spaceStyle}><Icon type="upload" />选取文件并预览</Button>
80
+        <Button type="danger" onClick={submitExcel} style={spaceStyle}>提交</Button>
82 81
         <Button style={spaceStyle} onClick={() => router.go(-1)}>取消</Button>
82
+        <Button type="link" style={spaceStyle} onClick={downloadExcel}><Icon type="download" />下载模板</Button>
83 83
       </div>
84 84
 
85 85
       <Table dataSource={dataList} pagination={pagenavi} loading={loading}>