教学大纲下载功能
This commit is contained in:
+6
-2
@@ -103,9 +103,13 @@ public class ZYJXJHBController {
|
||||
|
||||
/**
|
||||
* 导出专业教学计划到 Excel(.xlsx)。
|
||||
* <p>专业代号、停用标识可选,与列表筛选条件一致。</p>
|
||||
*/
|
||||
@GetMapping("/export")
|
||||
public void exportData(HttpServletResponse response) throws Exception {
|
||||
zyjxjhbService.exportZYJXJHBExcel(response);
|
||||
public void exportData(
|
||||
HttpServletResponse response,
|
||||
@RequestParam(required = false) String zydh,
|
||||
@RequestParam(required = false) Integer ty) throws Exception {
|
||||
zyjxjhbService.exportZYJXJHBExcel(response, zydh, ty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,11 @@ public interface ZYJXJHBService {
|
||||
/** 从 Excel(.xls/.xlsx) 导入专业教学计划 */
|
||||
int importZYJXJHBFromExcel(org.springframework.web.multipart.MultipartFile file) throws Exception;
|
||||
|
||||
/** 导出专业教学计划到 Excel(.xlsx) */
|
||||
void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response) throws Exception;
|
||||
/**
|
||||
* 导出专业教学计划到 Excel(.xlsx)。
|
||||
*
|
||||
* @param zydh 专业代号(可选)
|
||||
* @param ty 停用标识(可选,0-正常,1-停用)
|
||||
*/
|
||||
void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response, String zydh, Integer ty) throws Exception;
|
||||
}
|
||||
|
||||
+10
-3
@@ -104,9 +104,16 @@ public class ZYJXJHBServiceImpl implements ZYJXJHBService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response) throws Exception {
|
||||
List<ZYJXJHB> list = zyjxjhbMapper.selectList(
|
||||
new LambdaQueryWrapper<ZYJXJHB>().orderByAsc(ZYJXJHB::getZydh));
|
||||
public void exportZYJXJHBExcel(jakarta.servlet.http.HttpServletResponse response, String zydh, Integer ty) throws Exception {
|
||||
LambdaQueryWrapper<ZYJXJHB> wrapper = new LambdaQueryWrapper<>();
|
||||
if (zydh != null && !zydh.isEmpty()) {
|
||||
wrapper.eq(ZYJXJHB::getZydh, zydh);
|
||||
}
|
||||
if (ty != null) {
|
||||
wrapper.eq(ZYJXJHB::getTy, ty);
|
||||
}
|
||||
wrapper.orderByAsc(ZYJXJHB::getZydh);
|
||||
List<ZYJXJHB> list = zyjxjhbMapper.selectList(wrapper);
|
||||
String[] headers = {"专业代号", "课编号", "学期第次", "课类型", "学时", "学分", "周课时",
|
||||
"课程定位", "模块", "成绩分制", "理论学时", "实践学时", "考试课时", "教研室代号", "简称"};
|
||||
byte[] bytes = com.roomroot.jwgl.utils.ExcelExportUtil.export("专业教学计划", headers, list,
|
||||
|
||||
@@ -56,3 +56,13 @@ export function listByZydhAndTy(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 导出教学大纲 Excel(可选 zydh、ty,与列表筛选一致)
|
||||
export function exportSyllabus(query) {
|
||||
return request({
|
||||
url: '/zyjxjhb/export',
|
||||
method: 'get',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -296,12 +296,14 @@ import {
|
||||
deleteSyllabus,
|
||||
batchDeleteSyllabus,
|
||||
updateSyllabus,
|
||||
listByZydhAndTy
|
||||
listByZydhAndTy,
|
||||
exportSyllabus
|
||||
} from '@/api/teachBusiness/syllabus'
|
||||
import { listMajor } from '@/api/subjectMajor/major'
|
||||
import { listKb } from '@/api/teachOffice/kb'
|
||||
import { listOffice } from '@/api/teachOffice/office'
|
||||
import { getDicts } from '@/api/system/dict/data'
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
const REFERENCE_DATA_PAGE_SIZE = 10000
|
||||
const COURSE_TYPE_DICT_CODE = 'course_type'
|
||||
@@ -500,9 +502,15 @@ export default {
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/* ---------- 下载(无后端接口) ---------- */
|
||||
/* ---------- 下载 ---------- */
|
||||
handleDownload() {
|
||||
this.$message.warning('后端暂未提供该接口')
|
||||
const query = {}
|
||||
if (this.searchForm.zydh) query.zydh = this.searchForm.zydh
|
||||
if (this.searchForm.ty === 0 || this.searchForm.ty === 1) query.ty = this.searchForm.ty
|
||||
exportSyllabus(query).then(blob => {
|
||||
saveAs(blob, '教学大纲.xlsx')
|
||||
this.$message.success('导出成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/* ---------- 分页 ---------- */
|
||||
|
||||
@@ -9,7 +9,7 @@ const CompressionPlugin = require('compression-webpack-plugin')
|
||||
|
||||
const name = process.env.VUE_APP_TITLE || '教学管理信息系统' // 网页标题
|
||||
|
||||
const baseUrl = 'http://127.0.0.1:8080' // 后端接口
|
||||
const baseUrl = 'http://127.10.0.193:8080' // 后端接口
|
||||
|
||||
const port = 80 // 固定开发服务器端口,避免多实例端口混乱
|
||||
|
||||
|
||||
Reference in New Issue
Block a user