forked from liweijie/education
模板
This commit is contained in:
@@ -67,3 +67,13 @@ export function exportJointTraining() {
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
// 下载联教联训导入模板(返回 Blob)
|
||||
// GET /download/joint-training
|
||||
export function downloadJointTrainingTemplate() {
|
||||
return request({
|
||||
url: '/download/joint-training',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -115,10 +115,10 @@ export function exportTeachingLog(query) {
|
||||
})
|
||||
}
|
||||
|
||||
// 下载导入模板(返回 Blob),接口形态:GET /log/teaching-log/download-template
|
||||
// 下载导入模板(返回 Blob),接口形态:GET /download/teaching-log
|
||||
export function downloadTeachingLogTemplate() {
|
||||
return request({
|
||||
url: '/log/teaching-log/download-template',
|
||||
url: '/download/teaching-log',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
|
||||
@@ -93,3 +93,15 @@ export function listClassroomByJxldh(jxldh) {
|
||||
params: { jxldh }
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载教学场地导入模板(返回 Blob)
|
||||
* GET /download/classroom
|
||||
*/
|
||||
export function downloadClassroomTemplate() {
|
||||
return request({
|
||||
url: '/download/classroom',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -69,3 +69,42 @@ export function listTraining(params) {
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出培养方案到 Excel(返回 Blob)
|
||||
* GET /training/export
|
||||
*/
|
||||
export function exportTrainingProgram() {
|
||||
return request({
|
||||
url: '/training/export',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载培养方案导入模板(返回 Blob)
|
||||
* GET /download/training-program
|
||||
*/
|
||||
export function downloadTrainingProgramTemplate() {
|
||||
return request({
|
||||
url: '/download/training-program',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入培养方案 Excel(multipart,字段名 file)
|
||||
* POST /training/import
|
||||
*/
|
||||
export function importTrainingProgram(file) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return request({
|
||||
url: '/training/import',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -44,4 +44,14 @@ export function updateKb(data) {
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 下载课程科目导入模板(返回 Blob)
|
||||
// GET /download/course-subject
|
||||
export function downloadCourseSubjectTemplate() {
|
||||
return request({
|
||||
url: '/download/course-subject',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
@@ -61,10 +61,10 @@ export function deleteTeachingMaterial(id) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 教材导入模板下载 GET /teachingMaterial/template */
|
||||
/** 教材导入模板下载 GET /download/teaching-material */
|
||||
export function downloadTeachingMaterialTemplate() {
|
||||
return request({
|
||||
url: '/teachingMaterial/template',
|
||||
url: '/download/teaching-material',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
|
||||
@@ -187,7 +187,8 @@ import {
|
||||
deleteJointTraining,
|
||||
getJointTraining,
|
||||
importJointTraining,
|
||||
exportJointTraining
|
||||
exportJointTraining,
|
||||
downloadJointTrainingTemplate
|
||||
} from '@/api/classHour/jointTraining'
|
||||
|
||||
export default {
|
||||
@@ -433,8 +434,10 @@ export default {
|
||||
},
|
||||
|
||||
handleDownloadTemplate() {
|
||||
// 后端暂未提供模板下载接口,仅作提示
|
||||
this.$message.info('后端暂未提供该接口')
|
||||
downloadJointTrainingTemplate().then(blob => {
|
||||
saveAs(blob, '联教连训管理.xls')
|
||||
this.$message.success('模板下载成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,12 +347,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { saveAs } from 'file-saver'
|
||||
import {
|
||||
addTraining,
|
||||
disableTraining,
|
||||
updateTraining,
|
||||
getTraining,
|
||||
listTraining
|
||||
listTraining,
|
||||
exportTrainingProgram,
|
||||
downloadTrainingProgramTemplate,
|
||||
importTrainingProgram
|
||||
} from '@/api/teachBusiness/training'
|
||||
import { getDicts } from '@/api/system/dict/data'
|
||||
import { optionselect } from '@/api/system/dict/type'
|
||||
@@ -586,12 +590,18 @@ export default {
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/* ---------- 下载 / 模板下载 / 上传(后端未提供接口) ---------- */
|
||||
/* ---------- 下载 / 模板下载 / 上传 ---------- */
|
||||
handleDownload() {
|
||||
this.$message.warning('后端暂未提供该接口')
|
||||
exportTrainingProgram().then(blob => {
|
||||
saveAs(blob, '人才培养方案课程数据文件.xlsx')
|
||||
this.$message.success('导出成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleTemplateDownload() {
|
||||
this.$message.warning('后端暂未提供该接口')
|
||||
downloadTrainingProgramTemplate().then(blob => {
|
||||
saveAs(blob, '人才培养方案课程数据文件模板.xls')
|
||||
this.$message.success('模板下载成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleChooseFile() {
|
||||
this.$refs.fileInputRef && this.$refs.fileInputRef.click()
|
||||
@@ -602,7 +612,18 @@ export default {
|
||||
this.fileName = file ? file.name : ''
|
||||
},
|
||||
handleUpload() {
|
||||
this.$message.warning('后端暂未提供该接口')
|
||||
if (!this.selectedFile) {
|
||||
this.$message.warning('请先选择文件')
|
||||
return
|
||||
}
|
||||
importTrainingProgram(this.selectedFile).then(response => {
|
||||
const count = (response && response.data) || 0
|
||||
this.$message.success(`导入成功,共导入 ${count} 条`)
|
||||
this.selectedFile = null
|
||||
this.fileName = ''
|
||||
if (this.$refs.fileInputRef) this.$refs.fileInputRef.value = ''
|
||||
this.fetchList()
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/* ---------- 工具 ---------- */
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<div class="list-title">教室列表</div>
|
||||
<div class="list-actions">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
|
||||
<el-button icon="el-icon-download" @click="handleDownloadTemplate">【教学场地管理模板】下载</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="tableData" border stripe highlight-current-row>
|
||||
@@ -193,12 +194,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { saveAs } from 'file-saver'
|
||||
import {
|
||||
addClassroom,
|
||||
deleteClassroom,
|
||||
updateClassroom,
|
||||
listClassroom,
|
||||
listAllClassroom
|
||||
listAllClassroom,
|
||||
downloadClassroomTemplate
|
||||
} from '@/api/teachBusiness/classroom'
|
||||
|
||||
export default {
|
||||
@@ -369,6 +372,14 @@ export default {
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/* ---------- 模板下载 ---------- */
|
||||
handleDownloadTemplate() {
|
||||
downloadClassroomTemplate().then(blob => {
|
||||
saveAs(blob, '教学场地管理模板.xls')
|
||||
this.$message.success('模板下载成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/* ---------- 工具 ---------- */
|
||||
createEmptyForm() {
|
||||
return {
|
||||
|
||||
@@ -320,7 +320,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listKb as listSubject, addKb as addSubject, updateKb as updateSubject, deleteKb as deleteSubject, getKb } from '@/api/teachOffice/kb'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { listKb as listSubject, addKb as addSubject, updateKb as updateSubject, deleteKb as deleteSubject, getKb, downloadCourseSubjectTemplate } from '@/api/teachOffice/kb'
|
||||
|
||||
export default {
|
||||
name: 'SubjectIndex',
|
||||
@@ -515,7 +516,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
// ==================== 下载(后端暂未提供) ====================
|
||||
// ==================== 下载 ====================
|
||||
handleDownloadCourse() {
|
||||
this.$message.warning('后端暂未提供该接口')
|
||||
},
|
||||
@@ -523,7 +524,10 @@ export default {
|
||||
this.$message.warning('后端暂未提供该接口')
|
||||
},
|
||||
handleDownloadTemplate() {
|
||||
this.$message.warning('后端暂未提供该接口')
|
||||
downloadCourseSubjectTemplate().then(blob => {
|
||||
saveAs(blob, '课程课目数据文件模板.xls')
|
||||
this.$message.success('模板下载成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
// ==================== 文件上传(后端暂未提供) ====================
|
||||
|
||||
Reference in New Issue
Block a user