fix: 修复多选组件后无法取消的情况

main
wu.jian2 2 years ago
parent 309f94ab1d
commit e9819c895b

@ -120,7 +120,7 @@ export default {
// this.changeActiveCodes([])
// this.changeActiveCode('')
}
//
if (event.button === 0 && this.isSelecting) {
this.isSelecting = false
if (newTime - time < 300) {
@ -142,6 +142,19 @@ export default {
this.startY = 0
this.endX = 0
this.endY = 0
} else if (!this.shiftKeyDown && !this.isSelecting) {
//
this.startX = 0
this.startY = 0
this.endX = 0
this.endY = 0
this.$emit('selectArea', {
startX: Math.min(this.startX, this.endX),
startY: Math.min(this.startY, this.endY),
endX: Math.max(this.startX, this.endX),
endY: Math.max(this.startY, this.endY)
})
this.changeActiveCodes([])
}
},
handleMouseLeave () {

@ -37,13 +37,24 @@ export default {
state.activeItemConfig = _.cloneDeep(activeItem)
},
changeActiveCodes (state, codes) {
state.activeCodes = codes
state.pageInfo.chartList = state.pageInfo.chartList?.map(chart => {
return {
...chart,
group: (codes.includes(chart.code) && !chart.group) ? 'tempGroup' : chart.group
}
})
// 传入codes将codes中的组件的group改为tempGroup不传入或者传入空数组将所有组件的group改为'',即取消组合
if (codes.length !== 0) {
state.activeCodes = codes
state.pageInfo.chartList = state.pageInfo.chartList?.map(chart => {
return {
...chart,
group: (codes.includes(chart.code) && !chart.group) ? 'tempGroup' : chart.group
}
})
} else {
state.activeCodes = codes
state.pageInfo.chartList = state.pageInfo.chartList?.map(chart => {
return {
...chart,
group: ''
}
})
}
},
// 改变当前hover组件id
changeHoverCode (state, code) {

Loading…
Cancel
Save