|
@@ -1,46 +1,64 @@
|
|
import * as React from 'react'
|
|
import * as React from 'react'
|
|
import type { ActionType } from '@ant-design/pro-table'
|
|
import type { ActionType } from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
import ProTable from '@ant-design/pro-table'
|
|
-import { Button, Modal, Form, Select, Card } from 'antd'
|
|
|
|
-import { GetGardenList, GetProvinceCityArea } from '../../services/api'
|
|
|
|
|
|
+import { Button, Modal, Form, Select } from 'antd'
|
|
|
|
+import { PlusOutlined } from '@ant-design/icons'
|
|
|
|
+import { withRouter } from 'react-router-dom'
|
|
|
|
|
|
const GardenList: React.FC = (props: any) => {
|
|
const GardenList: React.FC = (props: any) => {
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
const columns: any = [
|
|
const columns: any = [
|
|
|
|
+ {
|
|
|
|
+ title: 'ID',
|
|
|
|
+ dataIndex: 'id',
|
|
|
|
+ search: false
|
|
|
|
+ },
|
|
{
|
|
{
|
|
title: '小区名称',
|
|
title: '小区名称',
|
|
dataIndex: 'name'
|
|
dataIndex: 'name'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '小区地址',
|
|
|
|
- dataIndex: 'name'
|
|
|
|
|
|
+ title: '城市',
|
|
|
|
+ dataIndex: 'name',
|
|
|
|
+ search: false
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '所属物业公司',
|
|
|
|
- dataIndex: 'id',
|
|
|
|
- valueEnum: {
|
|
|
|
- 0: {
|
|
|
|
- text: '测试',
|
|
|
|
- status: 'Default',
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ title: '街道社区',
|
|
|
|
+ dataIndex: 'name',
|
|
|
|
+ search: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '小区详细地址',
|
|
|
|
+ dataIndex: 'name',
|
|
|
|
+ search: false,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: '联系人',
|
|
|
|
+ dataIndex: 'name',
|
|
|
|
+ search: false,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '物业联系人',
|
|
title: '物业联系人',
|
|
- dataIndex: 'name'
|
|
|
|
|
|
+ dataIndex: 'name',
|
|
|
|
+ search: false,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '物业联系人手机号',
|
|
|
|
|
|
+ title: '联系电话',
|
|
dataIndex: 'company_phone',
|
|
dataIndex: 'company_phone',
|
|
search: false,
|
|
search: false,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '社区',
|
|
|
|
- dataIndex: 'id'
|
|
|
|
|
|
+ title: '管理入口',
|
|
|
|
+ dataIndex: 'company_phone',
|
|
|
|
+ search: false,
|
|
|
|
+ render: (_, record) => [
|
|
|
|
+ <Button type='link'>管理入口</Button>
|
|
|
|
+ ]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: '街道',
|
|
|
|
- dataIndex: 'id'
|
|
|
|
|
|
+ title: '创建时间',
|
|
|
|
+ dataIndex: 'company_phone',
|
|
|
|
+ search: false,
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '操作',
|
|
title: '操作',
|
|
@@ -49,7 +67,9 @@ const GardenList: React.FC = (props: any) => {
|
|
render: (_, row, index, action) => [
|
|
render: (_, row, index, action) => [
|
|
<Button type='link' onClick={() => {
|
|
<Button type='link' onClick={() => {
|
|
setState(pre => ({ ...pre, visible: true }))
|
|
setState(pre => ({ ...pre, visible: true }))
|
|
- }}>修改所属物业公司</Button>
|
|
|
|
|
|
+ }}>修改</Button>, <Button type='link' onClick={() => {
|
|
|
|
+ setState(pre => ({ ...pre, visible: true }))
|
|
|
|
+ }}>删除</Button>
|
|
]
|
|
]
|
|
}
|
|
}
|
|
]
|
|
]
|
|
@@ -57,76 +77,10 @@ const GardenList: React.FC = (props: any) => {
|
|
visible: false,
|
|
visible: false,
|
|
examineVisible: false
|
|
examineVisible: false
|
|
})
|
|
})
|
|
- const [areaData, setAreaData] = React.useState({
|
|
|
|
- province_list: [],
|
|
|
|
- city_list: [],
|
|
|
|
- area_list: []
|
|
|
|
- })
|
|
|
|
- // cache
|
|
|
|
- const [areaDataCache, setAreaDataCache] = React.useState({
|
|
|
|
- province_list: [],
|
|
|
|
- city_list: [],
|
|
|
|
- area_list: []
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- React.useEffect(() => {
|
|
|
|
- GetProvinceCityArea({}).then(res => {
|
|
|
|
- setAreaDataCache(res.data)
|
|
|
|
- setAreaData(pre => ({
|
|
|
|
- ...pre,
|
|
|
|
- province_list: res.data.province_list
|
|
|
|
- }))
|
|
|
|
- console.log(areaDataCache.city_list)
|
|
|
|
- })
|
|
|
|
- }, [])
|
|
|
|
|
|
|
|
const actionRef = React.useRef<ActionType>();
|
|
const actionRef = React.useRef<ActionType>();
|
|
return (
|
|
return (
|
|
<React.Fragment>
|
|
<React.Fragment>
|
|
- <Card>
|
|
|
|
- <Select
|
|
|
|
- placeholder='省份'
|
|
|
|
- style={{ width: 200 }}
|
|
|
|
- onChange={
|
|
|
|
- (value) => {
|
|
|
|
- setAreaData(pre => ({
|
|
|
|
- ...pre,
|
|
|
|
- city_list: areaDataCache.city_list.filter((item: any) => item.province_code === value)
|
|
|
|
- }))
|
|
|
|
- }
|
|
|
|
- }>
|
|
|
|
- {
|
|
|
|
- areaData.province_list.map((province: any) => {
|
|
|
|
- return <Select.Option value={province.code} key={province.code}>{province.name}</Select.Option>
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- </Select>
|
|
|
|
- <Select
|
|
|
|
- placeholder='城市'
|
|
|
|
- style={{ width: 200 }}
|
|
|
|
- onChange={
|
|
|
|
- (value) => {
|
|
|
|
- setAreaData(pre => ({
|
|
|
|
- ...pre,
|
|
|
|
- area_list: areaDataCache.area_list.filter((item: any) => item.city_code === value)
|
|
|
|
- }))
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- >
|
|
|
|
- {
|
|
|
|
- areaData.city_list.map((item: any) => {
|
|
|
|
- return <Select.Option value={item.code} key={item.code}>{item.name}</Select.Option>
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- </Select>
|
|
|
|
- <Select placeholder='区域' style={{ width: 200 }}>
|
|
|
|
- {
|
|
|
|
- areaData.area_list.map((item: any) => {
|
|
|
|
- return <Select.Option value={item.code} key={item.code}>{item.name}</Select.Option>
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- </Select>
|
|
|
|
- </Card>
|
|
|
|
<ProTable
|
|
<ProTable
|
|
headerTitle="小区列表"
|
|
headerTitle="小区列表"
|
|
actionRef={actionRef}
|
|
actionRef={actionRef}
|
|
@@ -139,7 +93,17 @@ const GardenList: React.FC = (props: any) => {
|
|
success: true,
|
|
success: true,
|
|
});
|
|
});
|
|
}}
|
|
}}
|
|
- toolBarRender={() => []}
|
|
|
|
|
|
+ toolBarRender={() => [
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ key="primary"
|
|
|
|
+ onClick={() => {
|
|
|
|
+ props.history.push('/admin/garden/create')
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <PlusOutlined /> 新建
|
|
|
|
+ </Button>
|
|
|
|
+ ]}
|
|
columns={columns}
|
|
columns={columns}
|
|
/>
|
|
/>
|
|
<Modal
|
|
<Modal
|
|
@@ -162,4 +126,4 @@ const GardenList: React.FC = (props: any) => {
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
-export default GardenList
|
|
|
|
|
|
+export default withRouter(GardenList)
|