This commit is contained in:
zhangsir
2024-06-26 11:09:29 +08:00
parent b973ebccc5
commit 1e28aa139f
2 changed files with 82 additions and 12 deletions

View File

@@ -25,16 +25,16 @@
<view class="table-container">
<table width="100%">
<thead>
<tr style="background: #F0F6FC;">
<tr style="background: #F0F6FC;display: flex;align-items: center;">
<th class="first" align="center"><view class="text">
</view></th>
<th v-for="item in titleList" align="center">{{ item.title }}</th>
<th class="item1" v-for="item in titleList" align="center">{{ item.title }}</th>
</tr>
</thead>
<tbody>
<tr v-for="item,index in preparedData" :key="index">
<tr style="display: flex;align-items: center;" v-for="item,index in preparedData" :key="index">
<td class="first" align="center"><view class="text">{{ item.isOtherPosition == 1 ? item.positionName + '(' + item.organizationName + ')' : item.positionName }}</view></td>
<td align="center" v-for="t,i in item.bandCodes">
<td :style="{width: 222 * t.number + 'rpx'}" class="item" align="center" v-for="t,i in item.bandCodes">
<image
v-if="(t && t.isMajorPosition) "
src="@/static/images/learnpath/thispath.png"
@@ -150,6 +150,41 @@
});
});
const integratedDataArray = Array.from(integratedDataMap.values());
const mergeById = (array) => {
const result = [];
let currentGroup = null;
array.forEach(item => {
if (item === null) {
if (currentGroup && currentGroup.growId !== null) {
result.push(currentGroup);
currentGroup = null;
}
if (!currentGroup) {
currentGroup = { growId: null, number: 1, ...item };
} else {
currentGroup.number++;
}
} else {
if (!currentGroup || currentGroup.growId !== item.growId) {
if (currentGroup) {
result.push(currentGroup);
}
currentGroup = { growId: item.growId, number: 1, ...item };
} else {
currentGroup.number++;
}
}
});
if (currentGroup) {
result.push(currentGroup);
}
return result;
};
integratedDataArray.forEach(item => {
item.bandCodes = mergeById(item.bandCodes);
});
console.log(integratedDataArray,'integratedDataArray')
return integratedDataArray;
},
@@ -176,22 +211,23 @@
table {
width: 100%;
border-collapse: collapse;
border: 2rpx solid #F0F6FC;
}
th {
/* th {
padding: 12px 20px;
text-align: center;
border: 2rpx solid #F0F6FC;
background: #F0F6FC;
}
td{
} */
/* td{
padding: 12px 16px;
text-align: center;
border: 2rpx solid #F0F6FC;
color: #333333;
font-weight: 400;
font-size: 28rpx;
}
} */
th {
font-weight: bold;
@@ -202,10 +238,39 @@
text-align: center;
.text{
width: 212rpx;
border-collapse: collapse;
border-collapse: collapse;
}
}
.item1{
/* padding: 12px 20px; */
width: 220rpx;
min-height: 100rpx;
text-align: center;
border: 2rpx solid #F0F6FC;
background: #F0F6FC;
font-weight: bold;
color: #387DF7;
font-weight: bold;
border-collapse: collapse;
display: flex;
justify-content: center;
align-items: center;
}
.item{
width: 220rpx;
min-height: 120rpx;
text-align: center;
border: 2rpx solid #F0F6FC;
border-bottom: none;
background-color: #ffffff;
color: #333333;
font-weight: 400;
font-size: 28rpx;
border-collapse: collapse;
display: flex;
justify-content: center;
align-items: center;
}
tbody tr:nth-child(odd) {
background-color: #ffffff;
}