J教学日志管理

This commit is contained in:
2026-08-28 20:31:41 +08:00
parent f32d19e411
commit 4c9cfb8d7f
5 changed files with 111 additions and 58 deletions
+20 -1
View File
@@ -85,6 +85,24 @@ export function rejectTeachingLog(bh, thyj) {
}) })
} }
// 批量上报教学日志,接口形态:POST /log/teaching-log/batch-reportbody 为裸数组 ["",""]
export function batchReportTeachingLog(bhList) {
return request({
url: '/log/teaching-log/batch-report',
method: 'post',
data: bhList
})
}
// 批量审核教学日志,接口形态:POST /log/teaching-log/batch-auditbody 为裸数组 ["",""]
export function batchAuditTeachingLog(bhList) {
return request({
url: '/log/teaching-log/batch-audit',
method: 'post',
data: bhList
})
}
// 根据课表自动创建教学日志,接口形态:POST /log/teaching-log/auto-create?tybh= // 根据课表自动创建教学日志,接口形态:POST /log/teaching-log/auto-create?tybh=
export function autoCreateTeachingLog(tybh) { export function autoCreateTeachingLog(tybh) {
return request({ return request({
@@ -101,7 +119,8 @@ export function importTeachingLogExcel(file) {
return request({ return request({
url: '/log/teaching-log/import-excel', url: '/log/teaching-log/import-excel',
method: 'post', method: 'post',
data: formData data: formData,
headers: { 'Content-Type': 'multipart/form-data' }
}) })
} }
@@ -114,11 +114,6 @@
<el-table-column prop="zt" label="日志状态" width="100" align="center" /> <el-table-column prop="zt" label="日志状态" width="100" align="center" />
<el-table-column prop="gdqk" label="变动汇总" min-width="120" show-overflow-tooltip /> <el-table-column prop="gdqk" label="变动汇总" min-width="120" show-overflow-tooltip />
<el-table-column prop="jxrzcjfs" label="创建方式" width="100" align="center" /> <el-table-column prop="jxrzcjfs" label="创建方式" width="100" align="center" />
<el-table-column label="操作" width="80" align="center" fixed="right" class-name="table-action-column">
<template slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.row)">详细</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
@@ -225,6 +220,11 @@ export default {
this.selectedRows = rows this.selectedRows = rows
}, },
/** 组件方法:包一层全局 formatDate,供模板调用 */
formatDate(val) {
return formatDate(val)
},
/** 根据已填写的查询值构建实际查询参数 */ /** 根据已填写的查询值构建实际查询参数 */
buildSearchParams() { buildSearchParams() {
const form = this.searchForm const form = this.searchForm
@@ -255,11 +255,10 @@ export default {
this.loading = true this.loading = true
return getAuditedTeachingLogList(this.buildSearchParams()) return getAuditedTeachingLogList(this.buildSearchParams())
.then((res) => { .then((res) => {
if (res.code === 200 || res.code === 0) { // 列表接口返回裸 PageResult(无 code 包装),拦截器已保证成功,直接取数据
const { list, total } = this.extractListData(res) const { list, total } = this.extractListData(res)
this.tableData = list this.tableData = list
this.total = total this.total = total
}
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {
@@ -94,8 +94,7 @@
<div class="left-group"> <div class="left-group">
<el-button type="primary" @click="handleBatchReport">批准上报所选</el-button> <el-button type="primary" @click="handleBatchReport">批准上报所选</el-button>
<!-- <el-button @click="handleRecheck">重新检查通报变更情况</el-button> --> <!-- <el-button @click="handleRecheck">重新检查通报变更情况</el-button> -->
<el-button type="danger" plain @click="handleDeleteSelected">删除所选</el-button> <el-button icon="el-icon-download" @click="handleExport">导出</el-button>
<el-button icon="el-icon-download" @click="handleExport">导出到 Word</el-button>
<el-button icon="el-icon-refresh" @click="handleRefresh">刷新</el-button> <el-button icon="el-icon-refresh" @click="handleRefresh">刷新</el-button>
<el-button icon="el-icon-upload2" :loading="importing" @click="handleImportExcel">导入教学日志</el-button> <el-button icon="el-icon-upload2" :loading="importing" @click="handleImportExcel">导入教学日志</el-button>
<el-button icon="el-icon-download" @click="handleDownloadTemplate">下载模板</el-button> <el-button icon="el-icon-download" @click="handleDownloadTemplate">下载模板</el-button>
@@ -137,7 +136,6 @@
<el-table-column prop="jxrzcjfs" label="创建方式" width="100" align="center" /> <el-table-column prop="jxrzcjfs" label="创建方式" width="100" align="center" />
<el-table-column label="操作" width="80" align="center" fixed="right" class-name="table-action-column"> <el-table-column label="操作" width="80" align="center" fixed="right" class-name="table-action-column">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handleDetail(scope.row)">详细</el-button>
<el-button type="text" @click="handleReport(scope.row)">上报</el-button> <el-button type="text" @click="handleReport(scope.row)">上报</el-button>
</template> </template>
</el-table-column> </el-table-column>
@@ -191,11 +189,11 @@
import { formatDate } from '@/utils/index' import { formatDate } from '@/utils/index'
import { import {
getTeachingLogList, getTeachingLogList,
submitTeachingLog,
exportTeachingLog, exportTeachingLog,
importTeachingLogExcel, importTeachingLogExcel,
downloadTeachingLogTemplate, downloadTeachingLogTemplate,
getTeachingLogByBh getTeachingLogByBh,
batchReportTeachingLog
} from '@/api/log' } from '@/api/log'
export default { export default {
@@ -247,6 +245,8 @@ export default {
// ==================== 导入 ==================== // ==================== 导入 ====================
importing: false, importing: false,
// 导入成功后是否跳到最后一页(定位到刚导入的数据)
importJumpLast: false,
// ==================== 详情 ==================== // ==================== 详情 ====================
detailVisible: false, detailVisible: false,
@@ -258,6 +258,10 @@ export default {
this.fetchList() this.fetchList()
}, },
methods: { methods: {
formatDate(val) {
return formatDate(val)
},
handleSelectionChange(rows) { handleSelectionChange(rows) {
this.selectedRows = rows this.selectedRows = rows
}, },
@@ -294,11 +298,20 @@ export default {
this.loading = true this.loading = true
return getTeachingLogList(this.buildSearchParams()) return getTeachingLogList(this.buildSearchParams())
.then((res) => { .then((res) => {
if (res.code === 200 || res.code === 0) { // 列表接口返回裸 PageResult(无 code 包装),拦截器已保证成功,直接取数据
const { list, total } = this.extractListData(res) const { list, total } = this.extractListData(res)
this.tableData = list // 导入成功后:跳到最后一页,定位刚导入的数据
this.total = total 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(() => { .catch(() => {
// 错误已由拦截器统一处理 // 错误已由拦截器统一处理
@@ -337,11 +350,6 @@ export default {
return ids return ids
}, },
handleDeleteSelected() {
// 后端暂未提供删除接口,仅作提示
this.$message.info('后端暂未提供该接口')
},
handleBatchReport() { handleBatchReport() {
const ids = this.getSelectedBhs() const ids = this.getSelectedBhs()
if (ids.length === 0) return if (ids.length === 0) return
@@ -351,12 +359,8 @@ export default {
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
// 提交教学日志审核,逐条上报至「已上报」状态 // 批量上报教学日志
let settled = Promise.resolve() return batchReportTeachingLog(ids)
ids.forEach((bh) => {
settled = settled.then(() => submitTeachingLog(bh, '已上报'))
})
return settled
}) })
.then(() => { .then(() => {
this.$message.success(`已上报 ${ids.length} 条记录`) this.$message.success(`已上报 ${ids.length} 条记录`)
@@ -376,7 +380,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(() => submitTeachingLog(String(bh), '已上报')) .then(() => batchReportTeachingLog([String(bh)]))
.then(() => { .then(() => {
this.$message.success('上报成功') this.$message.success('上报成功')
this.fetchList() this.fetchList()
@@ -425,6 +429,7 @@ export default {
.then((res) => { .then((res) => {
if (res.code === 200 || res.code === 0) { if (res.code === 200 || res.code === 0) {
this.$message.success(res.message || '导入成功') this.$message.success(res.message || '导入成功')
this.importJumpLast = true
this.fetchList() this.fetchList()
} else { } else {
this.$message.error(res.message || '导入失败') this.$message.error(res.message || '导入失败')
@@ -78,7 +78,7 @@
<div class="search-actions"> <div class="search-actions">
<div class="left-group"> <div class="left-group">
<el-button type="primary" @click="handleBatchAudit">审核通过所选</el-button> <el-button v-if="!isTeacher" type="primary" @click="handleBatchAudit">审核通过所选</el-button>
<el-button icon="el-icon-download" @click="handleExport">导出到 Word</el-button> <el-button icon="el-icon-download" @click="handleExport">导出到 Word</el-button>
</div> </div>
<div class="right-group"> <div class="right-group">
@@ -92,7 +92,7 @@
<el-card shadow="never" class="table-card"> <el-card shadow="never" class="table-card">
<el-table v-loading="loading" :data="tableData" stripe border highlight-current-row <el-table v-loading="loading" :data="tableData" stripe border highlight-current-row
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" /> <el-table-column v-if="!isTeacher" type="selection" width="50" align="center" />
<el-table-column type="index" label="序号" width="60" align="center" /> <el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column prop="rwlb" label="任务类别" width="120" align="center" show-overflow-tooltip /> <el-table-column prop="rwlb" label="任务类别" width="120" align="center" show-overflow-tooltip />
<el-table-column prop="jyxm" label="主讲教员" width="100" align="center" /> <el-table-column prop="jyxm" label="主讲教员" width="100" align="center" />
@@ -104,23 +104,22 @@
{{ scope.row.qsjc && scope.row.jsjc ? `${scope.row.qsjc}-${scope.row.jsjc}` : (scope.row.qsjc || '-') }} {{ scope.row.qsjc && scope.row.jsjc ? `${scope.row.qsjc}-${scope.row.jsjc}` : (scope.row.qsjc || '-') }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="kcmc" label="课程名称" min-width="150" show-overflow-tooltip /> <el-table-column prop="kcmc" label="课程名称" width="80" show-overflow-tooltip />
<el-table-column prop="pxqbxx" label="培训期班信息" min-width="140" show-overflow-tooltip /> <el-table-column prop="pxqbxx" label="培训期班信息" show-overflow-tooltip />
<el-table-column label="人数" width="70" align="center"> <el-table-column label="人数" width="80" align="center">
<template slot-scope="scope">{{ scope.row.sdrs || scope.row.ydrs || '-' }}</template> <template slot-scope="scope">{{ scope.row.sdrs || scope.row.ydrs || '-' }}</template>
</el-table-column> </el-table-column>
<el-table-column label="分组指导教员" width="120" align="center"> <el-table-column label="分组指导教员" width="100" align="center">
<template slot-scope="scope">{{ scope.row.fzyzdjy || '-' }}</template> <template slot-scope="scope">{{ scope.row.fzyzdjy || '-' }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="jsfs" label="教学方法" width="100" align="center" /> <el-table-column prop="jsfs" label="教学方法" width="80" align="center" />
<el-table-column prop="zt" label="日志状态" width="100" align="center" /> <el-table-column prop="zt" label="日志状态" width="100" align="center" />
<el-table-column prop="gdqk" label="变动汇总" min-width="120" show-overflow-tooltip /> <el-table-column prop="gdqk" label="变动汇总" width="100" show-overflow-tooltip />
<el-table-column prop="jxrzcjfs" label="创建方式" width="100" align="center" /> <el-table-column prop="jxrzcjfs" label="创建方式" width="100" align="center" />
<el-table-column label="操作" width="80" align="center" fixed="right" class-name="table-action-column"> <el-table-column v-if="!isTeacher" label="操作" width="160" align="center" fixed="right" class-name="table-action-column">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handleAudit(scope.row)">审核</el-button> <el-button type="text" @click="handleAudit(scope.row)">审核</el-button>
<el-button type="text" @click="handleReject(scope.row)">退回</el-button> <el-button type="text" @click="handleReject(scope.row)">退回</el-button>
<el-button type="text" @click="handleDetail(scope.row)">详细</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -173,14 +172,21 @@
import { formatDate } from '@/utils/index' import { formatDate } from '@/utils/index'
import { import {
getReportedTeachingLogList, getReportedTeachingLogList,
approveTeachingLog,
rejectTeachingLog, rejectTeachingLog,
exportTeachingLog, exportTeachingLog,
getTeachingLogByBh getTeachingLogByBh,
batchAuditTeachingLog
} from '@/api/log' } from '@/api/log'
export default { export default {
name: 'ReportedView', name: 'ReportedView',
props: {
/** 当前用户是否为教员角色,用于隐藏审核相关操作 */
isTeacher: {
type: Boolean,
default: false
}
},
data() { data() {
return { return {
// ==================== 查询表单 ==================== // ==================== 查询表单 ====================
@@ -239,6 +245,11 @@ export default {
this.selectedRows = rows this.selectedRows = rows
}, },
/** 组件方法:包一层全局 formatDate,供模板调用 */
formatDate(val) {
return formatDate(val)
},
/** 根据已填写的查询值构建实际查询参数 */ /** 根据已填写的查询值构建实际查询参数 */
buildSearchParams() { buildSearchParams() {
const form = this.searchForm const form = this.searchForm
@@ -266,11 +277,10 @@ export default {
this.loading = true this.loading = true
return getReportedTeachingLogList(this.buildSearchParams()) return getReportedTeachingLogList(this.buildSearchParams())
.then((res) => { .then((res) => {
if (res.code === 200 || res.code === 0) { // 列表接口返回裸 PageResult(无 code 包装),拦截器已保证成功,直接取数据
const { list, total } = this.extractListData(res) const { list, total } = this.extractListData(res)
this.tableData = list this.tableData = list
this.total = total this.total = total
}
}) })
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {
@@ -333,12 +343,8 @@ export default {
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
// 审核通过教学日志,逐条审核 // 批量审核教学日志
let settled = Promise.resolve() return batchAuditTeachingLog(ids)
ids.forEach((bh) => {
settled = settled.then(() => approveTeachingLog(bh, ''))
})
return settled
}) })
.then(() => { .then(() => {
this.$message.success(`已审核通过 ${ids.length} 条记录`) this.$message.success(`已审核通过 ${ids.length} 条记录`)
@@ -358,7 +364,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(() => approveTeachingLog(String(bh), '')) .then(() => batchAuditTeachingLog([String(bh)]))
.then(() => { .then(() => {
this.$message.success('审核通过成功') this.$message.success('审核通过成功')
this.fetchList() this.fetchList()
@@ -2,11 +2,12 @@
<div class="page-container"> <div class="page-container">
<el-card shadow="never" class="tab-card"> <el-card shadow="never" class="tab-card">
<el-tabs v-model="activeTab" class="organ-tabs"> <el-tabs v-model="activeTab" class="organ-tabs">
<el-tab-pane label="教学日志管理查询" name="query"> <!-- 教学日志管理查询页仅管理员/教研室等非教员非机关人员可见 -->
<el-tab-pane v-if="hasQueryAccess" label="教学日志管理查询" name="query">
<log-view v-if="activeTab === 'query'" /> <log-view v-if="activeTab === 'query'" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="已上报机关教学日志" name="reported"> <el-tab-pane label="已上报机关教学日志" name="reported">
<reported-view v-if="activeTab === 'reported'" /> <reported-view v-if="activeTab === 'reported'" :is-teacher="isTeacher" />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="机关已审核教学日志" name="audited"> <el-tab-pane label="机关已审核教学日志" name="audited">
<audited-view v-if="activeTab === 'audited'" /> <audited-view v-if="activeTab === 'audited'" />
@@ -28,6 +29,29 @@ export default {
return { return {
activeTab: 'query' 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'
}
} }
} }
</script> </script>