forked from liweijie/education
J教学日志管理
This commit is contained in:
@@ -94,8 +94,7 @@
|
||||
<div class="left-group">
|
||||
<el-button type="primary" @click="handleBatchReport">批准上报所选</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">导出到 Word</el-button>
|
||||
<el-button icon="el-icon-download" @click="handleExport">导出</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-download" @click="handleDownloadTemplate">下载模板</el-button>
|
||||
@@ -137,7 +136,6 @@
|
||||
<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>
|
||||
<el-button type="text" @click="handleReport(scope.row)">上报</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -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 || '导入失败')
|
||||
|
||||
Reference in New Issue
Block a user