diff --git a/src/views/study/Growth.vue b/src/views/study/Growth.vue index adf8fc31..e336ff64 100644 --- a/src/views/study/Growth.vue +++ b/src/views/study/Growth.vue @@ -128,7 +128,7 @@
@@ -476,13 +476,48 @@ export default {
const codeTrimmed = code.trim();
const index = bandCodeIndexMap.get(codeTrimmed);
if (index !== undefined) {
- integratedDataMap.get(key).bandCodes[index] = { growId: item.growId, permission: item.permission ,isMajorPosition:item.isMajorPosition ,growName:item.growName };
+ integratedDataMap.get(key).bandCodes[index] = { growId: item.growId, permission: item.permission ,isMajorPosition:item.isMajorPosition ,growName:item.growName ,colspan: item.colspan };
}
});
});
const integratedDataArray = Array.from(integratedDataMap.values());
-
- console.log(integratedDataArray,'integratedDataArray')
+ 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;
},
toggleFlag() {