Commit a712fa03 authored by daniel's avatar daniel

fix(gunRule): 随机分配名单

parent 90547f5f
...@@ -166,6 +166,12 @@ ...@@ -166,6 +166,12 @@
<n-button v-if="activeMenu!=menuOptions[0].value" @click="exportEnroll"> <n-button v-if="activeMenu!=menuOptions[0].value" @click="exportEnroll">
导出名单 导出名单
</n-button> </n-button>
<n-button v-if="activeMenu!=menuOptions[0].value" @click="randomAssign">
随机分配枪次
</n-button>
<n-button v-if="activeMenu!=menuOptions[0].value" @click="initWaves">
初始化规则
</n-button>
</div> </div>
</n-card> </n-card>
...@@ -237,13 +243,6 @@ ...@@ -237,13 +243,6 @@
<n-card title="选手列表" :bordered="false" v-if="activeMenu!=menuOptions[0].value"> <n-card title="选手列表" :bordered="false" v-if="activeMenu!=menuOptions[0].value">
<template #header-extra> <template #header-extra>
<n-space> <n-space>
<!-- <n-button type="error">
清空名单
</n-button> -->
<n-button @click="randomAssign">
随机分配
</n-button>
<n-button @click="downloadImportList"> <n-button @click="downloadImportList">
下载导入模板 下载导入模板
</n-button> </n-button>
...@@ -253,7 +252,7 @@ ...@@ -253,7 +252,7 @@
v-model:file-list="fileList" v-model:file-list="fileList"
> >
<n-button type="primary"> <n-button type="primary">
上传文件 导入选手名单
</n-button> </n-button>
</n-upload> </n-upload>
</n-space> </n-space>
...@@ -481,12 +480,20 @@ ...@@ -481,12 +480,20 @@
const SAVE_OR_UPDATE = ECC_BASE_URL + "/api-pick/v1/save-or-update-wave" const SAVE_OR_UPDATE = ECC_BASE_URL + "/api-pick/v1/save-or-update-wave"
// 更新名单 // 更新名单
const UPDATE_ENROLL_WAVE = ECC_BASE_URL + "/api-pick/v1/update-enroll-wave" const UPDATE_ENROLL_WAVE = ECC_BASE_URL + "/api-pick/v1/update-enroll-wave"
// 发枪预约规则列表
const RULE_LIST = ECC_BASE_URL + "/api-pick/v1/wave-reserve-list?" const RULE_LIST = ECC_BASE_URL + "/api-pick/v1/wave-reserve-list?"
// 选手列表
const ENROLL_PAGE = ECC_BASE_URL + "/api-pick/v1/enroll-page?" const ENROLL_PAGE = ECC_BASE_URL + "/api-pick/v1/enroll-page?"
const DELETE_RULE = ECC_BASE_URL + "/api-pick/v1/delete-rule?" // 删除发枪预约规则
const DELETE_WAVE_RULE = ECC_BASE_URL + "/api-pick/v1/delete-wave-reserve?" const DELETE_WAVE_RULE = ECC_BASE_URL + "/api-pick/v1/delete-wave-reserve?"
// 导入名单
const IMPORT_MARK_ENROLL = ECC_BASE_URL + "/api-pick/v1/import-mark-enroll" const IMPORT_MARK_ENROLL = ECC_BASE_URL + "/api-pick/v1/import-mark-enroll"
// 删除名单
const DELETE_ENROLL = ECC_BASE_URL + "/api-pick/v1/delete-enroll" const DELETE_ENROLL = ECC_BASE_URL + "/api-pick/v1/delete-enroll"
// 随机分配枪次
const ASSIGN_WAVES = ECC_BASE_URL + "/api-pick/v1/assign-waves"
// 初始化发枪预约规则
const INIT_WAVES_CONFIG = ECC_BASE_URL + "/api-pick/v1/init-waves-config"
// 导出名单 // 导出名单
const EXPORT_ENROLL = ECC_BASE_URL + "/api-pick/v1/export-markno-enroll" const EXPORT_ENROLL = ECC_BASE_URL + "/api-pick/v1/export-markno-enroll"
// 下载导入名单 // 下载导入名单
...@@ -798,6 +805,58 @@ ...@@ -798,6 +805,58 @@
if (!confirm) { if (!confirm) {
return return
} }
// 随机分配
const gtCmptId = getCId()
loading.value = true
const messageReactive = message.loading('随机分配中', {
duration: 0
})
const [err, data] = await to(fetch(ASSIGN_WAVES + '?cmptId=' + gtCmptId, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
}).then(res => res.json()))
loading.value = false
messageReactive.destroy()
if (err) {
message.error(err.message)
return
}
if (data.code === 200) {
message.success('随机分配成功')
getPlayers()
} else {
message.error(data.msg)
}
}
// 初始化规则
const initWaves = async () => {
const confirm = window.confirm('确定初始化规则吗?')
if (!confirm) {
return
}
// 初始化规则
const gtCmptId = getCId()
loading.value = true
const messageReactive = message.loading('初始化规则中', {
duration: 0
})
const [err, data] = await to(fetch(INIT_WAVES_CONFIG + '?cmptId=' + gtCmptId, {
method: 'GET',
}).then(res => res.json()))
loading.value = false
messageReactive.destroy()
if (err) {
message.error(err.message)
return
}
if (data.code === 200) {
message.success('初始化规则成功')
getGunRules()
} else {
message.error(data.msg)
}
} }
// 导出名单 // 导出名单
const exportEnroll = async () => { const exportEnroll = async () => {
...@@ -1076,6 +1135,7 @@ ...@@ -1076,6 +1135,7 @@
columns, columns,
players, players,
randomAssign, randomAssign,
initWaves,
exportEnroll, exportEnroll,
// 枪次表相关 // 枪次表相关
waveColumns, waveColumns,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment