CN-749 fix: 统一error交互
This commit is contained in:
@@ -285,8 +285,7 @@ export default {
|
||||
console.error(e)
|
||||
this.toggleLoading(false)
|
||||
this.showError = true
|
||||
this.errorMsg = ''
|
||||
this.errorMsg = e.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
})
|
||||
},
|
||||
getUrlParam (param, defaultValue, isNumber) {
|
||||
|
||||
@@ -165,7 +165,7 @@ export default {
|
||||
}).catch((e) => {
|
||||
this.isNoData = false
|
||||
this.showError = true
|
||||
this.errorMsg = e.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
|
||||
@@ -139,10 +139,10 @@ export default {
|
||||
this.showError = true
|
||||
this.errorMsg = res.message
|
||||
}
|
||||
}).catch((e) => {
|
||||
}).catch(e => {
|
||||
this.isNoData = false
|
||||
this.showError = true
|
||||
this.errorMsg = e.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
|
||||
@@ -89,9 +89,9 @@ export default {
|
||||
this.showError = true
|
||||
this.errorMsg = res.message
|
||||
}
|
||||
}).catch(error => {
|
||||
}).catch(e => {
|
||||
this.showError = true
|
||||
this.errorMsg = error.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
|
||||
@@ -61,8 +61,8 @@ import { shallowRef } from 'vue'
|
||||
import _ from 'lodash'
|
||||
import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools'
|
||||
import { getSecond } from '@/utils/date-util'
|
||||
import { get } from '@/utils/http'
|
||||
import { api } from '@/utils/api'
|
||||
import axios from 'axios'
|
||||
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
||||
import chartMixin from '@/views/charts2/chart-mixin'
|
||||
import unitConvert from '@/utils/unit-convert'
|
||||
@@ -154,7 +154,8 @@ export default {
|
||||
url = api.npm.location.packetsRetrains
|
||||
}
|
||||
if (url) {
|
||||
get(url, params).then(res => {
|
||||
axios.get(url, { params: params }).then(res => {
|
||||
res = res.data
|
||||
if (res.code === 200) {
|
||||
this.showError = false
|
||||
this.isNoData = res.data.result.length === 0
|
||||
@@ -180,10 +181,11 @@ export default {
|
||||
this.showError = true
|
||||
this.errorMsg = res.message
|
||||
}
|
||||
}).catch((e) => {
|
||||
}).catch(e => {
|
||||
console.error(e)
|
||||
this.isNoData = false
|
||||
this.showError = true
|
||||
this.errorMsg = e.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
|
||||
@@ -54,7 +54,8 @@ import { storageKey, unitTypes, countryNameIdMapping } from '@/utils/constants'
|
||||
import locationOptions from '@/views/charts2/charts/locationOptions'
|
||||
import { valueToRangeValue } from '@/utils/unit-convert'
|
||||
import { getSecond } from '@/utils/date-util'
|
||||
import { api, getData } from '@/utils/api'
|
||||
import { api } from '@/utils/api'
|
||||
import axios from 'axios'
|
||||
import { get } from '@/utils/http'
|
||||
import chartMixin from '@/views/charts2/chart-mixin'
|
||||
// import { Rectangle3D } from '@amcharts/amcharts4/.internal/core/elements/3d/Rectangle3D'
|
||||
@@ -121,7 +122,8 @@ export default {
|
||||
side: this.trafficDirection.toLowerCase(),
|
||||
country: this.location
|
||||
}
|
||||
getData(api.npm.location.map, params).then(res => {
|
||||
axios.get(api.npm.location.map, { params: params }).then(res => {
|
||||
res = res.data
|
||||
if (res.length > 0) {
|
||||
// 计算分数
|
||||
this.showError = false
|
||||
@@ -176,7 +178,7 @@ export default {
|
||||
}
|
||||
}).catch((e) => {
|
||||
this.showError = true
|
||||
this.errorMsg = e.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
|
||||
@@ -130,10 +130,10 @@ export default {
|
||||
this.showError = true
|
||||
this.errorMsg = res.message
|
||||
}
|
||||
}).catch(error => {
|
||||
}).catch(e => {
|
||||
this.isNoData = false
|
||||
this.showError = true
|
||||
this.errorMsg = error.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
|
||||
@@ -36,6 +36,7 @@ import { chartColor3, unitTypes } from '@/utils/constants.js'
|
||||
import { ref, shallowRef } from 'vue'
|
||||
import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools'
|
||||
import { get } from '@/utils/http'
|
||||
import axios from 'axios'
|
||||
import { api } from '@/utils/api'
|
||||
import { getSecond } from '@/utils/date-util'
|
||||
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
||||
@@ -194,7 +195,8 @@ export default {
|
||||
}
|
||||
this.toggleLoading(true)
|
||||
if (params.type && params.q) {
|
||||
get(api.npm.overview.trafficGraph, params).then((res) => {
|
||||
axios.get(api.npm.overview.trafficGraph, { params: params }).then(res => {
|
||||
res = res.data
|
||||
if (res.code === 200) {
|
||||
this.showError = false
|
||||
this.isNoData = res.data.result.length === 0
|
||||
@@ -215,7 +217,6 @@ export default {
|
||||
{ name: this.$t('overall.packetRetrans'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 4 }
|
||||
]
|
||||
} else {
|
||||
console.info(res.data.result)
|
||||
this.initData(res.data.result, val)
|
||||
}
|
||||
} else {
|
||||
@@ -226,17 +227,17 @@ export default {
|
||||
}).catch(e => {
|
||||
this.isNoData = false
|
||||
this.showError = true
|
||||
this.errorMsg = e.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
console.error(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
} else {
|
||||
this.toggleLoading(true)
|
||||
const totalTrafficAnalysis = get(api.npm.overview.totalTrafficAnalysis, params)
|
||||
const totalNetworkAnalysis = get(api.npm.overview.totalNetworkAnalysis, params)
|
||||
const totalHttpResponseDelay = get(api.npm.overview.totalHttpResponseDelay, params)
|
||||
const totalSslConDelay = get(api.npm.overview.totalSslConDelay, params)
|
||||
const totalTrafficAnalysis = axios.get(api.npm.overview.totalTrafficAnalysis, { params: params })
|
||||
const totalNetworkAnalysis = get(api.npm.overview.totalNetworkAnalysis, { params: params })
|
||||
const totalHttpResponseDelay = get(api.npm.overview.totalHttpResponseDelay, { params: params })
|
||||
const totalSslConDelay = get(api.npm.overview.totalSslConDelay, { params: params })
|
||||
const npmLineData = []
|
||||
Promise.all([totalNetworkAnalysis, totalTrafficAnalysis, totalHttpResponseDelay, totalSslConDelay]).then(res => {
|
||||
res.forEach(item => {
|
||||
@@ -267,13 +268,12 @@ export default {
|
||||
{ name: this.$t('overall.packetRetrans'), show: true, positioning: 0, data: [], unitType: unitTypes.percent, index: 4 }
|
||||
]
|
||||
} else {
|
||||
console.info(npmLineData)
|
||||
this.initData(npmLineData, val)
|
||||
}
|
||||
}).catch(e => {
|
||||
this.isNoData = false
|
||||
this.showError = true
|
||||
this.errorMsg = e.message
|
||||
this.errorMsg = this.errorMsgHandler(e)
|
||||
}).finally(() => {
|
||||
this.toggleLoading(false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user