调整shift多选时获取首尾位置的方法

This commit is contained in:
buvta
2020-11-17 23:17:23 +08:00
parent 9147a8e1fb
commit 03775b091d
2 changed files with 6 additions and 6 deletions

View File

@@ -199,9 +199,9 @@ export default {
selectionCellClick (selection, row) {
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
this.selectionEnd = row.id
const start = Math.min(this.selectionBegin, this.selectionEnd) - 1
const end = Math.max(this.selectionBegin, this.selectionEnd)
const selections = this.sites.slice(start, end)
const start = this.sites.findIndex(e => e.id === Math.min(this.selectionBegin, this.selectionEnd))
const end = this.sites.findIndex(e => e.id === Math.max(this.selectionBegin, this.selectionEnd))
const selections = this.sites.slice(start, end + 1)
this.$nextTick(() => {
selections.forEach(e => this.$refs.editSitesTable.toggleRowSelection(e, true))
})

View File

@@ -203,9 +203,9 @@ export default {
selectionCellClick (selection, row) {
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
this.selectionEnd = row.id
const start = Math.min(this.selectionBegin, this.selectionEnd) - 1 - this.iptvList.length
const end = Math.max(this.selectionBegin, this.selectionEnd) - this.iptvList.length
const selections = this.channelList.slice(start, end) // 多选时强制不让展开
const start = this.channelList.findIndex(e => e.id === Math.min(this.selectionBegin, this.selectionEnd))
const end = this.channelList.findIndex(e => e.id === Math.max(this.selectionBegin, this.selectionEnd))
const selections = this.channelList.slice(start, end + 1) // 多选时强制不让展开
this.$nextTick(() => {
selections.forEach(e => this.$refs.iptvTable.toggleRowSelection(e, true))
})