weiximei 5 年之前
父節點
當前提交
1810b0cf0e
共有 2 個檔案被更改,包括 15 行新增13 行删除
  1. 12
    12
      src/pages/building/list/add/components/base.jsx
  2. 3
    1
      src/pages/building/list/add/components/tags.jsx

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

@@ -167,23 +167,23 @@ function AddBuilding(props) {
167 167
       data.videoImage = [{ imgType: 'videoImage', url: data.videoImage, orderNo: 1 }]
168 168
     }
169 169
 
170
-    if (res.buildingTransport) {
171
-      res.buildingTransport = res.buildingTransport.filter(f => f.delete === true).map(x => ({ tagName: x }))
170
+    if (data.buildingTransport) {
171
+      data.buildingTransport = data.buildingTransport.filter(f => f.delete === true).map(x => x.tagName).join(',')
172 172
     }
173
-    if (res.buildingMall) {
174
-      res.buildingMall = res.buildingMall.filter(f => f.delete === true).map(x => ({ tagName: x }))
173
+    if (data.buildingMall) {
174
+      data.buildingMall = data.buildingMall.filter(f => f.delete === true).map(x => x.tagName).join(',')
175 175
     }
176
-    if (res.buildingEdu) {
177
-      res.buildingEdu = res.buildingEdu.filter(f => f.delete === true).map(x => ({ tagName: x }))
176
+    if (data.buildingEdu) {
177
+      data.buildingEdu = data.buildingEdu.filter(f => f.delete === true).map(x => x.tagName).join(',')
178 178
     }
179
-    if (res.buildingHospital) {
180
-      res.buildingHospital = res.buildingHospital.filter(f => f.delete === true).map(x => ({ tagName: x }))
179
+    if (data.buildingHospital) {
180
+      data.buildingHospital = data.buildingHospital.filter(f => f.delete === true).map(x => x.tagName).join(',')
181 181
     }
182
-    if (res.buildingBank) {
183
-      res.buildingBank = res.buildingBank.filter(f => f.delete === true).map(x => ({ tagName: x }))
182
+    if (data.buildingBank) {
183
+      data.buildingBank = data.buildingBank.filter(f => f.delete === true).map(x => x.tagName).join(',')
184 184
     }
185
-    if (res.buildingRestaurant) {
186
-      res.buildingRestaurant = res.buildingRestaurant.filter(f => f.delete === true).map(x => ({ tagName: x }))
185
+    if (data.buildingRestaurant) {
186
+      data.buildingRestaurant = data.buildingRestaurant.filter(f => f.delete === true).map(x => x.tagName).join(',')
187 187
     }
188 188
 
189 189
     const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding

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

@@ -43,8 +43,10 @@ class EditableTagGroup extends React.Component {
43 43
     const { inputValue } = this.state;
44 44
 
45 45
     const tags = this.getTags()
46
-    if (inputValue && tags.indexOf(inputValue) === -1) {
46
+    const tagList = tags.map(x => x.tagName)
47
+    if (inputValue && tagList.indexOf(inputValue) === -1) {
47 48
       // 如果有新的值,就把这个值追加到 tags 原本值的后面,在通过onChange事件传递出去
49
+      console.log(tags.concat([{ tagName: inputValue, delete: true }]))
48 50
       this.toggleOnChange(tags.concat([{ tagName: inputValue, delete: true }]))
49 51
     }
50 52