9.25更新

This commit is contained in:
许允枞 2024-09-25 13:23:11 +08:00
parent 79e4675798
commit 7defd1d771
9 changed files with 778 additions and 4 deletions

View File

@ -47,6 +47,17 @@ public class HitRegInfoController extends BaseController
List<HitRegInfo> list = hitRegInfoService.selectHitRegInfoList(hitRegInfo);
return getDataTable(list);
}
/**
* 学生查询报名信息列表
*/
@GetMapping("/studentList")
public TableDataInfo studentList(HitRegInfo hitRegInfo)
{
List<HitRegInfo> list = hitRegInfoService.selectStudentHitRegInfoList(hitRegInfo);
return getDataTable(list);
}
/**
* 导出报名信息列表
@ -92,6 +103,16 @@ public class HitRegInfoController extends BaseController
{
return toAjax(hitRegInfoService.updateHitRegInfo(hitRegInfo));
}
/**
* 修改报名信息
*/
@Log(title = "报名信息", businessType = BusinessType.UPDATE)
@PutMapping("/studentEdit")
public AjaxResult studentEdit(@RequestBody HitRegInfo hitRegInfo)
{
return toAjax(hitRegInfoService.studentEdit(hitRegInfo));
}
/**
* 修改报名信息
*/

View File

@ -42,7 +42,7 @@ public class HitRegInfo extends BaseEntity
/** 赛事 */
@ApiModelProperty(value = "赛事")
@TableField(exist = false)
// @TableField(exist = false)
private String competition;
/** 团队名称(个人赛不需求,可以为空) */

View File

@ -66,4 +66,7 @@ public interface IHitRegInfoService
HitRegInfo selectHitByUserId2(Long userId);
List<HitRegInfo> selectStudentHitRegInfoList(HitRegInfo hitRegInfo);
int studentEdit(HitRegInfo hitRegInfo);
}

View File

@ -7,6 +7,7 @@ import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -55,6 +56,9 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService
@Autowired
private HitCompetitionStudentInfoMapper hitCompetitionStudentInfoMapper;
@Autowired
private HitRegInfoUserMapper hitRegInfoUserMapper;
/**
* 查询报名信息
@ -334,6 +338,81 @@ public class HitRegInfoServiceImpl implements IHitRegInfoService
return hitRegInfo;
}
@Override
public List<HitRegInfo> selectStudentHitRegInfoList(HitRegInfo hitRegInfo) {
Long userId = SecurityUtils.getLoginUser().getUserId();
//判断当前登陆人是否是领队老师如果是查询该老师学校下的战队
//查询当前学生所在的战队信息
HitRegInfoUser hitRegInfoUser1 = hitRegInfoUserMapper.selectOne(new LambdaQueryWrapper<HitRegInfoUser>()
.eq(HitRegInfoUser::getUserId, userId)
.last("limit 1"));
if (ObjectUtils.isEmpty(hitRegInfoUser1)) {
throw new RuntimeException("您并未参加战队");
}
HitRegInfo hitRegInfo1 = hitRegInfoMapper.selectOne(new LambdaQueryWrapper<HitRegInfo>()
.eq(HitRegInfo::getId, hitRegInfoUser1.getRegId())
.last("limit 1"));
//判断当前登陆人是否是领队老师如果是查询该老师学校下的战队
HitRegistrationTeachInfo teacherInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(userId);
if (teacherInfo != null && teacherInfo.getType().equals("1")) {
hitRegInfo.setSchoolName(teacherInfo.getSchoolName());
}
PageUtils.startPage();
// List<HitRegInfo> hitRegInfos = hitRegInfoMapper.selectHitRegInfoList(hitRegInfo);
List<HitRegInfo> hitRegInfos = hitRegInfoMapper.selectList(new LambdaQueryWrapper<HitRegInfo>()
.eq(HitRegInfo::getId, hitRegInfoUser1.getRegId()));
for (HitRegInfo regInfo : hitRegInfos) {
HitRegInfoUser hitRegInfoUser =new HitRegInfoUser();
hitRegInfoUser.setRegId(regInfo.getId());
List<HitRegInfoUser> hitRegInfoUsers = regInfoUserService.selectHitRegInfoUserList(hitRegInfoUser);
for (HitRegInfoUser regInfoUser : hitRegInfoUsers) {
switch (regInfoUser.getType()) {
case "3": {
HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId());
regInfo.setLdTeacher(hitRegistrationTeachInfo);
break;
}
case "2": {
HitRegistrationTeachInfo hitRegistrationTeachInfo = teachInfoMapper.selectHitRegistrationTeachInfoByUserId(regInfoUser.getUserId());
regInfo.getZdTeacher().add(hitRegistrationTeachInfo);
break;
}
case "1":
HitCompetitionStudentInfo studentInfo = hitCompetitionStudentInfoMapper.selectHitCompetitionStudentInfoByUserId(regInfoUser.getUserId());
regInfo.getStudentUserss().add(studentInfo);
break;
}
}
}
return hitRegInfos;
}
@Override
public int studentEdit(HitRegInfo hitRegInfo) {
HitRegInfo hitRegInfo1 = new HitRegInfo();
hitRegInfo1.setId(hitRegInfo.getId());
if (ObjectUtil.isNotEmpty(hitRegInfo.getCompetition())) {
hitRegInfo1.setCompetition(hitRegInfo.getCompetition());
}
if (ObjectUtil.isNotEmpty(hitRegInfo.getSampleNumber())) {
hitRegInfo1.setSampleNumber(hitRegInfo.getSampleNumber());
}
hitRegInfo1.setSampleAddress(hitRegInfo.getSampleAddress());
//判断hitRegInfo.getCompetition()是否包含1
if (!hitRegInfo.getCompetition().contains("1")) {
hitRegInfo1.setSampleAddress("");
}
if (ObjectUtil.isNotEmpty(hitRegInfo.getSampleConcat())) {
hitRegInfo1.setSampleConcat(hitRegInfo.getSampleConcat());
}
int i = hitRegInfoMapper.updateById(hitRegInfo1);
return i;
}
/**
* 更新队员信息
* @param teamId

View File

@ -15,6 +15,8 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.service.ISysUserService;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -33,6 +35,8 @@ import java.util.Date;
*/
@Service
public class HitTeamsServiceImpl extends ServiceImpl<HitTeamsMapper, HitTeams> implements IHitTeamsService {
private static final Logger log = LoggerFactory.getLogger(HitTeamsServiceImpl.class);
@Autowired
private HitCompetitionStudentInfoMapper hitCompetitionStudentInfoMapper;
@ -84,6 +88,7 @@ public class HitTeamsServiceImpl extends ServiceImpl<HitTeamsMapper, HitTeams> i
hitRegInfo.setUploadFile(preliminary.getUploadFile());
hitRegInfo.setAuditStatus("9");
hitRegInfo.setCreateTime(new Date());
log.info("插入数据:"+hitRegInfo);
hitRegInfo.setCompetition(preliminary.getCompetition());
int insert = hitRegInfoMapper.insert(hitRegInfo);
//插入人员信息

View File

@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectHitRegInfoVo">
select id, school_name, college_name, division, team_name, sample_concat, sample_number,audit_status, sample_address, remark, upload_file,ds_file, del_flag, create_time, create_by, update_time, update_by from hit_reg_info
select id, school_name, college_name, division, team_name, sample_concat, sample_number,audit_status, sample_address, remark, upload_file,ds_file, del_flag, create_time, create_by, update_time, update_by,competition from hit_reg_info
</sql>
<select id="selectHitRegInfoList" parameterType="HitRegInfo" resultMap="HitRegInfoResult">

View File

@ -8,11 +8,19 @@ export function listHitRegistrationStudentInfo(query) {
params: query
})
}
// 查询报名信息列表学生
export function listHitRegistrationStudentInfoStudent(query) {
return request({
url: '/system/hit_reg_info/studentList',
method: 'get',
params: query
})
}
// 查询报名信息详细
export function getHitRegistrationStudentInfo(id) {
return request({
url: '/hit/hitRegistrationStudentInfo/' + id,
url: '/system/hit_reg_info/' + id,
method: 'get'
})
}
@ -34,6 +42,14 @@ export function updateHitRegistrationStudentInfo(data) {
data: data
})
}
// 学生修改报名信息
export function studentUpdateHitRegistrationStudentInfo(data) {
return request({
url: '/system/hit_reg_info/studentEdit',
method: 'put',
data: data
})
}
// 删除报名信息
export function delHitRegistrationStudentInfo(id) {

View File

@ -98,7 +98,7 @@
<el-table-column label="团队名称" align="center" prop="teamName" />
<el-table-column label="盲样邮寄地址" align="center" prop="sampleAddress" />
<el-table-column label="收件人" align="center" prop="sampleConcat" />
<el-table-column label="联系电话" align="center" prop="sampleAddress" />
<el-table-column label="联系电话" align="center" prop="sampleNumber" />
<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">
@ -125,6 +125,12 @@
</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">
@ -295,6 +301,21 @@ export default {
this.HitRegistrationStudentInfoList[i].registrationInformation = this.registrationInformation[j]
}
}
this.HitRegistrationStudentInfoList[i].competitionName = ""
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);
}
console.log("this.HitRegistrationStudentInfoList", this.HitRegistrationStudentInfoList)
@ -311,6 +332,13 @@ export default {
})
this.fetchRegistrationInformation()
},
splitStringToArray(str) {
return str.split(',').map(item => item.trim());
},
//
arrayToString(arr) {
return arr.join(',');
},
//
submitData(data,status) {
data.status = status

View File

@ -0,0 +1,622 @@
<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="competitionYear">-->
<!-- <el-select v-model="queryParams.createTime" placeholder="请选择">-->
<!-- <el-option <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="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['hit:hitRegistrationStudentInfo:remove']"-->
<!-- >删除</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>
</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="sampleAddress"/>
<el-table-column label="收件人" align="center" prop="sampleConcat"/>
<el-table-column label="联系电话" align="center" prop="sampleNumber"/>
<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">
<template slot-scope="props">
{{ props.row.createTime.substring(0, 11) }}
</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.status == '0' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'"-->
<!-- style="color:#007bff;"> 待确认-->
<!-- </div>-->
<!-- <div-->
<!-- v-if="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.status == '2' && props.row.zdTeacherList.includes(userId) && techerType == '0' && props.row.auditStatus == '9'"-->
<!-- style="color:red;"> 已拒绝-->
<!-- </div>-->
<!-- </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-button
type="text"
plain
icon="el-icon-plus"
size="mini"
@click="handleUpdate(scope.row)"
>修改
</el-button>
</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>-->
<!-- &lt;!&ndash; 指导老师 &ndash;&gt;-->
<!-- <el-popconfirm title="确定当前操作"-->
<!-- @confirm="submitData(scope.row.registrationInformation,1)" v-if="techerType == '0' && 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.includes(userId) && scope.row.auditStatus == '9'" @confirm="submitData(scope.row.registrationInformation,2)">-->
<!-- <el-button size="mini" type="text" slot="reference">拒绝</el-button>-->
<!-- </el-popconfirm>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 添加或修改大赛学生对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
<!-- <el-form-item label="团队报名主键" prop="hitRegId">-->
<!-- <el-input v-model="form.hitRegId" placeholder="请输入团队报名主键" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="学生姓名" prop="stuName">-->
<!-- <el-input v-model="form.stuName" placeholder="请输入学生姓名" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="学校名称" prop="schoolName">-->
<!-- <el-input v-model="form.schoolName" placeholder="请输入学校名称"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="院系名称" prop="collegeName">-->
<!-- <el-input v-model="form.collegeName" placeholder="请输入院系名称"/>-->
<!-- </el-form-item>-->
<el-form-item label="盲样联系人" prop="sampleConcat">
<el-input v-model="form.sampleConcat"></el-input>
</el-form-item>
<el-form-item label="盲样联系人手机号" prop="sampleNumber">
<el-input v-model="form.sampleNumber"></el-input>
</el-form-item>
<el-form-item label="赛事" prop="competition">
<el-checkbox-group v-model="form.competition">
<el-checkbox label="1">化验赛</el-checkbox>
<el-checkbox label="2">虚拟赛</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item v-if="form.competition.includes('1')" label="盲样邮寄地址" prop="sampleAddress">
<el-input v-model="form.sampleAddress"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listHitRegistrationStudentInfo,
getHitRegistrationStudentInfo,
delHitRegistrationStudentInfo,
addHitRegistrationStudentInfo,
updateHitRegistrationStudentInfo,
getTeachInfoByIds, listHitRegistrationStudentInfoStudent, studentUpdateHitRegistrationStudentInfo
} from "@/api/hit/registrationStudentInfo";
import {selectBaseInfo, editStatus} from '@/api/cms/baseInfo'
import {getHitRegistrationTeachInfoByUserId, selectByUserId} from '@/api/hit/teacherInfo'
import {editRegUser} from '@/api/officialWebsite/registerStudent'
export default {
name: "HitRegistrationStudentInfo",
dicts: ['sys_user_sex', 'competition_type'],
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: [],
//
title: "",
//
open: false,
zdTeacherList: [],
//
registrationInformation: {},
//
queryParams: {
pageNum: 1,
pageSize: 10,
year: null,
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: {},
//
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"}
],
competition: [
{ required: true, message: "赛事不能为空", trigger: "blur" }
],
sampleNumber: [
{ required: true, message: "不能为空", trigger: "blur" }
],
sampleAddress: [
{ required: true, message: "不能为空", trigger: "blur" }
],
sampleConcat: [
{ required: true, message: "不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
selectBaseInfo().then(res => {
this.registerStatus = res.data.registerStatus
})
this.yearList = this.years();
// id
console.log('当前登陆人id', this.$store);
this.userId = this.$store.state.user.id
this.getTeachInfoByIds(this.$store.state.user.id)
},
methods: {
/** 查询报名信息列表 */
getList() {
this.loading = true;
listHitRegistrationStudentInfoStudent(this.queryParams).then(response => {
console.log("报名信息", response)
this.HitRegistrationStudentInfoList = response.rows;
//
if (this.HitRegistrationStudentInfoList.length == 0) {
this.loading = false;
}
if (this.HitRegistrationStudentInfoList[0].competition == null) {
this.form.competition = []
} else {
console.log('执行了')
this.form.competition = []
//
console.log('this.HitRegistrationStudentInfoList[0].competitionn', this.HitRegistrationStudentInfoList[0].competition)
// this.form.competition = []
this.HitRegistrationStudentInfoList[0].competitionName = ""
const arr =this.splitStringToArray(this.HitRegistrationStudentInfoList[0].competition)
const arr2 = []
//arr
for (let i = 0; i < arr.length; i++) {
//
if (arr[i] == "1") {
arr2.push('化验赛')
// this.HitRegistrationStudentInfoList[0].competitionName += ""
} else if (arr[i] == "2") {
arr2.push('虚拟赛')
// this.HitRegistrationStudentInfoList[0].competitionName += ","
}
}
this.HitRegistrationStudentInfoList[0].competitionName = this.arrayToString(arr2);
}
console.log("报名信息", this.HitRegistrationStudentInfoList);
//forthis.HitRegistrationStudentInfoList
// 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 = {}
// if (this.HitRegistrationStudentInfoList[i].competition == null) {
// this.HitRegistrationStudentInfoList[i].competition = []
// }
// //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]
// }
// }
// }
console.log("this.HitRegistrationStudentInfoList", this.HitRegistrationStudentInfoList)
this.total = response.total;
this.loading = false;
});
},
//
getTeachInfoByIds(id) {
getHitRegistrationTeachInfoByUserId(id).then(res => {
console.log('当前老师类型', res.data.type);
this.techerType = res.data.type
})
this.fetchRegistrationInformation()
},
splitStringToArray(str) {
return str.split(',').map(item => item.trim());
},
//
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 => {
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");
if (this.form.competition == null) {
this.form.competition = []
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.createTime = 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 => {
console.log("修改信息", response)
this.form = response.data;
if (response.data.competition == '' || response.data.competition == null) {
// console.log('')
this.form.competition = ["1"]
}else {
// console.log('')
this.form.competition= this.splitStringToArray(response.data.competition)
}
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) {
const data = JSON.parse(JSON.stringify(this.form));
data.competition = this.arrayToString(data.competition);
if (!this.form.competition.includes('1')){
this.form.sampleAddress = ''
}
console.log("修改信息", data);
studentUpdateHitRegistrationStudentInfo(data).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addHitRegistrationStudentInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
//
arrayToString(arr) {
console.log("执行了")
return arr.join(',');
},
/** 删除按钮操作 */
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('hit/hitRegistrationStudentInfo/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);
},
}
};
</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>