排课窗口单元格单击双选问题修复
This commit is contained in:
@@ -180,7 +180,7 @@
|
||||
:class="slotClass(d, jc)"
|
||||
:title="slotTitle(d, jc)"
|
||||
@mousedown.prevent="startDrag(d.fi, jc, d, $event)"
|
||||
@mouseenter="hoverCell(d.fi, jc)"
|
||||
@mouseenter="hoverCell(d.fi, jc, $event)"
|
||||
@dblclick="dblclickCell(d, jc)"
|
||||
@dragover="onCellDragover(d, jc, $event)"
|
||||
@dragleave="onCellDragleave(d, jc)"
|
||||
@@ -227,7 +227,7 @@
|
||||
:class="slotClass(d, jc)"
|
||||
:title="slotTitle(d, jc)"
|
||||
@mousedown.prevent="startDrag(d.fi, jc, d, $event)"
|
||||
@mouseenter="hoverCell(d.fi, jc)"
|
||||
@mouseenter="hoverCell(d.fi, jc, $event)"
|
||||
@dblclick="dblclickCell(d, jc)"
|
||||
@dragover="onCellDragover(d, jc, $event)"
|
||||
@dragleave="onCellDragleave(d, jc)"
|
||||
@@ -608,6 +608,8 @@ export default {
|
||||
dragging: false,
|
||||
/** 本次拖拽是否为追加(Ctrl / Meta) */
|
||||
additiveDrag: false,
|
||||
/** 按下时的指针位置,用于忽略首次聚焦滚动触发的误 hover */
|
||||
dragOrigin: null,
|
||||
/** 当前聚焦格(⑨ 当前格子编排信息) */
|
||||
focusedCell: null,
|
||||
/** 视图模式:week 单周 / all 全学期 / h 横版 */
|
||||
@@ -840,6 +842,7 @@ export default {
|
||||
this.dragging = false
|
||||
this.dragStart = null
|
||||
this.dragEnd = null
|
||||
this.dragOrigin = null
|
||||
// 尽量保留原来选中的课程
|
||||
const list = this.courses
|
||||
this.currentCourse = keepBh ? (list.find(c => c.sskcbh === keepBh) || list[0] || null) : (list[0] || null)
|
||||
@@ -1024,18 +1027,29 @@ export default {
|
||||
// 拖拽调课模式下按住格子只做聚焦,课次块用 HTML5 拖拽移动
|
||||
if (this.moveMode) {
|
||||
this.focusCell(day.date, jc)
|
||||
if (this.$refs.gridWrap && this.$refs.gridWrap.focus) this.$refs.gridWrap.focus()
|
||||
const wrap = this.$refs.gridWrap
|
||||
if (wrap && wrap.focus) wrap.focus({ preventScroll: true })
|
||||
return
|
||||
}
|
||||
this.dragging = true
|
||||
this.additiveDrag = !!(ev && (ev.ctrlKey || ev.metaKey))
|
||||
this.dragStart = { fi, jc }
|
||||
this.dragEnd = { fi, jc }
|
||||
this.dragOrigin = ev ? { x: ev.clientX, y: ev.clientY } : null
|
||||
this.focusCell(day.date, jc)
|
||||
if (this.$refs.gridWrap && this.$refs.gridWrap.focus) this.$refs.gridWrap.focus()
|
||||
const wrap = this.$refs.gridWrap
|
||||
if (wrap && wrap.focus) wrap.focus({ preventScroll: true })
|
||||
},
|
||||
hoverCell(fi, jc) {
|
||||
hoverCell(fi, jc, ev) {
|
||||
if (!this.dragging) return
|
||||
// 刚进入页面首次单击会 focus 课表导致滚动,DOM 从指针下经过时误发 mouseenter。
|
||||
// 指针未真正移动时不把结束格改成别的格子。
|
||||
const origin = this.dragOrigin
|
||||
if (origin && ev) {
|
||||
const dx = Math.abs(ev.clientX - origin.x)
|
||||
const dy = Math.abs(ev.clientY - origin.y)
|
||||
if (dx < 6 && dy < 6) return
|
||||
}
|
||||
this.dragEnd = { fi, jc }
|
||||
},
|
||||
finishDrag() {
|
||||
@@ -1047,6 +1061,7 @@ export default {
|
||||
this.dragStart = null
|
||||
this.dragEnd = null
|
||||
this.additiveDrag = false
|
||||
this.dragOrigin = null
|
||||
if (!s || !e) return
|
||||
const fiFrom = Math.min(s.fi, e.fi)
|
||||
const fiTo = Math.max(s.fi, e.fi)
|
||||
|
||||
Reference in New Issue
Block a user