瀏覽代碼

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager

许静 5 年之前
父節點
當前提交
1ae4ffa8d4

+ 1
- 1
src/components/SelectButton/CitySelect.jsx 查看文件

32
   return (
32
   return (
33
       <Select value={props.value} style={{ width: '180px' }} placeholder="请选择城市" onChange={props.onChange}>
33
       <Select value={props.value} style={{ width: '180px' }} placeholder="请选择城市" onChange={props.onChange}>
34
           {data.map(city => (
34
           {data.map(city => (
35
-            <Option key={city.id}>{city.name}</Option>
35
+            <Option key={city.id} value={city.id}>{city.name}</Option>
36
           ))}
36
           ))}
37
       </Select>
37
       </Select>
38
   )
38
   )

+ 1
- 1
src/pages/building/list/add/components/amap.jsx 查看文件

61
 
61
 
62
         // 实例点击事件
62
         // 实例点击事件
63
         mapInstance.on('click', e => {
63
         mapInstance.on('click', e => {
64
-          const lngLat = `${e.lnglat.getLng()},${e.lnglat.getLat()}`
64
+          const lngLat = `${e.lnglat.getLat()},${e.lnglat.getLng()}`
65
           console.log('坐标位置:', lngLat)
65
           console.log('坐标位置:', lngLat)
66
           this.props.onChange(lngLat)
66
           this.props.onChange(lngLat)
67
         });
67
         });

+ 7
- 2
src/pages/building/list/add/components/base.jsx 查看文件

54
    function getById(currentId) {
54
    function getById(currentId) {
55
 
55
 
56
     request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
56
     request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
57
-      res.openingDate = moment(res.openingDate)
58
-      res.receivedDate = moment(res.receivedDate)
57
+      if (res.openingDate !== null) {
58
+        res.openingDate = moment(res.openingDate)
59
+      }
60
+      if (res.receivedDate !== null) {
61
+        res.receivedDate = moment(res.receivedDate)
62
+      }
63
+
59
       res.avatarImage = res.buildingImg.map(item => item.url)
64
       res.avatarImage = res.buildingImg.map(item => item.url)
60
       props.form.setFieldsValue(res)
65
       props.form.setFieldsValue(res)
61
     })
66
     })

+ 9
- 2
src/pages/building/list/add/components/tags.jsx 查看文件

8
   };
8
   };
9
 
9
 
10
   // 每次取值,都从 this.props.value 获取最新值
10
   // 每次取值,都从 this.props.value 获取最新值
11
-  getTags = () => (this.props.value || '').split(',')
11
+  getTags = () => {
12
+    // (this.props.value || '').split(',')
13
+    if (this.props.value) {
14
+      return this.props.value.split(',')
15
+    }
16
+
17
+    return []
18
+  }
12
 
19
 
13
   toggleOnChange = tags => {
20
   toggleOnChange = tags => {
14
     if (typeof this.props.onChange === 'function') {
21
     if (typeof this.props.onChange === 'function') {
49
 
56
 
50
   render() {
57
   render() {
51
     const { inputVisible, inputValue } = this.state;
58
     const { inputVisible, inputValue } = this.state;
52
-
59
+    console.log('this.getTags(): ', this.getTags())
53
     return (
60
     return (
54
       <div>
61
       <div>
55
         {this.getTags().map((tag, index) => {
62
         {this.getTags().map((tag, index) => {

+ 2
- 2
src/pages/building/type/edi.jsx 查看文件

56
     dataSources.createDate = new Date()
56
     dataSources.createDate = new Date()
57
     request({ ...apis.buildingType.add, data: { ...dataSources } }).then(() => {
57
     request({ ...apis.buildingType.add, data: { ...dataSources } }).then(() => {
58
       // eslint-disable-next-line no-unused-expressions
58
       // eslint-disable-next-line no-unused-expressions
59
-      this.openNotificationWithIcon('success', '操作成功')
59
+      openNotificationWithIcon('success', '操作成功')
60
       router.go(-1)
60
       router.go(-1)
61
     }).catch(err => {
61
     }).catch(err => {
62
       // eslint-disable-next-line no-unused-expressions
62
       // eslint-disable-next-line no-unused-expressions
63
-      this.openNotificationWithIcon('error', err)
63
+      openNotificationWithIcon('error', err)
64
     })
64
     })
65
   }
65
   }
66
 
66
 

+ 14
- 5
src/pages/building/type/index.jsx 查看文件

1
 import React, { useState, useEffect } from 'react';
1
 import React, { useState, useEffect } from 'react';
2
-import { Button, Table, Pagination, Alert, Icon, Tag } from 'antd'
2
+import { Button, Table, Pagination, Alert, Icon, Tag, notification } from 'antd'
3
 import router from 'umi/router';
3
 import router from 'umi/router';
4
 import moment from 'moment';
4
 import moment from 'moment';
5
 import Styles from './style.less'
5
 import Styles from './style.less'
67
     })
67
     })
68
   }
68
   }
69
 
69
 
70
+  const openNotificationWithIcon = (type, message) => {
71
+    notification[type]({
72
+      message,
73
+      description:
74
+        '',
75
+    });
76
+  }
77
+
70
   // 分页
78
   // 分页
71
   function onChange(pageNumber) {
79
   function onChange(pageNumber) {
72
     // eslint-disable-next-line no-console
80
     // eslint-disable-next-line no-console
76
 
84
 
77
   // 删除
85
   // 删除
78
   function deleteType(row) {
86
   function deleteType(row) {
79
-    const { url, method } = apis.buildingType.update
80
-    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(row.buildingTypeId)
81
-
82
     row.status = -1
87
     row.status = -1
83
-    request({ url: tempUrl, method, data: { ...row } }).then(() => {
88
+    request({ ...apis.buildingType.update, urlData: { id: row.buildingTypeId }, data: { ...row } }).then(() => {
84
       getList({ pageNum: data.current, pageSize: 10 })
89
       getList({ pageNum: data.current, pageSize: 10 })
90
+    }).then(() => {
91
+      openNotificationWithIcon('success', '操作成功')
92
+    }).catch(err => {
93
+      openNotificationWithIcon('error', err)
85
     })
94
     })
86
   }
95
   }
87
 
96