allSportsmanList.vue
6.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<template>
<el-dialog v-model="show" :title="title" width="1000px" append-to-body>
<div class="funcBtns">
<el-button type="primary" @click="addMember">添加选手</el-button>
<el-button type="primary" plain @click="importSportman">导入选手</el-button>
</div>
<div class="from-Card">
<el-form :inline="true" :model="query" class="mt20" label-width="60" size="small">
<el-form-item label="姓名">
<el-input v-model="query.realName" style="width: 120px;" clearable/>
</el-form-item>
<el-form-item label="短名">
<el-input v-model="query.shortName" style="width: 120px;" clearable/>
</el-form-item>
<el-form-item label="手机号码">
<el-input v-model="query.phone" style="width: 120px;" clearable/>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="query.email" style="width: 120px;" clearable/>
</el-form-item>
<el-form-item label="证件类型">
<el-input v-model="query.idcType" style="width: 120px;" clearable/>
</el-form-item>
<el-form-item label="证件号">
<el-input v-model="query.idcode" style="width: 120px;" clearable/>
</el-form-item>
<el-form-item label="角色">
<el-input v-model="query.label" style="width: 120px;" clearable/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList">查询</el-button>
</el-form-item>
</el-form>
</div>
<p v-if="noPhotoCanSign == 0" class="text-danger">*需上传照片才可报名</p>
<el-table ref="allSportmenTable" v-loading="loading" :data="tableData" height="60vh"
@selection-change="handleSelectionChange">
<el-table-column type="selection" label="选择" :selectable="selectable"/>
<el-table-column label="所属国家" prop="countryName"/>
<el-table-column label="姓氏" prop="xing"/>
<el-table-column label="名" prop="ming"/>
<el-table-column label="短名" prop="shortName"/>
<el-table-column label="性别" prop="sexStr"/>
<el-table-column label="年龄" prop="age"/>
<el-table-column label="出生日期" prop="birth" width="100"/>
<el-table-column label="手机号码" prop="phone" width="120"/>
<el-table-column label="邮箱" prop="email" width="150"/>
<el-table-column label="证件类型" prop="idcTypeStr"/>
<el-table-column label="证件号码" prop="idcCode" width="200"/>
<el-table-column label="会员角色" width="200">
<template #default="scope">
<div>
<div style="white-space: nowrap" class="esp">
<span v-for="item in scope.row.label?.split(',')" :key="item.id">
<el-tag type="warning" size="small" v-if="item==='0'" effect="plain" class="ml10">运动员</el-tag>
<el-tag type="warning" size="small" v-if="item==='1'" effect="plain" class="ml10">教练</el-tag>
<el-tag type="warning" size="small" v-if="item==='2'" effect="plain" class="ml10">领队</el-tag>
<el-tag type="warning" size="small" v-if="item==='3'" effect="plain" class="ml10">队医</el-tag>
<el-tag type="warning" size="small" v-if="item==='4'" effect="plain" class="ml10">翻译</el-tag>
<el-tag type="warning" size="small" v-if="item==='5'" effect="plain" class="ml10">官员</el-tag>
<el-tag type="warning" size="small" v-if="item==='6'" effect="plain" class="ml10">其他</el-tag>
</span>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="详细地址" prop="address"/>
<el-table-column label="操作" width="120" fixed="right" align="center">
<template #default="scope">
<el-button type="text" @click="editPerson(scope.row)">编辑</el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<div class="dialog-footer text-center">
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
<addCoach ref="dialogAddCoach" @submitForm="getList"/>
<Import ref="dialogImportProps"/>
</template>
<script setup>
import {reactive, ref, toRefs, watch} from 'vue'
import {getCurrentInstance, nextTick, onMounted} from '@vue/runtime-core'
import * as match from '@/apiPc/match'
import addCoach from '../components/addCoach'
import {getGroupPersonList} from "@/apiPc/match";
import Import from '../components/import'
const {proxy} = getCurrentInstance()
const emit = defineEmits(['submitForm', 'transfer'])
const data = reactive({
query: {},
tableData: [],
birthArr: [],
show: false,
loading: false,
title: '选择运动员',
noPhotoCanSign: 0
})
const {query, tableData, show, title, birthArr, loading, noPhotoCanSign} = toRefs(data)
let matchId
let groupId
let choosedList = []
const choosedIds = []
const open = (params) => {
matchId = params.matchId
groupId = params.groupId
noPhotoCanSign.value = params.noPhotoCanSign
show.value = true
choosedList = params.choosedList
for (const p of choosedList) {
choosedIds.push(p.id)
}
getList()
}
defineExpose({
open
})
const selectable = (row) => {
if (!row.picUrl && noPhotoCanSign.value == 0) {
return false
} else {
return true
}
}
const getList = () => {
loading.value = true
if (birthArr.value) {
query.value.birthBegin = birthArr.value[0]
query.value.birthEnd = birthArr.value[1]
}
match.getGroupPersonList(query.value, groupId).then(res => {
tableData.value = res.rows
nextTick(() => {
for (const n in tableData.value) {
if (choosedIds.indexOf(tableData.value[n].id) > -1) {
proxy.$refs['allSportmenTable'].toggleRowSelection(tableData.value[n], true)
}
}
})
loading.value = false
})
}
function handleSelectionChange(val) {
// console.log(val)
choosedList = val
}
function submitForm() {
emit('transfer', choosedList)
// emit('submitForm', choosedList)
show.value = false
}
function cancel() {
show.value = false
}
function editPerson(row) {
const params = {
id: row.id,
groupId: groupId
}
proxy.$refs['dialogAddCoach'].open(params)
}
function addMember() {
const params = {
title: '添加人员',
id: 0,
groupId: groupId.value
}
proxy.$refs['dialogAddCoach'].open(params)
}
function importSportman() {
const params = {
title: '批量导入选手',
groupId: groupId.value
}
proxy.$refs['dialogImportProps'].open(params)
}
</script>
<style scoped lang="scss">
.el-form--inline .el-form-item {
width: auto;
}
</style>