排课窗口单元格单击双选问题修复
This commit is contained in:
@@ -20,7 +20,9 @@ export function importTeachingPlan(file) {
|
||||
return request({
|
||||
url: '/teachingPlan/import',
|
||||
method: 'post',
|
||||
data: formData
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
timeout: 60000
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<div class="action-bar">
|
||||
<div class="bar-center">
|
||||
<div class="file-area">
|
||||
<el-button icon="el-icon-download" @click="handleDownloadTemplate">【教学实施计划模板】下载</el-button>
|
||||
<input ref="fileInputRef" type="file" accept=".xlsx,.xls" style="display: none" @change="handleFileChange" />
|
||||
<el-button icon="el-icon-folder-opened" @click="handleChooseFile">选择文件</el-button>
|
||||
<span class="file-name">{{ selectedFileName }}</span>
|
||||
@@ -144,7 +145,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listTeachingPlan, importTeachingPlan } from '@/api/schedule/teachingPlan'
|
||||
import { listTeachingPlan, importTeachingPlan, downloadTeachingPlanTemplate } from '@/api/schedule/teachingPlan'
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
export default {
|
||||
name: 'PlanImportIndex',
|
||||
@@ -261,6 +263,17 @@ export default {
|
||||
},
|
||||
|
||||
// ==================== 导入到系统 ====================
|
||||
handleDownloadTemplate() {
|
||||
downloadTeachingPlanTemplate().then(blob => {
|
||||
if (blob && blob.type && String(blob.type).indexOf('json') !== -1) {
|
||||
this.$message.error('模板下载失败')
|
||||
return
|
||||
}
|
||||
saveAs(blob, '教学实施计划导入模板.xlsx')
|
||||
this.$message.success('模板下载成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
handleImport() {
|
||||
if (!this.selectedFile) {
|
||||
this.$message.warning('请先选择文件')
|
||||
|
||||
@@ -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