From 2049a4e6f4bcc42df3240d2e6699fc10677abcd8 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 31 Mar 2022 13:33:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?NEZ-1754=20fix=EF=BC=9A=E5=BC=80=E5=90=AF2F?= =?UTF-8?q?A=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=E8=8B=B1=E6=96=87=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/login.vue | 8 -------- nezha-fronted/src/store/user.js | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nezha-fronted/src/components/common/login.vue b/nezha-fronted/src/components/common/login.vue index f4c342272..c4c9ad589 100644 --- a/nezha-fronted/src/components/common/login.vue +++ b/nezha-fronted/src/components/common/login.vue @@ -167,14 +167,6 @@ export default { this.$i18n.locale = this.lang this.theme = res.data.user.theme this.userInfo = res.data.user - // 获取可选语言 - get('/sys/dict/all?type=lang').then(response => { - if (response.code === 200) { - const langList = response.data.map(lang => ({ name: lang.name, value: lang.value })) - this.$store.commit('setLangList', langList) - localStorage.setItem('nz-language-list', JSON.stringify(langList)) - } - }) localStorage.setItem('nz-token', res.data.authToken) if (res.data.authFlag === 1) { if (res.data.authBind === 0) { diff --git a/nezha-fronted/src/store/user.js b/nezha-fronted/src/store/user.js index 6dbdd8aae..930d49e38 100644 --- a/nezha-fronted/src/store/user.js +++ b/nezha-fronted/src/store/user.js @@ -102,6 +102,14 @@ const user = { localStorage.setItem('nz-mfa-enable', Number(res.data.mfaAuthEnable) ? 1 : 0) store.commit('setLanguage', res.data.user.lang || defaultAppearance.language) store.commit('setTimeFormatMain', localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss') + // 获取可选语言 + get('/sys/dict/all?type=lang').then(response => { + if (response.code === 200) { + const langList = response.data.map(lang => ({ name: lang.name, value: lang.value })) + store.commit('setLangList', langList) + localStorage.setItem('nz-language-list', JSON.stringify(langList)) + } + }) post('/sys/user/permissions', { token: res.data.token }).then(res => { const menuList = sortByOrderNum(res.data.menus) // localStorage.setItem('nz-user-permissions', JSON.stringify(res.data.buttons)) From 9ab970d000aa0e83aab946ee740d47bc137e981f Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 1 Apr 2022 10:48:43 +0800 Subject: [PATCH 2/4] =?UTF-8?q?NEZ-1767=20fix=EF=BC=9A=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=9B=BE=E8=A1=A8=E5=AE=BD=E5=AF=BC=E8=87=B4=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E9=87=8D=E5=8F=A0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/chartList.vue | 63 +++++++++++++++++++ .../src/components/chart/chartMixin.js | 1 - .../common/rightBox/chart/chartRightBox.vue | 31 +++++++-- 3 files changed, 90 insertions(+), 5 deletions(-) diff --git a/nezha-fronted/src/components/chart/chartList.vue b/nezha-fronted/src/components/chart/chartList.vue index 25771bdb3..370ba37c0 100644 --- a/nezha-fronted/src/components/chart/chartList.vue +++ b/nezha-fronted/src/components/chart/chartList.vue @@ -210,6 +210,8 @@ export default { if (!this.isGroup) { this.moveChart() this.onScroll(this.scrollTop) + } else { + bus.$emit('groupChildMove') } }, containerResizedEvent (i, newH, newW, newHPx, newWPx) { @@ -346,6 +348,65 @@ export default { }, refreshPanel () { bus.$emit('refreshPanel') + }, + createChartSuccess (params) { + const arr = this.copyDataList.filter(item => !item.staic) + const charts = [] + let weight = 0 + arr.forEach(item => { + const chart = { + id: item.id, + x: item.x, + y: item.y, + span: item.span, + height: item.height, + groupId: item.groupId, + weight: weight + } + if (!params.groupId && chart.y >= params.y) { + chart.y = chart.y + 1 + } + if (params.id == item.id) { + chart.y = params.y + chart.x = params.x + } + charts.push(chart) + + weight++ + if (item.type === 'group') { + item.children && item.children.forEach(children => { + const childrenChart = { + id: children.id, + x: children.x, + y: children.y, + span: children.span, + height: children.height, + groupId: children.groupId, + weight: weight + } + if (item.id === params.groupId && children.y >= params.y) { + childrenChart.y = childrenChart.y + 1 + } + if (params.id == childrenChart.id) { + childrenChart.y = params.y + childrenChart.x = params.x + } + charts.push(childrenChart) + weight++ + }) + } + }) + const chartParams = { + panelId: this.panelId, + charts: charts + } + if (charts && charts.length) { + this.$put('/visual/panel/chart/weights', chartParams).then(() => { + if (params.cb) { + params.cb() + } + }) + } } }, created () { @@ -355,6 +416,8 @@ export default { this.init() if (!this.isGroup) { bus.$on('groupMove', this.changeGroupHeight) + bus.$on('creat-chart-success', this.createChartSuccess) + bus.$on('groupChildMove', this.moveChart) this.$store.commit('setChartListId', `chartList${this.timestamp}`) window.addEventListener('resize', this.resize) } diff --git a/nezha-fronted/src/components/chart/chartMixin.js b/nezha-fronted/src/components/chart/chartMixin.js index 3e8224aef..181536364 100644 --- a/nezha-fronted/src/components/chart/chartMixin.js +++ b/nezha-fronted/src/components/chart/chartMixin.js @@ -261,7 +261,6 @@ export default { } }, resize () { - console.log('reszie') setTimeout(() => { getChart(this.chartId) && getChart(this.chartId).resize() }, 100) diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index 48aa7572f..e392ea405 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -207,6 +207,8 @@ export default { }, // 保存endpoint save () { + const self = this + let resetFlag = false // 页面是否需要重排 const arr = [this.$refs.chartForm.validate()] arr.push(this.$refs['childrenFrom' + this.editChart.datasource].$refs.chartForm.validate()) Promise.all(arr).then(res => { @@ -245,6 +247,7 @@ export default { if (params.x + params.span > 12) { params.x = 0 params.y += 1 + resetFlag = true } delete params.panel if (params.type === 'table') { @@ -257,8 +260,18 @@ export default { this.$put('visual/panel/chart', params).then(response => { if (response.code === 200) { this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) - this.$emit('on-create-success', { id: this.panelId, name: this.panelName }) - this.esc(true) + if (resetFlag) { + bus.$emit('creat-chart-success', { + ...params, + cb: function () { + self.$emit('on-create-success', { id: this.panelId, name: this.panelName }) + self.esc(true) + } + }) + } else { + self.$emit('on-create-success', { id: this.panelId, name: this.panelName }) + self.esc(true) + } } else { this.$message.error(response.msg) } @@ -267,8 +280,18 @@ export default { this.$post('visual/panel/chart', params).then(response => { if (response.code === 200) { this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) - this.$emit('on-create-success', { id: this.panelId, name: this.panelName }) - this.esc(true) + if (resetFlag) { + bus.$emit('creat-chart-success', { + ...params, + cb: function () { + self.$emit('on-create-success', { id: this.panelId, name: this.panelName }) + self.esc(true) + } + }) + } else { + self.$emit('on-create-success', { id: this.panelId, name: this.panelName }) + self.esc(true) + } } else { this.$message.error(response.msg) } From 08274e4cbf949eb5be9269d125929fd0a0101d73 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 1 Apr 2022 10:56:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=20NEZ-1760=20fix=EF=BC=9A=E6=8B=93?= =?UTF-8?q?=E6=89=91=E5=9B=BE=E5=86=85=E6=9F=A5=E7=9C=8Bendpoint=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=86=85=E5=AE=B9=E6=9C=AA=E6=BB=A1=E4=B8=80=E9=A1=B5?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8B=E6=96=B9=E8=BE=B9=E6=A1=86=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/project/popData/endpointTable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nezha-fronted/src/components/common/project/popData/endpointTable.vue b/nezha-fronted/src/components/common/project/popData/endpointTable.vue index d73892af4..06bfcbc69 100644 --- a/nezha-fronted/src/components/common/project/popData/endpointTable.vue +++ b/nezha-fronted/src/components/common/project/popData/endpointTable.vue @@ -14,7 +14,7 @@ >