Your Name 4 år sedan
förälder
incheckning
465e96da1c

+ 6
- 0
config/routes.js Visa fil

@@ -56,6 +56,12 @@ export default [
56 56
                 name: '项目列表',
57 57
                 component: './building/List',
58 58
               },
59
+              {
60
+                path: '/building/add',
61
+                name: '项目维护',
62
+                component: './building/Edit',
63
+                hideInMenu: true,
64
+              },
59 65
             ],
60 66
           },
61 67
           {

+ 2
- 2
src/components/TableList/index.jsx Visa fil

@@ -12,7 +12,7 @@ export default React.forwardRef((props, ref) => {
12 12
   const [pageTotal, setPageTotal] = useState(0)
13 13
   const [pageConfig, setPageConfig] = useState({ current: 1, pageSize: 10 })
14 14
 
15
-  const { api, params = {}, onPageChange, ...tableProps } = props
15
+  const { api, params, onPageChange, ...tableProps } = props
16 16
 
17 17
   // 更新分页
18 18
   const updatePage = useCallback(
@@ -36,7 +36,7 @@ export default React.forwardRef((props, ref) => {
36 36
     () => {
37 37
       setLoading(true)
38 38
       const queryParams = {
39
-        ...params,
39
+        ...params || {},
40 40
         pageNum: pageConfig.current,
41 41
         pageSize: pageConfig.pageSize,
42 42
       }

+ 37
- 0
src/pages/building/Edit/Basic.jsx Visa fil

@@ -0,0 +1,37 @@
1
+import React from 'react'
2
+import { Form, Input } from 'antd'
3
+import BuildingType from './components/BuildingTypeSelect'
4
+import { formItemLayout } from './utils'
5
+
6
+const Item = Form.Item
7
+
8
+const BuildingBasic = (props) => {
9
+  const { form } = props;
10
+  const { getFieldDecorator } = form;
11
+
12
+  return (
13
+    <Form {...formItemLayout}>
14
+      <Item label="项目Id" style={{ display: 'none' }}>
15
+        {getFieldDecorator('buildingId')(<Input disabled />)}
16
+      </Item>
17
+      <Item label="楼盘编号" >
18
+        {getFieldDecorator('code', {
19
+          rules: [{ required: true, message: '请输入楼盘编号' }],
20
+        })(<Input />)}
21
+      </Item>
22
+      <Item label="楼盘名称" >
23
+        {getFieldDecorator('buildingName', {
24
+          rules: [{ required: true, message: '请输入楼盘名' }],
25
+        })(<Input />)}
26
+      </Item>
27
+      <Form.Item label="项目类型">
28
+        {getFieldDecorator('buildingProjectType', {
29
+          rules: [{ required: true, message: '请选择项目类型' }],
30
+        })(<BuildingType />)}
31
+      </Form.Item>
32
+
33
+    </Form>
34
+  )
35
+}
36
+
37
+export default Form.create()(BuildingBasic)

+ 50
- 0
src/pages/building/Edit/components/BuildingTypeDetail.jsx Visa fil

@@ -0,0 +1,50 @@
1
+import React from 'react'
2
+import { Button, Card, Form, Radio, Input, Select } from 'antd'
3
+import { formItemLayout } from '../utils'
4
+
5
+const Item = Form.Item
6
+
7
+const BuildingTypeDetail = (props) => {
8
+  const { buildingType, form } = props
9
+  const { getFieldDecorator } = form
10
+
11
+  return (
12
+    <Card size="small" title={buildingType?.buildingTypeName} extra={<Button type="link" icon="close" />}>
13
+      <Form>
14
+        <Item label="价格类型" {...formItemLayout}>
15
+          {getFieldDecorator('priceType')(
16
+            <Radio.Group>
17
+              <Radio value="average">均价</Radio>
18
+              <Radio value="total">总价</Radio>
19
+              <Radio value="lease">租赁价</Radio>
20
+            </Radio.Group>
21
+          )}
22
+        </Item>
23
+        <Item label="价格区间" help='最高价与最低价一致时,只展示一个' {...formItemLayout}>
24
+          <span>{getFieldDecorator('startPrice')(<Input type="number" placeholder="最低价" style={{width: '120px'}} maxLength="9" />)}</span>
25
+          <span>-</span>
26
+          <span>{getFieldDecorator('endPrice')(<Input type="number" placeholder="最高价" style={{width: '120px'}} maxLength="9" />)}</span>
27
+          {/* <span>{this.props.type.priceType === "average" ? "元/㎡" : this.props.type.priceType === "lease" ? "元/㎡/天" : "万元/套"}</span> */}
28
+        </Item>
29
+        <Item label="销售状态" {...formItemLayout}>
30
+          {getFieldDecorator('marketStatus')(
31
+            <Select placeholder="销售状态">
32
+              <Option value="待售">待售</Option>
33
+              <Option value="在售">在售</Option>
34
+              <Option value="售罄">售罄</Option>
35
+              <Option value="在租">在租</Option>
36
+            </Select>,
37
+          )}
38
+        </Item>
39
+        <Item label="装修标准" {...formItemLayout}>
40
+          {getFieldDecorator('decoration')(<Input />)}
41
+        </Item>
42
+        <Item label="产权年限" {...formItemLayout}>
43
+          {getFieldDecorator('rightsYear')(<Input />)}
44
+        </Item>
45
+      </Form>
46
+    </Card>
47
+  )
48
+}
49
+
50
+export default Form.create()(BuildingTypeDetail)

+ 19
- 0
src/pages/building/Edit/components/BuildingTypeSelect.jsx Visa fil

@@ -0,0 +1,19 @@
1
+import React, { useState, useEffect } from 'react'
2
+import { Checkbox, Card, notification } from 'antd'
3
+import request, { apis } from '@/utils/request'
4
+import CheckBuildingType from './CheckBuildingType'
5
+import BuildingTypeDetail from './BuildingTypeDetail'
6
+
7
+export default (props) => {
8
+  const [checkedType, setCheckedType] = useState([])
9
+
10
+  useEffect(() => {
11
+  }, [])
12
+
13
+  return (
14
+    <div>
15
+      <CheckBuildingType />
16
+      <BuildingTypeDetail />
17
+    </div>
18
+  )
19
+}

+ 36
- 0
src/pages/building/Edit/components/CheckBuildingType.jsx Visa fil

@@ -0,0 +1,36 @@
1
+import React, { useState, useEffect } from 'react'
2
+import { Checkbox, Card, notification } from 'antd'
3
+import request, { apis } from '@/utils/request'
4
+
5
+const gridStyle = {
6
+  width: '25%',
7
+  // textAlign: 'center',
8
+};
9
+
10
+export default (props) => {
11
+  const [checkedType, setCheckedType] = useState([])
12
+  const [typeList, setTypeList] = useState([])
13
+
14
+  useEffect(() => {
15
+    // 请求类型列表
16
+    request({ ...apis.buildingType.getList, params: { pageNum: 1, pageSize: 999 } }).then(res => {
17
+      setTypeList(res.records)
18
+    }).catch((err) => {
19
+      notification.error({ message: err.message })
20
+    })
21
+  }, [])
22
+
23
+  return (
24
+    <Checkbox.Group style={{ width: '100%' }}>
25
+      <Card bordered={false}>
26
+        {
27
+          typeList.map((it) => (
28
+            <Card.Grid style={gridStyle} key={it.buildingTypeId} hoverable={false}>
29
+              <Checkbox value={it.buildingTypeId}>{it.buildingTypeName}</Checkbox>
30
+            </Card.Grid>
31
+          ))
32
+        }
33
+      </Card>
34
+    </Checkbox.Group>
35
+  )
36
+}

+ 38
- 0
src/pages/building/Edit/index.jsx Visa fil

@@ -0,0 +1,38 @@
1
+import React from 'react'
2
+import { Tabs, Card } from 'antd'
3
+import Basic from './Basic'
4
+import styles from './style.less'
5
+
6
+const { TabPane } = Tabs
7
+
8
+export default (props) => {
9
+  return (
10
+    <Card>
11
+      <Tabs defaultActiveKey="1">
12
+        <TabPane tab="基础信息" key="1">
13
+          <div className={styles['tab-wrapper']} style={{maxWidth: 900}}>
14
+            <Basic />
15
+          </div>
16
+        </TabPane>
17
+        <TabPane tab="户型设置" key="2">
18
+          Content of Tab Pane 2
19
+        </TabPane>
20
+        <TabPane tab="项目相册" key="3">
21
+          Content of Tab Pane 3
22
+        </TabPane>
23
+        <TabPane tab="全景照片" key="4">
24
+          Content of Tab Pane 3
25
+        </TabPane>
26
+        <TabPane tab="海报图片" key="5">
27
+          Content of Tab Pane 3
28
+        </TabPane>
29
+        <TabPane tab="分享设置" key="6">
30
+          Content of Tab Pane 3
31
+        </TabPane>
32
+        <TabPane tab="渠道设置" key="7">
33
+          Content of Tab Pane 3
34
+        </TabPane>
35
+      </Tabs>
36
+    </Card>
37
+  )
38
+}

+ 4
- 0
src/pages/building/Edit/style.less Visa fil

@@ -0,0 +1,4 @@
1
+
2
+.tab-wrapper {
3
+  padding-top: 1em;
4
+}

+ 11
- 0
src/pages/building/Edit/utils.js Visa fil

@@ -0,0 +1,11 @@
1
+
2
+export const formItemLayout = {
3
+  labelCol: {
4
+    xs: { span: 24 },
5
+    sm: { span: 4 },
6
+  },
7
+  wrapperCol: {
8
+    xs: { span: 24 },
9
+    sm: { span: 16 },
10
+  },
11
+}

+ 3
- 1
src/pages/building/List/index.jsx Visa fil

@@ -1,6 +1,7 @@
1 1
 import React, { useMemo, useRef, useCallback, useState } from 'react'
2 2
 // import { PageHeaderWrapper } from '@ant-design/pro-layout'
3 3
 import { Button, notification, Spin } from 'antd'
4
+import { router } from 'umi'
4 5
 import QueryTable from '@/components/QueryTable'
5 6
 import request from '@/utils/request'
6 7
 import apis from '@/services/apis'
@@ -45,7 +46,8 @@ export default (props) => {
45 46
   }, [page])
46 47
 
47 48
   const actionRender = () => {
48
-    return <Button type="primary" icon="plus">新增</Button>
49
+    const gotoAdd = () => router.push('/building/add')
50
+    return <Button type="primary" icon="plus" onClick={gotoAdd}>新增</Button>
49 51
   }
50 52
 
51 53
   return (

+ 1
- 1
src/pages/building/List/tableColumns.js Visa fil

@@ -34,7 +34,7 @@ export default ({page, onPublish, onDelete}) => [
34 34
         <Button
35 35
           type="link"
36 36
           onClick={() => router.push({
37
-            pathname: '/building/list/add',
37
+            pathname: '/building/add',
38 38
             query: {
39 39
               id: row.buildingId,
40 40
             },