From 75bbe1b2ba3a9d9b37d5048ab313fe86209edd21 Mon Sep 17 00:00:00 2001 From: Xiao Bai <2835066049@qq.com> Date: Mon, 28 Nov 2022 17:36:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?NEZ-2377=20fix=20:=20=E6=8B=93=E6=89=91?= =?UTF-8?q?=E5=9B=BE=E7=9A=84module=20info=E6=82=AC=E6=B5=AE=E7=AA=97?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=A9=BA=E6=8B=93=E6=89=91=E5=9B=BE=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=87=AA=E5=8A=A8=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/project/topologyL5.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index ad962b79b..20557b723 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -661,9 +661,8 @@ export default { methods: { init () { // canvasOptions.on = this.onMessage - clearTimeout(this.timer3) - this.timer3 = null this.reload() + this.popDataShowUpdate('', false) }, reload () { From 27ebab5681ab2368ecabf8518e9f9e81dde8a098 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 28 Nov 2022 18:07:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?NEZ-2429=20=20feat=EF=BC=9Adashboard=20char?= =?UTF-8?q?t=20repeat=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/chartList.vue | 102 +++++++++++------- 1 file changed, 65 insertions(+), 37 deletions(-) diff --git a/nezha-fronted/src/components/chart/chartList.vue b/nezha-fronted/src/components/chart/chartList.vue index 51d634297..8bf5f38d9 100644 --- a/nezha-fronted/src/components/chart/chartList.vue +++ b/nezha-fronted/src/components/chart/chartList.vue @@ -593,47 +593,75 @@ export default { } } this.$nextTick(() => { - for (let index = 0; index < this.copyDataList.length; index++) { - const item = this.copyDataList[index] - if (this.$loadsh.get(this.showHidden[item.id], 'visibility') !== 'hidden' && this.$loadsh.get(item.param.enable, 'repeat')) { - this.variablesArr.forEach((variables) => { - const repeatVariable = this.$loadsh.get(item.param.repeat, 'variable') - if (item.type === 'group' && variables.name === repeatVariable) { - variables.checked.forEach((subItem, subIndex) => { - if (subIndex > 0) { - // 复制数据 重新设置id - const repeatItem = this.$loadsh.cloneDeep(item) - repeatItem.id = item.id + '-' + 'repeat-' + subIndex - repeatItem.i = repeatItem.id - repeatItem.repeatIndex = subIndex - repeatItem.repeatVariable = repeatVariable - repeatItem.repeatValue = subItem - repeatItem.children.forEach(children => { - children.id = children.id + '-' + 'repeat-' + subIndex - children.repeatIndex = subIndex - children.repeatVariable = repeatVariable - children.repeatValue = subItem - }) - index += 1 - // 复制数据 - this.copyDataList.splice(index, 0, repeatItem) - } else { - this.$set(item, 'repeatIndex', 0) - this.$set(item, 'repeatVariable', repeatVariable) - this.$set(item, 'repeatValue', subItem) - item.children.forEach(children => { - this.$set(children, 'repeatIndex', 0) - this.$set(children, 'repeatVariable', repeatVariable) - this.$set(children, 'repeatValue', subItem) - }) - this.$refs['chart' + item.id] && this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].getChartData() - } + // 先让数组根据 y 排序 之后直接判断顺序 即可判断 Group 是否相邻 + let arr = this.$loadsh.cloneDeep(this.copyDataList) + arr = this.$loadsh.orderBy(arr, function (item) { + return item.y + }) + const variablesRepeat = {} + for (let index = 0; index < arr.length; index++) { // 遍历找出所有需要 repeat的group 按照 name进行多次的分组 + const item = arr[index] + const repeatVariable = this.$loadsh.get(item.param.repeat, 'variable') + if (item.type === 'group' && repeatVariable) { + const itemPrev = arr[index - 1] + const repeatPrevVariable = this.$loadsh.get(itemPrev.param.repeat, 'variable') + if (itemPrev && itemPrev.type === 'group' && repeatPrevVariable === repeatVariable) { + const arr = variablesRepeat[repeatVariable] + arr[arr.length - 1].repeatArr.push(item) + arr[arr.length - 1].lastGroup = item + } else { + if (variablesRepeat[repeatVariable]) { + variablesRepeat[repeatVariable].push({ + repeatArr: [item], + lastGroup: item }) + } else { + variablesRepeat[repeatVariable] = [{ + repeatArr: [item], + lastGroup: item + }] } - }) + } } } - this.onScroll(this.scrollTop) + Object.keys(variablesRepeat).forEach(key => { // 遍历 variablesRepeat 确定需要插入的数组 + const findVariables = this.variablesArr.find(item => item.name == key) + findVariables.checked.forEach((subItem, subIndex) => { + variablesRepeat[key].forEach(group => { + group.repeatArr.forEach(item => { + if (subIndex > 0) { + // 复制数据 重新设置id + const repeatItem = this.$loadsh.cloneDeep(item) + repeatItem.id = item.id + '-' + 'repeat-' + subIndex + repeatItem.i = repeatItem.id + repeatItem.repeatIndex = subIndex + repeatItem.repeatVariable = key + repeatItem.repeatValue = subItem + repeatItem.y = group.lastGroup.y + repeatItem.children.forEach(children => { + children.id = children.id + '-' + 'repeat-' + subIndex + children.repeatIndex = subIndex + children.repeatVariable = key + children.repeatValue = subItem + }) + // 复制数据 + this.copyDataList.push(repeatItem) + } else { + const findItem = this.copyDataList.find(chart => chart.id === item.id) + this.$set(findItem, 'repeatIndex', 0) + this.$set(findItem, 'repeatVariable', key) + this.$set(findItem, 'repeatValue', subItem) + findItem.children.forEach(children => { + this.$set(children, 'repeatIndex', 0) + this.$set(children, 'repeatVariable', key) + this.$set(children, 'repeatValue', subItem) + }) + this.$refs['chart' + findItem.id] && this.$refs['chart' + findItem.id][0] && this.$refs['chart' + findItem.id][0].getChartData() + } + }) + }) + }) + }) }) } From 667e95b0af43a412e342919450cd79ed18d6acca Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 29 Nov 2022 10:15:54 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9group=20child?= =?UTF-8?q?ren=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/chart/chartList.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nezha-fronted/src/components/chart/chartList.vue b/nezha-fronted/src/components/chart/chartList.vue index 8bf5f38d9..3c0a2e3da 100644 --- a/nezha-fronted/src/components/chart/chartList.vue +++ b/nezha-fronted/src/components/chart/chartList.vue @@ -585,7 +585,7 @@ export default { delete item.repeatIndex delete item.repeatVariable delete item.repeatValue - item.children.forEach(children => { + item.children && item.children.forEach(children => { delete children.repeatIndex delete children.repeatVariable delete children.repeatValue @@ -638,7 +638,7 @@ export default { repeatItem.repeatVariable = key repeatItem.repeatValue = subItem repeatItem.y = group.lastGroup.y - repeatItem.children.forEach(children => { + repeatItem.children && repeatItem.children.forEach(children => { children.id = children.id + '-' + 'repeat-' + subIndex children.repeatIndex = subIndex children.repeatVariable = key @@ -651,7 +651,7 @@ export default { this.$set(findItem, 'repeatIndex', 0) this.$set(findItem, 'repeatVariable', key) this.$set(findItem, 'repeatValue', subItem) - findItem.children.forEach(children => { + findItem.children && findItem.children.forEach(children => { this.$set(children, 'repeatIndex', 0) this.$set(children, 'repeatVariable', key) this.$set(children, 'repeatValue', subItem)