|
|
|
@ -17,7 +17,8 @@ |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" round @click="autoAllocation">自动分配阶段成员</el-button> |
|
|
|
|
<el-button type="primary" round @click="autoAllocationConfirm">{{ !notBeginSign && allocated ? '取消' : '' |
|
|
|
|
}}自动分配阶段成员</el-button> |
|
|
|
|
<el-button type="primary" round @click="batchImport">导入</el-button> |
|
|
|
|
<el-button type="primary" round @click="add" v-auth="'/match/list:管理:报名人员:新增'">新增</el-button> |
|
|
|
|
<el-button type="primary" round :loading="exporting" @click="exportAll" |
|
|
|
@ -183,14 +184,14 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import util from "@/libs/util"; |
|
|
|
|
import Util from "@/libs/util"; |
|
|
|
|
import axios from 'axios' |
|
|
|
|
import Setting from "@/setting"; |
|
|
|
|
export default { |
|
|
|
|
name: "matchSignup", |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
|
token: Util.local.get(Setting.tokenKey), |
|
|
|
|
schoolId: this.$store.state.user.schoolId, |
|
|
|
|
id: +this.$route.query.id, |
|
|
|
|
info: { |
|
|
|
@ -275,12 +276,16 @@ export default { |
|
|
|
|
uploadTips: '', |
|
|
|
|
exportCode: '', |
|
|
|
|
headers: { |
|
|
|
|
token: util.local.get(Setting.tokenKey) |
|
|
|
|
token: Util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
diffSchool: false, |
|
|
|
|
uploading: false, |
|
|
|
|
exporting: false, |
|
|
|
|
loading: false, |
|
|
|
|
timer: null, |
|
|
|
|
now: '', |
|
|
|
|
notBeginSign: true, |
|
|
|
|
allocated: true, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -302,6 +307,7 @@ export default { |
|
|
|
|
this.getData() |
|
|
|
|
this.getInfo() |
|
|
|
|
this.getTeam() |
|
|
|
|
this.getAutomaticAllocation() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
init () { |
|
|
|
@ -333,8 +339,8 @@ export default { |
|
|
|
|
this.$refs.table.clearSelection(); |
|
|
|
|
}, |
|
|
|
|
// 获取赛事信息 |
|
|
|
|
getInfo () { |
|
|
|
|
this.$post(`${this.api.getCompetition}?competitionId=${this.id}`).then(({ competition }) => { |
|
|
|
|
async getInfo () { |
|
|
|
|
const { competition } = await this.$post(`${this.api.getCompetition}?competitionId=${this.id}`) |
|
|
|
|
this.info = competition |
|
|
|
|
this.getSchool() |
|
|
|
|
// 非本校内则查询接口获取学校列表 |
|
|
|
@ -344,7 +350,46 @@ export default { |
|
|
|
|
this.schoolDisable = true |
|
|
|
|
this.form.schoolId = this.$store.state.user.schoolId |
|
|
|
|
} |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
|
|
|
|
|
// 判断当前处于报名结束前还是后,报名结束前显示:自动分配/取消分配。报名结束后显示:自动分配。 |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
this.now = await Util.getNow() |
|
|
|
|
this.timer = setInterval(() => { |
|
|
|
|
this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1)) |
|
|
|
|
this.notBeginSign = this.now > new Date(this.info.signUpEndTime) // 是否在报名结束时间之前 |
|
|
|
|
}, 1000) |
|
|
|
|
}, |
|
|
|
|
// 获取是否已分配 |
|
|
|
|
async getAutomaticAllocation () { |
|
|
|
|
const res = await this.$post(`${this.api.viewEventAllocationInformation}?competitionId=${this.id}`) |
|
|
|
|
this.allocated = res.data && res.data.assignOrNot |
|
|
|
|
}, |
|
|
|
|
// 自动分配人员 |
|
|
|
|
async automaticAllocation (assignOrNot) { |
|
|
|
|
await this.$post(this.api.updateEventAllocationRecord, { |
|
|
|
|
assignOrNot, |
|
|
|
|
competitionId: this.id, |
|
|
|
|
}) |
|
|
|
|
this.getAutomaticAllocation() |
|
|
|
|
}, |
|
|
|
|
// 自动分配人员弹框 |
|
|
|
|
async autoAllocationConfirm () { |
|
|
|
|
// 报名结束后 |
|
|
|
|
if (this.notBeginSign) { |
|
|
|
|
this.$confirm('确定立即自动分配阶段成员?', '提示', { |
|
|
|
|
type: 'success', |
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
}).then(async () => { |
|
|
|
|
await this.$post(`${this.api.automaticAllocation}?competitionId=${this.id}`) // 立马分配 |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} else { |
|
|
|
|
this.$confirm(`确定${this.allocated ? '取消' : '开启'}自动分配阶段成员?`, { |
|
|
|
|
type: 'success', |
|
|
|
|
closeOnClickModal: false, |
|
|
|
|
}).then(async () => { |
|
|
|
|
this.automaticAllocation(this.allocated ? 0 : 1) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
initData () { |
|
|
|
|
this.handleCurrentChange(1) |
|
|
|
@ -401,7 +446,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 上传文件 |
|
|
|
|
handleExceed (files, fileList) { |
|
|
|
|
util.warningMsg( |
|
|
|
|
Util.warningMsg( |
|
|
|
|
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!` |
|
|
|
|
) |
|
|
|
|
}, |
|
|
|
@ -413,7 +458,7 @@ export default { |
|
|
|
|
}).then((res) => { |
|
|
|
|
console.log("🚀 ~ showFaild ~ res:", res) |
|
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
|
util.downloadFileDirect(name ? decodeURI(name) : '批量导入报名人员失败数据导出.xlsx', new Blob([res.data])) |
|
|
|
|
Util.downloadFileDirect(name ? decodeURI(name) : '批量导入报名人员失败数据导出.xlsx', new Blob([res.data])) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
uploadSuccess ({ data, status }) { |
|
|
|
@ -428,11 +473,11 @@ export default { |
|
|
|
|
this.uploadFaild = true |
|
|
|
|
this.uploadTips = tip |
|
|
|
|
} else { |
|
|
|
|
util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000) |
|
|
|
|
Util[tip.includes('5000') ? 'errorMsg' : 'successMsg'](tip, 3000) |
|
|
|
|
this.importVisible = false |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
util.errorMsg(res.message || '上传失败,请检查数据', 3000) |
|
|
|
|
Util.errorMsg(res.message || '上传失败,请检查数据', 3000) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
uploadError (err, file, fileList) { |
|
|
|
@ -484,7 +529,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.$post(this.api.batchDeleteApplicants, { registrationVOS: [row] }).then(res => { |
|
|
|
|
util.successMsg("删除成功"); |
|
|
|
|
Util.successMsg("删除成功"); |
|
|
|
|
this.init() |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
@ -548,7 +593,7 @@ export default { |
|
|
|
|
this.addVisible = false |
|
|
|
|
this.init() |
|
|
|
|
this.submiting = false |
|
|
|
|
util.successMsg('编辑成功!') |
|
|
|
|
Util.successMsg('编辑成功!') |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
@ -556,7 +601,7 @@ export default { |
|
|
|
|
this.addVisible = false |
|
|
|
|
this.init() |
|
|
|
|
this.submiting = false |
|
|
|
|
util.successMsg('编辑成功!') |
|
|
|
|
Util.successMsg('编辑成功!') |
|
|
|
|
} |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submiting = false |
|
|
|
@ -575,7 +620,7 @@ export default { |
|
|
|
|
this.addVisible = false |
|
|
|
|
this.init() |
|
|
|
|
this.submiting = false |
|
|
|
|
util.successMsg('报名成功!') |
|
|
|
|
Util.successMsg('报名成功!') |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submiting = false |
|
|
|
|
}) |
|
|
|
@ -593,13 +638,13 @@ export default { |
|
|
|
|
form.account = `${Setting.platformId}-3-${form.schoolId}-${form.workNumber}` |
|
|
|
|
const { phone, email } = form |
|
|
|
|
if (phone && !/^1[3456789]\d{9}$/.test(phone)) { |
|
|
|
|
return util.errorMsg("请输入正确的手机号") |
|
|
|
|
return Util.errorMsg("请输入正确的手机号") |
|
|
|
|
} else if (email && !/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email)) { |
|
|
|
|
return util.errorMsg("请输入正确的邮箱") |
|
|
|
|
return Util.errorMsg("请输入正确的邮箱") |
|
|
|
|
} else if (this.notExit) { |
|
|
|
|
return util.errorMsg('学生不存在,无法添加!') |
|
|
|
|
return Util.errorMsg('学生不存在,无法添加!') |
|
|
|
|
} else if (this.exitMember) { |
|
|
|
|
return util.errorMsg('学生已存在') |
|
|
|
|
return Util.errorMsg('学生已存在') |
|
|
|
|
} else { |
|
|
|
|
this.submiting = true |
|
|
|
|
this.submitForm() |
|
|
|
@ -676,8 +721,8 @@ export default { |
|
|
|
|
// 团队提交 |
|
|
|
|
teamSubmit () { |
|
|
|
|
const form = this.teamForm |
|
|
|
|
if (!form.teamName) return util.errorMsg('请输入团队名称') |
|
|
|
|
if (form.invitationCode.length !== 6) return util.errorMsg('请输入6位数团队邀请码') |
|
|
|
|
if (!form.teamName) return Util.errorMsg('请输入团队名称') |
|
|
|
|
if (form.invitationCode.length !== 6) return Util.errorMsg('请输入6位数团队邀请码') |
|
|
|
|
form.accountId = this.form.id |
|
|
|
|
form.schoolId = this.form.schoolId |
|
|
|
|
form.studentAffiliatedInstitutionId = this.form.studentAffiliatedInstitutionId |
|
|
|
@ -685,7 +730,7 @@ export default { |
|
|
|
|
this.teamVisible = false |
|
|
|
|
this.addVisible = false |
|
|
|
|
this.init() |
|
|
|
|
util.successMsg('报名成功!') |
|
|
|
|
Util.successMsg('报名成功!') |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 参赛信息 |
|
|
|
@ -705,7 +750,7 @@ export default { |
|
|
|
|
responseType: 'blob' |
|
|
|
|
}).then((res) => { |
|
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
|
util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) |
|
|
|
|
Util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) |
|
|
|
|
this.exporting = false |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.exporting = false |
|
|
|
@ -718,7 +763,7 @@ export default { |
|
|
|
|
responseType: 'blob' |
|
|
|
|
}).then((res) => { |
|
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
|
util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) |
|
|
|
|
Util.downloadFileDirect(name ? decodeURI(name) : '报名人员.xlsx', new Blob([res.data])) |
|
|
|
|
this.exporting = false |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.exporting = false |
|
|
|
@ -740,7 +785,7 @@ export default { |
|
|
|
|
await this.$post(`${this.api.deleteAllData}?competitionId=${this.id}`) |
|
|
|
|
} |
|
|
|
|
this.init() |
|
|
|
|
util.successMsg('删除成功') |
|
|
|
|
Util.successMsg('删除成功') |
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
}).catch(() => { }); |
|
|
|
|
}, |
|
|
|
|