|
@@ -65,6 +65,7 @@ export default {
|
|
|
const _this = this
|
|
|
const ind = _this.data.findIndex(item => item.productSn == cur.key)
|
|
|
cur.row = ind != -1 ? _this.data[ind] : undefined
|
|
|
+ return cur
|
|
|
},
|
|
|
handleChange (value) {
|
|
|
const _this = this
|
|
@@ -74,18 +75,18 @@ export default {
|
|
|
value.row = ind != -1 ? _this.data[ind] : undefined
|
|
|
}
|
|
|
} else if (this.mode == 'multiple') { // 多选
|
|
|
- console.log('===========')
|
|
|
- console.log(this.lastData)
|
|
|
- console.log(value)
|
|
|
- console.log('===========')
|
|
|
// 新增
|
|
|
- if (_this.lastData.length < value.length) {
|
|
|
- _this.getRow(value[value.length - 1])
|
|
|
- value = this.lastData.concat(value[value.length - 1])
|
|
|
+ if (this.lastData.length < value.length) {
|
|
|
+ const ret = this.getRow(value[value.length - 1])
|
|
|
+ value = [...this.lastData, ret]
|
|
|
} else {
|
|
|
// 删除
|
|
|
- const delItem = this.lastData.filter(item => !value.find(a => a.key == item.key))
|
|
|
- console.log(delItem)
|
|
|
+ value.map(item => {
|
|
|
+ const r = this.lastData.find(k => k.key == item.key)
|
|
|
+ if (r) {
|
|
|
+ item.row = r.row
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
Object.assign(this, {
|
|
@@ -93,6 +94,9 @@ export default {
|
|
|
data: [],
|
|
|
fetching: false
|
|
|
})
|
|
|
+ if (this.dealerName) {
|
|
|
+ this.lastData = JSON.parse(JSON.stringify(this.dealerName))
|
|
|
+ }
|
|
|
this.$emit('change', value || { key: undefined }, this.id)
|
|
|
},
|
|
|
resetForm () {
|