NEZ-2274 feat:图表同步操作 增加遮罩层避免用户重复操作

This commit is contained in:
zyh
2022-10-20 16:25:03 +08:00
parent 02653c5552
commit 893b612b58
7 changed files with 14 additions and 14 deletions

View File

@@ -717,7 +717,7 @@ export default {
this.$store.dispatch('dispatchPanelLock', { flag: boolean }) this.$store.dispatch('dispatchPanelLock', { flag: boolean })
}, },
chartBySync () { chartBySync () {
this.panelTabLoading = true this.$store.dispatch('dispatchHomeLoading', true)
const params = {} const params = {}
if (this.from === 'chartTemp') { if (this.from === 'chartTemp') {
params.pid = this.obj.id params.pid = this.obj.id
@@ -725,7 +725,7 @@ export default {
params.panelId = this.showPanel.id params.panelId = this.showPanel.id
} }
this.$post('visual/panel/chart/syncTmpl', params).then(res => { this.$post('visual/panel/chart/syncTmpl', params).then(res => {
this.panelTabLoading = false this.$store.dispatch('dispatchHomeLoading', false)
if (res.code === 200) { if (res.code === 200) {
this.getTableData(this.obj.id) this.getTableData(this.obj.id)
this.$message.success(this.$t('tip.syncSuccess')) this.$message.success(this.$t('tip.syncSuccess'))

View File

@@ -131,7 +131,9 @@ export default {
}, },
methods: { methods: {
chartBySync (row) { chartBySync (row) {
this.$store.dispatch('dispatchHomeLoading', true)
this.$post('visual/panel/chart/syncTmpl', { models: [row.id] }).then(res => { this.$post('visual/panel/chart/syncTmpl', { models: [row.id] }).then(res => {
this.$store.dispatch('dispatchHomeLoading', false)
if (res.code === 200) { if (res.code === 200) {
this.getTableData() this.getTableData()
this.$message.success(this.$t('tip.syncSuccess')) this.$message.success(this.$t('tip.syncSuccess'))

View File

@@ -264,7 +264,9 @@ export default {
} }
}, },
chartBySync (row) { chartBySync (row) {
this.$store.dispatch('dispatchHomeLoading', true)
this.$post('visual/panel/chart/syncTmpl', { pid: row.id }).then(res => { this.$post('visual/panel/chart/syncTmpl', { pid: row.id }).then(res => {
this.$store.dispatch('dispatchHomeLoading', false)
if (res.code === 200) { if (res.code === 200) {
this.getTableData() this.getTableData()
this.$message.success(this.$t('tip.syncSuccess')) this.$message.success(this.$t('tip.syncSuccess'))

View File

@@ -1843,7 +1843,7 @@ import chartDataFormat from '../../../chart/chartDataFormat'
import logTab from './logTab' import logTab from './logTab'
import promqlInputMixin from '@/components/common/mixin/promqlInput' import promqlInputMixin from '@/components/common/mixin/promqlInput'
import chartRightBox from '@/components/common/rightBox/chart/chartRightBox' import chartRightBox from '@/components/common/rightBox/chart/chartRightBox'
import {Loading} from "element-ui"; import { Loading } from 'element-ui'
export default { export default {
name: 'exploreItem', name: 'exploreItem',
@@ -2628,13 +2628,9 @@ export default {
if (!this.showMetrics) { if (!this.showMetrics) {
params.limit = this.$refs.logDetail ? this.$refs.logDetail.getLimit() : 100 params.limit = this.$refs.logDetail ? this.$refs.logDetail.getLimit() : 100
} }
const loading = Loading.service({ this.$store.dispatch('dispatchHomeLoading', true)
lock: true,
customClass: 'export-pdf-mask',
background: 'rgba(0,0,0,.2)'
})
this.$get('/visual/explore/snapshot', params, 'blob').then(res => { this.$get('/visual/explore/snapshot', params, 'blob').then(res => {
loading.close() this.$store.dispatch('dispatchHomeLoading', false)
const self = this const self = this
let fileName = this.showMetrics ? 'Metrics explore' : 'Logs explore' let fileName = this.showMetrics ? 'Metrics explore' : 'Logs explore'
const resFileName = '' const resFileName = ''

View File

@@ -505,9 +505,9 @@ export default {
this.rightBox.chartTemp.show = true this.rightBox.chartTemp.show = true
}, },
chartBySync () { chartBySync () {
this.panelTabLoading = true this.$store.dispatch('dispatchHomeLoading', true)
this.$post('visual/panel/chart/syncTmpl', { panelId: this.showPanel.id }).then(res => { this.$post('visual/panel/chart/syncTmpl', { panelId: this.showPanel.id }).then(res => {
this.panelTabLoading = false this.$store.dispatch('dispatchHomeLoading', false)
if (res.code === 200) { if (res.code === 200) {
this.getData(this.filter) this.getData(this.filter)
this.$message.success(this.$t('tip.syncSuccess')) this.$message.success(this.$t('tip.syncSuccess'))

View File

@@ -473,7 +473,9 @@ export default {
}) })
}, },
chartBySync (row) { chartBySync (row) {
this.$store.dispatch('dispatchHomeLoading', true)
this.$post('visual/panel/chart/syncTmpl', { modules: row.id }).then(res => { this.$post('visual/panel/chart/syncTmpl', { modules: row.id }).then(res => {
this.$store.dispatch('dispatchHomeLoading', false)
if (res.code === 200) { if (res.code === 200) {
this.getTableData() this.getTableData()
this.$message.success(this.$t('tip.syncSuccess')) this.$message.success(this.$t('tip.syncSuccess'))

View File

@@ -123,9 +123,7 @@ export function get (url, params, responseType) {
if (err.response) { if (err.response) {
resolve(err.response.data) resolve(err.response.data)
} else if (err.message) { } else if (err.message) {
if (err.message !== 'cancel') { // 判断是否是路由跳转取消的请求是的话没必要提示message
resolve(err.message) resolve(err.message)
}
} else { } else {
resolve(err) resolve(err)
} }