This commit is contained in:
2025-09-13 14:42:21 +08:00
parent efc7f9ceb2
commit b0e7aa89c2
11 changed files with 818 additions and 266 deletions
@@ -12,225 +12,324 @@ const groupBy = (list, fn) => {
})
}
var ACTIVITY_SPORTS_APPLY_USER = {
template: `
<div style="margin: 20px">
<el-tabs tab-position="top" v-model="activeName">
<el-tab-pane :label="activityTableData.allName" name="1">
<el-card>
<el-transfer
:data="leftApplyUserList"
:filter-method="filterMethod"
:props="{key: 'id',label: 'name'}"
:titles="['可报人员名单', '当前选择']"
filterable
ref="transfer"
v-model="rightApplyUserList">
<template #right-footer>
<div class="transfer">
<el-select :clearable="false"
@change="flushApplyUser(applyUserList)"
placeholder="队伍"
size="small"
v-if="activityTableData.eveProjectType=='2'"
v-model="applyFromData.teamId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in teamList">
</el-option>
</el-select>
<el-button @click="applyUser" icon="el-icon-plus"
size="small"
type="primary">
参加比赛
</el-button>
</div>
</template>
</el-transfer>
template: /*language=HTML*/ `
<div style="margin: 20px">
<el-tabs tab-position="top" v-model="activeName">
<el-tab-pane :label="activityTableData.allName" name="1">
<el-card>
<el-transfer
:data="leftApplyUserList"
:filter-method="filterMethod"
:props="{key: 'id',label: 'name'}"
:titles="['可报人员名单', '当前选择']"
filterable
ref="transfer"
v-model="rightApplyUserList">
<template #right-footer>
<div class="transfer">
<el-select :clearable="false"
@change="flushApplyUser(applyUserList)"
placeholder="队伍"
size="small"
v-if="activityTableData.eveProjectType=='2'"
v-model="applyFromData.teamId">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in teamList">
</el-option>
</el-select>
<el-button @click="applyUser" icon="el-icon-plus"
size="small"
type="primary">
参加比赛
</el-button>
</div>
</template>
</el-transfer>
<!-- 个人项目-->
<template v-if="activityTableData.eveProjectType==='1'">
<div style="display: flex;margin: 20px 0">
<el-divider content-position="left">
单项报名人数最多{{activityTableData.athleteMaxNum}}
人,该队已有{{applyUserTableData.length}}
名成员,还可报名{{activityTableData.athleteMaxNum-applyUserTableData.length}}
</el-divider>
</div>
</template>
<!-- 团体项目-->
<template v-if="activityTableData.eveProjectType==='2'">
<!-- 如果是只需要报领队 -->
<div style="display: flex;margin: 20px 0;align-items: center;"
v-if="activityTableData.isLeader">
<el-divider content-position="left">每支队伍最少运动员人数
{{activityTableData.restrictMaxNum}} 人,最多
{{activityTableData.restrictMaxNum}} 人,该队运动员已有
{{activityTableData.athleteMaxNum}} 名成员,还可报名
{{activityTableData.restrictMaxNum-applyUserTableData.filter(v=>v.identity.includes('1')).length}}
人。
</el-divider>
</div>
<!--如果是正常报名-->
<template v-if="!activityTableData.isLeader">
<div style="display: flex;margin: 20px 0;align-items: center;">
<el-divider content-position="left">每支队伍最多
{{activityTableData.restrictMaxNum}}
人,其中领队{{activityTableData.leanderNum}}人,
教练{{activityTableData.coachNum}}人,
运动员必须设置{{activityTableData.athleteMaxNum}}人,
替补{{activityTableData.substituteNum}}人。
男运动员最少{{activityTableData.restrictBoyNum?activityTableData.restrictBoyNum:'0'}}人,
女运动员最少{{activityTableData.restrictGirlNum?activityTableData.restrictGirlNum:'0'}}人【该队运动员已有
{{applyUserTableData.filter(v=>v.identity.includes('1')).length}}
人,还可报名
{{activityTableData.athleteMaxNum-applyUserTableData.filter(v=>v.identity.includes('1')).length}}人;
替补还可以报{{activityTableData.substituteNum-applyUserTableData.filter(v=>v.identity.includes('5')).length}}人(非必需)】
</el-divider>
</div>
<el-button @click="setUserRole('4')"
icon="el-icon-check"
plain
size="small" type="primary"
v-if="activityTableData.deputyDirectorNum>0">
设置处级领导
</el-button>
<el-button @click="setUserRole('3')" icon="el-icon-check" plain
size="small"
type="primary"
v-if="activityTableData.leanderNum>0">设置领队
</el-button>
<el-button @click="setUserRole('2')" icon="el-icon-check" plain
size="small" type="primary"
v-if="activityTableData.coachNum>0">
设置教练
</el-button>
<!-- 个人项目-->
<template v-if="activityTableData.eveProjectType==='1'">
<div style="display: flex;margin: 20px 0">
<el-divider content-position="left">
单项报名人数最多{{activityTableData.athleteMaxNum}}
人,该队已有{{applyUserTableData.length}}
名成员,还可报名{{activityTableData.athleteMaxNum-applyUserTableData.length}}
</el-divider>
</div>
</template>
<!-- 团体项目-->
<template v-if="activityTableData.eveProjectType==='2'">
<!-- 如果是只需要报领队 -->
<div style="display: flex;margin: 20px 0;align-items: center;"
v-if="activityTableData.isLeader">
<el-divider content-position="left">每支队伍最少运动员人数
{{activityTableData.restrictMaxNum}} 人,最多
{{activityTableData.restrictMaxNum}} 人,该队运动员已有
{{activityTableData.athleteMaxNum}} 名成员,还可报名
{{activityTableData.restrictMaxNum-applyUserTableData.filter(v=>v.identity.includes('1')).length}}
人。
</el-divider>
</div>
<!--如果是正常报名-->
<template v-if="!activityTableData.isLeader">
<div style="display: flex;margin: 20px 0;align-items: center;">
<el-divider content-position="left">每支队伍最多
{{activityTableData.restrictMaxNum}}
人,其中领队{{activityTableData.leanderNum}}人,
教练{{activityTableData.coachNum}}人,
运动员必须设置{{activityTableData.athleteMaxNum}}人,
替补{{activityTableData.substituteNum}}人。
男运动员最少{{activityTableData.restrictBoyNum?activityTableData.restrictBoyNum:'0'}}人,
女运动员最少{{activityTableData.restrictGirlNum?activityTableData.restrictGirlNum:'0'}}人【该队运动员已有
{{applyUserTableData.filter(v=>v.identity.includes('1')).length}}
人,还可报名
{{activityTableData.athleteMaxNum-applyUserTableData.filter(v=>v.identity.includes('1')).length}}人;
替补还可以报{{activityTableData.substituteNum-applyUserTableData.filter(v=>v.identity.includes('5')).length}}人(非必需)】
</el-divider>
<div style="padding-left: 10px">
<el-tooltip class="item"
content="系统中查询不到的人可以点击添加"
effect="dark"
placement="top">
<el-button
:disabled="(activityTableData.restrictMaxNum-applyUserTableData.length)<=0"
@click="openAddUser" circle icon="el-icon-plus"
type="danger"></el-button>
</el-tooltip>
</div>
</div>
<el-button @click="setUserRole('4')"
icon="el-icon-check"
plain
size="small" type="primary"
v-if="activityTableData.deputyDirectorNum>0">
设置处级领导
</el-button>
<el-button @click="setUserRole('3')" icon="el-icon-check" plain
size="small"
type="primary"
v-if="activityTableData.leanderNum>0">设置领队
</el-button>
<el-button @click="setUserRole('2')" icon="el-icon-check" plain
size="small" type="primary"
v-if="activityTableData.coachNum>0">
设置教练
</el-button>
<el-button @click="setUserRole('5')" icon="el-icon-check"
plain
size="small" type="primary"
v-if="activityTableData.substituteNum>0">
设置替补
</el-button>
<el-dropdown @command="changeTeam"
v-if="activityTableData.eveProjectType==2&&teamList.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}"
:key="item.id" v-for="item in teamList">
{{item.name}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</template>
<el-table :data="applyUserTableData"
@selection-change="handleSelectionChange" border
class="mt10" ref="multipleTable"
row-key="id" size="small"
stripe
v-loading="applyUserTabLoading">
<el-table-column :reserve-selection="true"
align="center" header-align="center"
type="selection"
width="55">
</el-table-column>
<el-table-column
align="center" header-align="center" label="序号"
type="index"
width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="所属队"
prop="team" width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="姓名"
prop="username" width="130">
</el-table-column>
<el-table-column
align="center" header-align="center" label="教工号"
prop="loginname" width="130">
</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="sex" width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="年龄"
prop="age" width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="身份"
prop="identity" width="300px">
<template scope="{$index,row}">
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'4')"
closable
effect="light"
type="info"
v-if="row.identity.includes('4')">处级领导
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'3')"
closable
effect="light"
type="warning"
v-if="row.identity.includes('3')">领队
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'2')"
closable
effect="light"
type="success"
v-if="row.identity.includes('2')">教练
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'1')"
closable
effect="light"
v-if="row.identity.includes('1')">运动员
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'5')"
closable
effect="light"
type="danger"
v-if="row.identity.includes('5')">替补
</el-tag>
<el-button @click="setUserRole('5')" icon="el-icon-check"
plain
size="small" type="primary"
v-if="activityTableData.substituteNum>0">
设置替补
</el-button>
<el-dropdown @command="changeTeam"
v-if="activityTableData.eveProjectType==2&&teamList.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}"
:key="item.id" v-for="item in teamList">
{{item.name}}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
</el-tabs>
</div>
`,
<el-table :data="applyUserTableData"
@selection-change="handleSelectionChange" border
class="mt10" ref="multipleTable"
row-key="id" size="small"
stripe
v-loading="applyUserTabLoading">
<el-table-column :reserve-selection="true"
align="center" header-align="center"
type="selection"
width="55">
</el-table-column>
<el-table-column
align="center" header-align="center" label="序号"
type="index"
width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="所属队"
prop="team" width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="姓名"
prop="username" width="130">
</el-table-column>
<el-table-column
align="center" header-align="center" label="教工号"
prop="loginname" width="130">
</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="sex" width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="年龄"
prop="age" width="80">
</el-table-column>
<el-table-column
align="center" header-align="center" label="身份"
prop="identity" width="300px">
<template scope="{$index,row}">
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'4')"
closable
effect="light"
type="info"
v-if="row.identity.includes('4')">处级领导
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'3')"
closable
effect="light"
type="warning"
v-if="row.identity.includes('3')">领队
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'2')"
closable
effect="light"
type="success"
v-if="row.identity.includes('2')">教练
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'1')"
closable
effect="light"
v-if="row.identity.includes('1')">运动员
</el-tag>
<el-tag :disable-transitions="false"
@close="delApplyUser($index,row,'5')"
closable
effect="light"
type="danger"
v-if="row.identity.includes('5')">替补
</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>
</el-tab-pane>
</el-tabs>
<el-dialog
:append-to-body="true"
:visible.sync="addUserDialogVisible"
title="添加人员"
width="40%"
>
<el-form :model="formData" label-width="100px" ref="lsryform">
<el-form-item label="所在队伍" prop="teamId"
:rules="{required: true, message: '请选择所在队伍', trigger: 'blur'}">
<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 teamList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="姓名" prop="userId"
:rules="{required: true, message: '请输入工号或者姓名查询', trigger: 'blur'}">
<el-select
:remote-method="querySearchAsync"
@change="addUserChange"
filterable
placeholder="请输入工号或者下姓名查询"
remote
reserve-keyword
style="width: 100%"
v-model="formData.userId">
<el-option
:key="item.id"
:label="item.username+'-'+item.loginname"
:value="item.id"
v-for="item in lsUserList">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="工号" prop="loginname"
:rules="{required: true, message: '请填写工号', trigger: 'blur'}">
<el-input disabled maxlength="50" placeholder="请填写工号"
type="text" v-model="formData.loginname"></el-input>
</el-form-item>
<el-form-item label="性别" prop="sex" :rules="{required: true, message: '性别', trigger: 'blur'}">
<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="birthday"
:rules="{required: true, message: '选择出生年月', trigger: 'blur'}">
<el-date-picker
style="width: 100%"
v-model="formData.birthday"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择出生年月">
</el-date-picker>
</el-form-item>
<el-form-item label="电话" prop="mobile">
<el-input maxlength="50" placeholder="请填写电话" type="text"
v-model="formData.mobile"></el-input>
</el-form-item>
<el-form-item label="身份证号" prop="idcard">
<el-input maxlength="30" placeholder="请填写身份证号" type="text"
v-model="formData.idcard"></el-input>
</el-form-item>
<el-form-item label="所在单位" prop="unitId"
:rules="{required: true, message: '请选择所在单位', trigger: 'blur'}">
<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="addUserDialogVisible = false">取 消</el-button>
<el-button @click="doAddUser" type="primary">确 定</el-button>
</span>
</el-dialog>
</div>
`,
store,
mixins: [initTableMixins],
data() {
@@ -253,10 +352,85 @@ var ACTIVITY_SPORTS_APPLY_USER = {
applyUserTabLoading: false,
selection: [],
//全部可报名的人员
userList: []
userList: [],
addUserDialogVisible: false,
lsUserList: [],
unitOptions: []
}
},
methods: {
doAddUser() {
this.$refs["lsryform"].validate(async (valid) => {
if (valid) {
const birthDate = this.$moment(this.formData.birthday);
const age = this.$moment().diff(birthDate, 'years');
const data = {
isAddUser: true,
age: age,
unitname: this.unitOptions.find(x => x.id === this.formData.unitId).name,
...this.formData
}
const newUser = this.userList.find(a => a.id === this.formData.userId)
if (newUser) {
this.notifyWarning('该用户已存在左侧选择框内,请从左侧选择框内选择!')
return
}
this.applyUserList.push(data)
this.flushApplyUser(this.applyUserList)
this.sortApplyUserTableData()
this.$notify.success({title: '成功', message: '已添加'});
this.addUserDialogVisible = false
} else {
this.$notify.error({title: '错误', message: '存在未填写的的必填项'});
}
})
},
async addUserChange(val) {
const user = this.lsUserList.find(l => l.id === val)
this.$set(this.formData, 'eventId', this.eventData.eventId)
this.$set(this.formData, 'activityId', this.activityTableData.activityId)
this.$set(this.formData, 'team', this.applyFromData.teamName)
this.$set(this.formData, 'teamId', this.applyFromData.teamId)
this.$set(this.formData, 'userId', user ? user.id : null)
this.$set(this.formData, 'loginname', user ? user.loginname : null)
this.$set(this.formData, 'username', user ? user.username : null)
this.$set(this.formData, 'unitId', user ? user.unitId : null)
this.$set(this.formData, 'sex', user ? user.sex : null)
this.$set(this.formData, 'idcard', user ? user.idCard : null)
this.$set(this.formData, 'mobile', user ? user.mobile : null)
this.$set(this.formData, 'birthday', user ? user.birthday : null)
this.$set(this.formData, 'awardsMode', this.activityTableData.eveProjectType)
this.$set(this.formData, 'status', 2)
},
async querySearchAsync(queryString) {
/* const leftApplyUserList = this.leftApplyUserList.map(m => m.loginname)
const rightApplyUserList = this.rightApplyUserList.map(m => m.loginname)
const loginnames = leftApplyUserList.concat(rightApplyUserList)*/
const loginnames = this.applyUserTableData.map(m => m.loginname)
const {code, data} = await $.get("/platform/activity/apply/getSysUser", {
loginnames: JSON.stringify(loginnames),
queryString: queryString
})
if (code === 0) {
this.lsUserList = data
} else {
this.lsUserList = []
}
},
openAddUser() {
this.formData = {
teamName: this.applyFromData.teamName,
teamId: this.applyFromData.teamId,
identity: ['1']
}
this.addUserDialogVisible = true
if (this.$refs['lsryform']) {
this.$refs['lsryform'].resetFields()
}
},
async openUniteApply(data) {
this.activityTableData = data
//固定模式
@@ -299,7 +473,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
isMenWomenTwo: data.isMenWomen
})
if (resp.code === 0) {
const { users, awardsModeT, awardsModeG, team, activity, getEvent } = resp.data
const {users, awardsModeT, awardsModeG, team, activity, getEvent} = resp.data
this.activityData = activity
this.eventData = getEvent
this.teamList = team
@@ -332,7 +506,16 @@ var ACTIVITY_SPORTS_APPLY_USER = {
let message = null
if (flag) {
const { athletesMaxNum, restrictGirlNum, restrictBoyNum, leanderNum, coachNum, deputyDirectorNum, substituteNum, projectType } =
const {
athletesMaxNum,
restrictGirlNum,
restrictBoyNum,
leanderNum,
coachNum,
deputyDirectorNum,
substituteNum,
projectType
} =
this.eventData
const applyUserList = clone(this.applyUserList)
@@ -382,13 +565,13 @@ var ACTIVITY_SPORTS_APPLY_USER = {
message = teamName + "替补最多设置" + substituteNum + "人"
break
}
const womanYdyNum = teamApplyData[i].filter((v) => v.sex === "女" && v.identity.includes("1")).length
const womanYdyNum = teamApplyData[i].filter((v) => ["女", "女"].includes(v.sex) && v.identity.includes("1")).length
if (restrictGirlNum > 0 && womanYdyNum < restrictGirlNum) {
msgFlag = false
message = teamName + "女运动员至少设置" + restrictGirlNum + "人"
break
}
const manYdyNum = teamApplyData[i].filter((v) => v.sex === "女" && v.identity.includes("1")).length
const manYdyNum = teamApplyData[i].filter((v) => ["男", "男性"].includes(v.sex) && v.identity.includes("1")).length
if (restrictBoyNum > 0 && manYdyNum < restrictBoyNum) {
msgFlag = false
message = teamName + "男运动员至少设置" + restrictBoyNum + "人"
@@ -397,7 +580,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
}
}
if (!msgFlag && !this.activityTableData.isLeader) {
this.$notify.warning({ title: "警告", message: message })
this.$notify.warning({title: "警告", message: message})
return
}
}
@@ -406,7 +589,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
if (!flag) {
msg = "确定要保存吗?"
}
const confirm = await this.$confirm(msg, "提示", { type: "warning" })
const confirm = await this.$confirm(msg, "提示", {type: "warning"})
if (confirm === "confirm") {
const loading = this.$loading({
lock: true,
@@ -432,10 +615,10 @@ var ACTIVITY_SPORTS_APPLY_USER = {
},
//点击添加运动员操作
async applyUser() {
const { isManGirlNum, restrictGirlNum, restrictBoyNum } = this.eventData
const {isManGirlNum, restrictGirlNum, restrictBoyNum} = this.eventData
if (!this.rightApplyUserList.length) {
this.$notify.warning({ title: "警告", message: "请在右侧列表中选择人员" })
this.$notify.warning({title: "警告", message: "请在右侧列表中选择人员"})
return
}
@@ -492,7 +675,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
}
}
const resp = await this.$axios.post(loc() + "/getActivityData", { activityId: this.activityData.id })
const resp = await this.$axios.post(loc() + "/getActivityData", {activityId: this.activityData.id})
const aa = resp.data.filter((v) => {
return this.rightApplyUserList.includes(v.userId)
})
@@ -515,7 +698,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
username: v.username,
age: v.age,
birthday: v.birthday,
unitId: v.unitid,
unitId: v.unitId,
unionId: v.unionId,
unitname: v.unitname,
userId: v.id,
@@ -586,7 +769,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
this.$refs.multipleTable.clearSelection()
},
changeTeam(command) {
const { item } = command
const {item} = command
if (!this.selection.length) {
this.$notify({
title: "警告",
@@ -616,7 +799,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
this.$refs.multipleTable.clearSelection()
},
async findUserOne(id) {
const { data } = await this.$axios.post(loc() + "/findUserOne", { id })
const {data} = await this.$axios.post(loc() + "/findUserOne", {id})
return data
},
async delApplyUser(index, row, num) {
@@ -666,6 +849,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
getTransProp(user) {
return {
id: user.id,
loginname: user.loginname,
name: user.username + "" + (user.sex ? user.sex : "") + "-" + user.loginname + ""
}
},
@@ -681,5 +865,7 @@ var ACTIVITY_SPORTS_APPLY_USER = {
this.userList = []
}
},
async created() {}
async created() {
this.unitOptions = await this.$businessTool.listUnit()
}
}
@@ -90,7 +90,6 @@ var ACTIVITY_SPORTS_DELETE_USER = {
this.pageForm.eventId = this.rowData.eventId
this.pageForm.unionId = this.rowData.unionId
this.$axios.post(loc() + "/applyPageData", this.pageForm).then(data => {
console.log(data)
this.tableLoading = false
if (data.code === 0) {
this.tableData = data.data.list
@@ -257,7 +257,7 @@ layout("/layouts/platform.html"){
</template>
<template #public>
<activity-sports-delete-user @flip="flip"
<activity-sports-delete-user @flush="doSearch"
ref="activityDeleteUser"></activity-sports-delete-user>
</template>
</guava>
@@ -191,8 +191,8 @@ layout("/layouts/platform_h5.html"){
<van-icon name="location-o"></van-icon>
报名方式:
<span v-if="viewData.signUpMethod===1" style="color: var(--color-primary)">个人报名</span>
<span v-if="viewData.signUpMethod===2" style="color: var(--color-primary)">分工会报名</span>
<span v-if="viewData.signUpMethod===3" style="color: var(--color-primary)">组队报名</span>
<span v-if="viewData.signUpMethod===2" style="color: var(--color-primary)">组队报名</span>
<span v-if="viewData.signUpMethod===3" style="color: var(--color-primary)">分工会报名</span>
</div>
<div class="info-item" v-if="viewData.signUpMethod==3">
<van-icon name="location-o"></van-icon>
@@ -277,6 +277,51 @@ layout("/layouts/platform_h5.html"){
</div>
</div>
<!-- 分工会报名-->
<div v-else-if="viewData.signUpMethod===3" class="block">
<div class="notice-title left-tag-title">选择报名人员
<span v-if="viewData.userNumberLimit===2">
,报名人数 <span style="color: red">
{{viewData.unionTeamNum}}</span>
</span>
</div>
<el-select
v-if="inApplyTime"
v-model="searchTeammateUserId"
filterable
clearable
remote
reserve-keyword
placeholder="请输入关键词"
:remote-method="queryTeammate">
<el-option
v-for="item in teammateOptions"
:key="item.userId"
:label="item.userName + '(' + item.loginName + ')'"
:value="item.userId">
</el-option>
</el-select>
<el-button v-if="inApplyTime" class="ml5" type="primary" icon="el-icon-plus"
@click="addTeamUser">添加
</el-button>
<el-table :data="teamUsers" class="mt10">
<el-table-column label="序号" type="index" width="60px"></el-table-column>
<el-table-column prop="userName" label="姓名"></el-table-column>
<el-table-column prop="loginName" label="工号"></el-table-column>
<!-- <el-table-column prop="sex" label="性别"></el-table-column>-->
<!-- <el-table-column prop="unitName" label="单位"></el-table-column>-->
<!-- <el-table-column prop="mobile" label="手机号"></el-table-column>-->
<el-table-column label="操作" width="100px"
v-if="inApplyTime">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="removeTeamUser(scope.$index)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="form-create-h5" v-if="isCustomForm">
<div class="notice-title left-tag-title">填写报名信息</div>
<form-create :value.sync="dynamicFormData" v-model="fapi" :rule="formCreateRule"
@@ -301,6 +346,7 @@ layout("/layouts/platform_h5.html"){
<span>取消报名</span>
<span style="font-size: 12px; margin-top: 5px">{{viewData.applyEndTime}}截止报名</span>
</div>
<div class="bottom-button" v-if="$moment(viewData.endTime).valueOf() < $moment().valueOf()">活动已结束</div>
</div>
</div>
@@ -361,11 +407,22 @@ layout("/layouts/platform_h5.html"){
this.$axios.post("/platform/activity/culture/infoManage/activityInfo", {id: this.id}).then((res) => {
if (res.code === 0) {
this.viewData = res.data
//总人数限制
if (this.viewData.userNumberLimit === 1) {
} else if (this.viewData.userNumberLimit === 2) {
//分工会人数限制
const union = this.viewData.unionUserNumberLimit.find(v => v.id === this.$store.state.user.union.id)
this.viewData.unionTeamNum = union.limitNum
}
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
if (this.viewData.formConfig) {
this.formCreateRule = formCreate.parseJson(this.viewData.formConfig.rule)
this.formCreateOption = formCreate.parseJson(this.viewData.formConfig.options)
}
this.listTeamUser()
}
})
}
@@ -381,6 +438,17 @@ layout("/layouts/platform_h5.html"){
}
})
},
//查询报名人员
listTeamUserUnion() {
this.$axios.post("/platform/activity/culture/applyUser/listTeamUserUnion", {activityId: this.id}).then((res) => {
if (res.code === 0) {
this.isSignUp = res.data.length > 0
this.teamUsers = res.data
this.defaultAddSelf()
this.customFormInit()
}
})
},
//表单回显
customFormInit() {
if (this.teamUsers && this.teamUsers.length > 0) {
@@ -466,7 +534,7 @@ layout("/layouts/platform_h5.html"){
})
return
}
if (this.teamUsers.length > this.viewData.teamNum) {
if (this.viewData.teamNum && this.teamUsers.length > this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
@@ -498,7 +566,11 @@ layout("/layouts/platform_h5.html"){
this.$axios.post("/platform/activity/culture/applyUser/signUp", formData).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.listTeamUser()
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
}
})
})
@@ -567,7 +639,7 @@ layout("/layouts/platform_h5.html"){
})
return
}
if (this.teamUsers.length > this.viewData.teamNum) {
if (this.viewData.teamNum && this.teamUsers.length > this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
@@ -600,7 +672,11 @@ layout("/layouts/platform_h5.html"){
this.$axios.post("/platform/activity/culture/applyUser/signUp", formData).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.listTeamUser()
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
}
})
})
@@ -617,7 +693,11 @@ layout("/layouts/platform_h5.html"){
this.$axios.post("/platform/activity/culture/applyUser/cancelSignUp", {activityId: this.id}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.listTeamUser()
if (this.viewData.signUpMethod === 3) {
this.listTeamUserUnion()
} else {
this.listTeamUser()
}
this.fapi.resetFields()
}
})
@@ -627,7 +707,10 @@ layout("/layouts/platform_h5.html"){
//查询队友信息
queryTeammate(val) {
if (val) {
this.$axios.post("/platform/activity/culture/applyUser/queryTeammate", {keyword: val}).then((res) => {
this.$axios.post("/platform/activity/culture/applyUser/queryTeammate", {
keyword: val,
signUpMethod: this.viewData.signUpMethod
}).then((res) => {
if (res.code === 0) {
res.data.map(v => {
v.applyUserId = this.$store.state.user.id
@@ -662,7 +745,7 @@ layout("/layouts/platform_h5.html"){
})
return
}
if (this.teamUsers.length >= this.viewData.teamNum) {
if (this.viewData.teamNum && this.teamUsers.length >= this.viewData.teamNum) {
this.$dialog
.alert({
title: "提示",
@@ -90,7 +90,7 @@ layout("/layouts/platform_h5.html"){
loading: false,
pageForm: {
isActivity: 2,
applyStatus: 2,
applyStatus: 1,
year: new Date().getFullYear(),
pageNumber: 1,
pageSize: 5,
@@ -121,7 +121,7 @@ layout("/layouts/platform_h5.html"){
},
pageData() {
this.loading = true
this.$axios.post("/platform/h5/activity/apply/activityData", this.pageForm).then((res) => {
this.$axios.post("/platform/activity/apply/h5/activityData", this.pageForm).then((res) => {
this.tableData = res.data
this.finished = true
@@ -5,16 +5,17 @@ layout("/layouts/platform_h5.html"){
<div id="app" v-cloak>
<van-sticky>
<van-nav-bar
@click-left="()=>this.$pjaxReplace('/platform/h5/activity/apply/applyUser')"
left-arrow
left-text="返回"
placeholder
title="项目列表"
@click-left="historyBack"
left-arrow
left-text="返回"
placeholder
title="项目列表"
></van-nav-bar>
</van-sticky>
<div>
<van-list :finished="finished" @load="pageData" finished-text="没有更多了" v-if="tableData.length>0" v-model="loading">
<van-list :finished="finished" @load="pageData" finished-text="没有更多了" v-if="tableData.length>0"
v-model="loading">
<div class="table-list">
<div :key="row.id" class="table-card" v-for="row in tableData">
<van-image :src="row.image" fit="cover" height="200" v-if="row.image" width="100%"></van-image>
@@ -25,11 +26,17 @@ layout("/layouts/platform_h5.html"){
</div>
</template>
<template #right-icon>
<div style="display: flex; justify-content: flex-end" v-if="row.status">
<div style="display: flex; justify-content: flex-end"
v-if="row.status&&row.applyWay.length===1&&row.applyWay.includes(1)">
<van-tag type="primary" v-if="row.status===1">待审核</van-tag>
<van-tag type="success" v-if="row.status===2">已成功报名</van-tag>
<van-tag type="danger" v-if="row.status===3">审核不通过</van-tag>
</div>
<div style="display: flex; justify-content: flex-end" v-else>
<van-tag type="primary" v-if="row.status2===0">待审核</van-tag>
<van-tag type="success" v-if="row.status2===2">已成功报名</van-tag>
<van-tag type="danger" v-if="row.status2===3">审核不通过</van-tag>
</div>
</template>
</van-cell>
<van-cell title="可报队数" v-if="row.eveProjectType==='2'">
@@ -60,25 +67,46 @@ layout("/layouts/platform_h5.html"){
<span v-else>暂无</span>
</template>
</van-cell>
<!--<van-cell class="table-card-footer">
<template>
<van-button :loading="subLoading" @click="openView(row)" round
<van-cell class="table-card-footer">
<div v-if="row.applyWay.length===1&&row.applyWay.includes(1)">
<van-button :loading="subLoading" @click="signUpUser(row)" round
size="small"
type="primary">
报名
type="primary" v-if="activityData.applyWay.includes(1)&&row.userApply===0">
</van-button>
</template>
</van-cell>-->
<van-button :loading="subLoading" @click="cancelApply(row)" round
size="small"
color="#dd6363"
type="primary" v-if="activityData.applyWay.includes(1)&&row.userApply>0">
取消报名
</van-button>
</div>
<div v-else>
<van-button :loading="subLoading" @click="signUpUser(row)" round
size="small"
type="primary" v-if="activityData.applyWay.includes(1)&&row.userApply2===0">
报 名
</van-button>
<van-button :loading="subLoading" @click="cancelApply(row)" round
size="small"
color="#dd6363"
type="primary" v-if="activityData.applyWay.includes(1)&&row.userApply2>0">
取消报名
</van-button>
</div>
</van-cell>
</div>
</div>
</van-list>
<van-empty image="/assets/platform/plugins/vant-green/images/nodata/nodata.png" description="暂无数据" v-else></van-empty>
<van-empty image="/assets/platform/plugins/vant-green/images/nodata/nodata.png" description="暂无数据"
v-else></van-empty>
</div>
</div>
<script>
new Vue({
el: "#app",
store,
data() {
return {
tableData: [],
@@ -90,16 +118,89 @@ layout("/layouts/platform_h5.html"){
pageSize: 5,
totalCount: 0
},
subLoading: false
subLoading: false,
activityData: {}
}
},
components: {},
methods: {
openApplyUser() {},
openView(row) {},
openApplyUser() {
},
cancelApply(row) {
this.$dialog.confirm({
title: "提示",
message: "确认要取消报名吗?"
}).then(() => {
/* if (row.applyUser !== this.$store.state.user.id) {
this.$dialog.alert({
title: '温馨提示',
message: "报名人不是您,请联系报名人取消!",
}).then(() => {
})
return;
}*/
this.$axios.post("/platform/activity/apply/h5/cancelApply", {
activityId: row.activityId,
eventId: row.eventId,
schoolEventId: row.id
}).then(resp => {
if (resp.code === 0) {
this.doSearch()
this.$dialog.alert({
title: '温馨提示',
message: resp.msg,
}).then(() => {
})
}
})
})
},
signUpUser(row) {
this.$dialog.confirm({
title: "提示",
message: "确认要报名吗?"
}).then(async () => {
const teamList = await this.listTeamList(row)
if (teamList.length > 0) {
row.teamId = teamList[0].id
}
this.$axios.post("/platform/activity/apply/h5/signUpUser", {
activityId: row.activityId,
teamId: row.teamId,
eventId: row.eventId,
schoolEventId: row.id
}).then(resp => {
if (resp.code === 0) {
this.doSearch()
this.$dialog.alert({
title: '温馨提示',
message: resp.msg,
}).then(() => {
// on close
});
}
})
})
},
async listTeamList(row) {
const resp = await this.$axios.post("/platform/activity/apply/h5/listTeamList", {
activityId: row.activityId,
eventId: row.eventId,
})
if (resp.code === 0) {
return resp.data
}
},
doSearch() {
this.tableKey = new Date().getTime()
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.tableData = []
this.pageData()
},
pageData() {
this.loading = true
this.$axios.post("/platform/h5/activity/apply/pageData", { data: JSON.stringify(this.pageForm) }).then((res) => {
this.$axios.post("/platform/activity/apply/h5/pageData", {data: JSON.stringify(this.pageForm)}).then((res) => {
this.tableData = this.tableData.concat(res.data.list)
if (this.tableData.length === res.data.totalCount) {
this.finished = true
@@ -110,9 +211,10 @@ layout("/layouts/platform_h5.html"){
this.loading = false
})
},
findOneActivity() {
this.$axios.post("/platform/h5/activity/apply/findOneActivity", { activityId: this.pageForm.activityId }).then((res) => {
if (res.code === 200) {
this.$axios.post("/platform/activity/apply/h5/findOneActivity", {activityId: this.pageForm.activityId}).then((res) => {
if (res.code === 0) {
this.activityData = res.data
}
})
@@ -30,7 +30,7 @@ let ACTIVITY_EVENT_NOTIFICATION = {
},
methods: {
openReg() {
this.$pjaxReplace("/platform/h5/activity/apply/eventList?activityId=" + this.id)
this.$pjaxReplace("/platform/activity/apply/h5/eventList?activityId=" + this.id)
}
}
}