From d0d871f7c618fc1651bb11839e68796d2c6b923d Mon Sep 17 00:00:00 2001 From: zhaichao Date: Wed, 26 Aug 2026 14:12:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=AD=A6=E5=A4=A7=E7=BA=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/teachBusiness/syllabus.js | 14 +---- .../views/teachBusiness/syllabus/index.vue | 60 +++++++++++++------ 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/frontend/src/api/teachBusiness/syllabus.js b/frontend/src/api/teachBusiness/syllabus.js index 0b4c144f..b8957fea 100644 --- a/frontend/src/api/teachBusiness/syllabus.js +++ b/frontend/src/api/teachBusiness/syllabus.js @@ -48,19 +48,11 @@ export function getSyllabus(bh) { }) } -// 查询所有(返回 List,无分页,前端本地分页) -export function listSyllabus() { +// 列表查询(支持 zydh、ty 及分页参数) +export function listSyllabus(query) { return request({ url: '/zyjxjhb/list', - method: 'get' - }) -} - -// 根据专业代号和停用标识查询(zydh、ty 均必填,等值匹配) -export function listSyllabusByZydhAndTy(zydh, ty) { - return request({ - url: '/zyjxjhb/listByZydhAndTy', method: 'get', - params: { zydh, ty } + params: query }) } diff --git a/frontend/src/views/teachBusiness/syllabus/index.vue b/frontend/src/views/teachBusiness/syllabus/index.vue index 43c212f0..a773c308 100644 --- a/frontend/src/views/teachBusiness/syllabus/index.vue +++ b/frontend/src/views/teachBusiness/syllabus/index.vue @@ -46,10 +46,13 @@ - + + + + @@ -58,6 +61,13 @@ + + + + + + + @@ -278,8 +288,7 @@ import { deleteSyllabus, batchDeleteSyllabus, updateSyllabus, - listSyllabus, - listSyllabusByZydhAndTy + listSyllabus } from '@/api/teachBusiness/syllabus' import { listMajor } from '@/api/subjectMajor/major' import { listKb } from '@/api/teachOffice/kb' @@ -302,6 +311,7 @@ export default { total: 0, pageNum: 1, pageSize: 20, + localPaging: false, selection: [], referenceDataLoading: false, majorOptions: [], @@ -326,6 +336,9 @@ export default { }, computed: { pagedData() { + if (!this.localPaging) { + return this.tableData + } const start = (this.pageNum - 1) * this.pageSize return this.tableData.slice(start, start + this.pageSize) } @@ -380,21 +393,26 @@ export default { /* ---------- 列表加载 ---------- */ fetchList() { this.loading = true - const { zydh, ty } = this.searchForm - // 专业代号存在时走后端组合查询;否则查全部后按停用标识过滤 - const useApiQuery = Boolean(zydh) - const req = useApiQuery - ? listSyllabusByZydhAndTy(zydh, ty) - : listSyllabus() - req.then(response => { - let list = response.data || [] - if (!useApiQuery) { - if (zydh) list = list.filter(i => i.zydh && i.zydh.indexOf(zydh) !== -1) - list = list.filter(i => Number(i.ty) === Number(ty)) + const query = { + pageNum: this.pageNum, + pageSize: this.pageSize, + ty: this.searchForm.ty + } + if (this.searchForm.zydh) { + query.zydh = this.searchForm.zydh + } + listSyllabus(query).then(response => { + const data = response.data + if (Array.isArray(data)) { + this.tableData = data + this.total = data.length + this.localPaging = true + } else { + const pageData = data || {} + this.tableData = pageData.records || [] + this.total = pageData.total || 0 + this.localPaging = false } - this.tableData = list - this.total = list.length - this.pageNum = 1 }).catch(() => { this.tableData = [] this.total = 0 @@ -403,10 +421,12 @@ export default { }) }, handleQuery() { + this.pageNum = 1 this.fetchList() }, handleReset() { this.searchForm = { zydh: '', ty: 0 } + this.pageNum = 1 this.fetchList() }, handleSelectionChange(val) { @@ -487,9 +507,15 @@ export default { handleSizeChange(size) { this.pageSize = size this.pageNum = 1 + if (!this.localPaging) { + this.fetchList() + } }, handlePageChange(page) { this.pageNum = page + if (!this.localPaging) { + this.fetchList() + } }, /* ---------- 工具 ---------- */