Files
UNION_NSI/target/classes/views/platform/activity/school/ActivityApply.html
T
2026-09-08 19:49:21 +08:00

2295 lines
106 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 class="platform" id="app" 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
@change="activityInfoData"
placeholder="选择年"
style="width: 100%" type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">活动状态</div>
<div class="search-item-option">
<el-radio-group @change="activityInfoData" v-model="pageForm.isActivity"
>
<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 :key="index"
v-for="index in Math.ceil(activityList.length/4)">
<el-row :gutter="20">
<el-col :span="6"
v-for="item in activityList.slice((index-1)*4,index*4)">
<el-card
:class="'box-card '+(item.id===pageForm.activityId?'activeCard':'')"
style="border-radius: 10px;cursor: pointer">
<div @click="openApply(item)" class="clearfix"
slot="header"
style="font-size: 16px;padding: 5px 0;display: flex">
<div :title="item.NAME"
style="width: calc(100% - 120px);white-space: nowrap;overflow: hidden;text-overflow: ellipsis">
{{item.NAME}}
</div>
<div style="width: 120px;">
<el-button @click="openApply(item)" class="reserve_btn"
type="text">
请选择活动报名
</el-button>
</div>
<!-- <el-tooltip class="item" effect="dark" :content="item.NAME"-->
<!-- placement="top-start">-->
<!-- <span v-if="item.NAME.length<=10">{{item.NAME}}</span>-->
<!-- <span v-else>{{item.NAME.substr(0,10)}}...</span>-->
<!-- </el-tooltip>-->
</div>
<div @click="openApply(item)">
<div class="text e-item">
<span style="color: gray">活动类型:</span>
<span v-if="item.gameStyle===1">{{item.activityLevelName}}</span>
<el-tag effect="dark" style="float: right"
type="danger"
v-if="moment(item.applyEndTime).valueOf() <moment().valueOf()">
报名结束
</el-tag>
<el-tag effect="dark" style="float: right"
type="success"
v-else-if="moment().valueOf()>moment(item.applyStartTime).valueOf()&&moment().valueOf()<moment(item.applyEndTime).valueOf()">
报名中
</el-tag>
<el-tag effect="dark" style="float: right"
type="danger"
v-else-if="moment().valueOf()<moment(item.applyEndTime).valueOf()">
报名未开始
</el-tag>
</div>
<div class="text e-item">
<span style="color: gray">活动地址:</span>
{{item.address}}
</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 class="mt10" shadow="never">
<table-tool :app="this" label="活动项目信息">
<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 @change="doSearch" clearable
filterable
placeholder="请选择组别"
style="width: 100%;margin-bottom: 5px;margin-left: 10px"
v-if="unionLeaderCoach"
v-model="pageForm.groupName">
<el-option
:key="item.id"
:label="item.name"
:value="item.name"
v-for="item in groupList">
</el-option>
</el-select>
</div>
<div class="search-item-option ml5">
<el-select @change="doSearch" clearable
filterable
placeholder="请选择活动项目"
style="width: 100%;margin-bottom: 5px;margin-left: 10px"
v-if="unionLeaderCoach"
v-model="pageForm.eventId">
<el-option
:key="item.id"
:label="item.allName"
:value="item.eventId"
v-for="item in events">
</el-option>
</el-select>
</div>
</template>
<template #func>
<!-- <div v-if="unionLeaderCoach" class="mr10">-->
<!-- &lt;!&ndash; 团长:<span style="color: #419BF8">{{headData.username | str}}</span>&emsp13;&ndash;&gt;-->
<!-- 领队:<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" :size="tableSize" @sort-change="pageOrder"
class="vi-table" row-key="id" style="width: 100%;margin-bottom: 20px"
v-loading="tableLoading">
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index"
width="80px"></el-table-column>
<el-table-column
:key="column.prop"
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns">
<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 align="center" header-align="center" label="报名操作"
prop="userOnline"
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 :loading="row.loading" size="mini">
<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')||@shiro.hasRole('ghzl')){#-->
<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 @click="doApplied(false)" type="primary">保 存</el-button>
<el-button @click="doApplied(true)" type="primary">提 交</el-button>
</template>
<template #edit>
<el-timeline>
<el-timeline-item placement="top" timestamp="设置人员">
<el-tabs @tab-click="handleTabClick" tab-position="top" v-model="activeName">
<el-tab-pane :label="eventName" name="1" v-if="combinationMethod==1">
<el-card>
<el-transfer
:data="applyData"
:filter-method="filterMethod"
:props="{key: 'id',label: 'name'}"
:right-default-checked="rightChecked"
:titles="['可报人员名单', '当前选择']"
@change="rightChange"
@right-check-change="rightCheckChange"
filterable
ref="transfer"
v-model="applyValue">
<template #right-footer>
<div class="transfer">
<el-button @click="apply1(1)" icon="el-icon-plus"
size="small"
type="primary">
设置人员
</el-button>
</el-button>
</div>
</template>
</el-transfer>
<div style="display: flex;margin: 20px 0" v-if="athleteMaxNum<100">
<el-divider content-position="left">
单项报名人数最多{{athleteMaxNum}}
人,该队已有{{appliedData3.length}}
名成员,还可报名{{athleteMaxNum-appliedData3.length}} 人
。(系统中查询不到的人可以点击右边按钮添加)
</el-divider>
<div style="padding-left: 10px">
<el-tooltip class="item" content="系统中查询不到的人可以点击添加"
effect="dark"
placement="top">
<el-button
:disabled="(eventData.restrictTotalPeople-appliedData3.length)<=0"
@click="openAddUserD" circle icon="el-icon-plus"
type="danger"></el-button>
</el-tooltip>
</div>
</div>
<el-table :data="appliedData3" :key="tabkey" border class="mt20"
size="small"
stripe>
<el-table-column
align="center" header-align="center" label="序号"
type="index"
width="100">
</el-table-column>
<el-table-column
align="center" header-align="center" label="姓名"
prop="username">
</el-table-column>
<el-table-column
align="center" header-align="center" label="教工号"
prop="loginname">
</el-table-column>
<el-table-column
align="center" header-align="center" label="单位"
prop="unitname"
sortable>
</el-table-column>
<el-table-column
align="center" header-align="center" label="电话"
prop="mobile">
</el-table-column>
<el-table-column
align="center" header-align="center" label="年龄"
prop="age">
</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>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!--<el-table-column prop="notes" header-align="center" align="center"
label="备注(如不能参加请填写备注原因)" width="300px">
<template scope="{$index,row}">
<el-input v-model="row.notes" max="50"></el-input>
</template>
</el-table-column>-->
<!-- <el-table-column align="center" header-align="center"
label="参加地点(仙林校区/灵谷寺校区)"
prop="campus" width="300px">
<template scope="{$index,row}">
<el-select v-model="row.campus">
<el-option :key="item.campus_id"
:label="item.campus_name"
:value="item.campus_name"
v-for="item in campusList"></el-option>
</el-select>
</template>
</el-table-column>-->
<el-table-column align="center" label="操作" label="操作">
<template scope="{$index,row}">
<el-button @click="delApplyed($index,row,'1')"
size="mini"
type="danger">删除
</el-button>
</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
:data="applyData"
:filter-method="filterMethod"
:props="{key: 'id',label: 'name'}"
:right-default-checked="rightChecked"
:titles="['可报人员名单', '当前选择']"
@change="rightChange"
@right-check-change="rightCheckChange"
filterable
ref="transfer"
v-model="applyValue">
<template #left-footer>
<div></div>
</template>
<template #right-footer>
<div class="transfer">
<el-select :clearable="false"
@change="flushApplyed(appliedData)"
placeholder="队伍"
size="small"
v-model="team">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in teams">
</el-option>
</el-select>
<el-button @click="apply(1)" class="m10"
icon="el-icon-plus"
size="small"
type="primary" 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 @click="setLeader2()" icon="el-icon-check" plain
size="small"
type="primary"
v-if="leanderNum>0">设置领队
</el-button>
<el-button @click="setCoach2" icon="el-icon-check" plain
size="small" type="primary"
v-if="coachNum>0">
设置教练
</el-button>
<el-button @click="setDivisionLevelLeadership"
icon="el-icon-check"
plain
size="small" type="primary"
v-if="deputyDirectorNum>0">
设置处级领导
</el-button>
<el-button @click="setSubstitute" icon="el-icon-check"
plain
size="small" type="primary"
v-if="substituteNum>0">
设置替补
</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 size="small" type="primary">
修改小队<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 :data="appliedData2" :key="tabkey"
@selection-change="handleSelectionChange" border
class="mt10" ref="multipleTable"
row-key="id" size="small"
stripe
v-if="appliedData2.length>0"
v-loading="applyedTabLoading">
<el-table-column :reserve-selection="true"
type="selection"
width="55">
</el-table-column>
<el-table-column
align="center" header-align="center" label="序号"
type="index"
width="100">
</el-table-column>
<el-table-column
align="center" header-align="center" label="所属队"
prop="team">
</el-table-column>
<el-table-column
align="center" header-align="center" label="姓名"
prop="username">
</el-table-column>
<el-table-column
align="center" header-align="center" label="教工号"
prop="loginname">
</el-table-column>
<el-table-column
align="center" header-align="center" label="单位"
prop="unitname"
sortable>
</el-table-column>
<el-table-column
align="center" header-align="center" label="电话"
prop="mobile">
</el-table-column>
<el-table-column
align="center" header-align="center" label="性别"
prop="sex">
</el-table-column>
<el-table-column
align="center" header-align="center" label="年龄"
prop="age">
</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-column align="center" header-align="center"
label="备注(如不能参加请填写备注原因)"
prop="notes" width="300px">
<template scope="{$index,row}">
<el-input max="50" v-model="row.notes"></el-input>
</template>
</el-table-column>
<el-table-column align="center" label="操作" label="操作">
<template scope="{$index,row}">
<el-button @click="delApplyed($index,row,'1')"
size="mini"
type="danger">删除
</el-button>
</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" ref="delete_info"
v-model="selection"></delete_info>
</template>
</guava>
<el-dialog
:visible.sync="dialogLeaderCoach"
title="添加领队/教练/工作人员"
width="60%"
>
<el-form :model="headData" :rules="formRules" label-width="100px" ref="form">
<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 label="姓&emsp;&emsp;名" prop="userId">
<el-select
:loading="userLoading"
:remote-method="userLeaderCoach"
@change="changeLeader"
clearable
filterable
placeholder="请输入姓名或工号查找"
remote
reserve-keyword
style="width: 100%"
v-model="LeaderData.userId">
<el-option
:key="item.id"
:label="item.username+ ''+item.sex+''+''+item.loginname+''"
:value="item.id"
v-for="item in userOptions">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所在单位" prop="unitId">
<el-select clearable filterable placeholder="请选择所在单位"
style="width: 100%"
v-model="LeaderData.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="电&emsp;&emsp;话" prop="mobile">
<el-input maxlength="50" placeholder="请填写电话" type="text"
v-model="LeaderData.mobile"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<vi-title title="填写教练信息"></vi-title>
<el-form-item label="姓&emsp;&emsp;名" prop="userId">
<el-select
:loading="userLoading"
:remote-method="userLeaderCoach"
@change="changeCoach"
clearable
filterable
placeholder="请输入姓名或工号查找"
remote
reserve-keyword
style="width: 100%"
v-model="CoachData.userId">
<el-option
:key="item.id"
:label="item.username+ ''+item.sex+''+''+item.loginname+''"
:value="item.id"
v-for="item in userOptions">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所在单位" prop="unitId">
<el-select clearable filterable placeholder="请选择所在单位"
style="width: 100%"
v-model="CoachData.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="电&emsp;&emsp;话" prop="mobile">
<el-input maxlength="50" placeholder="请填写电话" type="text"
v-model="CoachData.mobile"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<vi-title title="填写工作人员信息"></vi-title>
<el-form-item label="姓&emsp;&emsp;名" prop="userId">
<el-select
:loading="userLoading"
:remote-method="userLeaderCoach"
@change="changeStaff"
clearable
filterable
placeholder="请输入姓名或工号查找"
remote
reserve-keyword
style="width: 100%"
v-model="staffData.userId">
<el-option
:key="item.id"
:label="item.username+ ''+item.sex+''+''+item.loginname+''"
:value="item.id"
v-for="item in userOptions">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="所在单位" prop="unitId">
<el-select clearable filterable placeholder="请选择所在单位"
style="width: 100%"
v-model="staffData.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="电&emsp;&emsp;话" prop="mobile">
<el-input maxlength="50" placeholder="请填写电话" type="text"
v-model="staffData.mobile"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="dialogLeaderCoach = false">取 消</el-button>
<el-button @click="doLeaderCoach" plain type="primary">确 认</el-button>
</span>
</el-dialog>
<el-dialog
:visible.sync="dialogVisible"
title="添加人员"
width="40%"
>
<el-form :model="formData" :rules="formRules" label-width="100px" ref="form">
<el-form-item label="所在队伍" prop="teamId">
<el-select clearable disabled placeholder="请选择所在队伍" style="width: 100%"
v-model="formData.teamId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in teams">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="姓&emsp;&emsp;名" prop="username">
<el-input maxlength="50" placeholder="请填写姓名" type="text"
v-model="formData.username"></el-input>
</el-form-item>
<el-form-item label="工&emsp;&emsp;号" prop="loginname">
<el-input maxlength="50" placeholder="请填写工号" type="text"
v-model="formData.loginname"></el-input>
</el-form-item>
<el-form-item label="电&emsp;&emsp;话" prop="mobile">
<el-input maxlength="50" placeholder="请填写电话" type="text"
v-model="formData.mobile"></el-input>
</el-form-item>
<el-form-item label="性&emsp;&emsp;别" prop="sex">
<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 label="处级领导" prop="divisionLevelLeadership">
<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 label="所在单位" prop="unitId">
<el-select clearable filterable placeholder="请选择所在单位" style="width: 100%"
v-model="formData.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button @click="doAddUser" type="primary">确 定</el-button>
</span>
</el-dialog>
<el-dialog
:visible.sync="dialogVisible2"
title="添加人员"
width="40%"
>
<el-form :model="formData" :rules="formRules" label-width="100px" ref="form">
<el-form-item label="姓&emsp;&emsp;名" prop="username">
<el-input maxlength="50" placeholder="请填写姓名" type="text"
v-model="formData.username"></el-input>
</el-form-item>
<el-form-item label="工&emsp;&emsp;号" prop="loginname">
<el-input maxlength="50" placeholder="请填写工号" type="text"
v-model="formData.loginname"></el-input>
</el-form-item>
<el-form-item label="电&emsp;&emsp;话" prop="mobile">
<el-input maxlength="50" placeholder="请填写电话" type="text"
v-model="formData.mobile"></el-input>
</el-form-item>
<el-form-item label="所在单位" prop="unitId">
<el-select clearable filterable placeholder="请选择所在单位" style="width: 100%"
v-model="formData.unitId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in unitOptions">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="dialogVisible2 = false">取 消</el-button>
<el-button @click="doAddUser2" type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
<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;
};
var 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: 'applyNum2', 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,
selection: [],
groupList: [
{value: 1, name: "甲组"},
{value: 2, name: "乙组"},
{value: 3, name: "丙组"},
{value: 4, name: "丁组"}
],
campusList: [],
}
},
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')
})
this.$refs.multipleTable.clearSelection();
this.leader = 3
},
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')
})
this.$refs.multipleTable.clearSelection();
this.coach = 2
},
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
})
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)
}
)
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.appliedData3 = 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
debugger
if (this.eventData.projectType === '2') {
await this.apply()
} else {
await this.apply1()
}
if (flag1) {
const {
athletesMaxNum,
restrictGirlNum,
restrictBoyNum,
leanderNum,
coachNum,
deputyDirectorNum,
substituteNum
} = this.eventData
const appliedData = clone(this.appliedData)
const teamAppliedData = groupBy(appliedData, (v) => {
return v.teamId
})
if (this.appliedData3 && this.appliedData3.length > 0) {
/*const campusList = this.appliedData3.map(v => v.campus)
if (campusList.includes(null)) {
this.$notify.warning({
title: '警告',
message: '请填写参加地点'
});
return
}*/
}
if (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
if (deputyDirectorNum > 0 && teamAppliedData[i].filter(v => v.divisionLevelLeadership).length > deputyDirectorNum) {
flag = false
msg = teamName + '处级领导应设置' + deputyDirectorNum + '人'
break;
}
if (leanderNum > 0 && teamAppliedData[i].filter(v => v.identity.includes('3')).length > leanderNum) {
flag = false
msg = teamName + '领队应设置' + leanderNum + '人'
break;
}
if (coachNum > 0 && teamAppliedData[i].filter(v => v.identity.includes('2')).length > coachNum) {
flag = false
msg = teamName + '教练应设置' + coachNum + '人'
break;
}
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 (teamAppliedData[i].filter(v => v.identity.includes('5')).length > 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 (!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),
appliedData3: JSON.stringify(this.appliedData3)
}
)
loading.close()
if (resp.code === 0) {
this.$message.success(resp.msg)
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),
appliedData3: JSON.stringify(this.appliedData3)
}
)
loading.close()
if (resp.code === 0) {
this.$message.success(resp.msg)
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) {
console.log(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.age + "岁-" + user.userstatex + "",
}
},
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.appliedData3.length + this.rightChecked.length > this.athleteMaxNum) {
this.$notify({
title: '警告',
message: '最多人数为' + this.athleteMaxNum + "人,已有" + this.appliedData3.length + "人",
type: 'warning'
});
return;
}
if (this.appliedData3.length === 0 && !this.rightChecked.length) {
this.$notify.warning({title: '警告', message: '请在右侧列表中选择人员'});
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,
userId: v.id,
sex: v.sex,
age: v.age,
campus: null,
birthday: v.birthday,
team: "会员",
loginname: v.loginname,
username: v.username,
mobile: v.mobile,
identity: ["1"],
divisionLevelLeadership: this.divisionLevelLeadership,
eventId: this.eventData.eventId
}
this.appliedData3.push(data)
if (this.eventData.restrictRegNumber >= 0) {
cc.forEach(z => {
if (z[0]) {
const index = this.appliedData3.findIndex(x => x.userId === z[0].userId && x.id === null)
if (index > -1) {
this.appliedData3.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.$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.eventData.projectType === '2' ? this.team : null,
team: this.eventData.projectType === '2' ? 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
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)
this.campusList = await getCampus()
}
})
</script>
<!--#
}
#-->