diff --git a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue index 1a2fc4e08..7b83c7dfc 100644 --- a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue +++ b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue @@ -96,7 +96,6 @@ export default { } const decimals = this.chartInfo.param.decimals || 2 const { minTime, maxTime, minValue, maxValue, copies, unit, dot } = this.getMinMaxFromData(this.chartData, this.chartInfo.unit) // - console.log(maxTime - minTime, maxTime, minTime) chartOption.xAxis.axisLabel.formatter = this.xAxisLabelFormatter(minTime, maxTime)// 需转为毫秒 chartOption.tooltip.formatter = this.tooltipFormatter(this.chartInfo.param.stack) chartOption.tooltip.position = this.tooltipPosition diff --git a/nezha-fronted/src/components/common/mixin/editRigthBox.js b/nezha-fronted/src/components/common/mixin/editRigthBox.js index ecabae178..b91994e3f 100644 --- a/nezha-fronted/src/components/common/mixin/editRigthBox.js +++ b/nezha-fronted/src/components/common/mixin/editRigthBox.js @@ -4,7 +4,8 @@ export default { isEdit: false, messageParams: { route: '', - params: {} + params: {}, + emit: '' }, closeMessage: '' } @@ -17,9 +18,10 @@ export default { } }, methods: { - messageShow (msg, route, params, showNext = false, nextText = 'setup.next') { + messageShow (msg, route, params, showNext = false, nextText = 'setup.next', emit) { this.messageParams.route = route this.messageParams.params = params + this.messageParams.emit = emit this.closeMessage = this.$message({ duration: showNext ? 5000 : 2000, dangerouslyUseHTMLString: true, @@ -35,6 +37,10 @@ export default { assetAdd.addEventListener('click', this.saveNext) }, saveNext () { + if (!this.messageParams.route) { + this.$store.dispatch(this.messageParams.emit, this.messageParams.params) + return + } this.$router.push({ path: this.messageParams.route, query: this.messageParams.params diff --git a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue index d42cc7cd7..4852a7cdf 100644 --- a/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue +++ b/nezha-fronted/src/components/common/rightBox/asset/assetBox.vue @@ -743,7 +743,7 @@ export default { this.$put(this.url, params).then(res => { this.prevent_opt.save = false if (res.code === 200) { - this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, true, 'guide.addEndpoint') + this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, false, 'guide.addEndpoint') this.esc(true) } else { this.$message.error(res.msg) @@ -753,7 +753,7 @@ export default { this.$post(this.url, params).then(res => { this.prevent_opt.save = false if (res.code === 200) { - this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, false, 'guide.addEndpoint') + this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, true, 'guide.addEndpoint') this.esc(true) } else { this.$message.error(res.msg) diff --git a/nezha-fronted/src/components/common/rightBox/dcBox.vue b/nezha-fronted/src/components/common/rightBox/dcBox.vue index 226df3eaa..5b82c23fc 100644 --- a/nezha-fronted/src/components/common/rightBox/dcBox.vue +++ b/nezha-fronted/src/components/common/rightBox/dcBox.vue @@ -124,7 +124,7 @@ export default { this.$put('/dc', param).then(response => { this.prevent_opt.save = false if (response.code === 200) { - this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, false, 'guide.addCabinet', 'addCabinet') this.esc(true) } else { this.$message.error(response.msg) @@ -147,7 +147,7 @@ export default { this.$post('/dc', param).then(response => { this.prevent_opt.save = false if (response.code === 200) { - this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, true, 'guide.addCabinet', 'addCabinet') this.esc(true) } else { this.$message.error(response.msg) diff --git a/nezha-fronted/src/components/common/rightBox/moduleBox.vue b/nezha-fronted/src/components/common/rightBox/moduleBox.vue index 97bafe5c9..85c395ae0 100644 --- a/nezha-fronted/src/components/common/rightBox/moduleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/moduleBox.vue @@ -934,7 +934,8 @@ export default { if (this.editModule.id) { this.$put('monitor/module', params).then(response => { if (response.code === 200) { - this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + // this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, false, 'guide.addEndpoint') this.$store.commit('setReloadFacade') this.esc(true) } else { @@ -945,7 +946,7 @@ export default { } else { this.$post('monitor/module', params).then(response => { if (response.code === 200) { - this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, true, 'guide.addEndpoint') this.$store.commit('setReloadFacade') this.esc(true) } else { diff --git a/nezha-fronted/src/components/common/rightBox/projectBox.vue b/nezha-fronted/src/components/common/rightBox/projectBox.vue index 1cb5bb2fd..9b66268ea 100644 --- a/nezha-fronted/src/components/common/rightBox/projectBox.vue +++ b/nezha-fronted/src/components/common/rightBox/projectBox.vue @@ -71,7 +71,8 @@ export default { if (this.editProject.id) { this.$put('monitor/project', this.editProject).then(response => { if (response.code === 200) { - this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + // this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, false, 'guide.addModule') this.$store.commit('projectListChange') this.$store.commit('setProject', this.project) this.esc(true) @@ -83,7 +84,7 @@ export default { } else { this.$post('monitor/project', this.editProject).then(response => { if (response.code === 200) { - this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) + this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, true, 'guide.addModule') this.$store.commit('projectListChange') this.esc(true) } else { diff --git a/nezha-fronted/src/components/page/config/dc.vue b/nezha-fronted/src/components/page/config/dc.vue index 680cd36cc..1cc5e0257 100644 --- a/nezha-fronted/src/components/page/config/dc.vue +++ b/nezha-fronted/src/components/page/config/dc.vue @@ -137,7 +137,7 @@ - + @@ -232,6 +232,11 @@ export default { trendKey: 'dcId' } }, + computed: { + addCabinetBoxShow () { + return this.$store.getters.getAddCabinetBoxParams + } + }, methods: { getUserData () { return new Promise(resolve => { @@ -246,7 +251,11 @@ export default { regNumTest (val) { // 校验是否是数字 return this.regNum.test(val) }, - addCabinet () { + addCabinet (params) { + console.log('addCabinet') + if (params) { + this.cabinet.idcId = params.dcid + } this.cabinetBoxShow = true }, add () { @@ -261,8 +270,10 @@ export default { }) }, closeRightBox (refresh) { + console.log('closeRightBox') this.rightBox.show = false this.cabinetBoxShow = false + this.$store.dispatch('addCabinet', { dcid: '', cabinetBoxShow: false }) if (refresh) { this.delFlag = true this.getTableData() @@ -290,6 +301,12 @@ export default { } } } + }, + addCabinetBoxShow: { + handler (n) { + this.cabinetBoxShow = n.cabinetBoxShow + this.cabinet.idcId = n.dcId + } } } } diff --git a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue index 47baffd73..0174ccece 100644 --- a/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue +++ b/nezha-fronted/src/components/page/monitor/endpoint/endpointList.vue @@ -896,6 +896,14 @@ export default { } this.rightBox.show = true } + if (this.$route.query && this.$route.query.moduleId) { + this.object = { + ...this.newObject(), + moduleId: Number(this.$route.query.moduleId), + projectId: Number(this.$route.query.projectId) + } + this.rightBox.show = true + } if (localStorage.getItem('endpointProjectId')) { this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))] // this.$refs.clickSearch.selectValueOut.projectIds = [localStorage.getItem('endpointProjectId')] diff --git a/nezha-fronted/src/components/page/monitor/module/moduleList.vue b/nezha-fronted/src/components/page/monitor/module/moduleList.vue index 9bc7cab89..d29d2fbc0 100644 --- a/nezha-fronted/src/components/page/monitor/module/moduleList.vue +++ b/nezha-fronted/src/components/page/monitor/module/moduleList.vue @@ -549,6 +549,13 @@ export default { this.initQueryFromPath(searchKeys) }, mounted () { + if (this.$route.query && this.$route.query.projectId) { + this.object = { + ...this.newObject(), + projectId: Number(this.$route.query.projectId) + } + this.rightBox.show = true + } }, watch: { $route: { diff --git a/nezha-fronted/src/store/panel.js b/nezha-fronted/src/store/panel.js index bccb95813..2fe6a2cc1 100644 --- a/nezha-fronted/src/store/panel.js +++ b/nezha-fronted/src/store/panel.js @@ -19,7 +19,8 @@ const panel = { topologyShow: false, topologyChartInfo: {}, // 查看模式 - mode: '' + mode: '', + addCabinetBoxParams: { dcid: '', cabinetBoxShow: false } }, mutations: { setShowRightBox (state, flag) { @@ -54,6 +55,9 @@ const panel = { state.headerHPadding = h.headerHPadding state.rowHeight = h.rowHeight }, + setCabinet (state, params) { + state.addCabinetBoxParams = params + }, cleanPanel (state) { state.showRightBox = false state.chart = '' @@ -120,6 +124,9 @@ const panel = { }, getTopologyChartInfo (state) { return state.topologyChartInfo + }, + getAddCabinetBoxParams (state) { + return state.addCabinetBoxParams } }, actions: { @@ -149,6 +156,9 @@ const panel = { dispatchPanelLock (store, playload) { store.commit('setPanelLock', playload.flag) }, + addCabinet (store, playload) { + store.commit('setCabinet', playload) + }, clearPanel (store) { store.commit('cleanPanel') },