Files
zhgh_neu_h5/src/pages/activity/sports/summary.vue
T
2026-09-08 20:07:08 +08:00

397 lines
13 KiB
Vue
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.
<template>
<view>
<van-sticky class="van-sticky van-sticky--fixed" style="top: 40px">
<van-dropdown-menu active-color="#1989fa">
<van-dropdown-item v-model="pageForm.year" :options="yearList"
@change="yearChange"></van-dropdown-item>
<van-dropdown-item v-model="pageForm.activityLevel" :options="activityTypeOptions"
@change="getNearActivity()"></van-dropdown-item>
<van-dropdown-item v-model="pageForm.id" :options="activityOptions"
@change="onRefresh"></van-dropdown-item>
<van-dropdown-item v-model="pageForm.unionid" :options="unionOptions"
@change="onRefresh"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<div style="margin-top: 50px;">
<van-list v-model="loading" :finished="finished"
:finished-text="apply.length>0?'没有更多了':''"
v-if="apply && apply.length>0" @load="pageData">
<van-collapse v-model="oneCollapseName" accordion @change="changeCollapse">
<template v-for="item in apply">
<van-collapse-item :title="item.unionCode+'-'+item.unionName+''+item.num+'人)'"
:name="item.unionCode">
<van-collapse v-model="twoCollapseName" accordion>
<van-collapse-item title="领队" name="1" v-if="item.leader">
<van-cell title="姓名" :value="item.leader.username"/>
<van-cell title="教工号" :value="item.leader.loginname"/>
<van-cell title="性别">
{{ item.leader.sex == '0' ? '男' : item.leader.sex == '1' ? '女' : '暂无' }}
</van-cell>
<van-cell title="单位" :value="item.coach.unitname"/>
</van-collapse-item>
<van-collapse-item title="教练" name="2" v-if="item.coach">
<van-cell title="姓名" :value="item.coach.username"/>
<van-cell title="教工号" :value="item.coach.loginname"/>
<van-cell title="性别">
{{ item.coach.sex == '0' ? '男' : item.coach.sex == '1' ? '女' : '暂无' }}
</van-cell>
<van-cell title="单位" :value="item.coach.unitname"/>
</van-collapse-item>
<van-collapse-item title="团长" name="3" v-if="item.head">
<van-cell title="姓名" :value="item.head.username"/>
<van-cell title="教工号" :value="item.head.loginname"/>
<van-cell title="性别">
{{ item.head.sex == '0' ? '男' : item.head.sex == '1' ? '女' : '暂无' }}
</van-cell>
<van-cell title="单位" :value="item.head.unitname"/>
</van-collapse-item>
<van-collapse-item title="工作人员" name="4" v-if=" item.staff">
<van-cell title="姓名" :value="item.staff.username"/>
<van-cell title="教工号" :value="item.staff.loginname"/>
<van-cell title="性别">
{{ item.staff.sex == '0' ? '男' : item.staff.sex == '1' ? '女' : '暂无' }}
</van-cell>
<van-cell title="单位" :value="item.staff.unitname"/>
</van-collapse-item>
<van-collapse-item title="项目报名信息" name="5">
<template v-if="item.apply2">
<van-cell-group inset v-for="userItem in item.apply2">
<van-cell title="项目名称" :value="userItem.allName"/>
<van-cell title="所属队" :value="userItem.team?userItem.team.team:'暂无'"/>
<van-cell title="姓名" :value="userItem.username"/>
<van-cell title="教工号" :value="userItem.loginname"/>
<van-cell title="性别">
{{ userItem.sex == '0' ? '男' : userItem.sex == '1' ? '女' : '暂无' }}
</van-cell>
<van-cell title="单位" :value="userItem.unitname"/>
<van-cell title="身份">
<van-tag type="primary" v-if="userItem.identity.includes('1')"
style="margin-right: 5px">运动员
</van-tag>
<van-tag type="success" v-if="userItem.identity.includes('2')"
style="margin-right: 5px">教练
</van-tag>
<van-tag type="warning" v-if="userItem.identity.includes('3')"
style="margin-right: 5px">领队
</van-tag>
<van-tag type="danger" v-if="userItem.identity.includes('4')"
style="margin-right: 5px">处级领导
</van-tag>
<van-tag type="danger" v-if="userItem.identity.includes('5')"
style="margin-right: 5px">替补
</van-tag>
</van-cell>
<van-cell title="备注" :value="userItem.bz"/>
</van-cell-group>
</template>
<template v-else>暂无</template>
</van-collapse-item>
</van-collapse>
</van-collapse-item>
</template>
</van-collapse>
</van-list>
</div>
</view>
</template>
<script>
import mobileMixins from "@/mixins/mobileMixins";
export default {
mixins: [mobileMixins],
name: "summary",
filters: {
money(val) {
return val || 0
},
str(val) {
return val || '暂无'
}
},
computed: {
activityTypeOptions() {
if (this.activityTypeList) {
return this.activityTypeList.map(v => {
return {
value: v.code,
text: v.name
}
})
}
return []
},
activityOptions() {
if (this.activities) {
return this.activities.map(v => {
return {
value: v.id,
text: v.name
}
})
}
return []
},
unionOptions() {
if (this.unions) {
return this.unions.map(v => {
return {
value: v.id,
text: v.unionName
}
})
}
return []
}
},
data() {
return {
isH04: this.$auth.hasRole('H04'),
events: [],
activityTypeList: [],
activities: [],
apply: [],
apply2: [],
unions: [],
rootData: [],
pageForm: {
pageSize: 10,
id: '',
unionid: '',
year: new Date().getFullYear(),
},
projectTypeList: [
{id: '1', name: '单项'},
{id: '2', name: '团体'}
],
//年份列表
yearOptions: [],
oneCollapseName: "",
twoCollapseName: "",
}
},
methods: {
changeCollapse(){
this.twoCollapseName=""
},
async onRefresh() {
this.apply = []
this.refreshing = true;
this.finished = false;
this.pageForm.pageNumber = 0
this.loading = true;
this.oneCollapseName = ""
this.twoCollapseName = ""
await this.pageData();
},
async changeActivity() {
const resp = await this.$http.get('/activity/sports/activityApply/getEvents', {
params: {
activityId: this.pageForm.id
}
})
if (resp.code === 200) {
this.events = resp.data
}
},
async yearChange() {
this.pageForm.id = null
await this.getNearActivity()
},
async getNearActivity() {
const resp = await this.$http.get('/activity/sports/reading/getNearActivity', {
params: {
year: this.pageForm.year,
activityLevel: this.pageForm.activityLevel
}
})
if (resp.code === 200) {
this.activities = resp.data
if (resp.data.length) {
this.pageForm.id = resp.data[0].id
await this.onRefresh()
} else {
this.pageForm.unionid = ''
this.unions = []
this.apply = []
this.pageForm.pageNumber = 0
}
}
},
async changeActivit() {
const resp = await this.$http.get('/activity/sports/activityApply/getEvents', {
params: {
activityId: this.pageForm.id
}
})
if (resp.code === 200) {
this.events = resp.data
}
},
async pageData() {
this.$modal.loading()
this.loading = true
await this.changeActivit()
const activity = this.activities.filter(v => {
return v.id === this.pageForm.id
})
this.pageForm.activityName = activity.length > 0 ? activity[0].name : null
this.pageForm.applyType = activity[0].applyType
const resp = await this.$http.post('/activity/sports/reading/getData', this.pageForm, {
params: {
id: this.pageForm.id,
activityLevel: this.pageForm.activityLevel,
applyed: this.pageForm.applyed,
unionid: this.pageForm.unionid
}
})
if (resp.code === 200) {
const v = resp.data.list
if (v.length) {
v.forEach(x => {
const leaders = x.apply.filter(i => {
return i.unionLeader
})
x.leader = null
if (leaders.length) {
x.leader = leaders[0]
}
const coachs = x.apply.filter(i => {
return i.unionCoach
})
x.coach = null
if (coachs.length) {
x.coach = coachs[0]
}
const heads = x.apply.filter(i => {
return i.unionHead
})
x.head = null
if (heads.length) {
x.head = heads[0]
}
const staffs = x.apply.filter(i => {
return i.unionStaff
})
x.staff = null
if (staffs.length) {
x.staff = staffs[0]
}
x.apply = x.apply.filter(i => {
return !i.unionLeader && !i.unionCoach && !i.unionHead && !i.unionStaff
})
})
this.rootData = JSON.parse(JSON.stringify(v))
this.rootData.forEach(x => {
if (x.apply&&x.apply.length>0){
x.apply2 = this.clone(x.apply)
}else{
x.apply2 = null
}
})
} else {
this.unions = []
this.pageForm.unionid = ''
this.loading = false
this.finished = true
this.$modal.closeLoading()
}
if (this.pageForm.activityLevel !== '40001' && this.rootData && this.rootData.length > 0) {
this.$set(this.rootData[0], 'show', true)
}
this.apply = this.apply.concat(this.rootData)
this.pageForm.totalCount = resp.data.totalCount
if (this.apply.length === this.pageForm.totalCount) {
this.finished = true
this.unions = this.apply.map(v => {
return {id: v.id, unionName: v.unionName}
})
this.unions.unshift({id: '', unionName: '全部'})
if (this.unions.length === 2) {
this.pageForm.unionid = this.unions[1].id
}
} else {
this.pageForm.pageNumber++
}
this.loading = false
this.$modal.closeLoading()
} else {
this.loading = false
this.finished = true
this.$modal.closeLoading()
}
},
async getActivityTypeList(code) {
const {data} = await this.$http.get('/activity/common/getActivityTwoLevelType', {
params: {
code: code
}
})
return data
},
doEventType(app) {
const {apply, projectType} = app
if (!app.projectType) {
this.$set(app, 'apply2', apply)
} else {
const arr = apply.filter(i => {
return i.projectType === projectType
})
this.$set(app, 'apply2', arr)
}
},
doEvent(app) {
const {apply, eventId} = app
if (!app.eventId) {
this.$set(app, 'apply2', apply)
} else {
const arr = apply.filter(i => {
return !i.unionLeader && !i.unionCoach && i.evid === eventId
})
this.$set(app, 'apply2', arr)
}
},
},
async created() {
await this.changeActivity()
const activityType = await this.getActivityTypeList('40000')
this.activityTypeList = activityType
this.$set(this.pageForm, 'activityLevel', this.activityTypeList[0].code)
await this.getNearActivity()
}
}
</script>
<style scoped>
</style>