Main #1
@@ -0,0 +1,34 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// ======================== 教学实施计划导入 ========================
|
||||||
|
// 接口前缀 /teachingPlan,经 vue.config.js 代理转发为 /api/teachingPlan。
|
||||||
|
|
||||||
|
// 分页查询教学实施计划列表
|
||||||
|
// 支持参数:pageNum pageSize nd kcmc bc zrdw skjy ytgjc ybdr(与后端 Mapper 一致)
|
||||||
|
export function listTeachingPlan(query) {
|
||||||
|
return request({
|
||||||
|
url: '/teachingPlan/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导入教学实施计划 Excel(multipart,字段名 file),返回导入条数
|
||||||
|
export function importTeachingPlan(file) {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', file)
|
||||||
|
return request({
|
||||||
|
url: '/teachingPlan/import',
|
||||||
|
method: 'post',
|
||||||
|
data: formData
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载教学实施计划导入模板(返回 Blob)
|
||||||
|
export function downloadTeachingPlanTemplate() {
|
||||||
|
return request({
|
||||||
|
url: '/teachingPlan/template',
|
||||||
|
method: 'get',
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -101,9 +101,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bar-right">
|
<div class="bar-right">
|
||||||
|
<el-button type="primary" @click="handleImportToSystem" :loading="importing">缓存数据导入到系统</el-button>
|
||||||
<el-button type="primary" @click="handleUploadToCache">上传数据至缓存</el-button>
|
<el-button type="primary" @click="handleUploadToCache">上传数据至缓存</el-button>
|
||||||
<el-button type="primary" @click="handleCheckCache">检查缓存数据</el-button>
|
<el-button type="primary" @click="handleCheckCache">检查缓存数据</el-button>
|
||||||
<el-button type="primary" @click="handleImportToSystem">缓存数据导入到系统</el-button>
|
|
||||||
<el-button type="danger" @click="handleDeleteCache">删除缓存数据</el-button>
|
<el-button type="danger" @click="handleDeleteCache">删除缓存数据</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,10 +112,10 @@
|
|||||||
<!-- ==================== 3. 数据表格 ==================== -->
|
<!-- ==================== 3. 数据表格 ==================== -->
|
||||||
<el-card shadow="never" class="table-card">
|
<el-card shadow="never" class="table-card">
|
||||||
<el-table v-loading="loading" :data="tableData" stripe border highlight-current-row class="import-table">
|
<el-table v-loading="loading" :data="tableData" stripe border highlight-current-row class="import-table">
|
||||||
<el-table-column prop="xq" label="学期" width="53" align="center" />
|
<el-table-column prop="nd" label="年度" width="60" align="center" />
|
||||||
<el-table-column prop="xh" label="序号" width="53" align="center" />
|
<el-table-column prop="xh" label="序号" width="53" align="center" />
|
||||||
<el-table-column prop="yxh" label="原序号" width="67" align="center" />
|
<el-table-column prop="yxh" label="原序号" width="67" align="center" />
|
||||||
<el-table-column prop="rq" label="日期" width="53" align="center" :formatter="formatDate" />
|
<el-table-column prop="rq" label="日期" width="120" align="center" :formatter="formatDate" />
|
||||||
<el-table-column prop="yjc" label="原节次" width="67" align="center" />
|
<el-table-column prop="yjc" label="原节次" width="67" align="center" />
|
||||||
<el-table-column prop="jc" label="节次" width="53" align="center" />
|
<el-table-column prop="jc" label="节次" width="53" align="center" />
|
||||||
<el-table-column prop="kcmc" label="课程名称" width="85" show-overflow-tooltip />
|
<el-table-column prop="kcmc" label="课程名称" width="85" show-overflow-tooltip />
|
||||||
@@ -125,7 +125,6 @@
|
|||||||
<el-table-column prop="jxcd" label="教学场地" width="81" align="center" />
|
<el-table-column prop="jxcd" label="教学场地" width="81" align="center" />
|
||||||
<el-table-column prop="jxnr" label="教学内容" width="81" show-overflow-tooltip />
|
<el-table-column prop="jxnr" label="教学内容" width="81" show-overflow-tooltip />
|
||||||
<el-table-column prop="jxff" label="教学方法" width="81" align="center" />
|
<el-table-column prop="jxff" label="教学方法" width="81" align="center" />
|
||||||
<el-table-column prop="jxyd" label="教学要点" width="81" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="jybz" label="教员备注" width="81" show-overflow-tooltip />
|
<el-table-column prop="jybz" label="教员备注" width="81" show-overflow-tooltip />
|
||||||
<el-table-column prop="jwbz" label="教务备注" width="81" show-overflow-tooltip />
|
<el-table-column prop="jwbz" label="教务备注" width="81" show-overflow-tooltip />
|
||||||
<el-table-column prop="jcjg" label="检查结果" width="81" align="center" />
|
<el-table-column prop="jcjg" label="检查结果" width="81" align="center" />
|
||||||
@@ -134,9 +133,9 @@
|
|||||||
<span>{{ row.ytgjc ? '是' : '否' }}</span>
|
<span>{{ row.ytgjc ? '是' : '否' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="ybhhl" label="已被忽略" width="81" align="center">
|
<el-table-column prop="ybhl" label="已被忽略" width="81" align="center">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<span>{{ row.ybhhl ? '是' : '否' }}</span>
|
<span>{{ row.ybhl ? '是' : '否' }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="ybcl" label="已被处理" width="81" align="center">
|
<el-table-column prop="ybcl" label="已被处理" width="81" align="center">
|
||||||
@@ -166,12 +165,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// 模拟导入记录数据(后端接口未提供,接口就绪后可删除并改为接口加载)
|
import { listTeachingPlan, importTeachingPlan, downloadTeachingPlanTemplate } from '@/api/schedule/teachingPlan'
|
||||||
const mockTableData = [
|
|
||||||
{ xq: '2026-2027-1', xh: 1, yxh: 1, rq: '2026-09-01 08:00:00', yjc: '1-2', jc: '1', kcmc: '高等数学', bc: '2026级1队', zrdw: '基础部', skjy: '王教员', jxcd: '教学楼101', jxnr: '第一章 函数与极限', jxff: '讲授', jxyd: '理解极限定义', jybz: '', jwbz: '', jcjg: '通过', ytgjc: true, ybhhl: false, ybcl: true, ybdr: false },
|
|
||||||
{ xq: '2026-2027-1', xh: 2, yxh: 2, rq: '2026-09-01 10:00:00', yjc: '3-4', jc: '2', kcmc: '大学英语', bc: '2026级2队', zrdw: '外语系', skjy: '李教员', jxcd: '教学楼102', jxnr: 'Unit 1 课文讲解', jxff: '讲授', jxyd: '掌握重点词汇', jybz: '', jwbz: '', jcjg: '通过', ytgjc: true, ybhhl: false, ybcl: true, ybdr: false },
|
|
||||||
{ xq: '2026-2027-1', xh: 3, yxh: 3, rq: '2026-09-02 08:00:00', yjc: '1-2', jc: '1', kcmc: '军事理论', bc: '2026级1队', zrdw: '军事教研室', skjy: '张教员', jxcd: '学术报告厅', jxnr: '国防概论', jxff: '讲授', jxyd: '了解国防常识', jybz: '', jwbz: '', jcjg: '待检', ytgjc: false, ybhhl: false, ybcl: false, ybdr: false }
|
|
||||||
]
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PlanImportIndex',
|
name: 'PlanImportIndex',
|
||||||
@@ -193,50 +187,68 @@ export default {
|
|||||||
kmmc: ''
|
kmmc: ''
|
||||||
},
|
},
|
||||||
|
|
||||||
// ==================== 文件上传与缓存操作 ====================
|
// ==================== 文件上传与导入 ====================
|
||||||
selectedFileName: '未选择任何文件',
|
selectedFileName: '未选择任何文件',
|
||||||
|
selectedFile: null,
|
||||||
|
importing: false,
|
||||||
|
|
||||||
// ==================== 表格数据 ====================
|
// ==================== 表格数据 ====================
|
||||||
tableData: [],
|
tableData: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
allData: [],
|
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
total: 0
|
total: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.handleSearch()
|
this.fetchList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// ==================== 查询 ====================
|
// ==================== 查询 ====================
|
||||||
// TODO: 后端接口未提供,暂用模拟数据;接口就绪后替换为接口加载
|
// 仅传后端 Mapper 支持的字段:skjy(授课教员) bc(班次) kcmc(课程名称) ytgjc(已通过检查)
|
||||||
handleSearch() {
|
// 课程时间、忽略状态、教学场地名称后端列表查询不支持,不传
|
||||||
this.loading = true
|
buildSearchParams() {
|
||||||
setTimeout(() => {
|
const f = this.searchForm
|
||||||
this.allData = mockTableData.slice()
|
const params = { pageNum: this.pageNum, pageSize: this.pageSize }
|
||||||
this.total = this.allData.length
|
if (f.jyxm && f.jyxm.trim()) params.skjy = f.jyxm.trim()
|
||||||
this.pageNum = 1
|
if (f.bcmc && f.bcmc.trim()) params.bc = f.bcmc.trim()
|
||||||
this.applyPage()
|
if (f.kmmc && f.kmmc.trim()) params.kcmc = f.kmmc.trim()
|
||||||
this.$message.success(`查询完成,共 ${this.allData.length} 条记录(前端模拟)`)
|
// 检查状态:仅勾选「已通过」或「未通过」其中之一时才按该条件过滤
|
||||||
this.loading = false
|
if (f.jcztEnabled) {
|
||||||
}, 200)
|
if (f.jcztYtg && !f.jcztWtg) params.ytgjc = true
|
||||||
|
else if (!f.jcztYtg && f.jcztWtg) params.ytgjc = false
|
||||||
|
}
|
||||||
|
return params
|
||||||
},
|
},
|
||||||
|
|
||||||
applyPage() {
|
fetchList() {
|
||||||
const start = (this.pageNum - 1) * this.pageSize
|
this.loading = true
|
||||||
this.tableData = this.allData.slice(start, start + this.pageSize)
|
listTeachingPlan(this.buildSearchParams()).then(response => {
|
||||||
|
const data = response.data || {}
|
||||||
|
this.tableData = data.records || []
|
||||||
|
this.total = data.total || 0
|
||||||
|
this.loading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.tableData = []
|
||||||
|
this.total = 0
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSearch() {
|
||||||
|
this.pageNum = 1
|
||||||
|
this.fetchList()
|
||||||
},
|
},
|
||||||
|
|
||||||
handlePageChange(current) {
|
handlePageChange(current) {
|
||||||
this.pageNum = current
|
this.pageNum = current
|
||||||
this.applyPage()
|
this.fetchList()
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSizeChange(size) {
|
handleSizeChange(size) {
|
||||||
this.pageSize = size
|
this.pageSize = size
|
||||||
this.pageNum = 1
|
this.pageNum = 1
|
||||||
this.applyPage()
|
this.fetchList()
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 日期格式化 */
|
/** 日期格式化 */
|
||||||
@@ -244,7 +256,7 @@ export default {
|
|||||||
return cellValue ? String(cellValue).substring(0, 10) : ''
|
return cellValue ? String(cellValue).substring(0, 10) : ''
|
||||||
},
|
},
|
||||||
|
|
||||||
// ==================== 文件上传与缓存操作 ====================
|
// ==================== 文件选择 ====================
|
||||||
handleChooseFile() {
|
handleChooseFile() {
|
||||||
this.$refs.fileInputRef && this.$refs.fileInputRef.click()
|
this.$refs.fileInputRef && this.$refs.fileInputRef.click()
|
||||||
},
|
},
|
||||||
@@ -253,36 +265,68 @@ export default {
|
|||||||
const target = event.target
|
const target = event.target
|
||||||
const file = target.files && target.files[0]
|
const file = target.files && target.files[0]
|
||||||
if (file) {
|
if (file) {
|
||||||
|
this.selectedFile = file
|
||||||
this.selectedFileName = file.name
|
this.selectedFileName = file.name
|
||||||
this.$message.success(`已选择文件:${file.name}`)
|
|
||||||
} else {
|
} else {
|
||||||
|
this.selectedFile = null
|
||||||
this.selectedFileName = '未选择任何文件'
|
this.selectedFileName = '未选择任何文件'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO: 后端接口未提供,以下操作均为前端模拟;接口就绪后替换为对应接口
|
// ==================== 下载模板 ====================
|
||||||
handleDownloadTemplate() {
|
handleDownloadTemplate() {
|
||||||
this.$message.success('下载课程表数据文件模板(前端模拟)')
|
downloadTeachingPlanTemplate().then(blob => {
|
||||||
|
this.downloadBlob(blob, '教学实施计划导入模板.xlsx')
|
||||||
|
this.$message.success('模板下载成功')
|
||||||
|
}).catch(() => {})
|
||||||
},
|
},
|
||||||
|
|
||||||
handleUploadToCache() {
|
downloadBlob(blob, fileName) {
|
||||||
if (this.selectedFileName === '未选择任何文件') {
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = fileName
|
||||||
|
document.body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
document.body.removeChild(link)
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
},
|
||||||
|
|
||||||
|
// ==================== 导入到系统 ====================
|
||||||
|
handleImportToSystem() {
|
||||||
|
if (!this.selectedFile) {
|
||||||
this.$message.warning('请先选择文件')
|
this.$message.warning('请先选择文件')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$message.success('上传数据至缓存(前端模拟)')
|
this.importing = true
|
||||||
|
importTeachingPlan(this.selectedFile).then(res => {
|
||||||
|
const count = res && res.data
|
||||||
|
if (count !== null && count !== undefined) {
|
||||||
|
this.$message.success(`导入成功,共 ${count} 条记录`)
|
||||||
|
} else {
|
||||||
|
this.$message.success((res && res.msg) || '导入成功')
|
||||||
|
}
|
||||||
|
this.selectedFile = null
|
||||||
|
this.selectedFileName = '未选择任何文件'
|
||||||
|
this.$refs.fileInputRef && (this.$refs.fileInputRef.value = '')
|
||||||
|
this.pageNum = 1
|
||||||
|
this.fetchList()
|
||||||
|
}).catch(() => {}).finally(() => {
|
||||||
|
this.importing = false
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDeleteCache() {
|
// ==================== 缓存操作(后端暂未提供) ====================
|
||||||
this.$message.success('删除缓存数据(前端模拟)')
|
handleUploadToCache() {
|
||||||
|
this.$message.info('后端暂未提供该接口')
|
||||||
},
|
},
|
||||||
|
|
||||||
handleCheckCache() {
|
handleCheckCache() {
|
||||||
this.$message.success('检查缓存数据(前端模拟)')
|
this.$message.info('后端暂未提供该接口')
|
||||||
},
|
},
|
||||||
|
|
||||||
handleImportToSystem() {
|
handleDeleteCache() {
|
||||||
this.$message.success('缓存数据导入到系统(前端模拟)')
|
this.$message.info('后端暂未提供该接口')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user