chore: 支持过滤0业绩的数据
This commit is contained in:
@@ -146,23 +146,23 @@
|
|||||||
{
|
{
|
||||||
"id": 14,
|
"id": 14,
|
||||||
"name": "赵十六",
|
"name": "赵十六",
|
||||||
"score": 732,
|
"score": 0,
|
||||||
"level": "C",
|
"level": "C",
|
||||||
"avatar": "🎯",
|
"avatar": "🎯",
|
||||||
"department": "财务部",
|
"department": "财务部",
|
||||||
"completedTasks": 20,
|
"completedTasks": 20,
|
||||||
"bonus": 300,
|
"bonus": 0,
|
||||||
"team": "力争上游"
|
"team": "力争上游"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 15,
|
"id": 15,
|
||||||
"name": "钱十七",
|
"name": "钱十七",
|
||||||
"score": 715,
|
"score": 0,
|
||||||
"level": "C",
|
"level": "C",
|
||||||
"avatar": "🎯",
|
"avatar": "🎯",
|
||||||
"department": "人力资源部",
|
"department": "人力资源部",
|
||||||
"completedTasks": 18,
|
"completedTasks": 18,
|
||||||
"bonus": 300,
|
"bonus": 0,
|
||||||
"team": "蓄势待发"
|
"team": "蓄势待发"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -377,7 +377,8 @@
|
|||||||
"department": "left",
|
"department": "left",
|
||||||
"bonus": "left"
|
"bonus": "left"
|
||||||
},
|
},
|
||||||
"defaultDisplayRows": 7
|
"defaultDisplayRows": 7,
|
||||||
|
"filterZeroScore": true
|
||||||
},
|
},
|
||||||
"team": {
|
"team": {
|
||||||
"showMemberCount": false,
|
"showMemberCount": false,
|
||||||
@@ -402,7 +403,8 @@
|
|||||||
"leader": "left",
|
"leader": "left",
|
||||||
"bonus": "left"
|
"bonus": "left"
|
||||||
},
|
},
|
||||||
"defaultDisplayRows": 0
|
"defaultDisplayRows": 0,
|
||||||
|
"filterZeroScore": false
|
||||||
},
|
},
|
||||||
"championLogos": {
|
"championLogos": {
|
||||||
"teamChampion": "",
|
"teamChampion": "",
|
||||||
@@ -436,10 +438,7 @@
|
|||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"pattern": {
|
"pattern": {
|
||||||
"strongBeats": [
|
"strongBeats": [],
|
||||||
1,
|
|
||||||
4
|
|
||||||
],
|
|
||||||
"totalBeats": 4,
|
"totalBeats": 4,
|
||||||
"accentMultiplier": 1.5,
|
"accentMultiplier": 1.5,
|
||||||
"accentFrequencyOffset": 10,
|
"accentFrequencyOffset": 10,
|
||||||
|
|||||||
@@ -88,6 +88,12 @@
|
|||||||
<span class="text-gold">显示头像列</span>
|
<span class="text-gold">显示头像列</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="config-item">
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" v-model="localDisplayConfig.individual.filterZeroScore">
|
||||||
|
<span class="text-gold">过滤业绩为0的记录</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="config-item">
|
<div class="config-item">
|
||||||
<label class="checkbox-label">
|
<label class="checkbox-label">
|
||||||
<span class="text-gold">移动端默认显示行数:</span>
|
<span class="text-gold">移动端默认显示行数:</span>
|
||||||
@@ -112,7 +118,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column-alignment-section">
|
<div class="column-alignment-section">
|
||||||
<h4 class="text-gold">列对齐设置</h4>
|
<h4 style="color: #007bff;">英雄排名列表-列对齐设置</h4>
|
||||||
<div class="column-alignment-item">
|
<div class="column-alignment-item">
|
||||||
<label class="text-gold">排名列对齐:</label>
|
<label class="text-gold">排名列对齐:</label>
|
||||||
<select v-model="localDisplayConfig.individual.columnAlignments.rank" class="align-select">
|
<select v-model="localDisplayConfig.individual.columnAlignments.rank" class="align-select">
|
||||||
@@ -172,7 +178,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="column-alignment-section">
|
<div class="column-alignment-section">
|
||||||
<h4 class="text-gold">列对齐设置</h4>
|
<h4 style="color: #007bff;">战区排名列表-列对齐设置</h4>
|
||||||
<div class="column-alignment-item">
|
<div class="column-alignment-item">
|
||||||
<label class="text-gold">排名列对齐:</label>
|
<label class="text-gold">排名列对齐:</label>
|
||||||
<select v-model="localDisplayConfig.team.columnAlignments.rank" class="align-select">
|
<select v-model="localDisplayConfig.team.columnAlignments.rank" class="align-select">
|
||||||
@@ -294,6 +300,12 @@
|
|||||||
<span class="text-gold">显示队长列</span>
|
<span class="text-gold">显示队长列</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="config-item">
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" v-model="localDisplayConfig.team.filterZeroScore">
|
||||||
|
<span class="text-gold">过滤业绩为0的记录</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="config-item">
|
<div class="config-item">
|
||||||
<label class="checkbox-label">
|
<label class="checkbox-label">
|
||||||
<span class="text-gold">移动端默认显示行数:</span>
|
<span class="text-gold">移动端默认显示行数:</span>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
<span v-if="localDisplayConfig.team?.showLeader" class="leader-col" :style="{ textAlign: localDisplayConfig.team?.columnAlignments?.leader || 'left' }">队长</span>
|
<span v-if="localDisplayConfig.team?.showLeader" class="leader-col" :style="{ textAlign: localDisplayConfig.team?.columnAlignments?.leader || 'left' }">队长</span>
|
||||||
<span v-if="localDisplayConfig.team?.showBonus" class="bonus-col" :style="{ textAlign: localDisplayConfig.team?.columnAlignments?.bonus || 'left' }">奖金</span>
|
<span v-if="localDisplayConfig.team?.showBonus" class="bonus-col" :style="{ textAlign: localDisplayConfig.team?.columnAlignments?.bonus || 'left' }">奖金</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(item, index) in teamRankings" :key="item.id" class="table-row"
|
<div v-for="(item, index) in filteredTeamRankings" :key="item.id" class="table-row"
|
||||||
:style="{ 'grid-template-columns': teamGridTemplate }" :class="{
|
:style="{ 'grid-template-columns': teamGridTemplate }" :class="{
|
||||||
'top-three': index < 3,
|
'top-three': index < 3,
|
||||||
'highlight': index === 0
|
'highlight': index === 0
|
||||||
@@ -93,22 +93,22 @@
|
|||||||
<!-- 英雄冠军 -->
|
<!-- 英雄冠军 -->
|
||||||
<div class="individual-champion">
|
<div class="individual-champion">
|
||||||
<div class="individual-avatar champion-container">
|
<div class="individual-avatar champion-container">
|
||||||
<div class="crown-animation" v-if="individualRankings.length > 0">
|
<div class="crown-animation" v-if="filteredIndividualRankings.length > 0">
|
||||||
👑
|
👑
|
||||||
</div>
|
</div>
|
||||||
<img v-if="individualRankings[0]?.avatar && individualRankings[0].avatar.startsWith('/')"
|
<img v-if="filteredIndividualRankings[0]?.avatar && filteredIndividualRankings[0].avatar.startsWith('/')"
|
||||||
:src="individualRankings[0].avatar" alt="冠军头像" class="avatar-image avatar-image-champion"
|
:src="filteredIndividualRankings[0].avatar" alt="冠军头像" class="avatar-image avatar-image-champion"
|
||||||
:style="{ width: localDisplayConfig.championLogos?.individualChampionSize + 'px', height: localDisplayConfig.championLogos?.individualChampionSize + 'px' }">
|
:style="{ width: localDisplayConfig.championLogos?.individualChampionSize + 'px', height: localDisplayConfig.championLogos?.individualChampionSize + 'px' }">
|
||||||
<img v-else-if="localDisplayConfig.championLogos?.individualChampion"
|
<img v-else-if="localDisplayConfig.championLogos?.individualChampion"
|
||||||
:src="localDisplayConfig.championLogos.individualChampion" alt="英雄冠军" class="champion-logo"
|
:src="localDisplayConfig.championLogos.individualChampion" alt="英雄冠军" class="champion-logo"
|
||||||
:style="{ width: localDisplayConfig.championLogos?.individualChampionSize + 'px', height: localDisplayConfig.championLogos?.individualChampionSize + 'px' }">
|
:style="{ width: localDisplayConfig.championLogos?.individualChampionSize + 'px', height: localDisplayConfig.championLogos?.individualChampionSize + 'px' }">
|
||||||
<span v-else
|
<span v-else
|
||||||
:style="{ fontSize: localDisplayConfig.championLogos?.individualChampionSize ? (localDisplayConfig.championLogos.individualChampionSize * 0.8) + 'px' : '2rem' }">
|
:style="{ fontSize: localDisplayConfig.championLogos?.individualChampionSize ? (localDisplayConfig.championLogos.individualChampionSize * 0.8) + 'px' : '2rem' }">
|
||||||
{{ individualRankings[0]?.avatar || '👤' }}
|
{{ filteredIndividualRankings[0]?.avatar || '👤' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="champion-name">
|
<div class="champion-name">
|
||||||
{{ individualRankings[0]?.name || '暂无冠军' }}
|
{{ filteredIndividualRankings[0]?.name || '暂无冠军' }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 英雄排名 -->
|
<!-- 英雄排名 -->
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
<span v-if="localDisplayConfig.individual?.showDepartment" class="dept-col" :style="{ textAlign: localDisplayConfig.individual?.columnAlignments?.department || 'left' }">部门</span>
|
<span v-if="localDisplayConfig.individual?.showDepartment" class="dept-col" :style="{ textAlign: localDisplayConfig.individual?.columnAlignments?.department || 'left' }">部门</span>
|
||||||
<span v-if="localDisplayConfig.individual?.showBonus" class="bonus-col" :style="{ textAlign: localDisplayConfig.individual?.columnAlignments?.bonus || 'left' }">奖金</span>
|
<span v-if="localDisplayConfig.individual?.showBonus" class="bonus-col" :style="{ textAlign: localDisplayConfig.individual?.columnAlignments?.bonus || 'left' }">奖金</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="(item, index) in individualRankings" :key="item.id" class="table-row"
|
<div v-for="(item, index) in filteredIndividualRankings" :key="item.id" class="table-row"
|
||||||
:style="{ 'grid-template-columns': individualGridTemplate }" :class="{
|
:style="{ 'grid-template-columns': individualGridTemplate }" :class="{
|
||||||
'top-three': index < 3,
|
'top-three': index < 3,
|
||||||
'highlight': index === 0
|
'highlight': index === 0
|
||||||
@@ -209,6 +209,7 @@ function createDefaultDisplayConfig() {
|
|||||||
showTeam: true, // 默认显示战区列
|
showTeam: true, // 默认显示战区列
|
||||||
showAvatar: false, // 默认不显示头像列
|
showAvatar: false, // 默认不显示头像列
|
||||||
defaultDisplayRows: 10, // 默认显示10行
|
defaultDisplayRows: 10, // 默认显示10行
|
||||||
|
filterZeroScore: false, // 默认不过滤业绩为0的记录
|
||||||
columnWidths: {
|
columnWidths: {
|
||||||
team: 120 // 默认战区列宽
|
team: 120 // 默认战区列宽
|
||||||
},
|
},
|
||||||
@@ -231,6 +232,7 @@ function createDefaultDisplayConfig() {
|
|||||||
showLeader: true,
|
showLeader: true,
|
||||||
showBonus: false,
|
showBonus: false,
|
||||||
defaultDisplayRows: 0, // 默认显示所有行
|
defaultDisplayRows: 0, // 默认显示所有行
|
||||||
|
filterZeroScore: false, // 默认不过滤业绩为0的记录
|
||||||
columnWidths: {},
|
columnWidths: {},
|
||||||
columnAlignments: {
|
columnAlignments: {
|
||||||
rank: 'left',
|
rank: 'left',
|
||||||
@@ -276,6 +278,26 @@ function mergeConfig(config1, config2) {
|
|||||||
// 响应式数据 - 使用ref包装导入的数据,确保响应式更新
|
// 响应式数据 - 使用ref包装导入的数据,确保响应式更新
|
||||||
const individualRankings = ref(importedIndividualRankings || []);
|
const individualRankings = ref(importedIndividualRankings || []);
|
||||||
const teamRankings = ref(importedTeamRankings || []);
|
const teamRankings = ref(importedTeamRankings || []);
|
||||||
|
|
||||||
|
// 计算属性 - 过滤后的个人排名数据
|
||||||
|
const filteredIndividualRankings = computed(() => {
|
||||||
|
let filtered = individualRankings.value;
|
||||||
|
// 如果配置了过滤业绩为0的记录
|
||||||
|
if (localDisplayConfig.value?.individual?.filterZeroScore) {
|
||||||
|
filtered = filtered.filter(item => item.score > 0);
|
||||||
|
}
|
||||||
|
return filtered;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 计算属性 - 过滤后的战区排名数据
|
||||||
|
const filteredTeamRankings = computed(() => {
|
||||||
|
let filtered = teamRankings.value;
|
||||||
|
// 如果配置了过滤业绩为0的记录
|
||||||
|
if (localDisplayConfig.value?.team?.filterZeroScore) {
|
||||||
|
filtered = filtered.filter(item => item.totalScore > 0);
|
||||||
|
}
|
||||||
|
return filtered;
|
||||||
|
});
|
||||||
// 确保即使displayConfig存在,也要和默认配置合并,保证结构完整性
|
// 确保即使displayConfig存在,也要和默认配置合并,保证结构完整性
|
||||||
const localDisplayConfig = ref(() => {
|
const localDisplayConfig = ref(() => {
|
||||||
if (displayConfig) {
|
if (displayConfig) {
|
||||||
|
|||||||
Reference in New Issue
Block a user