2025-12-29 09:56:08 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
<el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true"
|
|
|
|
|
|
label-width="72px">
|
|
|
|
|
|
<el-form-item label="班级代码" prop="bjdm">
|
|
|
|
|
|
<el-input v-model="queryParams.bjdm" placeholder="请输入班级代码" clearable
|
|
|
|
|
|
@keyup.enter.native="handleQuery" />
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
2026-01-04 10:43:20 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="年级代码" prop="gradeCode">
|
|
|
|
|
|
<el-select v-model="queryParams.gradeCode" filterable clearable placeholder="请选择年级代码">
|
|
|
|
|
|
<el-option v-for="item in grade_list" :key="item.gradeCode" :label="item.gradeCode"
|
|
|
|
|
|
:value="item.gradeCode" size="mini" />
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
|
<el-button v-hasPermi="['system:middle:add']" type="primary" plain icon="el-icon-plus" size="mini"
|
|
|
|
|
|
@click="handleSync">同步数据</el-button>
|
2025-12-29 09:56:08 +08:00
|
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
2026-01-05 16:21:04 +08:00
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
|
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
|
|
|
|
|
</el-row>
|
2026-01-04 10:43:20 +08:00
|
|
|
|
<el-table v-loading="loading" :data="middleList">
|
2025-12-29 09:56:08 +08:00
|
|
|
|
<el-table-column label="班级代码" align="center" prop="bjdm" />
|
|
|
|
|
|
<el-table-column label="班级名称" align="center" prop="bjmc" />
|
2026-01-04 10:43:20 +08:00
|
|
|
|
<el-table-column label="班级简称" align="center" prop="BJJC" />
|
|
|
|
|
|
<el-table-column label="专业代码" align="center" prop="zyid" />
|
2025-12-29 15:19:29 +08:00
|
|
|
|
<el-table-column label="年级代码" align="center" prop="njid" />
|
2025-12-29 09:56:08 +08:00
|
|
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
|
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
|
|
|
|
|
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
2026-01-04 10:43:20 +08:00
|
|
|
|
import { listBj, syncBjinfo } from '@/api/stuCQS/synchronous-data/sync-class'
|
|
|
|
|
|
import { listGrade } from '@/api/stuCQS/basedata/grade'
|
2025-12-29 09:56:08 +08:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'Middle',
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
// 遮罩层
|
|
|
|
|
|
loading: true,
|
|
|
|
|
|
// 选中数组
|
|
|
|
|
|
ids: [],
|
|
|
|
|
|
// 非单个禁用
|
|
|
|
|
|
single: true,
|
|
|
|
|
|
// 非多个禁用
|
|
|
|
|
|
multiple: true,
|
|
|
|
|
|
// 显示搜索条件
|
|
|
|
|
|
showSearch: true,
|
|
|
|
|
|
// 总条数
|
|
|
|
|
|
total: 0,
|
|
|
|
|
|
// 【请填写功能名称】表格数据
|
|
|
|
|
|
middleList: [],
|
|
|
|
|
|
// 弹出层标题
|
|
|
|
|
|
title: '',
|
|
|
|
|
|
// 是否显示弹出层
|
|
|
|
|
|
open: false,
|
|
|
|
|
|
// 查询参数
|
|
|
|
|
|
queryParams: {
|
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
BJID: null,
|
|
|
|
|
|
bjdm: null,
|
2026-01-04 10:43:20 +08:00
|
|
|
|
bjjc: null,
|
2025-12-29 09:56:08 +08:00
|
|
|
|
bjmc: null,
|
|
|
|
|
|
njid: null,
|
2026-01-04 10:43:20 +08:00
|
|
|
|
zyid: null,
|
|
|
|
|
|
gradeCode: null
|
2025-12-29 09:56:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 表单参数
|
|
|
|
|
|
form: {},
|
|
|
|
|
|
// 表单校验
|
|
|
|
|
|
rules: {
|
2026-01-04 10:43:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
grade_list: []
|
2025-12-29 09:56:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
this.getList()
|
2026-01-04 10:43:20 +08:00
|
|
|
|
this.listGrade()
|
2025-12-29 09:56:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2026-01-04 10:43:20 +08:00
|
|
|
|
async listGrade() {
|
|
|
|
|
|
let res = await listGrade()
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
|
this.grade_list = [...res.rows]
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-12-29 09:56:08 +08:00
|
|
|
|
/** 查询【请填写功能名称】列表 */
|
|
|
|
|
|
getList() {
|
|
|
|
|
|
this.loading = true
|
2025-12-29 15:19:29 +08:00
|
|
|
|
listBj(this.queryParams).then(response => {
|
2025-12-29 09:56:08 +08:00
|
|
|
|
this.middleList = [...response.rows]
|
|
|
|
|
|
this.total = response.total
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 取消按钮
|
|
|
|
|
|
cancel() {
|
|
|
|
|
|
this.open = false
|
|
|
|
|
|
this.reset()
|
|
|
|
|
|
},
|
|
|
|
|
|
// 表单重置
|
|
|
|
|
|
reset() {
|
|
|
|
|
|
this.form = {
|
|
|
|
|
|
BJID: null,
|
|
|
|
|
|
bjdm: null,
|
2026-01-04 10:43:20 +08:00
|
|
|
|
bjjc: null,
|
2025-12-29 09:56:08 +08:00
|
|
|
|
bjmc: null,
|
|
|
|
|
|
njid: null,
|
2026-01-04 10:43:20 +08:00
|
|
|
|
zyid: null,
|
2025-12-29 09:56:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.resetForm('form')
|
|
|
|
|
|
},
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
|
handleQuery() {
|
|
|
|
|
|
this.queryParams.pageNum = 1
|
2025-12-30 11:43:23 +08:00
|
|
|
|
this.getList()
|
2025-12-29 09:56:08 +08:00
|
|
|
|
},
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
|
resetQuery() {
|
|
|
|
|
|
this.resetForm('queryForm')
|
|
|
|
|
|
this.queryParams.pageNum = 1
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
},
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
|
handleExport() {
|
|
|
|
|
|
this.download('system/middle/export', {
|
|
|
|
|
|
...this.queryParams
|
|
|
|
|
|
}, `middle_${new Date().getTime()}.xlsx`)
|
|
|
|
|
|
},
|
2026-01-04 10:43:20 +08:00
|
|
|
|
//同步数据
|
|
|
|
|
|
async handleSync() {
|
|
|
|
|
|
if (this.queryParams.gradeCode == null || this.queryParams.gradeCode == "") {
|
|
|
|
|
|
this.$modal.msgError('请选择年级代码')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
this.$modal.msgSuccess('正在同步')
|
|
|
|
|
|
const res = await syncBjinfo(this.queryParams)
|
|
|
|
|
|
// 增加接口返回值校验,避免res.msg不存在导致的二次报错
|
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
|
this.$modal.msgSuccess('同步完成')
|
2026-01-21 21:36:48 +08:00
|
|
|
|
this.getList()
|
2026-01-04 10:43:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
//this.getList() // 仅接口正常返回时刷新列表
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
// 捕获接口报错,提示用户并打印错误日志(便于排查)
|
|
|
|
|
|
this.$modal.msgError('同步失败:' + (error.message || '网络异常'))
|
|
|
|
|
|
//console.error('同步数据报错:', error)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
// 无论成功/失败,最终都会执行这里,重置加载状态
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
|
}
|
2025-12-29 09:56:08 +08:00
|
|
|
|
}
|
2026-01-04 10:43:20 +08:00
|
|
|
|
|
2025-12-29 09:56:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-04 10:43:20 +08:00
|
|
|
|
</script>
|