diff --git a/frontend/src/api/log.js b/frontend/src/api/log.js
index 4a60a929..3528181b 100644
--- a/frontend/src/api/log.js
+++ b/frontend/src/api/log.js
@@ -85,6 +85,24 @@ export function rejectTeachingLog(bh, thyj) {
})
}
+// 批量上报教学日志,接口形态:POST /log/teaching-log/batch-report(body 为裸数组 ["",""])
+export function batchReportTeachingLog(bhList) {
+ return request({
+ url: '/log/teaching-log/batch-report',
+ method: 'post',
+ data: bhList
+ })
+}
+
+// 批量审核教学日志,接口形态:POST /log/teaching-log/batch-audit(body 为裸数组 ["",""])
+export function batchAuditTeachingLog(bhList) {
+ return request({
+ url: '/log/teaching-log/batch-audit',
+ method: 'post',
+ data: bhList
+ })
+}
+
// 根据课表自动创建教学日志,接口形态:POST /log/teaching-log/auto-create?tybh=
export function autoCreateTeachingLog(tybh) {
return request({
@@ -101,7 +119,8 @@ export function importTeachingLogExcel(file) {
return request({
url: '/log/teaching-log/import-excel',
method: 'post',
- data: formData
+ data: formData,
+ headers: { 'Content-Type': 'multipart/form-data' }
})
}
diff --git a/frontend/src/views/teachingLog/organLog/components/auditedView.vue b/frontend/src/views/teachingLog/organLog/components/auditedView.vue
index 0b3df5bd..4fdec90a 100644
--- a/frontend/src/views/teachingLog/organLog/components/auditedView.vue
+++ b/frontend/src/views/teachingLog/organLog/components/auditedView.vue
@@ -114,11 +114,6 @@
-
-
- 详细
-
-
@@ -225,6 +220,11 @@ export default {
this.selectedRows = rows
},
+ /** 组件方法:包一层全局 formatDate,供模板调用 */
+ formatDate(val) {
+ return formatDate(val)
+ },
+
/** 根据已填写的查询值构建实际查询参数 */
buildSearchParams() {
const form = this.searchForm
@@ -255,11 +255,10 @@ export default {
this.loading = true
return getAuditedTeachingLogList(this.buildSearchParams())
.then((res) => {
- if (res.code === 200 || res.code === 0) {
- const { list, total } = this.extractListData(res)
- this.tableData = list
- this.total = total
- }
+ // 列表接口返回裸 PageResult(无 code 包装),拦截器已保证成功,直接取数据
+ const { list, total } = this.extractListData(res)
+ this.tableData = list
+ this.total = total
})
.catch(() => {})
.finally(() => {
diff --git a/frontend/src/views/teachingLog/organLog/components/logView.vue b/frontend/src/views/teachingLog/organLog/components/logView.vue
index e3a14a9d..a8d90f16 100644
--- a/frontend/src/views/teachingLog/organLog/components/logView.vue
+++ b/frontend/src/views/teachingLog/organLog/components/logView.vue
@@ -94,8 +94,7 @@
批准上报所选
-
删除所选
-
导出到 Word
+
导出
刷新
导入教学日志
下载模板
@@ -137,7 +136,6 @@
- 详细
上报
@@ -191,11 +189,11 @@
import { formatDate } from '@/utils/index'
import {
getTeachingLogList,
- submitTeachingLog,
exportTeachingLog,
importTeachingLogExcel,
downloadTeachingLogTemplate,
- getTeachingLogByBh
+ getTeachingLogByBh,
+ batchReportTeachingLog
} from '@/api/log'
export default {
@@ -247,6 +245,8 @@ export default {
// ==================== 导入 ====================
importing: false,
+ // 导入成功后是否跳到最后一页(定位到刚导入的数据)
+ importJumpLast: false,
// ==================== 详情 ====================
detailVisible: false,
@@ -258,6 +258,10 @@ export default {
this.fetchList()
},
methods: {
+ formatDate(val) {
+ return formatDate(val)
+ },
+
handleSelectionChange(rows) {
this.selectedRows = rows
},
@@ -294,11 +298,20 @@ export default {
this.loading = true
return getTeachingLogList(this.buildSearchParams())
.then((res) => {
- if (res.code === 200 || res.code === 0) {
- const { list, total } = this.extractListData(res)
- this.tableData = list
- this.total = total
+ // 列表接口返回裸 PageResult(无 code 包装),拦截器已保证成功,直接取数据
+ const { list, total } = this.extractListData(res)
+ // 导入成功后:跳到最后一页,定位刚导入的数据
+ if (this.importJumpLast) {
+ this.importJumpLast = false
+ const lastPage = total > 0 ? Math.ceil(total / this.pageSize) : 1
+ if (lastPage !== this.pageNum) {
+ this.pageNum = lastPage
+ this.fetchList()
+ return
+ }
}
+ this.tableData = list
+ this.total = total
})
.catch(() => {
// 错误已由拦截器统一处理
@@ -337,11 +350,6 @@ export default {
return ids
},
- handleDeleteSelected() {
- // 后端暂未提供删除接口,仅作提示
- this.$message.info('后端暂未提供该接口')
- },
-
handleBatchReport() {
const ids = this.getSelectedBhs()
if (ids.length === 0) return
@@ -351,12 +359,8 @@ export default {
type: 'warning'
})
.then(() => {
- // 提交教学日志审核,逐条上报至「已上报」状态
- let settled = Promise.resolve()
- ids.forEach((bh) => {
- settled = settled.then(() => submitTeachingLog(bh, '已上报'))
- })
- return settled
+ // 批量上报教学日志
+ return batchReportTeachingLog(ids)
})
.then(() => {
this.$message.success(`已上报 ${ids.length} 条记录`)
@@ -376,7 +380,7 @@ export default {
cancelButtonText: '取消',
type: 'warning'
})
- .then(() => submitTeachingLog(String(bh), '已上报'))
+ .then(() => batchReportTeachingLog([String(bh)]))
.then(() => {
this.$message.success('上报成功')
this.fetchList()
@@ -425,6 +429,7 @@ export default {
.then((res) => {
if (res.code === 200 || res.code === 0) {
this.$message.success(res.message || '导入成功')
+ this.importJumpLast = true
this.fetchList()
} else {
this.$message.error(res.message || '导入失败')
diff --git a/frontend/src/views/teachingLog/organLog/components/reportedView.vue b/frontend/src/views/teachingLog/organLog/components/reportedView.vue
index 7bddef53..b5614fdb 100644
--- a/frontend/src/views/teachingLog/organLog/components/reportedView.vue
+++ b/frontend/src/views/teachingLog/organLog/components/reportedView.vue
@@ -78,7 +78,7 @@
- 审核通过所选
+ 审核通过所选
导出到 Word
@@ -92,7 +92,7 @@
-
+
@@ -104,23 +104,22 @@
{{ scope.row.qsjc && scope.row.jsjc ? `${scope.row.qsjc}-${scope.row.jsjc}节` : (scope.row.qsjc || '-') }}
-
-
-
+
+
+
{{ scope.row.sdrs || scope.row.ydrs || '-' }}
-
+
{{ scope.row.fzyzdjy || '-' }}
-
+
-
+
-
+
审核
退回
- 详细
@@ -173,14 +172,21 @@
import { formatDate } from '@/utils/index'
import {
getReportedTeachingLogList,
- approveTeachingLog,
rejectTeachingLog,
exportTeachingLog,
- getTeachingLogByBh
+ getTeachingLogByBh,
+ batchAuditTeachingLog
} from '@/api/log'
export default {
name: 'ReportedView',
+ props: {
+ /** 当前用户是否为教员角色,用于隐藏审核相关操作 */
+ isTeacher: {
+ type: Boolean,
+ default: false
+ }
+ },
data() {
return {
// ==================== 查询表单 ====================
@@ -239,6 +245,11 @@ export default {
this.selectedRows = rows
},
+ /** 组件方法:包一层全局 formatDate,供模板调用 */
+ formatDate(val) {
+ return formatDate(val)
+ },
+
/** 根据已填写的查询值构建实际查询参数 */
buildSearchParams() {
const form = this.searchForm
@@ -266,11 +277,10 @@ export default {
this.loading = true
return getReportedTeachingLogList(this.buildSearchParams())
.then((res) => {
- if (res.code === 200 || res.code === 0) {
- const { list, total } = this.extractListData(res)
- this.tableData = list
- this.total = total
- }
+ // 列表接口返回裸 PageResult(无 code 包装),拦截器已保证成功,直接取数据
+ const { list, total } = this.extractListData(res)
+ this.tableData = list
+ this.total = total
})
.catch(() => {})
.finally(() => {
@@ -333,12 +343,8 @@ export default {
type: 'warning'
})
.then(() => {
- // 审核通过教学日志,逐条审核
- let settled = Promise.resolve()
- ids.forEach((bh) => {
- settled = settled.then(() => approveTeachingLog(bh, ''))
- })
- return settled
+ // 批量审核教学日志
+ return batchAuditTeachingLog(ids)
})
.then(() => {
this.$message.success(`已审核通过 ${ids.length} 条记录`)
@@ -358,7 +364,7 @@ export default {
cancelButtonText: '取消',
type: 'warning'
})
- .then(() => approveTeachingLog(String(bh), ''))
+ .then(() => batchAuditTeachingLog([String(bh)]))
.then(() => {
this.$message.success('审核通过成功')
this.fetchList()
diff --git a/frontend/src/views/teachingLog/organLog/index.vue b/frontend/src/views/teachingLog/organLog/index.vue
index a5d517e8..5d5cf97d 100644
--- a/frontend/src/views/teachingLog/organLog/index.vue
+++ b/frontend/src/views/teachingLog/organLog/index.vue
@@ -2,11 +2,12 @@
-
+
+
-
+
@@ -28,6 +29,29 @@ export default {
return {
activeTab: 'query'
}
+ },
+ computed: {
+ roles() {
+ return this.$store.getters.roles || []
+ },
+ /** 教员角色 */
+ isTeacher() {
+ return this.roles.includes('TEACHER')
+ },
+ /** 机关人员角色 */
+ isDepartmentPersonnel() {
+ return this.roles.includes('DEPARTMENT_PERSONNEL')
+ },
+ /** 教学日志管理查询页仅非教员、非机关人员可见 */
+ hasQueryAccess() {
+ return !this.isTeacher && !this.isDepartmentPersonnel
+ }
+ },
+ created() {
+ // 教员/机关人员无法查看教学日志管理查询页,默认落在已上报页
+ if (!this.hasQueryAccess) {
+ this.activeTab = 'reported'
+ }
}
}