File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,19 @@ export default {
149
149
this .selcetRecursion (child, select, children)
150
150
})
151
151
}
152
+ },
153
+ updateTreeNode (item ) {
154
+ return new Promise (resolve => {
155
+ const { _id , _parent } = item
156
+ const index = _id .split (' -' ).slice (- 1 )[0 ] // get last index
157
+ if (_parent) {
158
+ _parent .children .splice (index, 1 , item)
159
+ resolve (this .data )
160
+ } else {
161
+ this .data .splice (index, 1 , item)
162
+ resolve (this .data )
163
+ }
164
+ })
152
165
}
153
166
}
154
167
}
Original file line number Diff line number Diff line change @@ -129,17 +129,8 @@ export default {
129
129
this .tempItem = Object .assign ({}, row)
130
130
this .dialogFormVisible = true
131
131
},
132
- updateItem () {
133
- const data = this .$refs .TreeTable .getData ()
134
- const { _id } = this .tempItem
135
-
136
- for (let i = 0 ; i < data .length ; i++ ) {
137
- if (data[i]._id === _id) {
138
- data .splice (i, 1 , Object .assign ({}, this .tempItem ))
139
- break
140
- }
141
- }
142
-
132
+ async updateItem () {
133
+ await this .$refs .TreeTable .updateTreeNode (this .tempItem )
143
134
this .dialogFormVisible = false
144
135
},
145
136
addMenuItem (row , type ) {
You can’t perform that action at this time.
0 commit comments