Commit 62c0316b authored by daniel's avatar daniel

feat(gps押金): bug修复

parent be86be3f
......@@ -230,7 +230,7 @@
<n-form-item label="组别名称" path="roadName">
<div class="flex flex-col">
<n-input v-model:value="gunRuleValue.roadName" placeholder="请输入组别名称" />
<n-gradient-text type="warning">注:组别名仅支持数字和字母,并且不可重复</n-gradient-text>
<n-gradient-text type="warning">注:导入名单里的组别名要跟设置的组别名一致</n-gradient-text>
</div>
</n-form-item>
<n-form-item label="出发日期" path="startTime">
......@@ -498,8 +498,8 @@
const uploadUrl = window.location.origin + '/api-common/v1/upload?folder=gk/gunApply' + '&cmptId=' + getCId()
const downloadWeChatImgUrl = window.location.origin + '/api-common/v1/download-wechat-image'
// 添加全局 loading 指令
// const ECC_BASE_URL = "https://ecc.geexek.com"
const ECC_BASE_URL = "http://localhost:8081"
const ECC_BASE_URL = "https://ecc.geexek.com"
// const ECC_BASE_URL = "http://localhost:8081"
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"
......@@ -760,6 +760,7 @@
// 更新菜单
const updateMenu = (value) => {
activeMenu.value = value
getGunRulesStats()
}
// 更新枪次选项
......@@ -925,6 +926,8 @@
const ruleIndex = ref(0)
// 删除确认弹窗
const showDeleteModal = ref(false)
// 是否是第一次加载
const isFirst = ref(false)
// 号码簿规则校验
const gunRuleRules = {
roadName: {
......@@ -949,7 +952,59 @@
ruleIndex.value = index
gunRuleValue.value = gunRules.value[index]
getPlayers()
if (!isFirst.value) return
getGunRulesStats()
}
// 获取分枪组别统计
const getGunRulesStats = async () => {
const params = {
cmptId: getCId()
}
loading.value = true;
// 发起请求
const [err, res] = await to(fetch(RULE_LIST + new URLSearchParams(params).toString(), {
method: "GET",
headers: {
'Content-Type': 'application/json'
},
}).then(res => res.json()))
loading.value = false
if (err) {
message.error(err.message)
}
if (res.code !== 200) return message.error(res.message)
// 获取所有分组的名单总数
const totalApplies = res.data.map(v => v.details.reduce((detailPre, detailCur) => detailPre + detailCur.totalReservations ?? 0, 0))
// 获取所有分组的名单总数
const request = res.data.map(v => {
const playerParams = {
cmptId: getCId(),
roadName: v.roadName,
current: 1,
size: 1,
}
return fetch(ENROLL_PAGE, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(playerParams)
}).then(res => res.json())
})
let allPlayersTotals = []
await Promise.all(request).then(list => {
allPlayersTotals = list.map(v => v.data.total)
})
// 统计数据组装
gunRules.value.forEach((v, index) => {
v.totalPlayer = allPlayersTotals[index]
v.totalApply = totalApplies[index]
})
}
// 获取分枪组别列表
const getGunRules = async () => {
const params = {
......@@ -1006,6 +1061,7 @@
} else {
gunRuleValue.value = initialValue
}
isFirst.value = true
}
......
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