847 lines
32 KiB
Vue
847 lines
32 KiB
Vue
<template>
|
||
<div class="app-container">
|
||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
|
||
<el-form-item label="学校名称" prop="schoolName">
|
||
<el-input v-model="queryParams.schoolName" placeholder="请输入学校名称" clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="学院名称" prop="collegeName">
|
||
<el-input v-model="queryParams.collegeName" placeholder="请输入学院名称" clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="所属赛区" prop="division">
|
||
<el-input v-model="queryParams.division" placeholder="请输入所属赛区" clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="团队名称" prop="teamName">
|
||
<el-input v-model="queryParams.teamName" placeholder="请输入团队名称" clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="年份" prop="year">
|
||
<el-date-picker
|
||
v-model="queryParams.year"
|
||
type="year"
|
||
placeholder="选择年份"
|
||
>
|
||
</el-date-picker>
|
||
</el-form-item>
|
||
<el-form-item label="赛道" prop="year">
|
||
<el-select v-model="queryParams.racetrack" placeholder="请选择" clearable>
|
||
<el-option
|
||
v-for="item in dict.type.com_racetrack"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- <el-form-item label="大赛年份" prop="competitionYear">-->
|
||
<!-- <el-select v-model="queryParams.createTime" placeholder="请选择">-->
|
||
<!-- <el-option v-for="item in yearList" :key="item.value" :label="item.label" :value="item.value">-->
|
||
<!-- </el-option>-->
|
||
<!-- </el-select>-->
|
||
<!-- </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
|
||
type="info"
|
||
plain
|
||
icon="el-icon-upload2"
|
||
size="mini"
|
||
@click="handleImport('student')"
|
||
v-hasPermi="['hit:hitRegInfoUser:import']"
|
||
>导入学生成绩
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="info"
|
||
plain
|
||
icon="el-icon-upload2"
|
||
size="mini"
|
||
@click="handleImport('team')"
|
||
v-hasPermi="['hit:hitRegInfoTeam:import']"
|
||
>导入团队成绩
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="warning"
|
||
plain
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
@click="handleExport"
|
||
v-hasPermi="['hit:hitRegistrationStudentInfo:export']"
|
||
>导出
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5" v-hasPermi="['hit:open']">
|
||
<el-switch v-model="registerStatus" @change="updateRegisterStatus" active-value="1" inactive-value="0"
|
||
active-text="开启报名" inactive-text="关闭报名"
|
||
>
|
||
</el-switch>
|
||
</el-col>
|
||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||
</el-row>
|
||
|
||
<el-table style="width: 100%; table-layout: auto" v-loading="loading" :data="HitRegistrationStudentInfoList"
|
||
@selection-change="handleSelectionChange"
|
||
>
|
||
|
||
<el-table-column type="expand">
|
||
<template slot-scope="props">
|
||
<el-descriptions :title="'领队老师'" style="margin-left: 10%">
|
||
<el-descriptions-item label="老师姓名">{{ props.row.ldTeacher.teacherName }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师职务">{{ props.row.ldTeacher.teacherJob }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师手机号">{{ props.row.ldTeacher.teacherNumber }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师邮箱">{{ props.row.ldTeacher.teacherEmail }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师所在系及专业">{{
|
||
props.row.ldTeacher.teacherSchool
|
||
}}
|
||
</el-descriptions-item>
|
||
</el-descriptions>
|
||
<el-descriptions :title="'指导老师' + (index)" v-for="(item, index) in props.row.zdTeacher"
|
||
style="margin-left: 10%"
|
||
>
|
||
<el-descriptions-item label="老师姓名">{{ item.teacherName }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师职务">{{ item.teacherJob }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师手机号">{{ item.teacherNumber }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师邮箱">{{ item.teacherEmail }}</el-descriptions-item>
|
||
<el-descriptions-item label="老师所在系及专业">{{ item.teacherSchool }}</el-descriptions-item>
|
||
</el-descriptions>
|
||
<el-descriptions :title="'学生信息' + (index + 1)" v-for="(item, index) in props.row.studentUserss"
|
||
style="margin-left: 10%"
|
||
>
|
||
<!-- <el-descriptions-item label="比赛名称">{{props.row.competitionName}}</el-descriptions-item>-->
|
||
<el-descriptions-item label="学生姓名">{{ item.stuName }}</el-descriptions-item>
|
||
<el-descriptions-item label="学生性别">{{ item.sex }}</el-descriptions-item>
|
||
<el-descriptions-item label="学生专业">{{ item.major }}</el-descriptions-item>
|
||
<el-descriptions-item label="学生手机号">{{ item.phoneNumber }}</el-descriptions-item>
|
||
<el-descriptions-item label="虚拟赛成绩"><span style="color:red;">{{ item.virtualScore }}</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="化验赛成绩"><span style="color:red;">{{ item.assayScore }}</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="附件" v-if="item.dsFile">
|
||
<el-link :href="`${baseUrl}${item.dsFile}`" type="primary" :underline="false" target="_blank">
|
||
<span class="el-icon-document"> 下载 </span>
|
||
</el-link>
|
||
</el-descriptions-item>
|
||
</el-descriptions>
|
||
|
||
</template>
|
||
</el-table-column>
|
||
<!-- <el-table-column label="比赛名称" align="center" prop="competitionName" />-->
|
||
<el-table-column label="大赛年份" align="center" prop="year">
|
||
<template slot-scope="props">
|
||
{{ props.row.createTime.substring(0, 4) }}
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="所属赛区" align="center" prop="division"/>
|
||
<el-table-column label="学校名称" align="center" prop="schoolName"/>
|
||
<el-table-column label="院系名称" align="center" prop="collegeName"/>
|
||
<el-table-column label="团队名称" align="center" prop="teamName"/>
|
||
<el-table-column label="赛道" align="center" prop="racetrackLabel" width="180px"/>
|
||
<el-table-column label="盲样邮寄地址" align="center" prop="sampleAddress"/>
|
||
<el-table-column label="收件人" align="center" prop="sampleConcat"/>
|
||
<el-table-column label="联系电话" align="center" prop="sampleNumber"/>
|
||
<el-table-column label="分数" align="center" prop="score"/>
|
||
<el-table-column label="附件" align="center" prop="uploadFile">
|
||
<template slot-scope="props">
|
||
<el-link :href="`${baseUrl}${props.row.uploadFile}`" type="primary" :underline="false" target="_blank">
|
||
<span class="el-icon-document"> 下载 </span>
|
||
</el-link>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="报名时间" align="center" prop="createTime" width="100px">
|
||
<template slot-scope="props">
|
||
{{ props.row.createTime.substring(0, 10) }}
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="审核状态" align="center" prop="auditStatus">
|
||
<template slot-scope="props">
|
||
<div v-if="props.row.auditStatus == '0' " style="color:#007bff;"> 待审核</div>
|
||
<div v-if="props.row.auditStatus == '1' " style="color:green;"> 通过</div>
|
||
<div v-if="props.row.auditStatus == '2' " style="color:red;"> 拒绝</div>
|
||
<div
|
||
v-if="props.row.registrationInformation && props.row.registrationInformation.status == '0' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'"
|
||
style="color:#007bff;"
|
||
> 待确认
|
||
</div>
|
||
<div
|
||
v-if="props.row.registrationInformation && props.row.registrationInformation.status == '1' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'"
|
||
style="color:green;"
|
||
> 已同意
|
||
</div>
|
||
<div
|
||
v-if="props.row.registrationInformation && props.row.registrationInformation.status == '2' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'"
|
||
style="color:red;"
|
||
> 已拒绝
|
||
</div>
|
||
<!--&& props.row.zdTeacherList.includes(userId)-->
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="赛事" align="center" class-name="small-padding fixed-width">
|
||
<template slot-scope="props">
|
||
{{ props.row.competitionName }}
|
||
</template>
|
||
</el-table-column>
|
||
|
||
|
||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||
<template slot-scope="scope">
|
||
<el-popconfirm title="确定当前操作?"
|
||
v-if="techerType != '0' && (scope.row.auditStatus == '0' || scope.row.auditStatus == '2')"
|
||
@confirm="auditData(scope.row, '1')"
|
||
>
|
||
<el-button size="mini" type="text" slot="reference">通过</el-button>
|
||
</el-popconfirm>
|
||
|
||
<el-popconfirm title="确定当前操作?" style="margin-left: 10px"
|
||
v-if="techerType != '0' && (scope.row.auditStatus == '0' || scope.row.auditStatus == '1')"
|
||
@confirm="auditData(scope.row, '2')"
|
||
>
|
||
<el-button size="mini" type="text" slot="reference">拒绝</el-button>
|
||
</el-popconfirm>
|
||
|
||
<!-- 指导老师 -->
|
||
<!---->
|
||
<el-popconfirm title="确定当前操作"
|
||
@confirm="submitData(scope.row.registrationInformation,1)"
|
||
v-if="techerType == '0' && (scope.row.zdTeacherList) && scope.row.zdTeacherList.includes(userId) && scope.row.auditStatus == '9'"
|
||
>
|
||
<el-button size="mini" type="text" slot="reference">同意</el-button>
|
||
</el-popconfirm>
|
||
<!---->
|
||
|
||
<el-popconfirm title="确定当前操作?" style="margin-left: 10px"
|
||
v-if="techerType == '0' && (scope.row.zdTeacherList ) && scope.row.zdTeacherList.includes(userId) && scope.row.auditStatus == '9'"
|
||
@confirm="submitData(scope.row.registrationInformation,2)"
|
||
>
|
||
<el-button size="mini" type="text" slot="reference">拒绝</el-button>
|
||
</el-popconfirm>
|
||
|
||
<!-- 修改团队信息 -->
|
||
<el-button size="mini" type="text" style="margin-left: 10px" @click="editData(scope.row)">修改</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
</el-table>
|
||
|
||
<!-- 修改团队信息弹出层 对话框 -->
|
||
<el-dialog :visible.sync="editDialogVisible" title="编辑信息">
|
||
<el-form :model="currentRow">
|
||
<!-- <el-form-item label="所属赛区">-->
|
||
<!-- <el-input v-model="currentRow.division"></el-input>-->
|
||
<!-- </el-form-item>-->
|
||
<el-form-item label="所属赛区" prop="division">
|
||
<el-select v-model="currentRow.division" filterable allow-create default-first-option
|
||
placeholder="请选择所属赛区"
|
||
>
|
||
<el-option v-for="item in dict.type.com_region" :key="item.value" :label="item.label"
|
||
:value="item.value"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="赛道" prop="racetrackArr">
|
||
<el-checkbox-group v-model="currentRow.racetrackArr" @change="changeUpdateTeamRacetrack()">
|
||
<el-checkbox
|
||
v-for="item in dict.type.com_racetrack"
|
||
:key="item.value"
|
||
:label="item.value"
|
||
:checked="checked" @change="checked=!checked"
|
||
>
|
||
{{ item.label }}
|
||
</el-checkbox>
|
||
</el-checkbox-group>
|
||
</el-form-item>
|
||
<el-form-item label="赛事" prop="competition" v-if="showCompetition">
|
||
<el-checkbox-group v-model="currentRow.competitionArr" @change="changeCompetition()">
|
||
<el-checkbox label="1" :checked="competitionChecked" @change="competitionChecked=!competitionChecked">化验赛</el-checkbox>
|
||
<el-checkbox label="2" :checked="competitionChecked" @change="competitionChecked=!competitionChecked">虚拟赛</el-checkbox>
|
||
</el-checkbox-group>
|
||
</el-form-item>
|
||
<el-form-item label="学校名称">
|
||
<el-input v-model="currentRow.schoolName"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="院系名称">
|
||
<el-input v-model="currentRow.collegeName"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="团队名称">
|
||
<el-input v-model="currentRow.teamName"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="盲样邮寄地址">
|
||
<el-input v-model="currentRow.sampleAddress"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="收件人">
|
||
<el-input v-model="currentRow.sampleConcat"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="联系电话">
|
||
<el-input v-model="currentRow.sampleNumber"></el-input>
|
||
</el-form-item>
|
||
<el-form-item labe l="附件">
|
||
<FileUpload :file-type="['doc','zip', 'docx', 'pdf']" limit="1" v-model="currentRow.uploadFile"></FileUpload>
|
||
</el-form-item>
|
||
</el-form>
|
||
<span slot="footer" class="dialog-footer">
|
||
<el-button @click="editDialogVisible = false">取 消</el-button>
|
||
<el-button type="primary" @click="saveData">确 定</el-button>
|
||
</span>
|
||
</el-dialog>
|
||
|
||
<!-- 用户导入对话框 -->
|
||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||
<el-upload
|
||
ref="upload"
|
||
:limit="1"
|
||
accept=".xlsx, .xls"
|
||
:headers="upload.headers"
|
||
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
||
:disabled="upload.isUploading"
|
||
:on-progress="handleFileUploadProgress"
|
||
:on-success="handleFileSuccess"
|
||
:auto-upload="false"
|
||
drag
|
||
>
|
||
<i class="el-icon-upload"></i>
|
||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||
<div class="el-upload__tip text-center" slot="tip">
|
||
<div class="el-upload__tip" slot="tip">
|
||
<el-checkbox v-model="upload.updateSupport"/>
|
||
是否更新已经存在的用户数据
|
||
</div>
|
||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
||
@click="importTemplate"
|
||
>下载模板
|
||
</el-link>
|
||
</div>
|
||
</el-upload>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||
<el-button @click="upload.open = false">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||
@pagination="getList"
|
||
/>
|
||
<!-- Existing pagination -->
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
listHitRegistrationStudentInfo,
|
||
getHitRegistrationStudentInfo,
|
||
delHitRegistrationStudentInfo,
|
||
addHitRegistrationStudentInfo,
|
||
updateHitRegistrationStudentInfo,
|
||
listHitRegistrationStudentInfoExport,
|
||
getTeachInfoByIds,
|
||
adminUpdateTeamInformation
|
||
} from '@/api/hit/registrationStudentInfo'
|
||
import {selectBaseInfo, editStatus} from '@/api/cms/baseInfo'
|
||
import {getHitRegistrationTeachInfoByUserId, selectByUserId} from '@/api/hit/teacherInfo'
|
||
import {editRegUser} from '@/api/officialWebsite/registerStudent'
|
||
import {mapState} from 'vuex'
|
||
import {getToken} from '@/utils/auth'
|
||
|
||
export default {
|
||
name: 'HitRegistrationStudentInfo',
|
||
dicts: ['sys_user_sex', 'competition_type', 'com_racetrack','com_region'],
|
||
data() {
|
||
return {
|
||
yearList: [],
|
||
baseUrl: process.env.VUE_APP_BASE_API,
|
||
registerStatus: '',
|
||
leaderTeachList: [],
|
||
guideTeachList: [],
|
||
// 遮罩层
|
||
loading: true,
|
||
//当前用户id
|
||
userId: '',
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
//当前登录老师的类型
|
||
techerType: 0,
|
||
// 总条数
|
||
total: 0,
|
||
// 报名信息表格数据
|
||
HitRegistrationStudentInfoList: [],
|
||
showCompetition: false,
|
||
competitionChecked: false,
|
||
// 弹出层标题
|
||
title: '',
|
||
// 是否显示弹出层
|
||
open: false,
|
||
zdTeacherList: [],
|
||
//当前登录老师的报名信息
|
||
registrationInformation: {},
|
||
// 修改对话框是否显示
|
||
editDialogVisible: false,
|
||
currentRow: {
|
||
racetrackArr: [],
|
||
competitionArr: [],
|
||
},
|
||
upload: {
|
||
// 是否显示弹出层(用户导入)
|
||
open: false,
|
||
// 弹出层标题(用户导入)
|
||
title: '',
|
||
// 是否禁用上传
|
||
isUploading: false,
|
||
// 是否更新已经存在的用户数据
|
||
updateSupport: 0,
|
||
// 设置上传的请求头部
|
||
headers: {Authorization: 'Bearer ' + getToken()},
|
||
// 上传的地址
|
||
url: process.env.VUE_APP_BASE_API + '/system/hit_reg_info/importData'
|
||
},
|
||
importType: "student",
|
||
|
||
// 查询参数
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
year: new Date().getFullYear().toString(),
|
||
competitionName: null,
|
||
stuName: null,
|
||
stuGender: null,
|
||
stuMajor: null,
|
||
stuNumber: null,
|
||
schoolName: null,
|
||
division: null,
|
||
teamName: null,
|
||
leaderIds: null,
|
||
guideIds: null,
|
||
teachName: null,
|
||
createTime: null
|
||
},
|
||
// 表单参数
|
||
form: {},
|
||
checked: false,
|
||
// 表单校验
|
||
rules: {
|
||
competitionId: [
|
||
{required: true, message: '大赛ID不能为空', trigger: 'blur'}
|
||
],
|
||
stuName: [
|
||
{required: true, message: '学生姓名不能为空', trigger: 'blur'}
|
||
],
|
||
stuGender: [
|
||
{required: true, message: '学生性别不能为空', trigger: 'blur'}
|
||
],
|
||
stuMajor: [
|
||
{required: true, message: '学生专业不能为空', trigger: 'blur'}
|
||
],
|
||
stuNumber: [
|
||
{required: true, message: '学生手机号不能为空', trigger: 'blur'}
|
||
],
|
||
schoolName: [
|
||
{required: true, message: '学校及院系名称不能为空', trigger: 'blur'}
|
||
],
|
||
division: [
|
||
{required: true, message: '所属赛区不能为空', trigger: 'blur'}
|
||
],
|
||
delFlag: [
|
||
{required: true, message: '逻辑删除0未删除1真删除不能为空', trigger: 'blur'}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
created() {
|
||
this.getList()
|
||
selectBaseInfo().then(res => {
|
||
this.registerStatus = res.data.registerStatus
|
||
})
|
||
this.yearList = this.years()
|
||
// 获取当前登陆人的id
|
||
this.userId = this.$store.state.user.id
|
||
this.getTeachInfoByIds(this.userId)
|
||
|
||
},
|
||
|
||
methods: {
|
||
/** 查询报名信息列表 */
|
||
getList() {
|
||
this.loading = true
|
||
this.queryParams.year = new Date(this.queryParams.year).getFullYear().toString()
|
||
listHitRegistrationStudentInfo(this.queryParams).then(response => {
|
||
this.HitRegistrationStudentInfoList = response.rows
|
||
//判断数组是否为空
|
||
if (this.HitRegistrationStudentInfoList.length == 0) {
|
||
this.loading = false
|
||
}
|
||
console.log('报名信息', this.HitRegistrationStudentInfoList)
|
||
this.HitRegistrationStudentInfoList.map(row => {
|
||
const values = Array.isArray(row.racetrack)
|
||
? row.racetrack
|
||
: String(row.racetrack || '').split(',');
|
||
|
||
row.racetrackLabel = values
|
||
.map(val => {
|
||
const match = this.dict.type.com_racetrack.find(item => item.value === val);
|
||
return match ? match.label : val;
|
||
})
|
||
.join(',');
|
||
|
||
return row;
|
||
});
|
||
//for循环this.HitRegistrationStudentInfoList
|
||
if (this.HitRegistrationStudentInfoList.length != 0) {
|
||
for (let i = 0; i < this.HitRegistrationStudentInfoList.length; i++) {
|
||
//判断当前登录用户是否为指导老师
|
||
this.HitRegistrationStudentInfoList[i].zdTeacherList = this.HitRegistrationStudentInfoList[i].zdTeacher.map(teacher => teacher.userId)
|
||
this.HitRegistrationStudentInfoList[i].registrationInformation = {}
|
||
//循环this.registrationInformation
|
||
if (this.registrationInformation) {
|
||
for (let j = 0; j < this.registrationInformation.length; j++) {
|
||
if (this.registrationInformation[j].regId == this.HitRegistrationStudentInfoList[i].id) {
|
||
this.HitRegistrationStudentInfoList[i].registrationInformation = this.registrationInformation[j]
|
||
}
|
||
}
|
||
this.HitRegistrationStudentInfoList[i].competitionName = ''
|
||
//判断this.HitRegistrationStudentInfoList[i].competition不为空
|
||
if (this.HitRegistrationStudentInfoList[i].competition != null) {
|
||
|
||
const arr = this.splitStringToArray(this.HitRegistrationStudentInfoList[i].competition)
|
||
const arr2 = []
|
||
// 循环arr
|
||
for (let k = 0; k < arr.length; k++) {
|
||
//判断当前登录用户是否是指导老师
|
||
if (arr[k] == '1') {
|
||
arr2.push('化验赛')
|
||
// this.HitRegistrationStudentInfoList[0].competitionName += "化验赛"
|
||
} else if (arr[k] == '2') {
|
||
arr2.push('虚拟赛')
|
||
// this.HitRegistrationStudentInfoList[0].competitionName += ",虚拟赛"
|
||
}
|
||
}
|
||
this.HitRegistrationStudentInfoList[i].competitionName = this.arrayToString(arr2)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
this.total = response.total
|
||
this.loading = false
|
||
})
|
||
},
|
||
changeUpdateTeamRacetrack() {
|
||
//将数组转换为字符串
|
||
this.currentRow.racetrack = this.arrayToString(this.currentRow.racetrackArr)
|
||
console.log('字符串', this.currentRow.racetrack)
|
||
console.log('数组', this.currentRow.racetrackArr)
|
||
// 判断赛道中是否包含1
|
||
if (this.currentRow.racetrackArr.includes('1')) {
|
||
this.showCompetition = true
|
||
} else {
|
||
this.showCompetition = false
|
||
this.currentRow.competition = ''
|
||
this.currentRow.competitionArr = []
|
||
}
|
||
console.log('competitionArr', this.currentRow.competitionArr)
|
||
},
|
||
changeCompetition() {
|
||
//将数组转换为字符串
|
||
this.currentRow.competition = this.arrayToString(this.currentRow.competitionArr)
|
||
console.log('字符串', this.currentRow.competition)
|
||
console.log('数组', this.currentRow.competitionArr)
|
||
},
|
||
/** 导入按钮操作 */
|
||
handleImport(e) {
|
||
this.upload.title = '用户导入'
|
||
this.upload.open = true
|
||
if (e === 'team') {
|
||
//团队
|
||
this.upload.url = process.env.VUE_APP_BASE_API + '/system/hit_reg_info/importTeamData'
|
||
this.importType = 'team'
|
||
} else if (e === 'student') {
|
||
//学生
|
||
this.upload.url = process.env.VUE_APP_BASE_API + '/system/hit_reg_info/importData'
|
||
this.importType = 'student'
|
||
}
|
||
},
|
||
// 提交上传文件
|
||
submitFileForm() {
|
||
this.$refs.upload.submit()
|
||
},
|
||
//查询当前老师的类型
|
||
getTeachInfoByIds(id) {
|
||
getHitRegistrationTeachInfoByUserId(id).then(res => {
|
||
if (res.data) {
|
||
console.log('当前老师类型', res.data.type)
|
||
this.techerType = res.data.type
|
||
}
|
||
}).catch(err => {
|
||
console.log('查询当前老师的类型失败', err)
|
||
})
|
||
this.fetchRegistrationInformation()
|
||
},
|
||
splitStringToArray(str) {
|
||
return str.split(',').map(item => item.trim())
|
||
},
|
||
/** 下载模板操作 */
|
||
importTemplate() {
|
||
let url = 'system/hit_reg_info/importTemplate'
|
||
let filename = '学生成绩模板_'
|
||
if (this.importType === 'student') {
|
||
url = 'system/hit_reg_info/importTemplate'
|
||
filename = '学生成绩模板_'
|
||
} else if (this.importType === 'team') {
|
||
url = 'system/hit_reg_info/importTeamTemplate'
|
||
filename = '团队成绩模板_'
|
||
}
|
||
this.download(url, {}, filename + new Date().getTime() + '.xlsx')
|
||
},
|
||
// 文件上传中处理
|
||
handleFileUploadProgress(event, file, fileList) {
|
||
this.upload.isUploading = true
|
||
},
|
||
// 文件上传成功处理
|
||
handleFileSuccess(response, file, fileList) {
|
||
this.upload.open = false
|
||
this.upload.isUploading = false
|
||
this.$refs.upload.clearFiles()
|
||
this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', {dangerouslyUseHTMLString: true})
|
||
this.getList()
|
||
},
|
||
//将数组转为字符串
|
||
arrayToString(arr) {
|
||
return arr.join(',')
|
||
},
|
||
//指导老师同意
|
||
submitData(data, status) {
|
||
data.status = status
|
||
|
||
console.log('这是提交的信息', data)
|
||
editRegUser(data).then(res => {
|
||
this.$modal.msgSuccess('成功')
|
||
this.fetchRegistrationInformation()
|
||
})
|
||
this.getList()
|
||
|
||
},
|
||
//查询当前老师的报名信息
|
||
fetchRegistrationInformation() {
|
||
selectByUserId(this.userId).then(res => {
|
||
if (res.data) {
|
||
this.registrationInformation = res.data
|
||
console.log('这是获取的信息', this.registrationInformation)
|
||
}
|
||
})
|
||
},
|
||
// 取消按钮
|
||
cancel() {
|
||
this.open = false
|
||
this.reset()
|
||
},
|
||
// 表单重置
|
||
reset() {
|
||
this.form = {
|
||
id: null,
|
||
competitionId: null,
|
||
stuName: null,
|
||
stuGender: null,
|
||
stuMajor: null,
|
||
stuNumber: null,
|
||
schoolName: null,
|
||
division: null,
|
||
teamName: null,
|
||
leaderIds: null,
|
||
guideIds: null,
|
||
remark: null,
|
||
delFlag: null,
|
||
createBy: null,
|
||
updateTime: null,
|
||
updateBy: null,
|
||
createTime: null
|
||
}
|
||
this.resetForm('form')
|
||
},
|
||
/** 搜索按钮操作 */
|
||
handleQuery() {
|
||
this.queryParams.pageNum = 1
|
||
this.getList()
|
||
},
|
||
/** 重置按钮操作 */
|
||
resetQuery() {
|
||
this.resetForm('queryForm')
|
||
this.queryParams.createTime = null
|
||
this.queryParams.racetrack = null
|
||
this.handleQuery()
|
||
},
|
||
// 多选框选中数据
|
||
handleSelectionChange(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 = '添加报名信息'
|
||
},
|
||
/** 修改按钮操作 */
|
||
handleUpdate(row) {
|
||
this.reset()
|
||
const id = row.id || this.ids
|
||
getHitRegistrationStudentInfo(id).then(response => {
|
||
this.form = response.data
|
||
this.open = true
|
||
this.title = '修改报名信息'
|
||
})
|
||
},
|
||
auditData(data, status) {
|
||
data.auditStatus = status
|
||
updateHitRegistrationStudentInfo(data).then(response => {
|
||
this.$modal.msgSuccess('成功')
|
||
|
||
this.getList()
|
||
})
|
||
},
|
||
/** 提交按钮 */
|
||
submitForm() {
|
||
this.$refs['form'].validate(valid => {
|
||
if (valid) {
|
||
if (this.form.id != null) {
|
||
updateHitRegistrationStudentInfo(this.form).then(response => {
|
||
this.$modal.msgSuccess('修改成功')
|
||
this.open = false
|
||
this.getList()
|
||
})
|
||
} else {
|
||
addHitRegistrationStudentInfo(this.form).then(response => {
|
||
this.$modal.msgSuccess('新增成功')
|
||
this.open = false
|
||
this.getList()
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
/** 删除按钮操作 */
|
||
handleDelete(row) {
|
||
const ids = row.id || this.ids
|
||
this.$modal.confirm('是否确认删除报名信息编号为"' + ids + '"的数据项?').then(function () {
|
||
return delHitRegistrationStudentInfo(ids)
|
||
}).then(() => {
|
||
this.getList()
|
||
this.$modal.msgSuccess('删除成功')
|
||
}).catch(() => {
|
||
})
|
||
},
|
||
/** 导出按钮操作 */
|
||
handleExport() {
|
||
this.download('system/hit_reg_info/export', {
|
||
...this.queryParams
|
||
}, `HitRegistrationStudentInfo_${new Date().getTime()}.xlsx`)
|
||
},
|
||
getTeachInfo(row) {
|
||
if (row.leaderIds !== null && row.leaderIds.length !== 0) {
|
||
getTeachInfoByIds(row.leaderIds).then(res => {
|
||
this.leaderTeachList = res.data
|
||
})
|
||
}
|
||
if (row.guideIds !== null && row.guideIds.length !== 0) {
|
||
getTeachInfoByIds(row.guideIds).then(res => {
|
||
this.guideTeachList = res.data
|
||
})
|
||
}
|
||
},
|
||
updateRegisterStatus() {
|
||
editStatus(this.registerStatus).then(res => {
|
||
if (res.code === 200) {
|
||
this.$modal.msgSuccess(this.registerStatus === '1' ? '报名已开启' : '报名已关闭')
|
||
}
|
||
})
|
||
},
|
||
years() {
|
||
const currentYear = new Date().getFullYear()
|
||
const startYear = currentYear - 40 // 假设从当前年份往前 20 年
|
||
const endYear = currentYear
|
||
const years = []
|
||
for (let year = startYear; year <= endYear; year++) {
|
||
years.push({
|
||
label: year,
|
||
value: year + '-01-01'
|
||
})
|
||
}
|
||
return years.sort((a, b) => b.label - a.label)
|
||
},
|
||
editData(row) {
|
||
this.currentRow = {...row}
|
||
this.editDialogVisible = true
|
||
if (this.currentRow) {
|
||
//将字符串转为数组
|
||
if (this.currentRow.competition){
|
||
|
||
this.currentRow.competitionArr = this.currentRow.competition.split(',')
|
||
}else {
|
||
this.currentRow.competitionArr = []
|
||
}
|
||
console.log('这是数组', this.currentRow.competitionArr)
|
||
if (this.currentRow.racetrack) {
|
||
this.currentRow.racetrackArr = this.currentRow.racetrack.split(',')
|
||
if (this.currentRow.racetrackArr.includes('1')) {
|
||
this.showCompetition = true
|
||
} else {
|
||
this.showCompetition = false
|
||
this.currentRow.competitionArr = []
|
||
this.currentRow.competition = ''
|
||
}
|
||
}
|
||
}
|
||
},
|
||
saveData() {
|
||
console.log('保存数据', this.currentRow)
|
||
adminUpdateTeamInformation(this.currentRow).then(response => {
|
||
this.$modal.msgSuccess('团队信息修改成功')
|
||
this.editDialogVisible = false
|
||
this.getList()
|
||
}).catch(error => {
|
||
this.$modal.msgError('团队信息修改失败')
|
||
})
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.demo-table-expand {
|
||
font-size: 0;
|
||
}
|
||
|
||
.demo-table-expand label {
|
||
width: 90px;
|
||
color: #99a9bf;
|
||
}
|
||
|
||
.demo-table-expand .el-form-item {
|
||
margin-right: 0;
|
||
margin-bottom: 0;
|
||
width: 50%;
|
||
}
|
||
</style>
|