Quellcode durchsuchen

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

许静 vor 5 Jahren
Ursprung
Commit
1ae4ffa8d4

+ 1
- 1
src/components/SelectButton/CitySelect.jsx Datei anzeigen

@@ -32,7 +32,7 @@ const CitySelect = (props) => {
32 32
   return (
33 33
       <Select value={props.value} style={{ width: '180px' }} placeholder="请选择城市" onChange={props.onChange}>
34 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 37
       </Select>
38 38
   )

+ 1
- 1
src/pages/building/list/add/components/amap.jsx Datei anzeigen

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

+ 7
- 2
src/pages/building/list/add/components/base.jsx Datei anzeigen

@@ -54,8 +54,13 @@ function AddBuilding(props) {
54 54
    function getById(currentId) {
55 55
 
56 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 64
       res.avatarImage = res.buildingImg.map(item => item.url)
60 65
       props.form.setFieldsValue(res)
61 66
     })

+ 9
- 2
src/pages/building/list/add/components/tags.jsx Datei anzeigen

@@ -8,7 +8,14 @@ class EditableTagGroup extends React.Component {
8 8
   };
9 9
 
10 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 20
   toggleOnChange = tags => {
14 21
     if (typeof this.props.onChange === 'function') {
@@ -49,7 +56,7 @@ class EditableTagGroup extends React.Component {
49 56
 
50 57
   render() {
51 58
     const { inputVisible, inputValue } = this.state;
52
-
59
+    console.log('this.getTags(): ', this.getTags())
53 60
     return (
54 61
       <div>
55 62
         {this.getTags().map((tag, index) => {

+ 2
- 2
src/pages/building/type/edi.jsx Datei anzeigen

@@ -56,11 +56,11 @@ function body(props) {
56 56
     dataSources.createDate = new Date()
57 57
     request({ ...apis.buildingType.add, data: { ...dataSources } }).then(() => {
58 58
       // eslint-disable-next-line no-unused-expressions
59
-      this.openNotificationWithIcon('success', '操作成功')
59
+      openNotificationWithIcon('success', '操作成功')
60 60
       router.go(-1)
61 61
     }).catch(err => {
62 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 Datei anzeigen

@@ -1,5 +1,5 @@
1 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 3
 import router from 'umi/router';
4 4
 import moment from 'moment';
5 5
 import Styles from './style.less'
@@ -67,6 +67,14 @@ function body() {
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 79
   function onChange(pageNumber) {
72 80
     // eslint-disable-next-line no-console
@@ -76,12 +84,13 @@ function body() {
76 84
 
77 85
   // 删除
78 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 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 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