Files
UNION_HUTB/target/classes/views/platform/activity/school/ActivityApply.html
T
2026-09-09 09:14:28 +08:00

2339 lines
105 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.text {
font-size: 14px;
}
.e-item {
margin-bottom: 18px;
}
.el-divider--horizontal {
margin: 5px 0;
}
.v-tab .el-card__header {
padding: 10px 15px;
font-weight: bold;
}
.reserve_btn {
font-size: 15px;
float: right;
padding: 3px 0
}
.is-selected {
color: #1989FA;
}
.div-Calendar {
box-sizing: border-box;
height: 100%;
}
.el-carousel__button {
background-color: #c0c4cc;
}
.el-carousel__container {
height: 260px;
}
.el-button--mini.is-circle {
padding: 5px;
font-size: 1px;
}
.slider {
position: relative;
}
.cover {
position: absolute;
height: 6px;
background-color: #409EFF;
margin: 16px 0;
z-index: 999;
}
.cover2 {
position: absolute;
height: 6px;
background-color: #E4E7ED;
margin: 16px 0;
z-index: 1000;
}
.el-slider__marks-text {
margin-top: 10px !important;
}
.el-slider__stop {
z-index: 1001;
}
.el-slider__bar {
z-index: 1000;
}
.el-slider__marks-text {
min-width: 40px !important;
}
.el-slider__button-wrapper {
display: none !important;
}
input[type="file"] {
display: none
}
.el-input-number input {
text-align: left !important;
}
.el-input-number__decrease, .el-input-number__increase {
display: none;
}
.el-transfer-panel {
text-align: left;
width: calc(50% - 91px);
height: 53vh;
}
.el-transfer-panel__list.is-filterable {
height: calc(50vh - 110px);
}
.transfer {
display: flex;
height: 100%;
width: 100%;
align-items: center;
padding: 0 10px;
}
.transfer .el-checkbox {
display: inline-block !important;
margin: 0 10px !important;
}
.el-divider {
background-color: #ec524b !important;
}
.el-divider__text {
color: #ec524b !important;
}
.el-timeline-item__timestamp {
color: #ec524b;
}
.activeCard {
border: 1px solid #409EFF;
}
.el-table-container {
padding-top: 0;
}
</style>
<div id="app" class="platform" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">选择年</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.year"
type="year"
value-format="yyyy" style="width: 100%"
placeholder="选择年"
@change="activityInfoData">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">活动状态</div>
<div class="search-item-option">
<el-radio-group v-model="pageForm.isActivity" @change="activityInfoData"
>
<el-radio-button :label="1">全部</el-radio-button>
<el-radio-button :label="2">报名中</el-radio-button>
<el-radio-button :label="3">已结束</el-radio-button>
</el-radio-group>
</div>
</div>
</div>
</el-card>
<el-row class="el-table-container">
<el-carousel :interval="5000" arrow="always" style="margin: 10px auto">
<el-carousel-item v-for="index in Math.ceil(activityList.length/4)"
:key="index">
<el-row :gutter="20">
<el-col v-for="item in activityList.slice((index-1)*4,index*4)"
:span="6">
<el-card
:class="'box-card '+(item.id===pageForm.activityId?'activeCard':'')"
style="border-radius: 10px">
<div slot="header" class="clearfix"
style="font-size: 16px;padding: 5px 0"
@click="openApply(item)">
<el-tooltip class="item" effect="dark" :content="item.NAME"
placement="top-start">
<span v-if="item.NAME.length<=13">{{item.NAME}}</span>
<span v-else>{{item.NAME.substr(0,13)}}...</span>
</el-tooltip>
<el-button @click="openApply(item)" class="reserve_btn"
type="text">
请选择活动报名
</el-button>
</div>
<div @click="openApply(item)">
<div class="text e-item">
<span style="color: gray">活动名称:</span>
<el-tooltip class="item" effect="dark"
:content="item.NAME"
placement="top-start">
<span v-if="item.NAME.length<=15">{{item.NAME}}</span>
<span v-else>{{item.NAME.substr(0,15)}}...</span>
</el-tooltip>
<el-tag type="danger" effect="dark"
style="border-radius: 50%;float: right"
v-if="moment(item.applyEndTime).valueOf() <moment().valueOf()">
报名结束
</el-tag>
<el-tag type="success" effect="dark"
style="border-radius: 50%;float: right"
v-else-if="moment().valueOf()>moment(item.applyStartTime).valueOf()&&moment().valueOf()<moment(item.applyEndTime).valueOf()">
报名中
</el-tag>
<el-tag type="danger" effect="dark"
style="border-radius: 50%;float: right"
v-else-if="moment().valueOf()<moment(item.applyEndTime).valueOf()">
报名未开始
</el-tag>
</div>
<div class="text e-item">
<span style="color: gray">活动类型:</span>
<span v-if="item.gameStyle===1">{{item.activityLevelName}}</span>
</div>
<div class="text e-item">
<span style="color: gray">活动地址:</span>
<el-tooltip class="item" effect="dark"
:content="item.address"
placement="top-start">
<span v-if="item.address<=15">{{item.address}}</span>
<span v-else>{{item.address.substr(0,15)}}...</span>
</el-tooltip>
</div>
<div class="text e-item">
<span style="color: gray">报名时间:</span>
{{moment(item.applyStartTime)
.format('YYYY/MM/DD HH:mm')}} 至
{{moment(item.applyEndTime).format('YYYY/MM/DD HH:mm')}}
</div>
<div class="text item">
<span style="color: gray">活动时间:</span>
{{moment(item.startTime).format('YYYY/MM/DD HH:mm')}} 至
{{moment(item.endTime).format('YYYY/MM/DD HH:mm')}}
</div>
</div>
</el-card>
</el-col>
</el-row>
</el-carousel-item>
</el-carousel>
</el-row>
<el-card shadow="never" class="mt10">
<table-tool label="活动项目信息" :app="this">
<template #label_end>
<!--<el-radio-group v-model="pageForm.isMenWomen" @change="doSearch"
style="margin-left: 10px" v-if="unionLeaderCoach">
<el-radio-button :label="1">全部</el-radio-button>
<el-radio-button :label="2">男子</el-radio-button>
<el-radio-button :label="3">女子</el-radio-button>
<el-radio-button :label="4">团体</el-radio-button>
</el-radio-group>-->
<div class="search-item-option">
<el-select v-if="unionLeaderCoach" v-model="pageForm.groupName"
placeholder="请选择组别"
filterable clearable
style="width: 100%;margin-bottom: 5px;margin-left: 10px"
@change="doSearch">
<el-option
v-for="item in groupList"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</div>
<div class="search-item-option">
<el-select v-if="unionLeaderCoach" v-model="pageForm.eventId"
placeholder="请选择活动项目"
filterable clearable
style="width: 100%;margin-bottom: 5px;margin-left: 10px"
@change="doSearch">
<el-option
v-for="item in events"
:key="item.id"
:label="item.allName"
:value="item.eventId">
</el-option>
</el-select>
</div>
</template>
<template #func>
<div v-if="unionLeaderCoach" class="mr10">
<!-- 团长:<span style="color: #419BF8">{{headData.username | str}}</span>&emsp13;-->
领队:<span style="color: #419BF8">{{LeaderData.username | str}} </span>&emsp13;
教练:<span style="color: #419BF8">{{CoachData.username | str}}</span>
工作人员:<span style="color: #419BF8">{{staffData.username | str}}</span>
</div>
<div>
<el-button type="primary" plain @click="openLeaderCoach"
v-if="unionLeaderCoach">设置领队/教练/工作人员
</el-button>
</div>
</template>
</table-tool>
<el-table :data="tableData" style="width: 100%;margin-bottom: 20px" row-key="id"
@sort-change="pageOrder" v-loading="tableLoading" :size="tableSize"
class="vi-table">
<el-table-column align="center" header-align="center" type="index"
:index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
:key="column.prop"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
show-overflow-tooltip>
<template scope="{row}" v-if="column.prop=='projectType'">
<span v-if="row.projectType==1">单项</span>
<span v-else-if="row.projectType==2">团体</span>
</template>
<template scope="{row}" v-else-if="column.prop=='applyNum'">
<span v-if="row.applyNum>0&&row.applyType!=3">{{row.applyNum}}人</span>
<span v-else-if="row.totalApplyNum>0&&row.applyType==3">{{row.totalApplyNum}}人</span>
<span v-else>0人</span>
</template>
</el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center"
label="报名操作"
width="150px">
<template scope="{row}">
<!-- <el-button size="mini" :loading="row.loading" v-if="row.applyWay.includes(2)"
@click="openUniteApply(row)">项目报名
</el-button>-->
<el-dropdown @command="dropdownCommand">
<el-button size="mini" :loading="row.loading">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'openUniteApply',row}"
v-if="row.applyWay.includes(2)">
项目报名
</el-dropdown-item>
<!--#if(@shiro.hasRole('sysadmin')||@shiro.hasRole('H04')){#-->
<el-dropdown-item :command="{type:'delete',row}">
删除报名人员
</el-dropdown-item>
<!--#}#-->
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit_func>
<el-button type="primary" @click="doApplied(false)">保 存</el-button>
<el-button type="primary" @click="doApplied(true)">提 交</el-button>
</template>
<template #edit>
<el-timeline>
<el-timeline-item timestamp="设置运动员" placement="top">
<el-tabs v-model="activeName" tab-position="top" @tab-click="handleTabClick">
<el-tab-pane :label="eventName" name="1" v-if="combinationMethod==1">
<el-card>
<el-transfer
@right-check-change="rightCheckChange"
ref="transfer"
@change="rightChange"
:titles="['可报人员名单', '当前选择']"
filterable
:props="{key: 'id',label: 'name'}"
:filter-method="filterMethod"
:right-default-checked="rightChecked"
v-model="applyValue"
:data="applyData">
<template #right-footer>
<div class="transfer">
<el-select size="small" v-model="team" placeholder="队伍"
:clearable="false"
v-if="teams.length>1"
@change="flushApplyed(appliedData)">
<el-option
v-for="item in teams"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button size="small" type="primary"
@click="apply1(1)"
icon="el-icon-plus">
设置运动员
</el-button>
</el-button>
</div>
</template>
</el-transfer>
<div style="display: flex;margin: 20px 0">
<el-divider content-position="left">
单项报名人数最多{{athleteMaxNum}}
人,其中领队{{leanderNum}}人,教练{{coachNum}}人,该队运动员已有{{appliedData3.length}}
名成员,还可报名{{athleteMaxNum-appliedData3.length}} 人
。(系统中查询不到的人可以点击右边按钮添加)
</el-divider>
<!-- <div style="padding-left: 10px">
<el-tooltip class="item" effect="dark"
content="系统中查询不到的人可以点击添加"
placement="top">
<el-button
:disabled="(eventData.restrictTotalPeople-appliedData3.length)<=0"
icon="el-icon-plus" circle @click="openAddUserD"
type="danger"></el-button>
</el-tooltip>
</div>-->
</div>
<el-button icon="el-icon-check" v-if="leanderNum>0" size="small"
plain
type="primary"
@click="setLeader2()">设置领队
</el-button>
<el-button icon="el-icon-check" v-if="coachNum>0" size="small"
plain type="primary"
@click="setCoach2">
设置教练
</el-button>
<el-table row-key="userId" border stripe :data="appliedData3"
ref="multipleTable3"
class="mt10"
v-loading="applyedTabLoading"
@selection-change="handleSelectionChange"
size="small">
<el-table-column :reserve-selection="true"
type="selection"
width="55">
</el-table-column>
<el-table-column
type="index" label="序号" header-align="center"
align="center"
width="100">
</el-table-column>
<el-table-column
prop="username" header-align="center" align="center"
label="姓名">
</el-table-column>
<el-table-column
prop="loginname" header-align="center" align="center"
label="教工号">
</el-table-column>
<el-table-column
prop="unitname" header-align="center" align="center"
sortable
label="单位">
</el-table-column>
<el-table-column
prop="mobile" header-align="center" align="center"
label="电话">
</el-table-column>
<el-table-column
prop="sex" header-align="center" align="center"
label="性别">
</el-table-column>
<el-table-column
prop="age" header-align="center" align="center"
label="年龄">
</el-table-column>
<el-table-column
prop="identity" header-align="center" align="center"
label="身份">
<template scope="{$index,row}">
<el-tag v-if="row.identity.includes('1')" closable
effect="dark"
:disable-transitions="false"
@close="delApplyed($index,row,1)">运动员
</el-tag>
<el-tag v-if="row.identity.includes('3')" type="warning"
closable
effect="light"
:disable-transitions="false"
@close="delApplyed($index,row,'3')">领队
</el-tag>
<el-tag v-if="row.identity.includes('2')" type="success"
closable
effect="light"
:disable-transitions="false"
@close="delApplyed($index,row,'2')">教练
</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
<el-tab-pane :label="eventName" name="2" v-if="combinationMethod==2">
<el-card>
<el-transfer
@right-check-change="rightCheckChange"
@change="rightChange"
ref="transfer"
:titles="['可报人员名单', '当前选择']"
filterable
:props="{key: 'id',label: 'name'}"
:filter-method="filterMethod"
:right-default-checked="rightChecked"
v-model="applyValue"
:data="applyData">
<template #left-footer>
<div></div>
</template>
<template #right-footer>
<div class="transfer">
<el-select size="small" v-model="team" placeholder="队伍"
:clearable="false"
@change="flushApplyed(appliedData)">
<el-option
v-for="item in teams"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
<el-button size="small" class="m10" type="primary"
@click="apply(1)"
icon="el-icon-plus" v-if="!isLeader">
参加比赛
</el-button>
</el-button>
</div>
</template>
</el-transfer>
<!-- {{restrictMaxNum-appliedData2.filter(v=>v.identity.includes('1')).length}}-->
<!-- :disabled="(restrictMaxNum-appliedData2.filter(v=>v.identity.includes('1')).length)<=0"-->
<div style="display: flex;margin: 20px 0" v-if="!isLeader">
<el-divider content-position="left">每支队伍最多
{{restrictMaxNum}}
人,其中领队{{leanderNum}}人,教练{{coachNum}}人,运动员必须设置{{athleteMaxNum}}人,替补{{substituteNum}}人。男运动员最少{{restrictBoyNum?restrictBoyNum:'0'}}人,女运动员最少{{restrictGirlNum?restrictGirlNum:'0'}}人【该队运动员已有
{{appliedData2.filter(v=>v.identity.includes('1')).length}}
人,还可报名
{{athleteMaxNum-appliedData2.filter(v=>v.identity.includes('1')).length}}人;替补还可以报{{substituteNum-appliedData2.filter(v=>v.identity.includes('5')).length}}人(非必需)】
</el-divider>
<!-- <div style="padding-left: 10px">
<el-tooltip class="item" effect="dark" content="系统中查询不到的人可以点击添加"
placement="top">
<el-button
:disabled="(restrictMaxNum-appliedData2.length)<=0"
icon="el-icon-plus" circle @click="openAddUser"
type="danger"></el-button>
</el-tooltip>
</div>-->
</div>
<div style="display: flex;margin: 20px 0" v-if="isLeader">
<el-divider content-position="left">每支队伍最少运动员人数
{{restrictMaxNum}} 人,最多
{{restrictMaxNum}} 人,该队运动员已有 {{athleteMaxNum}} 名成员,还可报名
{{restrictMaxNum-appliedData2.filter(v=>v.identity.includes('1')).length}}
人。
</el-divider>
</div>
<div v-if="!isLeader">
<el-button icon="el-icon-check" v-if="leanderNum>0" size="small"
plain
type="primary"
@click="setLeader2()">设置领队
</el-button>
<el-button icon="el-icon-check" v-if="coachNum>0" size="small"
plain type="primary"
@click="setCoach2">
设置教练
</el-button>
<el-button icon="el-icon-check" v-if="deputyDirectorNum>0"
size="small"
plain type="primary"
@click="setDivisionLevelLeadership">
设置处级领导
</el-button>
<el-button icon="el-icon-check" v-if="substituteNum>0"
size="small"
plain type="primary"
@click="setSubstitute">
设置替补
</el-button>
<!-- <el-button icon="el-icon-check" size="small"
plain type="primary"
@click="changeTeam" v-if="projectType==2&&teams.length>1">
修改小队
</el-button>
<el-select size="small" v-model="teamId" placeholder="队伍" :clearable="false"
v-if="projectType==2&&teams.length>1">
<el-option
v-for="item in teams"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>-->
<el-dropdown @command="changeTeam"
v-if="projectType==2&&teams.length>1">
<el-button type="primary" size="small">
修改小队<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{item}"
v-for="item in teams">{{item.name}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-table class="mt10" :key="tabkey" border stripe
ref="multipleTable" row-key="id"
:data="appliedData2" size="small"
v-loading="applyedTabLoading"
@selection-change="handleSelectionChange"
v-if="appliedData2.length>0">
<el-table-column :reserve-selection="true"
type="selection"
width="55">
</el-table-column>
<el-table-column
type="index" label="序号" header-align="center"
align="center"
width="100">
</el-table-column>
<el-table-column
prop="team" header-align="center" align="center"
label="所属队">
</el-table-column>
<el-table-column
prop="username" header-align="center" align="center"
label="姓名">
</el-table-column>
<el-table-column
prop="loginname" header-align="center" align="center"
label="教工号">
</el-table-column>
<el-table-column
prop="unitname" header-align="center" align="center"
sortable
label="单位">
</el-table-column>
<el-table-column
prop="mobile" header-align="center" align="center"
label="电话">
</el-table-column>
<el-table-column
prop="sex" header-align="center" align="center"
label="性别">
</el-table-column>
<el-table-column
prop="age" header-align="center" align="center"
label="年龄">
</el-table-column>
<el-table-column
prop="identity" header-align="center" align="center"
label="身份" width="300px">
<template scope="{$index,row}">
<el-tag v-if="row.identity.includes('4')" type="info"
closable
effect="light"
:disable-transitions="false"
@close="delApplyed($index,row,'4')">处级领导
</el-tag>
<el-tag v-if="row.identity.includes('3')" type="warning"
closable
effect="light"
:disable-transitions="false"
@close="delApplyed($index,row,'3')">领队
</el-tag>
<el-tag v-if="row.identity.includes('2')" type="success"
closable
effect="light"
:disable-transitions="false"
@close="delApplyed($index,row,'2')">教练
</el-tag>
<el-tag v-if="row.identity.includes('1')" closable
effect="light"
:disable-transitions="false"
@close="delApplyed($index,row,'1')">运动员
</el-tag>
<el-tag v-if="row.identity.includes('5')" closable
type="danger"
effect="light"
:disable-transitions="false"
@close="delApplyed($index,row,'5')">替补
</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
</el-tabs>
</el-timeline-item>
</el-timeline>
</template>
<template #view>
<delete_info :event_list="eventList" @flush="pageData" v-model="selection"
ref="delete_info"></delete_info>
</template>
</guava>
<el-dialog
title="添加领队/教练/工作人员"
:visible.sync="dialogLeaderCoach"
width="60%"
>
<el-form :model="headData" ref="form" :rules="formRules" label-width="100px">
<el-row gutter="20">
<!-- <el-col :span="12">
<vi-title title="填写团长信息"></vi-title>
<el-form-item prop="userId" label="姓&emsp;&emsp;名">
<el-select
style="width: 100%"
v-model="headData.userId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入姓名或工号查找"
:remote-method="userLeaderCoach"
:loading="userLoading"
@change="changeHead">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username+ ''+item.sex+''+''+item.loginname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="unitId" label="所在单位">
<el-select v-model="headData.unitId" placeholder="请选择所在单位" clearable
filterable
style="width: 100%">
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="电&emsp;&emsp;话">
<el-input maxlength="50" placeholder="请填写电话" v-model="headData.mobile"
type="text"></el-input>
</el-form-item>
</el-col>-->
<el-col :span="12">
<vi-title title="填写领队信息"></vi-title>
<el-form-item prop="userId" label="姓&emsp;&emsp;名">
<el-select
style="width: 100%"
v-model="LeaderData.userId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入姓名或工号查找"
:remote-method="userLeaderCoach"
:loading="userLoading"
@change="changeLeader">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username+ ''+item.sex+''+''+item.loginname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="unitId" label="所在单位">
<el-select v-model="LeaderData.unitId" placeholder="请选择所在单位" clearable
filterable
style="width: 100%">
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="电&emsp;&emsp;话">
<el-input maxlength="50" placeholder="请填写电话" v-model="LeaderData.mobile"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<vi-title title="填写教练信息"></vi-title>
<el-form-item prop="userId" label="姓&emsp;&emsp;名">
<el-select
style="width: 100%"
v-model="CoachData.userId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入姓名或工号查找"
:remote-method="userLeaderCoach"
:loading="userLoading"
@change="changeCoach">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username+ ''+item.sex+''+''+item.loginname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="unitId" label="所在单位">
<el-select v-model="CoachData.unitId" placeholder="请选择所在单位" clearable
filterable
style="width: 100%">
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="电&emsp;&emsp;话">
<el-input maxlength="50" placeholder="请填写电话" v-model="CoachData.mobile"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<vi-title title="填写工作人员信息"></vi-title>
<el-form-item prop="userId" label="姓&emsp;&emsp;名">
<el-select
style="width: 100%"
v-model="staffData.userId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入姓名或工号查找"
:remote-method="userLeaderCoach"
:loading="userLoading"
@change="changeStaff">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username+ ''+item.sex+''+''+item.loginname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="unitId" label="所在单位">
<el-select v-model="staffData.unitId" placeholder="请选择所在单位" clearable
filterable
style="width: 100%">
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="mobile" label="电&emsp;&emsp;话">
<el-input maxlength="50" placeholder="请填写电话" v-model="staffData.mobile"
type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogLeaderCoach = false">取 消</el-button>
<el-button type="primary" plain @click="doLeaderCoach">确 认</el-button>
</span>
</el-dialog>
<el-dialog
title="添加人员"
:visible.sync="dialogVisible"
width="40%"
>
<el-form :model="formData" ref="form" :rules="formRules" label-width="100px">
<el-form-item prop="teamId" label="所在队伍">
<el-select v-model="formData.teamId" disabled placeholder="请选择所在队伍" clearable
style="width: 100%">
<el-option
v-for="item in teams"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="username" label="姓&emsp;&emsp;名">
<el-input maxlength="50" placeholder="请填写姓名" v-model="formData.username"
type="text"></el-input>
</el-form-item>
<el-form-item prop="loginname" label="工&emsp;&emsp;号">
<el-input maxlength="50" placeholder="请填写工号" v-model="formData.loginname"
type="text"></el-input>
</el-form-item>
<el-form-item prop="mobile" label="电&emsp;&emsp;话">
<el-input maxlength="50" placeholder="请填写电话" v-model="formData.mobile"
type="text"></el-input>
</el-form-item>
<el-form-item prop="sex" label="性&emsp;&emsp;别">
<el-radio-group v-model="formData.sex">
<el-radio :label="'男'" border></el-radio>
<el-radio :label="'女'" border></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="divisionLevelLeadership" label="处级领导">
<el-radio-group v-model="formData.divisionLevelLeadership">
<el-radio :label="true" border></el-radio>
<el-radio :label="false" border></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="unitId" label="所在单位">
<el-select v-model="formData.unitId" placeholder="请选择所在单位" clearable filterable
style="width: 100%">
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAddUser">确 定</el-button>
</span>
</el-dialog>
<el-dialog
title="添加人员"
:visible.sync="dialogVisible2"
width="40%"
>
<el-form :model="formData" ref="form" :rules="formRules" label-width="100px">
<el-form-item prop="username" label="姓&emsp;&emsp;名">
<el-input maxlength="50" placeholder="请填写姓名" v-model="formData.username"
type="text"></el-input>
</el-form-item>
<el-form-item prop="loginname" label="工&emsp;&emsp;号">
<el-input maxlength="50" placeholder="请填写工号" v-model="formData.loginname"
type="text"></el-input>
</el-form-item>
<el-form-item prop="mobile" label="电&emsp;&emsp;话">
<el-input maxlength="50" placeholder="请填写电话" v-model="formData.mobile"
type="text"></el-input>
</el-form-item>
<el-form-item prop="unitId" label="所在单位">
<el-select v-model="formData.unitId" placeholder="请选择所在单位" clearable filterable
style="width: 100%">
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible2 = false">取 消</el-button>
<el-button type="primary" @click="doAddUser2">确 定</el-button>
</span>
</el-dialog>
</div>
<!--
appliedData->全部运动会人员
appliedData2->团体运动会人员
appliedData3->单项运动会人员
-->
<script>
//分组
const groupBy = (list, fn) => {
const groups = {};
list.forEach(function (o) {
const group = JSON.stringify(fn(o));
groups[group] = groups[group] || [];
groups[group].push(o);
});
return Object.keys(groups).map(function (group) {
return groups[group];
});
};
const groupBy2 = (list, fn) => {
const groups = {};
list.forEach(function (o) {
const group = JSON.stringify(fn(o));
groups[group] = groups[group] || [];
groups[group].push(o);
});
return groups;
};
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
applyUserModel: 0,
isLeader: false,//只需报领队
activity: window.activity,
moment: window.moment,
eventName: "",
leaderIsAthlete: false,
coachIsAthlete: false,
unionLeaderCoach: false,
LeaderData: {},
CoachData: {},
headData: {},
staffData: {},
coachNum: "",
leanderNum: "",
deputyDirectorNum: "",
projectType: "",
selection: [],
tabkey: '',
eventList: {},
combinationMethod: "",
activitys: [],
pageForm: {
isMenWomen: [],
isActivity: "2",
year: new Date().getFullYear() + "",
},
activeName: '',
userOptions: [],
applyUsers: [],
applyValue: [],
applyData: [],
userLoading: false,
dialogVisible: false,
dialogVisible2: false,
dialogLeaderCoach: false,
applyedTabLoading: false,
appliedData: [],
appliedData2: [],
appliedData3: [],
divisionLevelLeadership: false,
team: '',
teamId: '',
teams: [],
rightChecked: [],
activityData: {},
activityData2: {},
eventData: {},
leaderId: '',
coachId: '',
coach: "",
leader: "",
searchLoading: false,
leaderOptions: [],
activityList: [],
unitOptions: [],
planList: [],
typeList: [],
events: [],
events2: [],
submitDisabled: false,
personalEnterFormData: {},
teammateEnterFormData: {},
restrictMaxNum: 0,
athleteMaxNum: 0,
substituteNum: 0,
restrictBoyNum: 0,
restrictGirlNum: 0,
tableColumns: [
/* {prop: 'name', label: '活动名称'},*/
{prop: 'allName', label: '项目名称'},
{prop: 'projectType', label: '项目类型'},
{prop: 'applyNum', label: '已报名人数'},
],
formRules: {
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
teamId: [{required: true, message: '必填', trigger: ['blur', 'change']}],
// userId: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
submitLoading: false,
groupList: [
{value: 1, name: "甲组"},
{value: 2, name: "乙组"},
{value: 3, name: "丙组"},
{value: 4, name: "丁组"}
]
}
},
filters: {
money(val) {
return val ? val : 0
},
str(val) {
return val ? val : '暂无'
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'delete_info': httpVueLoader('/components/activity/school/DeleteInfo.vue'),
},
methods: {
setLeader2() {
if (!this.selection.length) {
this.$notify({
title: '警告',
message: '请先勾选需要设置的用户!',
type: 'warning'
});
return
}
if (this.selection.length > 1) {
this.$notify({
title: '警告',
message: '小队只能设置一位领队!',
type: 'warning'
});
return
}
this.selection.forEach(v => {
v.identity.unshift('3')
})
if (this.$refs.multipleTable) this.$refs.multipleTable.clearSelection();
if (this.$refs.multipleTable3) this.$refs.multipleTable3.clearSelection();
},
setCoach2() {
if (!this.selection.length) {
this.$notify({
title: '警告',
message: '请先勾选需要设置的用户!',
type: 'warning'
});
return
}
if (this.selection.length > 1) {
this.$notify({
title: '警告',
message: '小队只能设置一位教练!',
type: 'warning'
});
return
}
this.selection.forEach(v => {
v.identity.unshift('2')
})
if (this.$refs.multipleTable) this.$refs.multipleTable.clearSelection();
if (this.$refs.multipleTable3) this.$refs.multipleTable3.clearSelection();
},
setDivisionLevelLeadership() {
if (!this.selection.length) {
this.$notify({
title: '警告',
message: '请先勾选需要设置的用户!',
type: 'warning'
});
return
}
this.selection.forEach(v => {
v.divisionLevelLeadership = true
})
this.selection.forEach(v => {
v.identity.unshift('4')
})
this.$refs.multipleTable.clearSelection();
},
setSubstitute() {
if (!this.selection.length) {
this.$notify({
title: '警告',
message: '请先勾选需要设置的用户!',
type: 'warning'
});
return
}
this.selection.forEach(v => {
v.identity = []
v.identity.push('5')
})
this.$refs.multipleTable.clearSelection();
},
changeTeam(command) {
const {item} = command
if (!this.selection.length) {
this.$notify({
title: '警告',
message: '请先勾选需要设置的用户!',
type: 'warning'
});
return
}
const teamName = this.teams.find(v => v.id === item.id).name
if (this.selection[0].teamId === item.id) {
this.$notify({
title: '警告',
message: '您选择的老师在' + this.selection[0].team + '无法更改!',
type: 'warning'
});
return
}
this.selection.map(v => {
v.teamId = item.id
v.team = teamName
})
//如果是单项项目
if (this.eventData.projectType === '1') {
this.selection.forEach(x => {
let index = this.appliedData3.findIndex(v => v.userId === x.userId)
this.appliedData3.splice(index, 1)
})
this.$refs.multipleTable3.clearSelection();
} else {
this.selection.forEach(x => {
let index = this.appliedData2.findIndex(v => v.userId === x.userId)
this.appliedData2.splice(index, 1)
})
this.$refs.multipleTable.clearSelection();
}
},
doDeleteUser() {
if (!this.selection.length) {
this.$notify({
title: '警告',
message: '请先勾选需要设置的用户!',
type: 'warning'
});
return
}
this.selection.forEach(async (x) => {
this.applyValue.push(x.userId)
if (x) {
this.applyData.push(this.getTransProp(x))
} else {
if (x.userId) {
const u = await this.findUserOne(x.userId)
this.applyUsers.push(u)
this.applyData.push(this.getTransProp(u))
}
}
let index = this.appliedData2.findIndex(v => v.userId === x.userId)
this.appliedData2.splice(index, 1)
this.appliedData3.splice(index, 1)
})
this.$refs.multipleTable.clearSelection();
},
handleSelectionChange(val) {
this.selection = val;
},
async changeLeader() {
const userData = await this.getUserData(this.LeaderData.userId);
this.$set(this.LeaderData, 'userId', this.LeaderData.userId)
this.$set(this.LeaderData, 'loginname', userData.loginname)
this.$set(this.LeaderData, 'username', userData.username)
this.$set(this.LeaderData, 'unitId', userData.unitid)
this.$set(this.LeaderData, 'sex', userData.sex)
this.$set(this.LeaderData, 'mobile', userData.mobile)
this.$set(this.LeaderData, 'unionLeader', true)
this.$set(this.LeaderData, 'unionId', userData.unionid)
this.$set(this.LeaderData, 'identity', ['3'])
this.$set(this.LeaderData, 'status', 2)
this.$set(this.LeaderData, 'awardsMode', 2)
this.$set(this.LeaderData, 'activityId', this.activityData2.id)
this.$set(this.LeaderData, 'divisionLevelLeadership', false)
this.$set(this.LeaderData, 'unionCoach', false)
},
async changeCoach() {
const userData = await this.getUserData(this.CoachData.userId);
this.$set(this.CoachData, 'userId', this.CoachData.userId)
this.$set(this.CoachData, 'loginname', userData.loginname)
this.$set(this.CoachData, 'username', userData.username)
this.$set(this.CoachData, 'unitId', userData.unitid)
this.$set(this.CoachData, 'sex', userData.sex)
this.$set(this.CoachData, 'mobile', userData.mobile)
this.$set(this.CoachData, 'unionCoach', true)
this.$set(this.CoachData, 'unionId', userData.unionid)
this.$set(this.CoachData, 'identity', ['2'])
this.$set(this.CoachData, 'status', 2)
this.$set(this.CoachData, 'awardsMode', 2)
this.$set(this.CoachData, 'activityId', this.activityData2.id)
this.$set(this.CoachData, 'divisionLevelLeadership', false)
this.$set(this.CoachData, 'unionLeader', false)
},
async changeStaff() {
const userData = await this.getUserData(this.staffData.userId);
this.$set(this.staffData, 'userId', this.staffData.userId)
this.$set(this.staffData, 'loginname', userData.loginname)
this.$set(this.staffData, 'username', userData.username)
this.$set(this.staffData, 'unitId', userData.unitid)
this.$set(this.staffData, 'sex', userData.sex)
this.$set(this.staffData, 'mobile', userData.mobile)
this.$set(this.staffData, 'unionStaff', true)
this.$set(this.staffData, 'identity', ['7'])
this.$set(this.staffData, 'unionId', userData.unionid)
this.$set(this.staffData, 'status', 2)
this.$set(this.staffData, 'awardsMode', 2)
this.$set(this.staffData, 'activityId', this.activityData2.id)
},
async changeHead() {
const userData = await this.getUserData(this.headData.userId);
this.$set(this.headData, 'userId', this.headData.userId)
this.$set(this.headData, 'loginname', userData.loginname)
this.$set(this.headData, 'username', userData.username)
this.$set(this.headData, 'unitId', userData.unitid)
this.$set(this.headData, 'sex', userData.sex)
this.$set(this.headData, 'mobile', userData.mobile)
this.$set(this.headData, 'unionCoach', false)
this.$set(this.headData, 'unionHead', true)
this.$set(this.headData, 'unionId', userData.unionid)
this.$set(this.headData, 'identity', ['6'])
this.$set(this.headData, 'status', 2)
this.$set(this.headData, 'awardsMode', 2)
this.$set(this.headData, 'activityId', this.activityData2.id)
this.$set(this.headData, 'divisionLevelLeadership', false)
this.$set(this.headData, 'unionLeader', false)
},
async doLeaderCoach() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
let loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + "/doLeaderCoachHead",
{
LeaderData: JSON.stringify(this.LeaderData),
CoachData: JSON.stringify(this.CoachData),
headData: JSON.stringify(this.headData),
staffData: JSON.stringify(this.staffData),
activityId: this.pageForm.activityId
}
)
loading.close()
if (resp.code === 0) {
this.activityData2.CoachCount = 1
this.activityData2.LeaderCount = 1
await this.getUnionCoachLeaderHead()
this.dialogLeaderCoach = false;
} else {
this.notifyWarning(resp.msg)
}
}
})
},
async getUnionCoachLeaderHead() {
this.LeaderData = {}
this.CoachData = {}
this.headData = {}
this.staffData = {}
const resp = await $.get(loc() + "/getUnionCoachLeaderHead", {activityId: this.activityData2.id})
const {unionCoach, unionLeader, unionHead, unionStaff, userOptions} = resp.data
if (unionCoach) {
this.CoachData = unionCoach
}
if (unionLeader) {
this.LeaderData = unionLeader
}
if (unionHead) {
this.headData = unionHead
}
if (unionStaff) {
this.staffData = unionStaff
}
this.userOptions = userOptions
},
async openLeaderCoach() {
if (this.activityData2.CoachCount > 0 || this.activityData2.LeaderCount > 0) {
await this.getUnionCoachLeaderHead()
this.dialogLeaderCoach = true
} else {
this.LeaderData = {}
this.CoachData = {}
this.dialogLeaderCoach = true
}
},
async userLeaderCoach(query) {
if (query) {
this.userLoading = true
const resp = await $.get(loc() + "/getUserUnion", {query})
this.userOptions = resp
this.userLoading = false
}
},
joinMemberFamily() {
if (!this.selection.length) {
this.$notify({
title: '警告',
message: '请先勾选需要删除的用户!',
type: 'warning'
});
return
}
this.$confirm('是否将已勾选的人员删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.submitLoading = true
const resp = await $.post(loc() + "/joinMemberFamily", {applysId: JSON.stringify(this.selection.map(v => v.id))})
this.submitLoading = false
if (resp.code === 0) {
this.$refs.delete_info.applyPageData()
this.pageData()
} else {
this.notifyWarning(resp.msg)
}
})
},
async activityEvent() {
await this.activityInfoData()
await this.pageData()
},
dropdownCommand(command) {
const {type, row} = command
if (type === 'openUniteApply') {
this.openUniteApply(row)
} else if (type === 'delete') {
this.doDelete(row)
} /*else if (type === 'openSingleApply') {
this.openSingleApply(row)
}*/
},
async openApply(item) {
this.$set(this.pageForm, "isMenWomen", 1)
this.activityData2 = item
this.pageForm.activityId = item.id
if (item.applyType == 2) {
await this.getUnionCoachLeaderHead()
this.unionLeaderCoach = true
} else {
this.unionLeaderCoach = false
}
this.pageData()
await this.changeActivit()
},
async changeYear() {
const resp = await $.post(loc() + "/getActivits", {year: this.pageForm.year})
this.activitys = resp
},
async changeActivit() {
const resp = await $.post("/platform/activity/apply/getEvents", {activityId: this.pageForm.activityId})
this.events = resp
},
handleTabClick(tab) {
if (tab.name == 1) {
this.awardsMode = 1
} else {
this.awardsMode = 2
}
},
/**
* 统一报名
* @param data
*/
async openUniteApply(data) {
this.applyUserModel = data.applyUserModel
this.appliedData2 = []
this.eventName = data.allName
if (data.applyUserModel === 1) {
if ([1, 2].includes(data.applyType) && !data.isLeader) {
this.restrictMaxNum = data.athletesMaxNum + data.coachNum + data.leanderNum + data.substituteNum
this.athleteMaxNum = data.athletesMaxNum
} else {
this.athleteMaxNum = data.leanderNum
}
} else {
if (data.applyType === 1) {
this.restrictMaxNum = data.athletesMaxNum + data.coachNum + data.leanderNum + data.substituteNum
this.athleteMaxNum = data.athletesMaxNum
} else {
if (data.unionLimit) {
data.unionLimit = JSON.parse(data.unionLimit)
const unionLimit = data.unionLimit.find(v => v.id === "${@shiro.getPrincipalProperty('unit').getUnionid()}")
this.athleteMaxNum = unionLimit.limitCount
} else {
this.athleteMaxNum = 0
}
}
}
this.isLeader = data.isLeader
this.leaderIsAthlete = false
this.coachIsAthlete = false
this.leaders = []
this.coach = []
this.leanderNum = data.leanderNum
this.coachNum = data.coachNum
this.substituteNum = data.substituteNum
this.restrictGirlNum = data.restrictGirlNum
this.restrictBoyNum = data.restrictBoyNum
this.deputyDirectorNum = data.deputyDirectorNum
this.projectType = data.projectType
const now = moment().valueOf()
if (now < moment(data.applyStartTime).valueOf() || now > moment(data.applyEndTime).valueOf()) {
this.$notify({
title: '警告',
message: '此活动不在报名时间内',
type: 'warning'
});
return
}
this.tabkey = new Date().getTime()
if (data.projectType == 1) {
this.combinationMethod = 1
this.activeName = "1"
} else {
this.combinationMethod = 2
this.activeName = "2"
}
const {
activityId,
eventId,
id,
projectType,
isMenWomen,
startAgeDate,
endAgeDate
} = data
this.$set(data, "loading", true)
this.uniteApplyReset()
const resp = await $.get(loc() + "/getUniteApplyInfo", {
activityId: activityId,
eventId: eventId,
schoolEventId: id,
projectType: projectType,
isMenWomen: isMenWomen,
startAgeDate: startAgeDate,
endAgeDate: endAgeDate
})
this.$set(data, "loading", false)
if (resp.code === 0) {
const {users, awardsModeT, awardsModeG, team, activity, getEvent} = resp.data
this.activityData = activity
this.eventData = getEvent
this.teams = team
if (this.teams.length) {
this.team = this.teams[0].id
this.teamId = this.teams[0].id
}
if (users) {
this.applyUsers = users
this.applyData = users.map(user => {
return this.getTransProp(user)
})
}
if (awardsModeG.length > 0) {
this.appliedData = awardsModeG
}
if (awardsModeT.length > 0) {
this.appliedData = awardsModeT
}
this.flushApplyed(this.appliedData)
this.sortApplyed()
this.$refs.guava.edit()
} else {
this.notifyWarning(resp.msg)
}
},
async getUserData(userId) {
const {data} = await $.get(loc() + "/getUserData", {userId})
return data
},
async userChange() {
const userData = await this.getUserData(this.teammateEnterFormData.userId);
this.$set(this.teammateEnterFormData, 'sex', userData.sex)
this.$set(this.teammateEnterFormData, 'username', userData.username)
this.$set(this.teammateEnterFormData, 'loginname', userData.loginname)
this.$set(this.teammateEnterFormData, 'unitId', userData.unitid)
this.$set(this.teammateEnterFormData, 'unionId', userData.unionid)
this.$set(this.teammateEnterFormData, 'mobile', userData.mobile)
this.$set(this.teammateEnterFormData, 'activityId', this.personalEnterFormData.activityId)
this.$set(this.teammateEnterFormData, 'divisionLevelLeadership', false)
this.$set(this.teammateEnterFormData, 'identity', ['1'])
this.$set(this.teammateEnterFormData, 'eventId', this.personalEnterFormData.eventId)
},
async userRemoteMethod(query) {
if (query) {
this.userLoading = true
const resp = await $.get(loc() + "/getUserUnion", {query})
this.userOptions = resp
this.userLoading = false
}
},
async getActivityCount(teamId) {
const resp = await $.post(loc() + "/getActivityCount", {teamId})
return resp;
},
async remoteMethod(query) {
if (query !== '') {
this.searchLoading = true
const resp = await $.get(loc() + "/leaderSearch", {
personType: this.activityData.personType,
eventId: this.eventData.eventId,
keyWord: query
})
this.searchLoading = false
if (resp.code === 0) {
this.leaderOptions = v
} else {
this.notifyWarning(resp.msg)
this.leaderOptions = []
}
} else {
this.leaderOptions = [];
}
},
doAddUser() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
const data = {
eventId: this.eventData.eventId,
activityId: this.activityData.id,
team: this.teams.find(x => x.id === this.formData.teamId).name,
unitname: this.unitOptions.find(x => x.id === this.formData.unitId).name,
...this.formData
}
this.appliedData.push(data)
this.sortApplyed()
this.flushApplyed(this.appliedData)
this.$notify.success({title: '成功', message: '已添加'});
this.dialogVisible = false
} else {
this.$notify.error({title: '错误', message: '存在未填写的的必填项'});
}
})
},
doAddUser2() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
const data = {
eventId: this.eventData.eventId,
activityId: this.activityData.id,
unitname: this.unitOptions.find(x => x.id === this.formData.unitId).name,
...this.formData
}
this.appliedData3.push(data)
this.sortApplyed()
this.flushApplyed(this.appliedData)
this.$notify.success({title: '成功', message: '已添加'});
this.dialogVisible2 = false
} else {
this.$notify.error({title: '错误', message: '存在未填写的的必填项'});
}
})
},
openAddUser() {
this.formData = {teamId: this.team, identity: ['1']}
this.dialogVisible = true
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
openAddUserD() {
this.formData = {identity: ['1']}
this.dialogVisible2 = true
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
async doApplied(flag1) {
let flag = true
let msg = null
await this.apply()
const {
athletesMaxNum,
restrictGirlNum,
restrictBoyNum,
leanderNum,
coachNum,
deputyDirectorNum,
substituteNum,
projectType
} = this.eventData
if (flag1) {
const appliedData = clone(this.appliedData)
const teamAppliedData = groupBy(appliedData, (v) => {
return v.teamId
})
//团体做的判断
if (projectType === '2' && this.appliedData3.length === 0 && this.appliedData.length === 0) {
this.$notify.warning({
title: '警告',
message: '每支队伍最少运动员人数' + this.athleteMaxNum + '人'
});
return
}
for (let i = 0; i < teamAppliedData.length; i++) {
const teamName = teamAppliedData[i][0].team
//教练
const identity2 = teamAppliedData[i].filter(v => v.identity.includes('2')).length
//领队
const identity3 = teamAppliedData[i].filter(v => v.identity.includes('3')).length
//处级领导
const identity4 = teamAppliedData[i].filter(v => v.identity.includes('4')).length
//替补
const identity5 = teamAppliedData[i].filter(v => v.identity.includes('5')).length
if (deputyDirectorNum > 0 && identity4 > deputyDirectorNum) {
flag = false
msg = teamName + '处级领导应设置' + deputyDirectorNum + '人'
break;
}
if (leanderNum > 0 && (identity3 === 0 || identity3 > leanderNum)) {
flag = false
msg = teamName + '领队应设置' + leanderNum + '人'
break;
}
if (coachNum > 0 && (identity2 === 0 || identity2 > coachNum)) {
flag = false
msg = teamName + '教练应设置' + coachNum + '人'
break;
}
if (substituteNum > 0 && identity5 > substituteNum) {
flag = false
msg = teamName + '替补最多设置' + substituteNum + '人'
break;
}
if (restrictGirlNum > 0 && teamAppliedData[i].filter(v => v.sex === '女' && v.identity.includes('1')).length < restrictGirlNum) {
flag = false
msg = teamName + '女运动员至少设置' + restrictGirlNum + '人'
break;
}
if (restrictBoyNum > 0 && teamAppliedData[i].filter(v => v.sex === '男' && v.identity.includes('1')).length < restrictBoyNum) {
flag = false
msg = teamName + '男运动员至少设置' + restrictBoyNum + '人'
break;
}
//团体才做的判断
if (projectType === '2') {
if ((athletesMaxNum ? athletesMaxNum : (restrictGirlNum + restrictBoyNum)) > 0 && (teamAppliedData[i].filter(v => v.identity.includes('1')).length < (athletesMaxNum ? athletesMaxNum : (restrictGirlNum + restrictBoyNum)) || teamAppliedData[i].filter(v => v.identity.includes('1')).length > (athletesMaxNum ? athletesMaxNum : (restrictGirlNum + restrictBoyNum)))) {
flag = false
msg = teamName + '运动员应设置' + (athletesMaxNum ? athletesMaxNum : (restrictGirlNum + restrictBoyNum)) + '人'
break;
}
}
}
if (!flag && this.isLeader == false) {
this.$notify.warning({title: '警告', message: msg});
return;
}
}
if (!flag1) {
const confirm = await this.$confirm('如果选择保存,报名人员会发生调整,需重新提交! 是否保存?', '提示', {type: 'warning'})
if (confirm === "confirm") {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + "/doApply",
{
pass: flag1,
eventId: this.eventData.eventId,
data: JSON.stringify(this.appliedData),
projectType: projectType
}
)
loading.close()
if (resp.code === 0) {
this.pageData()
this.$refs.guava.index()
} else {
this.notifyWarning(resp.msg)
}
}
} else {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + "/doApply",
{
pass: flag1,
eventId: this.eventData.eventId,
data: JSON.stringify(this.appliedData),
projectType: projectType
}
)
loading.close()
if (resp.code === 0) {
this.pageData()
this.$refs.guava.index()
} else {
this.notifyWarning(resp.msg)
}
}
},
async delApplyed(index, row, num) {
if (row.identity.length == 1) {
this.$set(row, "loading", true)
const user = this.applyUsers.find(v => {
return v.id === row.userId
})
if (user) {
this.applyData.push(this.getTransProp(user))
} else {
if (row.userId) {
const u = await this.findUserOne(row.userId)
this.applyUsers.push(u)
this.applyData.push(this.getTransProp(u))
}
}
this.appliedData = this.appliedData.filter(v => v.userId != row.userId)
this.$set(row, "loading", false)
this.appliedData2.splice(index, 1)
this.appliedData3.splice(index, 1)
} else {
if (num === '3') {
this.leader = {}
} else if (num === '2') {
this.coach = {}
} else if (num == '4') {
row.divisionLevelLeadership = false
}
row.identity.splice(row.identity.indexOf(num), 1);
}
},
async findUserOne(id) {
const {data} = await $.get(loc() + "/findUserOne", {id})
return data
},
getTransProp(user) {
return {
id: user.id,
// name: user.username + "" + (user.sex ? user.sex : '') + "-" + user.loginname + "-" + user.unitname + "-" + user.birthday + "",
name: user.username + "" + (user.sex ? user.sex : '') + "-" + user.loginname + "-" + user.birthday + "-" + user.age + "岁)",
}
},
sortApplyed() {
this.appliedData2.sort((a, b) => {
return b.identity - a.identity
})
this.appliedData.sort((a, b) => {
return b.identity - a.identity
})
this.appliedData3.sort((a, b) => {
return b.identity - a.identity
})
},
async apply1() {
if (!this.rightChecked.length) {
this.$notify.warning({title: '警告', message: '请在右侧列表中选择人员'});
return;
}
if (this.appliedData3.length + this.rightChecked.length > this.athleteMaxNum) {
this.$notify({
title: '警告',
message: '最多人数为' + this.athleteMaxNum + "人,已有" + this.appliedData3.length + "人",
type: 'warning'
});
return;
}
//当前小队的下标
const teamIndex = this.teams.findIndex(t => t.id === this.team)
if (teamIndex > 0) {
//当前小队上一个小队
const topTeam = this.teams[teamIndex - 1]
const app = this.appliedData.filter(a => a.teamId === topTeam.id)
if (app.length < this.athleteMaxNum) {
this.$notify({
title: '警告',
message: topTeam.name + '未报满,请报满后在报当前队',
type: 'warning'
});
return;
}
}
const activityId = this.pageForm.activityId
const resp = await $.post(loc() + "/getActivityData", {activityId})
const aa = resp.data.filter(v => {
return this.rightChecked.includes(v.userId)
})
const groupData = groupBy(aa, (v) => {
return v.userId
})
const cc = groupData.filter(v => {
if (v.length >= this.eventData.restrictRegNumber) return v
})
const arr = this.applyUsers.filter(v => {
return this.rightChecked.includes(v.id)
})
arr.forEach(v => {
const data = {
id: null,
awardsMode: this.awardsMode,
activityId: this.activityData.id,
unitId: v.unitid,
unitname: v.unitname,
teamId: this.team,
team: this.teams.find(x => x.id == this.team).name,
userId: v.id,
sex: v.sex,
age: v.age,
birthday: v.birthday,
loginname: v.loginname,
username: v.username,
mobile: v.mobile,
identity: ["1"],
divisionLevelLeadership: this.divisionLevelLeadership,
eventId: this.eventData.eventId
}
this.appliedData.push(data)
if (this.eventData.restrictRegNumber >= 0) {
cc.forEach(z => {
if (z[0]) {
const index = this.appliedData.findIndex(x => x.userId === z[0].userId && x.id === null)
if (index > -1) {
this.appliedData.splice(index, 1)
}
}
})
}
})
if (this.eventData.restrictRegNumber >= 0) {
const usernames = cc.map(v => v[0].username).join(',')
if (usernames) {
this.$notify({
title: '警告',
message: usernames + '已报' + this.eventData.restrictRegNumber + '项',
type: 'warning'
});
}
}
this.flushApplyed(this.appliedData)
this.$refs.transfer.clearQuery('right')
this.$refs.transfer.clearQuery('left')
this.applyData = this.applyData.filter(v => {
return !this.rightChecked.includes(v.id)
})
this.divisionLevelLeadership = false
this.rightChecked = []
this.applyValue = []
this.sortApplyed()
},
async apply() {
const {
isManGirlNum,
restrictGirlNum,
restrictBoyNum
} = this.eventData
const arr = this.applyUsers.filter(v => {
return this.rightChecked.includes(v.id)
})
const app = this.appliedData.filter(v => {
return v.identity.includes("1") && v.teamId === this.team
})
if (this.rightChecked.length > this.restrictMaxNum && !this.isLeader) {
this.$notify({
title: '警告',
message: '每队最多人数为' + this.restrictMaxNum + "人,您已勾选" + this.rightChecked.length + "人",
type: 'warning'
});
return;
}
if (app.length + this.rightChecked.length > this.restrictMaxNum) {
this.$notify({
title: '警告',
message: '每队最多人数为' + this.restrictMaxNum + "人。",
type: 'warning'
});
return;
}
if (restrictBoyNum === 0 && arr.filter(v => v.sex === '男').length > 0 && this.isLeader == false && isManGirlNum === false) {
this.$notify({
title: '警告',
message: '该项目暂不支持男性运动员报名',
type: 'warning'
});
return
}
if (restrictGirlNum === 0 && arr.filter(v => v.sex === '女').length > 0 && this.isLeader == false && isManGirlNum === false) {
this.$notify({
title: '警告',
message: '该项目暂不支持女性运动员报名',
type: 'warning'
});
return;
}
arr.forEach(v => {
const data = {
id: null,
loginname: v.loginname,
username: v.username,
awardsMode: this.awardsMode,
activityId: this.activityData.id,
teamId: this.team,
team: this.teams.find(x => x.id == this.team).name,
unitId: v.unitid,
unitname: v.unitname,
age: v.age,
birthday: v.birthday,
userId: v.id,
mobile: v.mobile,
sex: v.sex,
unionCoach: false,
unionLeader: false,
identity: ['1'],
divisionLevelLeadership: this.divisionLevelLeadership,
eventId: this.eventData.eventId
}
this.appliedData.push(data)
})
this.flushApplyed(this.appliedData)
this.$refs.transfer.clearQuery('right')
this.$refs.transfer.clearQuery('left')
this.applyData = this.applyData.filter(v => {
return !this.rightChecked.includes(v.id)
})
this.divisionLevelLeadership = false
this.rightChecked = []
this.applyValue = []
this.sortApplyed()
},
rightChange(v) {
if (this.isLeader) {
this.athleteMaxNum = v.length
if (v.length > this.restrictMaxNum) {
this.$notify({
title: '警告',
message: '每队最多人数为' + this.restrictMaxNum + "人,您已勾选" + v.length + "人",
type: 'warning'
});
this.rightChecked = []
this.applyValue = []
this.sortApplyed()
}
}
this.rightChecked = v
},
flushApplyed(applyed) {
this.applyedTabLoading = true
//如果项目等于单项
if (this.eventData.projectType === '1') {
this.appliedData3 = applyed.filter(v => {
return v.teamId == this.team
})
} else {
this.appliedData2 = applyed.filter(v => {
return v.teamId == this.team
})
}
this.applyedTabLoading = false
},
rightCheckChange(v, v2) {
this.rightChecked = v
},
filterMethod(query, item) {
return item.name.indexOf(query) > -1;
},
uniteApplyReset() {
this.applyData = []
this.applyValue = []
this.appliedData = []
this.appliedData2 = []
this.appliedData3 = []
this.divisionLevelLeadership = false
this.team = ''
this.rightChecked = []
this.teams = []
this.activityData = {}
this.searchLoading = false
this.leaderOptions = []
this.leader = {}
this.leaderId = ""
this.coachId = ""
},
openView(row) {
const {id} = row
this.$refs.info.getInfo(id)
this.$refs.guava.add()
},
async changeType() {
if (this.pageForm.type) {
this.events2 = await activity.getEvents(this.pageForm.type)
}
this.$set(this.pageForm, 'events', '')
},
doDelete(row) {
this.eventList = row
this.$refs.guava.view()
},
async doAdd() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
const formData = JSON.parse(JSON.stringify(this.formData))
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
const resp = await $.post(loc() + "/doAdd", {
data: JSON.stringify(formData),
})
loading.close()
if (resp.code === 0) {
this.pageData()
this.$refs.guava.index()
} else {
this.notifyWarning(resp.msg)
}
} else {
this.$notify.error({title: '错误', message: '存在未填写的的必填项'});
}
});
},
openAdd() {
this.formData = {}
this.$refs.guava.edit()
this.$nextTick(() => {
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
})
},
async activityInfoData() {
const resp = await $.post(loc() + "/activityData", this.pageForm)
if (resp.code === 0) {
this.activityList = resp.data
} else {
this.notifyWarning(resp.msg)
}
},
pageData() {
sublime.showLoadingbar();
this.tabLoading = true
const pageForm = clone(this.pageForm)
pageForm.isMenWomen = JSON.stringify(pageForm.isMenWomen)
$.post(base + "/platform/activity/apply/pageData", pageForm, (data) => {
sublime.closeLoadingbar();
this.tabLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
},
async created() {
await this.activityInfoData()
/*this.pageData()*/
await this.changeYear()
await this.userLeaderCoach()
await this.changeActivit()
this.planList = await activity.getSchoolActivityPlan()
this.unitOptions = await getUnits(null)
}
})
</script>
<!--#
}
#-->