代码格式修改
This commit is contained in:
@@ -1,27 +1,29 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form v-show="showSearch" ref="queryForm" :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="classId" v-if="xflag">
|
||||
<el-form-item v-if="xflag" label="班级" prop="classId">
|
||||
<el-select
|
||||
v-model="queryParams.classId"
|
||||
placeholder="请选择班级"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 300px;">
|
||||
style="width: 300px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in cascaderData"
|
||||
:key="item.classId"
|
||||
:label="item.className"
|
||||
:value="item.classId">
|
||||
</el-option>
|
||||
:value="item.classId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级" prop="deptId" v-else>
|
||||
<el-cascader v-model="queryParams.classId" ref="cas" style="width: 500px;" :options="cascaderData"
|
||||
:props="{ checkStrictly: false }" @change="handleChange" clearable filterable></el-cascader>
|
||||
<el-form-item v-else 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>
|
||||
@@ -31,22 +33,26 @@
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="importVClick"
|
||||
v-hasPermi="['graduate:basedata:add']">导入</el-button>
|
||||
<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="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['comprehensive:identifytexs:add']">新增</el-button>
|
||||
<el-button v-hasPermi="['comprehensive:identifytexs:add']" type="primary" plain icon="el-icon-plus" size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['comprehensive:identifytexs:remove']">删除</el-button>
|
||||
<el-button v-hasPermi="['comprehensive:identifytexs:remove']" type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-printer" size="mini" :disabled="multiple"
|
||||
@click="handleBatchPrint" v-hasPermi="['graduate:basedata:dayin']">批量打印</el-button>
|
||||
<el-button v-hasPermi="['graduate:basedata:dayin']" type="success" plain icon="el-icon-printer" size="mini"
|
||||
:disabled="multiple" @click="handleBatchPrint"
|
||||
>批量打印</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="identifytexsList" @selection-change="handleSelectionChange">
|
||||
@@ -58,18 +64,22 @@
|
||||
<el-table-column label="所属班级" align="center" prop="studentClass" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['comprehensive:identifytexs:edit']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['comprehensive:identifytexs:remove']">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-printer" @click="takeEclData(scope.row)"
|
||||
v-hasPermi="['graduate:basedata:dayin']">打印</el-button>
|
||||
<el-button v-hasPermi="['comprehensive:identifytexs:edit']" size="mini" type="text" icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button v-hasPermi="['comprehensive:identifytexs:remove']" size="mini" type="text" icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
<el-button v-hasPermi="['graduate:basedata:dayin']" size="mini" type="text" icon="el-icon-printer"
|
||||
@click="takeEclData(scope.row)"
|
||||
>打印</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改学生鉴定信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
@@ -97,8 +107,9 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="出生日期" prop="birthData">
|
||||
<span v-if="form.birthData != null" class="readonly-label">{{ formatDate(form.birthData) }}</span>
|
||||
<el-date-picker clearable v-model="getBirthData" type="date" value-format="yyyy-MM-dd" placeholder="请选择出生日期"
|
||||
v-else />
|
||||
<el-date-picker v-else v-model="getBirthData" clearable type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择出生日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- 第一学年信息 -->
|
||||
<el-row :gutter="20">
|
||||
@@ -139,13 +150,13 @@
|
||||
<el-input v-model="yearOneData.physicalQuality" placeholder="请输入体能素质" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总分" prop="yearOne.totalPoints">
|
||||
<el-input type="number" v-model="yearOneData.totalPoints" placeholder="请输入总分" />
|
||||
<el-input v-model="yearOneData.totalPoints" type="number" placeholder="请输入总分" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学年">
|
||||
<el-select v-if="mode === 'add' || yearOneData.stuYear == null" v-model="yearOneData.stuYear"
|
||||
placeholder="请选择学年" @change="handleYearChange">
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id">
|
||||
</el-option>
|
||||
placeholder="请选择学年" @change="handleYearChange"
|
||||
>
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id" />
|
||||
</el-select>
|
||||
<span v-else class="readonly-label">{{ getYearNameById(form.yearOne.stuYear) }}</span>
|
||||
</el-form-item>
|
||||
@@ -189,13 +200,13 @@
|
||||
<el-input v-model="yearTwoData.physicalQuality" placeholder="请输入体能素质" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总分" prop="yearTwo.totalPoints">
|
||||
<el-input type="number" v-model="yearTwoData.totalPoints" placeholder="请输入总分" />
|
||||
<el-input v-model="yearTwoData.totalPoints" type="number" placeholder="请输入总分" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学年">
|
||||
<el-select v-if="mode === 'add' || yearTwoData.stuYear == null" v-model="yearTwoData.stuYear"
|
||||
placeholder="请选择学年" @change="handleYearChange">
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id">
|
||||
</el-option>
|
||||
placeholder="请选择学年" @change="handleYearChange"
|
||||
>
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id" />
|
||||
</el-select>
|
||||
<span v-else class="readonly-label">{{ getYearNameById(form.yearTwo.stuYear) }}</span>
|
||||
</el-form-item>
|
||||
@@ -239,13 +250,13 @@
|
||||
<el-input v-model="yearThreeData.physicalQuality" placeholder="请输入体能素质" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总分" prop="yearThree.totalPoints">
|
||||
<el-input type="number" v-model="yearThreeData.totalPoints" placeholder="请输入总分" />
|
||||
<el-input v-model="yearThreeData.totalPoints" type="number" placeholder="请输入总分" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学年">
|
||||
<el-select v-if="mode === 'add' || yearThreeData.stuYear == null" v-model="yearThreeData.stuYear"
|
||||
placeholder="请选择学年" @change="handleYearChange">
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id">
|
||||
</el-option>
|
||||
placeholder="请选择学年" @change="handleYearChange"
|
||||
>
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id" />
|
||||
</el-select>
|
||||
<span v-else class="readonly-label">{{ getYearNameById(form.yearThree.stuYear) }}</span>
|
||||
</el-form-item>
|
||||
@@ -259,22 +270,24 @@
|
||||
|
||||
<!-- 导入模板对话框 -->
|
||||
<el-dialog title="导入模板" :visible.sync="importV" :before-close="handleClose" width="400px" center
|
||||
style="text-align: 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"></i>
|
||||
:file-list="fileList" :on-change="fileChoose" :on-success="handleFileSuccess"
|
||||
>
|
||||
<i class="el-icon-upload" />
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击选择</em></div>
|
||||
<div class="el-upload__tip" slot="tip">只能上传xlsx/xls文件(鉴定表) <el-link @click="downloadMode" type="primary"
|
||||
size="mini">下载模板</el-link></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>
|
||||
<br>
|
||||
<el-form>
|
||||
<el-form-item label="学年">
|
||||
<el-select v-model="stu_year_import" placeholder="请选择学年" @change="handleYearChanges">
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id">
|
||||
</el-option>
|
||||
<el-option v-for="(v, i) in stu_years" :key="i" :label="v.stuYearName" :value="v.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -285,9 +298,9 @@
|
||||
|
||||
<!-- 打印预览对话框 -->
|
||||
<el-dialog title="打印预览" :visible.sync="printDialogVisible" fullscreen>
|
||||
<div class="print-content" id="printContent">
|
||||
<div id="printContent" class="print-content">
|
||||
<!-- 双面打印提示 -->
|
||||
<div class="print-notice no-print" v-if="printDialogVisible">
|
||||
<div v-if="printDialogVisible" class="print-notice no-print">
|
||||
<el-alert title="打印提示" type="info" show-icon>
|
||||
<p>请确保打印机已设置为双面打印模式(短边翻转)</p>
|
||||
<p>评语表将打印在正面,鉴定表将打印在背面</p>
|
||||
@@ -485,7 +498,7 @@
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<div class="print-actions">
|
||||
<el-button type="primary" v-print="printObj" icon="el-icon-printer">双面打印全部</el-button>
|
||||
<el-button v-print="printObj" type="primary" icon="el-icon-printer">双面打印全部</el-button>
|
||||
<el-button @click="printDialogVisible = false">取消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -494,17 +507,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listIdentifytexs, getIdentifytexs, delIdentifytexs, addIdentifytexs, updateIdentifytexs, deptDataList } from "@/api/comprehensive/identifytexs";
|
||||
import { treeStudent } from "@/api/stuCQS/basedata/student";
|
||||
import { listQiyongYear as listYear } from "@/api/stuCQS/basedata/year";
|
||||
import * as XLSX from 'xlsx';
|
||||
import { excelDateToJSDate } from '@/utils/index';
|
||||
import { isEmpty } from "@/api/helpFunc";
|
||||
import { importGraduate, getStuInfo } from "@/api/graduate/index";
|
||||
import { parseTime } from '@/utils/ruoyi';
|
||||
import { listIdentifytexs, getIdentifytexs, delIdentifytexs, addIdentifytexs, updateIdentifytexs, deptDataList } from '@/api/comprehensive/identifytexs'
|
||||
import { treeStudent } from '@/api/stuCQS/basedata/student'
|
||||
import { listQiyongYear as listYear } from '@/api/stuCQS/basedata/year'
|
||||
import * as XLSX from 'xlsx'
|
||||
import { excelDateToJSDate } from '@/utils/index'
|
||||
import { isEmpty } from '@/api/helpFunc'
|
||||
import { importGraduate, getStuInfo } from '@/api/graduate/index'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
|
||||
export default {
|
||||
name: "Identifytexs",
|
||||
name: 'Identifytexs',
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@@ -523,7 +536,7 @@ export default {
|
||||
// 学生鉴定信息表格数据
|
||||
identifytexsList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
cascaderData: null,
|
||||
@@ -577,33 +590,33 @@ export default {
|
||||
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',
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getCascaderData();
|
||||
this.listAllStuYear();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getStudentCollege: { get() { return this.form.studentCollege != null ? this.form.studentCollege : null; }, set(val) { this.form.studentCollege = val; } },
|
||||
getStudentGrade: { get() { return this.form.studentGrade != null ? this.form.studentGrade : null; }, set(val) { this.form.studentGrade = val; } },
|
||||
getStudentClass: { get() { return this.form.studentClass != null ? this.form.studentClass : null; }, set(val) { this.form.studentClass = val; } },
|
||||
getSex: { get() { return this.form.sex != null ? this.form.sex : null; }, set(val) { this.form.sex = val; } },
|
||||
getNation: { get() { return this.form.nation != null ? this.form.nation : null; }, set(val) { this.form.nation = val; } },
|
||||
getBirthData: { get() { return this.form.birthData != null ? this.form.birthData : null; }, set(val) { this.form.birthData = val; } },
|
||||
yearOneData() { return this.form.yearOne || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, }; },
|
||||
yearTwoData() { return this.form.yearTwo || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, }; },
|
||||
yearThreeData() { return this.form.yearThree || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, }; },
|
||||
getStudentCollege: { get() { return this.form.studentCollege != null ? this.form.studentCollege : null }, set(val) { this.form.studentCollege = val } },
|
||||
getStudentGrade: { get() { return this.form.studentGrade != null ? this.form.studentGrade : null }, set(val) { this.form.studentGrade = val } },
|
||||
getStudentClass: { get() { return this.form.studentClass != null ? this.form.studentClass : null }, set(val) { this.form.studentClass = val } },
|
||||
getSex: { get() { return this.form.sex != null ? this.form.sex : null }, set(val) { this.form.sex = val } },
|
||||
getNation: { get() { return this.form.nation != null ? this.form.nation : null }, set(val) { this.form.nation = val } },
|
||||
getBirthData: { get() { return this.form.birthData != null ? this.form.birthData : null }, set(val) { this.form.birthData = val } },
|
||||
yearOneData() { return this.form.yearOne || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, } },
|
||||
yearTwoData() { return this.form.yearTwo || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, } },
|
||||
yearThreeData() { return this.form.yearThree || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, } },
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getCascaderData()
|
||||
this.listAllStuYear()
|
||||
},
|
||||
methods: {
|
||||
/** 查询学生鉴定信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listIdentifytexs(this.queryParams).then(response => {
|
||||
this.identifytexsList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.identifytexsList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 级联选择处理
|
||||
handleChange(value) {
|
||||
@@ -614,8 +627,8 @@ export default {
|
||||
const res = await deptDataList()
|
||||
this.cascaderData = res.data
|
||||
if(this.cascaderData.length > 0) {
|
||||
this.xflag = true;
|
||||
return;
|
||||
this.xflag = true
|
||||
return
|
||||
}
|
||||
const ress = await treeStudent()
|
||||
this.cascaderData = ress.data
|
||||
@@ -623,114 +636,114 @@ export default {
|
||||
dept.children.forEach(major => {
|
||||
major.children.forEach(c => { delete c.children })
|
||||
})
|
||||
});
|
||||
})
|
||||
//console.log(this.cascaderData, "班级数据");
|
||||
},
|
||||
// 获取学年信息
|
||||
async listAllStuYear() {
|
||||
let res = await listYear();
|
||||
this.stu_years = [...res.data];
|
||||
let res = await listYear()
|
||||
this.stu_years = [...res.data]
|
||||
},
|
||||
// 获取学年对应的下标数据
|
||||
handleYearChange(value) {
|
||||
const index = this.stu_years.findIndex(item => item.id === value);
|
||||
const index = this.stu_years.findIndex(item => item.id === value)
|
||||
if (index !== -1) {
|
||||
if (index == 0) { this.form.yearThree.biaoJit = index + 1; return; }
|
||||
if (index == 1) { this.form.yearTwo.biaoJit = index + 1; return; }
|
||||
if (index == 2) { this.form.yearOne.biaoJit = index + 1; return; }
|
||||
this.$alert('确定要选择此学年吗?', '提示', { confirmButtonText: '', showCancelButton: false, type: 'warning', center: true, callback: () => { } });
|
||||
if (index == 0) { this.form.yearThree.biaoJit = index + 1; return }
|
||||
if (index == 1) { this.form.yearTwo.biaoJit = index + 1; return }
|
||||
if (index == 2) { this.form.yearOne.biaoJit = index + 1; return }
|
||||
this.$alert('确定要选择此学年吗?', '提示', { confirmButtonText: '', showCancelButton: false, type: 'warning', center: true, callback: () => { } })
|
||||
}
|
||||
},
|
||||
//导入学年处理
|
||||
handleYearChanges(value) {
|
||||
const index = this.stu_years.findIndex(item => item.id === value);
|
||||
const index = this.stu_years.findIndex(item => item.id === value)
|
||||
if (index !== -1) {
|
||||
this.biaoJi = index + 1;
|
||||
return;
|
||||
this.biaoJi = index + 1
|
||||
return
|
||||
}
|
||||
},
|
||||
//出生日期格式处理
|
||||
formatDate(date) {
|
||||
return parseTime(date, 'yyyy-MM-dd');
|
||||
return parseTime(date, 'yyyy-MM-dd')
|
||||
},
|
||||
// 导入毕业生信息
|
||||
async doImport() {
|
||||
if (isEmpty(this.stu_year_import)) { this.$message.info("请选择学年"); return; }
|
||||
this.loading = true;
|
||||
let sdata = [];
|
||||
let temp = [...this.importData];
|
||||
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 = {};
|
||||
let temp1 = {}
|
||||
if (this.excelName == '鉴定表.xlsx') {
|
||||
temp1 = { studentCode: v.studentCode, studentName: v.studentName, politics: v.politics, moralCharacter: v.moralCharacter, observeDiscipline: v.observeDiscipline, attitude: v.attitude, attendanceSituation: v.attendanceSituation, positionHeld: v.positionHeld, workingAttitude: v.workingAttitude, workingAbility: v.workingAbility, stuYear: this.stu_year_import, biaoJit: this.biaoJi };
|
||||
} else { this.$message.info("只能上传鉴定表"); this.excelName = ''; return; }
|
||||
sdata.push(temp1);
|
||||
temp1 = { studentCode: v.studentCode, studentName: v.studentName, politics: v.politics, moralCharacter: v.moralCharacter, observeDiscipline: v.observeDiscipline, attitude: v.attitude, attendanceSituation: v.attendanceSituation, positionHeld: v.positionHeld, workingAttitude: v.workingAttitude, workingAbility: v.workingAbility, stuYear: this.stu_year_import, biaoJit: this.biaoJi }
|
||||
} else { this.$message.info('只能上传鉴定表'); this.excelName = ''; return }
|
||||
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;
|
||||
let res = await importGraduate(sdata)
|
||||
this.loading = false
|
||||
this.$message(res.msg)
|
||||
this.getList()
|
||||
this.importV = false
|
||||
this.fileList = []
|
||||
this.stu_year_import = null
|
||||
},
|
||||
// 下载模板
|
||||
downloadMode() {
|
||||
this.download('/comprehensive/rankingModel/downloadAllTemplates', {}, 'allTemplates.zip');
|
||||
this.download('/comprehensive/rankingModel/downloadAllTemplates', {}, 'allTemplates.zip')
|
||||
},
|
||||
// 导入模板弹窗
|
||||
importVClick() {
|
||||
this.importV = true;
|
||||
this.importV = true
|
||||
},
|
||||
// 关闭导入弹窗
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?').then(_ => { this.excelData = []; this.fileList = []; this.tableData = []; done(); }).catch(_ => { });
|
||||
this.$confirm('确认关闭?').then(_ => { this.excelData = []; this.fileList = []; this.tableData = []; done() }).catch(_ => { })
|
||||
},
|
||||
// 文件超出限制
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
||||
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
||||
},
|
||||
// 文件选择处理
|
||||
async fileChoose(file, fileList) {
|
||||
this.loading = true;
|
||||
this.excelName = file.name;
|
||||
this.loading = true
|
||||
this.excelName = file.name
|
||||
try {
|
||||
let data = await this.handleData(file);
|
||||
let data = await this.handleData(file)
|
||||
let daterank = []
|
||||
if (this.excelName == '鉴定表.xlsx') {
|
||||
daterank = data.map(item => ({ studentCode: item.学号, studentName: item.姓名, politics: item['思想表现-政治思想'], moralCharacter: item['思想表现-道德品质'], observeDiscipline: item['思想表现-遵纪守法'], attitude: item['学习表现-学习态度'], attendanceSituation: item['学习表现-考勤情况'], positionHeld: item['工作表现-担任职位'], workingAttitude: item['工作表现-工作态度'], workingAbility: item['工作表现-工作能力'], }));
|
||||
} else { this.$message.info("只能上传鉴定表"); return; }
|
||||
this.importData = daterank;
|
||||
this.importTotal = data.length;
|
||||
} catch (error) { console.error('上传失败:', error); } finally { this.loading = false; }
|
||||
daterank = data.map(item => ({ studentCode: item.学号, studentName: item.姓名, politics: item['思想表现-政治思想'], moralCharacter: item['思想表现-道德品质'], observeDiscipline: item['思想表现-遵纪守法'], attitude: item['学习表现-学习态度'], attendanceSituation: item['学习表现-考勤情况'], positionHeld: item['工作表现-担任职位'], workingAttitude: item['工作表现-工作态度'], workingAbility: item['工作表现-工作能力'], }))
|
||||
} else { this.$message.info('只能上传鉴定表'); return }
|
||||
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);
|
||||
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);
|
||||
};
|
||||
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.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();
|
||||
this.redingData = false;
|
||||
this.open = false
|
||||
this.reset()
|
||||
this.redingData = false
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
@@ -739,77 +752,77 @@ export default {
|
||||
yearOne: { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, },
|
||||
yearTwo: { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, },
|
||||
yearThree: { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, },
|
||||
};
|
||||
this.mode = 'add';
|
||||
this.resetForm("form");
|
||||
}
|
||||
this.mode = 'add'
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.queryParams.classId = null;
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.queryParams.classId = null
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.selection = selection;
|
||||
this.selection = selection
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加学生鉴定信息";
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加学生鉴定信息'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
const id = row.id || this.ids
|
||||
getIdentifytexs(id).then(response => {
|
||||
const data = response.data;
|
||||
const data = response.data
|
||||
this.form = {
|
||||
...data,
|
||||
studentCollege: data.studentCollege || null, studentGrade: data.studentGrade || null, studentClass: data.studentClass || null, sex: data.sex || null, nation: data.nation || null, birthData: data.birthData || null,
|
||||
yearOne: data.yearOne || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, },
|
||||
yearTwo: data.yearTwo || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, },
|
||||
yearThree: data.yearThree || { politics: null, moralCharacter: null, observeDiscipline: null, attitude: null, attendanceSituation: null, positionHeld: null, workingAttitude: null, workingAbility: null, ldeologicalPolitical: null, scientificQuality: null, physicalQuality: null, totalPoints: null, stuYear: null, }
|
||||
};
|
||||
this.mode = 'edit';
|
||||
this.open = true;
|
||||
this.title = "修改学生鉴定信息";
|
||||
if (data.studentCollege != null && data.studentGrade != null) { this.redingData = true; } else { this.redingData = false; }
|
||||
});
|
||||
}
|
||||
this.mode = 'edit'
|
||||
this.open = true
|
||||
this.title = '修改学生鉴定信息'
|
||||
if (data.studentCollege != null && data.studentGrade != null) { this.redingData = true } else { this.redingData = false }
|
||||
})
|
||||
},
|
||||
/** 获取学年名称通过ID */
|
||||
getYearNameById(yearId) {
|
||||
const year = this.stu_years.find(item => item.id === yearId);
|
||||
return year ? year.stuYearName : '';
|
||||
const year = this.stu_years.find(item => item.id === yearId)
|
||||
return year ? year.stuYearName : ''
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
const submitData = { ...this.form, ...this.form.yearOne, ...this.form.yearTwo, ...this.form.yearThree };
|
||||
const submitData = { ...this.form, ...this.form.yearOne, ...this.form.yearTwo, ...this.form.yearThree }
|
||||
if (this.form.id != null) {
|
||||
updateIdentifytexs(submitData).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); });
|
||||
updateIdentifytexs(submitData).then(response => { this.$modal.msgSuccess('修改成功'); this.open = false; this.getList() })
|
||||
} else {
|
||||
if (this.form.yearOne.stuYear != null && this.form.yearTwo.stuYear != null && this.form.yearThree.stuYear != null) {
|
||||
addIdentifytexs(submitData).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); });
|
||||
} else { this.$modal.msgSuccess("对应学生信息不能为空"); }
|
||||
addIdentifytexs(submitData).then(response => { this.$modal.msgSuccess('新增成功'); this.open = false; this.getList() })
|
||||
} else { this.$modal.msgSuccess('对应学生信息不能为空') }
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除学生鉴定信息编号为"' + ids + '"的数据项?').then(function () { return delIdentifytexs(ids); }).then(() => { this.getList(); this.$modal.msgSuccess("删除成功"); }).catch(() => { });
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除学生鉴定信息编号为"' + ids + '"的数据项?').then(function () { return delIdentifytexs(ids) }).then(() => { this.getList(); this.$modal.msgSuccess('删除成功') }).catch(() => { })
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
@@ -817,55 +830,55 @@ export default {
|
||||
},
|
||||
// 单个打印按钮操作
|
||||
async takeEclData(row) {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
try {
|
||||
const response = await getStuInfo(row.id);
|
||||
if (response.code !== 200) { throw new Error(response.msg || '获取学生信息失败'); }
|
||||
const processedData = this._processStudentData(row, response.data);
|
||||
this.printList = [processedData];
|
||||
this.printDialogVisible = true;
|
||||
const response = await getStuInfo(row.id)
|
||||
if (response.code !== 200) { throw new Error(response.msg || '获取学生信息失败') }
|
||||
const processedData = this._processStudentData(row, response.data)
|
||||
this.printList = [processedData]
|
||||
this.printDialogVisible = true
|
||||
} catch (error) {
|
||||
console.error('打印操作失败:', error);
|
||||
this.$message.error(error.message || '获取打印数据失败');
|
||||
console.error('打印操作失败:', error)
|
||||
this.$message.error(error.message || '获取打印数据失败')
|
||||
} finally {
|
||||
this.loading = false;
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
// 批量打印按钮操作
|
||||
async handleBatchPrint() {
|
||||
if (this.selection.length === 0) { this.$message.warning('请先选择要打印的学生'); return; }
|
||||
this.loading = true;
|
||||
if (this.selection.length === 0) { this.$message.warning('请先选择要打印的学生'); return }
|
||||
this.loading = true
|
||||
try {
|
||||
const promises = this.selection.map(row => getStuInfo(row.id));
|
||||
const results = await Promise.all(promises);
|
||||
const promises = this.selection.map(row => getStuInfo(row.id))
|
||||
const results = await Promise.all(promises)
|
||||
const processedList = results.map((response, index) => {
|
||||
if (response.code === 200) {
|
||||
const baseInfo = this.selection[index];
|
||||
return this._processStudentData(baseInfo, response.data);
|
||||
const baseInfo = this.selection[index]
|
||||
return this._processStudentData(baseInfo, response.data)
|
||||
} else {
|
||||
this.$message.error(`获取学号 ${this.selection[index].studentCode} 的信息失败: ${response.msg}`);
|
||||
return null;
|
||||
this.$message.error(`获取学号 ${this.selection[index].studentCode} 的信息失败: ${response.msg}`)
|
||||
return null
|
||||
}
|
||||
}).filter(item => item !== null);
|
||||
}).filter(item => item !== null)
|
||||
|
||||
if (processedList.length > 0) {
|
||||
this.printList = processedList;
|
||||
this.printDialogVisible = true;
|
||||
this.printList = processedList
|
||||
this.printDialogVisible = true
|
||||
} else if (this.selection.length > 0) {
|
||||
this.$message.error('所有选中学生的数据都获取失败,无法打印');
|
||||
this.$message.error('所有选中学生的数据都获取失败,无法打印')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('批量打印操作失败:', error);
|
||||
this.$message.error('批量获取打印数据时发生网络错误');
|
||||
console.error('批量打印操作失败:', error)
|
||||
this.$message.error('批量获取打印数据时发生网络错误')
|
||||
} finally {
|
||||
this.loading = false;
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
// 内部函数:处理单个学生的数据,用于代码复用
|
||||
_processStudentData(baseInfo, detailInfo) {
|
||||
const yearDataMap = {};
|
||||
const yearDataMap = {}
|
||||
if (detailInfo.graduateVoList && detailInfo.graduateVoList.length > 0) {
|
||||
detailInfo.graduateVoList.forEach((item, index) => { yearDataMap[index] = item; });
|
||||
detailInfo.graduateVoList.forEach((item, index) => { yearDataMap[index] = item })
|
||||
}
|
||||
return {
|
||||
...baseInfo, ...detailInfo, yearDataMap,
|
||||
@@ -876,31 +889,31 @@ export default {
|
||||
nation: detailInfo.nation || '无数据',
|
||||
studentName: detailInfo.studentName || baseInfo.studentName || '无数据',
|
||||
studentCode: detailInfo.studentCode || baseInfo.studentCode || '无数据'
|
||||
};
|
||||
}
|
||||
},
|
||||
// 修改 getYearData 以接收 student 对象
|
||||
getYearData(student, yearIndex, field) {
|
||||
if (!student || !student.yearDataMap) { return '无数据'; }
|
||||
const yearData = student.yearDataMap[yearIndex];
|
||||
if (!yearData) { return '无数据'; }
|
||||
const value = yearData[field];
|
||||
return value || '无数据';
|
||||
if (!student || !student.yearDataMap) { return '无数据' }
|
||||
const yearData = student.yearDataMap[yearIndex]
|
||||
if (!yearData) { return '无数据' }
|
||||
const value = yearData[field]
|
||||
return value || '无数据'
|
||||
},
|
||||
// 专门为打印创建了一个日期格式化函数
|
||||
formatDateForPrint(dateInput) {
|
||||
if (!dateInput) return '无数据';
|
||||
if (typeof dateInput === 'string' && dateInput.includes('年') && dateInput.includes('月') && dateInput.includes('日')) { return 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 '无数据'; }
|
||||
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 '无数据' }
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user