|
@@ -5,6 +5,7 @@ import request from '../../../../../utils/request';
|
5
|
5
|
import apis from '../../../../../services/apis';
|
6
|
6
|
import Styles from '../style.less';
|
7
|
7
|
import ImageUpload from '../../../../../components/XForm/ImageUpload'
|
|
8
|
+import ImageListUpload from '../../../../../components/XForm/ImageListUpload'
|
8
|
9
|
import Wangedit from '../../../../../components/Wangedit/Wangedit'
|
9
|
10
|
|
10
|
11
|
|
|
@@ -61,8 +62,8 @@ class ModalImage extends React.Component {
|
61
|
62
|
// }
|
62
|
63
|
|
63
|
64
|
componentDidUpdate(preProps, preState) {
|
64
|
|
- console.log(this.props.visibleData)
|
65
|
65
|
if (this.props.visibleData.visible !== preState.visibleData.visible) {
|
|
66
|
+ console.log(this.props.visibleData)
|
66
|
67
|
this.getById()
|
67
|
68
|
this.setState({ visibleData: this.props.visibleData });
|
68
|
69
|
}
|
|
@@ -91,7 +92,7 @@ class ModalImage extends React.Component {
|
91
|
92
|
|
92
|
93
|
request({ url: tempUrl, method, params: { ...params } }).then(res => {
|
93
|
94
|
// res.img = res.buildingImgList.map((item, _) => item.url)
|
94
|
|
- res.img = res.buildingImgList[0].url
|
|
95
|
+ res.img = res.buildingImgList.map(item => item.url)
|
95
|
96
|
this.props.form.setFieldsValue(res)
|
96
|
97
|
}).catch(err => {
|
97
|
98
|
this.openNotificationWithIcon('error', err)
|
|
@@ -118,7 +119,7 @@ class ModalImage extends React.Component {
|
118
|
119
|
|
119
|
120
|
submitData(data) {
|
120
|
121
|
// TODO 这里应该是要支持多图,但是封装的控件没有
|
121
|
|
- data.img = [{ imgType: 'aparment', url: data.img, orderNo: 1 }]
|
|
122
|
+ data.img = data.img.map((item, index) => ({ imgType: 'aparment', url: item, orderNo: index }))
|
122
|
123
|
data.buildingId = this.props.visibleData.buildingId;
|
123
|
124
|
const api = data.apartmentId !== undefined ? apis.building.buildingApartmentUpdate : apis.building.buildingApartmentAdd;
|
124
|
125
|
|
|
@@ -131,7 +132,7 @@ class ModalImage extends React.Component {
|
131
|
132
|
// onSuccess() 是自定义
|
132
|
133
|
this.props.onSuccess()
|
133
|
134
|
|
134
|
|
- this.handleCancel()
|
|
135
|
+ // this.setState({ visibleData: { visible: false, apartmentId: '', buildingId: '' } }, () => console.log('回调:', this.state.visibleData))
|
135
|
136
|
}).catch(err => {
|
136
|
137
|
// eslint-disable-next-line no-unused-expressions
|
137
|
138
|
this.openNotificationWithIcon('error', err)
|
|
@@ -186,7 +187,7 @@ class ModalImage extends React.Component {
|
186
|
187
|
</Form.Item>
|
187
|
188
|
<Form.Item label="图片">
|
188
|
189
|
{getFieldDecorator('img')(
|
189
|
|
- <ImageUpload />,
|
|
190
|
+ <ImageListUpload />,
|
190
|
191
|
)}
|
191
|
192
|
</Form.Item>
|
192
|
193
|
<Form.Item label="面积">
|