Files
zhxg_pc/src/views/basedata/graduate/index.vue
LWH d3b66e05f7 ```
feat: 更新学院标识和名称为梧州职业学院

- 替换所有页面中的"广西水利电力职业技术学院"为"梧州职业学院"
- 更新登录页面标题和版权信息
- 更换学院logo和登录背景图片
- 修改各种申请表、鉴定表、助学金申请等相关文档中的学院名称
- 调整休学证明、复学证明等文件中的学院简称
```
2026-03-20 15:44:07 +08:00

1020 lines
31 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div v-loading.fullscreen.lock="loading" class="app-container">
<!-- 搜索表单 -->
<el-form v-show="showSearch" ref="queryForm" class="search-form" :model="queryParams" size="small" :inline="true"
label-width="68px"
>
<el-form-item label="学号" prop="studentCode">
<el-input v-model="queryParams.studentCode" placeholder="请输入学号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="班级" prop="deptId">
<el-cascader ref="cas" v-model="queryParams.classId" style="width: 500px;" :options="cascaderData"
:props="{ checkStrictly: false }" clearable filterable @change="handleChange"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作按钮区域 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button v-hasPermi="['graduate:basedata:add']" type="warning" plain icon="el-icon-download" size="mini" @click="importVClick">导入模板</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-printer" size="mini" @click="takeEclDatas" v-hasPermi="['graduate:basedata:dayin']">批量打印</el-button>
</el-col> -->
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
</el-row>
<!-- 学生表格 -->
<div class="student-table">
<el-table v-loading="loading" :data="rankingList" border stripe @selection-change="handleSelectionChange">
<el-table-column label="学号" align="center" prop="studentCode" width="350" />
<el-table-column label="姓名" align="center" prop="studentName" width="350" />
<el-table-column label="班级" align="center" prop="studentClass" width="350" />
<el-table-column label="操作" align="center" width="320" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-hasPermi="['graduate:basedata:dayin']" size="mini" type="primary" icon="el-icon-printer" @click="takeEclData(scope.row)">打印</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 导入模板对话框 -->
<el-dialog title="导入模板" :visible.sync="importV" :before-close="handleClose" width="1000px" center
style="text-align: center;"
>
<el-row type="flex" class="row-bg" justify="space-around">
<el-upload center class="upload-demo" drag :auto-upload="false" :limit="1" :on-exceed="handleExceed" action=""
:file-list="fileList" :on-change="fileChoose" :on-success="handleFileSuccess"
>
<i class="el-icon-upload" />
<div class="el-upload__text">将文件拖到此处<em>点击选择</em></div>
<div slot="tip" class="el-upload__tip">只能上传xlsx/xls文件(先上传鉴定表再上传评语表) <el-link type="primary"
size="mini" @click="downloadMode"
>下载模板</el-link></div>
</el-upload>
</el-row>
<el-form>
<el-form-item label="学年">
<el-select v-model="stu_year_import" placeholder="请选择学年" @change="handleYearChange">
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id" />
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doImport()"> </el-button>
</span>
</el-dialog>
<!-- 打印预览对话框 -->
<el-dialog title="打印预览" :visible.sync="printDialogVisible" fullscreen>
<div id="printContent" class="print-content">
<!-- 双面打印提示 -->
<div v-if="printDialogVisible" class="print-notice no-print">
<el-alert title="打印提示" type="info" show-icon>
<p>请确保打印机已设置为双面打印模式短边翻转</p>
<p>评语表将打印在正面鉴定表将打印在背面</p>
</el-alert>
</div>
<!-- 学生评语表正面 -->
<div id="commentTable" class="print-page">
<div class="print-header">
<h1>梧州职业学院学生评语表</h1>
</div>
<table class="print-table comment-table">
<tr>
<th colspan="8">梧州职业学院学生评语表</th>
</tr>
<tr>
<td>学年</td>
<td colspan="3">第一学年</td>
<td colspan="3">第二学年</td>
<td>第三学年</td>
</tr>
<tr>
<td>辅导员评语</td>
<td colspan="3" class="comment-cell">
{{ getYearData(0, 'counselorComments') }}
<div class="signature">
<div>辅导员{{ getYearData(0, 'counselorName') }}</div>
<div>{{ formatDate(getYearData(0, 'fillData')) }}</div>
</div>
</td>
<td colspan="3" class="comment-cell">
{{ getYearData(1, 'counselorComments') }}
<div class="signature">
<div>辅导员{{ getYearData(1, 'counselorName') }}</div>
<div>{{ formatDate(getYearData(1, 'fillData')) }}</div>
</div>
</td>
<td class="comment-cell">
{{ getYearData(2, 'counselorComments') }}
<div class="signature">
<div>辅导员{{ getYearData(2, 'counselorName') }}</div>
<div>{{ formatDate(getYearData(2, 'fillData')) }}</div>
</div>
</td>
</tr>
<tr>
<td>学院意见</td>
<td colspan="3" class="comment-cell">
{{ getYearData(0, 'collegeOpinion') || '无数据' }}
<div class="signature">
<!-- <div>辅导员{{ getYearData(0, 'counselorName') || '无数据' }}</div> -->
<div>{{ formatDate(getYearData(0, 'fillData')) || '无数据' }}</div>
</div>
</td>
<td colspan="3" class="comment-cell">
{{ getYearData(1, 'collegeOpinion') || '无数据' }}
<div class="signature">
<!-- <div>辅导员{{ getYearData(1, 'counselorName') || '无数据' }}</div> -->
<div>{{ formatDate(getYearData(1, 'fillData')) || '无数据' }}</div>
</div>
</td>
<td class="comment-cell">
{{ getYearData(2, 'collegeOpinion') || '无数据' }}
<div class="signature">
<!-- <div>辅导员{{ getYearData(2, 'counselorName') || '无数据' }}</div> -->
<div>{{ formatDate(getYearData(2, 'fillData')) || '无数据' }}</div>
</div>
</td>
</tr>
</table>
<p class="print-note" style="text-align: center;">本表用钢笔或签字笔工整填写由辅导员保管学生离校时存入学生档案</p>
<p class="print-note" style="text-align: center;">梧州职业学院 学生工作处印制</p>
</div>
<!-- 学生综合素质鉴定表背面 -->
<div id="evaluationTable" class="print-page">
<div class="print-header">
<h1>梧州职业学院学生综合素质鉴定表</h1>
</div>
<table class="print-table evaluation-table">
<tr>
<th colspan="5">学生基本信息</th>
</tr>
<tr>
<td style="width: 120px;">姓名</td>
<td>{{ printData.studentName || '学生姓名' }}</td>
<td style="width: 120px;">学号</td>
<td colspan="2">{{ printData.studentCode || '学生学号' }}</td>
</tr>
<tr>
<td>学院</td>
<td>{{ printData.studentCollege || '所在学院' }}</td>
<td>班级</td>
<td colspan="2">{{ printData.studentClass || '所属班级' }}</td>
</tr>
<tr>
<td>性别</td>
<td>{{ printData.sex || '性别' }}</td>
<td>民族</td>
<td colspan="2">{{ printData.nation || '民族' }}</td>
</tr>
<tr>
<td>出生日期</td>
<td colspan="4">{{ printData.birth_data || '出生日期' }}</td>
</tr>
</table>
<table class="print-table evaluation-table">
<tr>
<th rowspan="3">思想表现</th>
<th>项目</th>
<th>第一学年</th>
<th>第二学年</th>
<th>第三学年</th>
</tr>
<tr>
<td>政治思想</td>
<td>{{ getYearData(0, 'politics') || '无数据' }}</td>
<td>{{ getYearData(1, 'politics') || '无数据' }}</td>
<td>{{ getYearData(2, 'politics') || '无数据' }}</td>
</tr>
<tr>
<td>道德品质</td>
<td>{{ getYearData(0, 'moralCharacter') || '无数据' }}</td>
<td>{{ getYearData(1, 'moralCharacter') || '无数据' }}</td>
<td>{{ getYearData(2, 'moralCharacter') || '无数据' }}</td>
</tr>
<tr>
<th rowspan="2">学习表现</th>
<td>学习态度</td>
<td>{{ getYearData(0, 'attitude') || '无数据' }}</td>
<td>{{ getYearData(1, 'attitude') || '无数据' }}</td>
<td>{{ getYearData(2, 'attitude') || '无数据' }}</td>
</tr>
<tr>
<td>考勤情况</td>
<td>{{ getYearData(0, 'attendanceSituation') || '无数据' }}</td>
<td>{{ getYearData(1, 'attendanceSituation') || '无数据' }}</td>
<td>{{ getYearData(2, 'attendanceSituation') || '无数据' }}</td>
</tr>
<tr>
<th rowspan="3">工作表现</th>
<td>担任职务</td>
<td>{{ getYearData(0, 'positionHeld') || '无数据' }}</td>
<td>{{ getYearData(1, 'positionHeld') || '无数据' }}</td>
<td>{{ getYearData(2, 'positionHeld') || '无数据' }}</td>
</tr>
<tr>
<td>工作态度</td>
<td>{{ getYearData(0, 'workingAttitude') || '无数据' }}</td>
<td>{{ getYearData(1, 'workingAttitude') || '无数据' }}</td>
<td>{{ getYearData(2, 'workingAttitude') || '无数据' }}</td>
</tr>
<tr>
<td>工作能力</td>
<td>{{ getYearData(0, 'workingAbility') || '无数据' }}</td>
<td>{{ getYearData(1, 'workingAbility') || '无数据' }}</td>
<td>{{ getYearData(2, 'workingAbility') || '无数据' }}</td>
</tr>
<tr>
<th rowspan="4">综合成绩</th>
<td>思想政治素质</td>
<td>{{ getYearData(0, 'ldeologicalPolitical') || '无数据' }}</td>
<td>{{ getYearData(1, 'ldeologicalPolitical') || '无数据' }}</td>
<td>{{ getYearData(2, 'ldeologicalPolitical') || '无数据' }}</td>
</tr>
<tr>
<td>科学文化素质</td>
<td>{{ getYearData(0, 'scientificQuality') || '无数据' }}</td>
<td>{{ getYearData(1, 'scientificQuality') || '无数据' }}</td>
<td>{{ getYearData(2, 'scientificQuality') || '无数据' }}</td>
</tr>
<tr>
<td>体能素质</td>
<td>{{ getYearData(0, 'physicalQuality') || '无数据' }}</td>
<td>{{ getYearData(1, 'physicalQuality') || '无数据' }}</td>
<td>{{ getYearData(2, 'physicalQuality') || '无数据' }}</td>
</tr>
<tr>
<td>总分</td>
<td>{{ getYearData(0, 'totalPoints') || '无数据' }}</td>
<td>{{ getYearData(1, 'totalPoints') || '无数据' }}</td>
<td>{{ getYearData(2, 'totalPoints') || '无数据' }}</td>
</tr>
</table>
<p class="print-note">
备注本表中的"思想表现""学习表现""工作表现"等项按优及格不及格等级填写考勤情况按全勤有迟到旷课早退请假的按实际数填写"担任职务"为班级学院学校学生干部名称个人素质综合成绩参照学生个人综合素质考评办法中的要求进行填写
</p>
</div>
</div>
<div slot="footer" class="dialog-footer">
<div class="print-actions">
<el-button v-print="printObj" type="primary" icon="el-icon-printer">双面打印全部</el-button>
<!-- <el-button @click="printSingle('commentTable')" icon="el-icon-document">仅打印评语表正面</el-button>
<el-button @click="printSingle('evaluationTable')" icon="el-icon-document">仅打印鉴定表背面</el-button> -->
<el-button @click="printDialogVisible = false">取消</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import * as XLSX from 'xlsx'
import { listAllYear as listYear } from '@/api/stuCQS/basedata/year'
import { getStuList, importGraduate, getStuInfo } from '@/api/graduate/index'
import { treeStudent } from '@/api/stuCQS/basedata/student' // 添加到现有的import中
import { isEmpty, isNumber } from '@/api/helpFunc'
import { excelDateToJSDate } from '@/utils/index'
export default {
name: 'Rankings',
data() {
return {
// 分页相关
currentPage: 1,
pagesize: 10,
total: 0,
// 导入相关
stu_year_import: null,
fileList: [],
stu_years: [],
cascaderData: null,
// 状态控制
loading: true,
ids: [],
tid: null,
single: true,
multiple: true,
showSearch: true,
importV: false,
biaoJi: null, //标记学年
// 数据
rankingList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
studentCode: null,
classId: null,
studentClass: null,
},
// 打印相关
printDialogVisible: false,
printData: {},
printObj: {
id: 'printContent',
popTitle: '毕业生信息打印',
extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
extraCss: 'https://cdn.jsdelivr.net/npm/element-ui@2.15.13/lib/theme-chalk/index.css',
beforeOpenCallback(vue) {
console.log('打开打印窗口前回调')
},
openCallback(vue) {
console.log('打开打印窗口回调')
// 添加打印样式
const style = document.createElement('style')
style.innerHTML = `
@page {
size: A4 landscape;
margin: 0;
}
@page :left {
margin: 0;
}
@page :right {
margin: 0;
}
`
document.head.appendChild(style)
},
closeCallback(vue) {
console.log('关闭打印窗口回调')
}
}
}
},
created() {
this.getList()
this.getCascaderData()
},
methods: {
// 级联选择处理
handleChange(value) {
this.queryParams = {
...this.queryParams,
classId: value[2],
}
},
// 获取学年信息
async listAllStuYear() {
let res = await listYear()
this.stu_years = [...res.data]
},
// 获取学年对应的下标数据
handleYearChange(value) {
const index = this.stu_years.findIndex(item => item.id === value)
if (index !== -1) {
if(this.stu_years.length === 4) {
if(index !== 3) {
this.biaoJi = index + 1 // 将对应的索引存入 biaoJi 字段
return
}
this.$alert('确定要选择此学年吗?', '提示', {
confirmButtonText: '',
showCancelButton: false,
type: 'warning',
center: true,
callback: () => {
// 可以留空或执行其他只读操作
}
})
}
//this.biaoJi = index;
}
},
// 获取级联数据
async getCascaderData() {
const res = await treeStudent()
this.cascaderData = res.data
this.cascaderData.forEach(dept => {
dept.children.forEach(major => {
major.children.forEach(c => {
delete c.children
})
})
})
},
// 获取学年数据
getYearData(yearIndex, field) {
console.log(`获取学年数据 - 学年索引: ${yearIndex}, 字段: ${field}`)
if (!this.printData.yearDataMap) {
console.log('yearDataMap未定义')
return '无数据'
}
const yearData = this.printData.yearDataMap[yearIndex]
if (!yearData) {
console.log(`学年 ${yearIndex} 数据不存在`)
return '无数据'
}
const value = yearData[field]
console.log('获取到的值:', value)
return value || '无数据'
},
// 格式化日期
formatDate(dateStr) {
if (!dateStr || dateStr === '无数据') return '无数据'
try {
const date = new Date(dateStr)
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
return `${year}${month}${day}`
} catch (e) {
return '无数据'
}
},
// 导入毕业生信息
async doImport() {
if (isEmpty(this.stu_year_import)) {
this.$message.info('请选择学年')
return
}
this.loading = true
let sdata = []
let temp = [...this.importData]
temp.map(v => {
if (true) {
let temp1 = {}
if (this.excelName == '鉴定表.xlsx') {
temp1 = {
studentCode: v.studentCode,
studentName: v.studentName,
studentCollege: v.studentCollege,
studentGrade: v.studentGrade,
studentClass: v.studentClass,
sex: v.sex,
nation: v.nation,
birthData: v.birthData,
politics: v.politics,
moralCharacter: v.moralCharacter,
observeDiscipline: v.observeDiscipline,
attitude: v.attitude,
attendanceSituation: v.attendanceSituation,
positionHeld: v.positionHeld,
workingAttitude: v.workingAttitude,
workingAbility: v.workingAbility,
ldeologicalPolitical: v.ldeologicalPolitical,
scientificQuality: v.scientificQuality,
physicalQuality: v.physicalQuality,
totalPoints: +v.totalPoints,
stuYear: this.stu_year_import,
biaoJit: this.biaoJi
}
} else {
temp1 = {
studentCode: v.studentCode,
studentName: v.studentName,
counselorComments: v.counselorComments,
counselorName: v.counselorName,
fillData: v.fillData,
collegeOpinion: v.collegeOpinion,
stuYear: this.stu_year_import,
biaoJit: this.biaoJi
}
}
sdata.push(temp1)
}
})
this.excelName = ''
let res = await importGraduate(sdata)
this.loading = false
this.$message(res.msg)
this.getList()
this.importV = false
this.fileList = []
this.stu_year_import = null
},
// 查询毕业生列表
getList() {
this.loading = true
getStuList(this.queryParams).then(response => {
this.rankingList = response.rows
this.total = response.total
this.loading = false
})
},
// 下载模板
downloadMode() {
this.download('/comprehensive/rankingModel/downloadAllTemplates', {}, 'allTemplates.zip')
},
// 导入模板弹窗
importVClick() {
this.importV = true
this.listAllStuYear()
},
// 关闭导入弹窗
handleClose(done) {
this.$confirm('确认关闭?').then(_ => {
this.excelData = []
this.fileList = []
this.tableData = []
done()
}).catch(_ => { })
},
// 文件超出限制
handleExceed(files, fileList) {
this.$message.warning(
`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`
)
},
// 文件选择处理
async fileChoose(file, fileList) {
this.loading = true
this.excelName = file.name
try {
let data = await this.handleData(file)
let daterank = []
if (this.excelName == '鉴定表.xlsx') {
daterank = data.map(item => ({
studentCode: item.学号,
studentName: item.姓名,
studentCollege: item.学院,
studentGrade: item.年级,
studentClass: item.班级,
sex: item.性别,
nation: item.民族,
birthData: excelDateToJSDate(item.出生年月).toISOString().split('T')[0],
politics: item['思想表现-政治思想'],
moralCharacter: item['思想表现-道德品质'],
observeDiscipline: item['思想表现-遵纪守法'],
attitude: item['学习表现-学习态度'],
attendanceSituation: item['学习表现-考勤情况'],
positionHeld: item['工作表现-担任职位'],
workingAttitude: item['工作表现-工作态度'],
workingAbility: item['工作表现-工作能力'],
ldeologicalPolitical: item['个人素质综合成绩-思想政治素质'],
scientificQuality: item['个人素质综合成绩-科学文化素质'],
physicalQuality: item['个人素质综合成绩-体能素质'],
totalPoints: item['个人素质综合成绩-总分']
}))
} else {
daterank = data.map(item => ({
studentCode: item.学号,
studentName: item.姓名,
counselorComments: item.辅导员评语,
counselorName: item.辅导员姓名,
fillData: excelDateToJSDate(item.年月日).toISOString().split('T')[0],
collegeOpinion: item.学院意见
}))
}
this.importData = daterank
this.importTotal = data.length
} catch (error) {
console.error('上传失败:', error)
} finally {
this.loading = false
}
},
// 文件数据处理
handleData(file) {
let reader = new FileReader()
reader.readAsArrayBuffer(file.raw)
return new Promise((resolve, reject) => {
reader.onload = (e) => {
let data = e.target.result
let workbook = XLSX.read(data, {
type: 'binary'
})
let jsonData = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]], {
defval: 'null'
})
resolve(jsonData)
}
})
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.tableData = []
this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
this.getList()
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: null,
studentCode: null,
classId: null,
studentClass: null,
}
this.resetForm('form')
},
// 分页处理
handleSizeChange(val) {
this.importForm.pagesize = val
},
handleCurrentChange(val) {
this.importForm.currentPage = val
},
// 搜索按钮操作
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
// 重置按钮操作
resetQuery() {
this.class_cas = []
this.queryParams.classId = null
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
// 打印按钮操作
async takeEclData(row) {
try {
this.loading = true
console.log('开始获取打印数据', row)
// 获取学生详细信息
const response = await getStuInfo(row.id)
if (response.code !== 200) {
throw new Error(response.msg || '获取学生信息失败')
}
console.log('获取学生信息成功', response.data)
const studentData = response.data
// 处理学年数据 - 按学年分组
const yearDataMap = {}
if (studentData.graduateVoList && studentData.graduateVoList.length > 0) {
studentData.graduateVoList.forEach((item, index) => {
yearDataMap[index] = item
})
}
// 打印yearDataMap检查数据结构
console.log('yearDataMap:', yearDataMap)
// 合并数据
this.printData = {
...row,
...studentData,
yearDataMap,
birth_data: this.formatDate(studentData.birthData) || '无数据',
studentCollege: studentData.studentCollege || '无数据',
studentClass: studentData.studentClass || row.studentClass || '无数据',
sex: studentData.sex || '无数据',
nation: studentData.nation || '无数据',
studentName: studentData.studentName || row.studentName || '无数据',
studentCode: studentData.studentCode || row.studentCode || '无数据'
}
this.printDialogVisible = true
} catch (error) {
console.error('打印操作失败:', error)
this.$message.error(error.message || '获取打印数据失败')
this.printData = {
...row,
yearDataMap: {},
studentCollege: '无数据',
sex: '无数据',
nation: '无数据',
birth_data: '无数据',
studentName: row.studentName || '无数据',
studentCode: row.studentCode || '无数据',
studentClass: row.studentClass || '无数据'
}
this.printDialogVisible = true
} finally {
this.loading = false
}
},
// 添加日期格式化方法
formatDate(dateInput) {
// 处理空值
if (!dateInput) return '无数据'
// 如果已经是格式化后的字符串,直接返回
if (typeof dateInput === 'string' && dateInput.includes('年') && dateInput.includes('月') && dateInput.includes('日')) {
return dateInput
}
try {
// 尝试创建日期对象
const date = new Date(dateInput)
// 检查是否为有效日期
if (isNaN(date.getTime())) {
return '无数据'
}
// 格式化日期
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
return `${year}${month}${day}`
} catch (e) {
console.error('日期格式化错误:', e)
return '无数据'
}
},
// 打印单个表格
printSingle(id) {
this.printObj.id = id
this.$nextTick(() => {
this.$print(this.printObj)
})
},
// 双面打印全部
printAll() {
this.printObj.id = 'printContent'
this.$nextTick(() => {
this.$print(this.printObj)
})
},
// 打印数据(多个)
// takeEclDatas() {
// console.log("打印数据");
// },
}
}
</script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
body {
background-color: #f5f7fa;
color: #333;
line-height: 1.6;
}
.app-container {
max-width: 1400px;
margin: 20px auto;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid #ebeef5;
}
.header h1 {
color: #1e4e8c;
font-size: 24px;
font-weight: 500;
}
.school-logo {
width: 60px;
height: 60px;
background: #1e4e8c;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
font-size: 14px;
text-align: center;
line-height: 1.3;
}
.search-form {
background: #f8f9fb;
padding: 20px;
border-radius: 6px;
margin-bottom: 20px;
}
.operation-bar {
margin-bottom: 20px;
display: flex;
justify-content: space-between;
}
.student-table {
margin-bottom: 20px;
}
.action-button {
margin-right: 10px;
}
/* 打印样式 */
.print-content {
padding: 20px;
}
.print-page {
margin-bottom: 30px;
background: white;
padding: 25px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.print-header {
text-align: center;
border-bottom: 2px solid #1e4e8c;
}
.print-header h1 {
color: #1e4e8c;
font-size: 24px;
margin-bottom: 5px;
}
.print-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
font-size: 14px;
}
.print-table th,
.print-table td {
border: 1px solid #000;
padding: 10px 8px;
text-align: center;
}
.print-table th {
background-color: #f2f2f2;
font-weight: 600;
}
.print-note {
font-size: 12px;
color: #666;
font-style: italic;
margin-top: 10px;
}
.comment-cell {
height: 150px;
position: relative;
}
.signature {
position: absolute;
right: 10px;
bottom: 10px;
text-align: right;
}
/* 打印对话框按钮 */
.print-actions {
display: flex;
gap: 15px;
margin-top: 20px;
justify-content: center;
}
/* 打印专用样式 */
@media print {
body * {
visibility: hidden;
}
.print-content,
.print-content * {
visibility: visible;
}
.print-content {
position: absolute;
left: 0;
top: 0;
width: 100%;
padding: 0;
margin: 0;
}
.no-print {
display: none !important;
}
/* 横屏打印设置 */
@page {
size: A4 landscape;
margin: 0;
}
/* 正面页样式 */
.front-page {
page: front-page;
}
/* 背面页样式 */
.back-page {
page: back-page;
}
@page front-page {
/* 正面页设置 */
margin: 0;
}
@page back-page {
/* 背面页设置 */
margin: 0;
}
.print-page {
page-break-after: always;
margin: 0;
padding: 0;
box-shadow: none;
width: 100%;
height: 100%;
}
/* 表格样式调整 */
.print-table {
width: 100% !important;
margin: 0 !important;
font-size: 12px !important;
}
/* 确保最后一个页面不分页 */
.print-page:last-child {
page-break-after: auto;
}
/* 调整评语表格高度 */
.comment-cell {
height: 150px !important;
}
/* 调整签名位置 */
.signature {
right: 5px !important;
bottom: 5px !important;
}
}
</style>