教学大纲新增显示排序问题

This commit is contained in:
2026-09-16 09:24:10 +08:00
parent b30e39f91a
commit b05c4d33db
2 changed files with 18 additions and 11 deletions
@@ -77,7 +77,7 @@ public class ZYJXJHBServiceImpl implements ZYJXJHBService {
if (ty != null) { if (ty != null) {
wrapper.eq(ZYJXJHB::getTy, ty); wrapper.eq(ZYJXJHB::getTy, ty);
} }
wrapper.orderByAsc(ZYJXJHB::getZydh); wrapper.orderByDesc(ZYJXJHB::getQysj).orderByAsc(ZYJXJHB::getZydh);
Page<ZYJXJHB> result = zyjxjhbMapper.selectPage(page, wrapper); Page<ZYJXJHB> result = zyjxjhbMapper.selectPage(page, wrapper);
return new PageResult<>(result.getRecords(), result.getTotal(), return new PageResult<>(result.getRecords(), result.getTotal(),
query.getPageNum(), query.getPageSize()); query.getPageNum(), query.getPageSize());
@@ -406,11 +406,19 @@ export default {
/* ---------- 列表加载 ---------- */ /* ---------- 列表加载 ---------- */
fetchList() { fetchList() {
this.loading = true this.loading = true
listByZydhAndTy({ zydh: this.searchForm.zydh, ty: this.searchForm.ty }).then(response => { this.localPaging = false
const data = response.data || [] const query = {
pageNum: this.pageNum,
pageSize: this.pageSize,
ty: this.searchForm.ty
}
if (this.searchForm.zydh) {
query.zydh = this.searchForm.zydh
}
listByZydhAndTy(query).then(response => {
const data = response.data || {}
this.tableData = Array.isArray(data) ? data : (data.records || []) this.tableData = Array.isArray(data) ? data : (data.records || [])
this.total = this.tableData.length this.total = Array.isArray(data) ? data.length : Number(data.total || 0)
this.localPaging = true
}).catch(() => { }).catch(() => {
this.tableData = [] this.tableData = []
this.total = 0 this.total = 0
@@ -458,6 +466,9 @@ export default {
req.then(() => { req.then(() => {
this.$message.success(isEdit ? '修改成功' : '新增成功') this.$message.success(isEdit ? '修改成功' : '新增成功')
this.dialog.visible = false this.dialog.visible = false
if (!isEdit) {
this.pageNum = 1
}
this.fetchList() this.fetchList()
}).finally(() => { }).finally(() => {
this.dialog.submitting = false this.dialog.submitting = false
@@ -517,15 +528,11 @@ export default {
handleSizeChange(size) { handleSizeChange(size) {
this.pageSize = size this.pageSize = size
this.pageNum = 1 this.pageNum = 1
if (!this.localPaging) {
this.fetchList() this.fetchList()
}
}, },
handlePageChange(page) { handlePageChange(page) {
this.pageNum = page this.pageNum = page
if (!this.localPaging) {
this.fetchList() this.fetchList()
}
}, },
/* ---------- 工具 ---------- */ /* ---------- 工具 ---------- */