fix: 废弃http.js的封装请求方法

This commit is contained in:
chenjinsong
2023-08-25 10:18:20 +08:00
parent 7f91d75792
commit f4ba0040ea
33 changed files with 244 additions and 332 deletions

View File

@@ -43,7 +43,7 @@
<button :id="id+'-json-import-template'" class="el-button el-button--default el-button--small" @click="downloadTemplate"> <button :id="id+'-json-import-template'" class="el-button el-button--default el-button--small" @click="downloadTemplate">
<span>{{$t('overall.template')}}</span> <span>{{$t('overall.template')}}</span>
</button> </button>
<button :id="id+'-json-import-add'" :class="{'cn-btn-disabled':prevent_opt.import}" :disabled="prevent_opt.import" class="cn-btn el-button el-button--default el-button--small" @click="importJson"> <button :id="id+'-json-import-add'" :class="{'cn-btn-disabled':blockOperation.import}" :disabled="blockOperation.import" class="cn-btn el-button el-button--default el-button--small" @click="importJson">
<span>{{$t('overall.import')}}</span> <span>{{$t('overall.import')}}</span>
</button> </button>
<button :id="id+'-json-import-esc'" class="el-button el-button--default el-button--small" @click="closeDialog"> <button :id="id+'-json-import-esc'" class="el-button el-button--default el-button--small" @click="closeDialog">
@@ -58,7 +58,6 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
import { post } from '@/utils/http'
import { storageKey } from '@/utils/constants' import { storageKey } from '@/utils/constants'
export default { export default {
@@ -103,20 +102,20 @@ export default {
}, },
importJson () { importJson () {
if (this.importFile && this.importFile.raw) { if (this.importFile && this.importFile.raw) {
this.prevent_opt.import = true this.blockOperation.import = true
const form = new FormData() const form = new FormData()
form.append('file', this.importFile.raw) form.append('file', this.importFile.raw)
if (this.paramsType) { if (this.paramsType) {
form.append('type', this.paramsType) form.append('type', this.paramsType)
} }
form.append('language', localStorage.getItem(storageKey.language) ? localStorage.getItem(storageKey.language) : 'en') form.append('language', localStorage.getItem(storageKey.language) ? localStorage.getItem(storageKey.language) : 'en')
post(this.importUrl, form, { 'Content-Type': 'multipart/form-data' }).then(response => { axios.post(this.importUrl, form, { 'Content-Type': 'multipart/form-data' }).then(response => {
if (response.code == 200 && response.msg == 'success') { if (response.status === 200 && response.data.msg === 'success') {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.importSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.importSuccess') })
} else { } else {
this.$message.error(response.msg) this.$message.error(response.msg)
} }
this.prevent_opt.import = false this.blockOperation.import = false
}) })
} else { } else {
this.$message.error(this.$t('tip.noImportFile')) this.$message.error(this.$t('tip.noImportFile'))

View File

@@ -276,7 +276,7 @@ import rightBoxMixin from '@/mixins/right-box'
import { storageKey, report } from '@/utils/constants' import { storageKey, report } from '@/utils/constants'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import _ from 'lodash' import _ from 'lodash'
import { get, post, put } from '@/utils/http' import axios from 'axios'
import { dateFormat, getMillisecond } from '@/utils/date-util' import { dateFormat, getMillisecond } from '@/utils/date-util'
import { ref, getCurrentInstance } from 'vue' import { ref, getCurrentInstance } from 'vue'
import i18n from '@/i18n' import i18n from '@/i18n'
@@ -527,11 +527,11 @@ export default {
if (_.isArray(this.editObject.categoryParams) && !_.isEmpty(this.editObject.categoryParams)) { if (_.isArray(this.editObject.categoryParams) && !_.isEmpty(this.editObject.categoryParams)) {
this.editObject.categoryParams.forEach(param => { this.editObject.categoryParams.forEach(param => {
if (!this.paramsOptions.some(p => p.key === param.key)) { if (!this.paramsOptions.some(p => p.key === param.key)) {
get(api.dict, { type: param.key, pageSize: -1 }).then(response => { axios.get(api.dict, { params: { type: param.key, pageSize: -1 } }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.paramsOptions.push({ this.paramsOptions.push({
key: param.key, key: param.key,
options: response.data.list.map(d => d.value) options: response.data.data.list.map(d => d.value)
}) })
} }
}) })
@@ -627,23 +627,23 @@ export default {
if (this.validateScheduleConfig(copyObject)) { if (this.validateScheduleConfig(copyObject)) {
copyObject.config = JSON.stringify(copyObject.config) copyObject.config = JSON.stringify(copyObject.config)
if (copyObject.id) { if (copyObject.id) {
put(this.url, copyObject).then(res => { axios.put(this.url, copyObject).then(res => {
this.blockOperation.save = false this.blockOperation.save = false
if (res.code === 200) { if (res.status === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(res.msg) this.$message.error(res.data.message)
} }
}) })
} else { } else {
post(this.url, copyObject).then(res => { axios.post(this.url, copyObject).then(res => {
this.blockOperation.save = false this.blockOperation.save = false
if (res.code === 200) { if (res.status === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(res.msg) this.$message.error(res.data.message)
} }
}) })
} }

View File

@@ -132,7 +132,7 @@
<script> <script>
import rightBoxMixin from '@/mixins/right-box' import rightBoxMixin from '@/mixins/right-box'
import { get, post, put } from '@/utils/http' import axios from 'axios'
import { panelTypeAndRouteMapping, storageKey } from '@/utils/constants' import { panelTypeAndRouteMapping, storageKey } from '@/utils/constants'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { VAceEditor } from 'vue3-ace-editor' import { VAceEditor } from 'vue3-ace-editor'
@@ -370,23 +370,23 @@ export default {
this.$refs.chartForm.validate((valid) => { this.$refs.chartForm.validate((valid) => {
if (valid) { if (valid) {
if (this.editObject.id) { if (this.editObject.id) {
put(this.url, this.editObject).then(res => { axios.put(this.url, this.editObject).then(res => {
this.blockOperation.save = false this.blockOperation.save = false
if (res.code === 200) { if (res.status === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(res.msg || res.message) this.$message.error(res.data.message)
} }
}) })
} else { } else {
post(this.url, this.editObject).then(res => { axios.post(this.url, this.editObject).then(res => {
this.blockOperation.save = false this.blockOperation.save = false
if (res.code === 200) { if (res.status === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(res.msg || res.message) this.$message.error(res.data.message)
} }
}) })
} }

View File

@@ -100,9 +100,8 @@
</template> </template>
<script> <script>
import { ref, defineComponent } from 'vue'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { get, getForDebug, postForDebug } from '@/utils/http' import { getForDebug, postForDebug } from '@/utils/http'
import axios from 'axios' import axios from 'axios'
import { VAceEditor } from 'vue3-ace-editor' import { VAceEditor } from 'vue3-ace-editor'
import 'ace-builds/src-noconflict/mode-javascript' import 'ace-builds/src-noconflict/mode-javascript'
@@ -234,9 +233,9 @@ export default {
}, },
async getGalaxyProxyData (value) { async getGalaxyProxyData (value) {
await get(api.galaxyProxy + '?pageSize=-1').then(response => { await axios.get(api.galaxyProxy + '?pageSize=-1').then(response => {
if (response.code === 200) { if (response.status === 200) {
this.galaxyProxyData = response.data.list this.galaxyProxyData = response.data.data.list
} }
}) })
}, },

View File

@@ -60,7 +60,6 @@
<script> <script>
import indexedDBUtils from '@/indexedDB' import indexedDBUtils from '@/indexedDB'
import { storageKey, dbTableColumnCustomizeConfigPre } from '@/utils/constants' import { storageKey, dbTableColumnCustomizeConfigPre } from '@/utils/constants'
import { get } from '@/utils/http'
export default { export default {
props: { props: {
customTableTitle: Array, // 自定义的title customTableTitle: Array, // 自定义的title

View File

@@ -73,7 +73,7 @@
<script> <script>
import table from '@/mixins/table' import table from '@/mixins/table'
import { put } from '@/utils/http' import axios from 'axios'
import { storageKey } from '@/utils/constants' import { storageKey } from '@/utils/constants'
export default { export default {
@@ -147,12 +147,12 @@ export default {
// if (!user.id){ // if (!user.id){
// return // return
// } // }
put('sys/user', user).then(response => { axios.put('sys/user', user).then(response => {
if (response.code === 200) { if (response.status === 200) {
// this.rightBox.show = false // this.rightBox.show = false
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
} else { } else {
this.$message.error(response.msg) this.$message.error(response.data.message)
} }
this.$emit('reload') this.$emit('reload')
}) })

View File

@@ -107,7 +107,7 @@
<script> <script>
import { detectionRuleType } from '@/utils/constants' import { detectionRuleType } from '@/utils/constants'
import { switchStatus } from '@/utils/tools' import { switchStatus } from '@/utils/tools'
import { get } from '@/utils/http' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
export default { export default {
@@ -158,12 +158,12 @@ export default {
methods: { methods: {
switchStatus, switchStatus,
initData () { initData () {
get(api.detection.statistics, { pageSize: -1 }).then(response => { axios.get(api.detection.statistics, { params: { pageSize: -1 } }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.categoryList = response.data.categoryList || [] this.categoryList = response.data.data.categoryList || []
this.typeList = response.data.typeList || [] this.typeList = response.data.data.typeList || []
} else { } else {
console.error(response) console.error(response.data)
} }
}).finally(() => { }).finally(() => {
}) })

View File

@@ -63,7 +63,7 @@
import unitConvert from '@/utils/unit-convert' import unitConvert from '@/utils/unit-convert'
import { unitTypes } from '@/utils/constants' import { unitTypes } from '@/utils/constants'
import { dateFormatByAppearance } from '@/utils/date-util' import { dateFormatByAppearance } from '@/utils/date-util'
import { get } from '@/utils/http' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import Loading from '@/components/common/Loading' import Loading from '@/components/common/Loading'
import ChartError from '@/components/common/Error' import ChartError from '@/components/common/Error'
@@ -127,15 +127,15 @@ export default {
params.param = data params.param = data
} }
get(api.detection.create.topKeys, params).then(res => { axios.get(api.detection.create.topKeys, { params }).then(res => {
this.tableTotal = 0 this.tableTotal = 0
this.tableData = [] this.tableData = []
if (res.code === 200) { if (res.status === 200) {
this.tableTotal = res.data.total this.tableTotal = res.data.data.total
this.tableData = res.data.list this.tableData = res.data.data.list
} else { } else {
this.httpError(res) this.httpError(res.data)
} }
}).catch(err => { }).catch(err => {
this.httpError(err) this.httpError(err)

View File

@@ -213,7 +213,7 @@
</template> </template>
<script> <script>
import { get } from '@/utils/http' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import HistoryTopKeys from '@/components/table/detection/HistoryTopKeys' import HistoryTopKeys from '@/components/table/detection/HistoryTopKeys'
import { eventSeverityColor, detectionRuleType } from '@/utils/constants' import { eventSeverityColor, detectionRuleType } from '@/utils/constants'
@@ -341,15 +341,15 @@ export default {
}, },
methods: { methods: {
initData () { initData () {
get(api.detection.statistics, { pageSize: -1 }).then(response => { axios.get(api.detection.statistics, { params: { pageSize: -1 } }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.sourceList = response.data.sourceList || [] this.sourceList = response.data.data.sourceList || []
this.levelList = response.data.levelList || [] this.levelList = response.data.data.levelList || []
this.conditionList = response.data.conditionList || [] this.conditionList = response.data.data.conditionList || []
this.metricList = response.data.metricList || [] this.metricList = response.data.data.metricList || []
this.libraryList = response.data.libraryList || [] this.libraryList = response.data.data.libraryList || []
} else { } else {
console.error(response) console.error(response.data)
} }
}).finally(() => { }).finally(() => {
}) })

View File

@@ -210,7 +210,7 @@
<script> <script>
import table from '@/mixins/table' import table from '@/mixins/table'
import Loading from '@/components/common/Loading' import Loading from '@/components/common/Loading'
import { del, get } from '@/utils/http' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { storageKey, report } from '@/utils/constants' import { storageKey, report } from '@/utils/constants'
import { urlParamsHandler, overwriteUrl } from '@/utils/tools' import { urlParamsHandler, overwriteUrl } from '@/utils/tools'
@@ -624,10 +624,10 @@ export default {
dropDownQueryChange (param) { dropDownQueryChange (param) {
this.loadingDown = true this.loadingDown = true
this.downDataList = [] this.downDataList = []
get(api.reportJob, param).then(res => { axios.get(api.reportJob, { params: param }).then(res => {
if (res.code === 200) { if (res.status === 200) {
this.downDataList = res.data.list this.downDataList = res.data.data.list
this.pageObj.total = res.data.total this.pageObj.total = res.data.data.total
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.dataTable.doLayout() this.$refs.dataTable.doLayout()
}) })
@@ -640,10 +640,10 @@ export default {
}) })
}, },
dataConversionProcessing (param) { dataConversionProcessing (param) {
get(api.reportJob, param).then(res => { axios.get(api.reportJob, { params: param }).then(res => {
if (res.code === 200) { if (res.status === 200) {
this.downDataList = res.data.list this.downDataList = res.data.data.list
this.pageObj.total = res.data.total this.pageObj.total = res.data.data.total
} }
}) })
}, },
@@ -653,8 +653,8 @@ export default {
cancelButtonText: this.$t('tip.no'), cancelButtonText: this.$t('tip.no'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
del(api.reportJob + '?ids=' + row.id).then(response => { axios.delete(api.reportJob + '?ids=' + row.id).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.delFlag = true this.delFlag = true
this.$message({ this.$message({
duration: 2000, duration: 2000,
@@ -664,7 +664,7 @@ export default {
this.dropDownQueryChange({ tempId: props.row.id }) this.dropDownQueryChange({ tempId: props.row.id })
this.$emit('reload') this.$emit('reload')
} else { } else {
this.$message.error(response.msg) this.$message.error(response.data.message)
} }
}) })
}).catch(() => {}) }).catch(() => {})

View File

@@ -1,11 +1,10 @@
import {get} from '@/utils/http'
import axios from 'axios' import axios from 'axios'
import router from '@/router' import router from '@/router'
import {getWelcomeMenu, sortByOrderNum} from '@/permission' import { getWelcomeMenu, sortByOrderNum } from '@/permission'
import {ElMessage} from 'element-plus' // dependent on utc plugin import { ElMessage } from 'element-plus' // dependent on utc plugin
import {dbDrilldownTableConfig, storageKey} from '@/utils/constants' import { dbDrilldownTableConfig, storageKey } from '@/utils/constants'
import {getConfigVersion} from '@/utils/tools' import { getConfigVersion } from '@/utils/tools'
import {api} from '@/utils/api' import { api } from '@/utils/api'
import indexedDBUtils from '@/indexedDB' import indexedDBUtils from '@/indexedDB'
const user = { const user = {

View File

@@ -104,77 +104,3 @@ export function postForDebug (url, params, headers) {
}) })
}) })
} }
export function get (url, params) {
return new Promise((resolve) => {
axios.get(url, {
params: params
}).then(response => {
resolve(response.data)
}).catch(err => {
if (err.response) {
resolve(err.response.data)
} else if (err.message) {
resolve(err.message)
}
})
})
}
export function post (url, params, headers) {
return new Promise(resolve => {
axios.post(url, params, { headers: headers }).then(response => {
resolve(response.data, response)
}).catch(err => {
if (err.response) {
resolve(err.response.data)
} else if (err.message) {
resolve(err.message)
}
})
})
}
export function put (url, params, headers) {
return new Promise((resolve) => {
axios.put(url, params, { headers: headers }).then(response => {
resolve(response.data, response)
}).catch(err => {
if (err.response) {
resolve(err.response.data)
console.error(err)
} else if (err.message) {
resolve(err.message)
}
})
})
}
export function patch (url, params, headers) {
return new Promise((resolve) => {
axios.patch(url, params, { headers: headers }).then(response => {
resolve(response.data, response)
}).catch(err => {
if (err.response) {
resolve(err.response.data)
console.error(err)
} else if (err.message) {
resolve(err.message)
}
})
})
}
export function del (url, params) {
return new Promise((resolve) => {
axios.delete(url, params).then(response => {
resolve(response.data, response)
}).catch(err => {
if (err.response) {
resolve(err.response.data)
} else if (err.message) {
resolve(err.message)
}
})
})
}

View File

@@ -88,7 +88,7 @@ import { tableTitleMapping, legendMapping } from '@/views/charts/charts/chart-ta
import { replaceUrlPlaceholder } from '@/utils/tools' import { replaceUrlPlaceholder } from '@/utils/tools'
import { getNowTime, getSecond } from '@/utils/date-util' import { getNowTime, getSecond } from '@/utils/date-util'
import { get } from '@/utils/http' import axios from 'axios'
import { ref } from 'vue' import { ref } from 'vue'
import _ from 'lodash' import _ from 'lodash'
@@ -215,17 +215,17 @@ export default {
} }
if (requestUrl) { if (requestUrl) {
get(replaceUrlPlaceholder(requestUrl, this.queryParams)).then(response => { axios.get(replaceUrlPlaceholder(requestUrl, { params: this.queryParams })).then(response => {
if (response.code === 200) { if (response.status === 200) {
if (Array.isArray(response.data.result)) { if (Array.isArray(response.data.data.result)) {
response.data.result.forEach(item => { response.data.data.result.forEach(item => {
if (item.legend && legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${item.legend}`]) { if (item.legend && legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${item.legend}`]) {
item.legend = this.$t(legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${item.legend}`]) item.legend = this.$t(legendMapping[`${this.entity && this.entity.ip ? 'ip_' : ''}${item.legend}`])
} }
}) })
} }
this.chartData = response.data.result this.chartData = response.data.data.result
this.resultType = response.data.resultType this.resultType = response.data.data.resultType
if (isEchartsWithStatistics(this.chartInfo.type)) { if (isEchartsWithStatistics(this.chartInfo.type)) {
const newArr = [] const newArr = []
_.forEach(this.chartData, function (value, key) { _.forEach(this.chartData, function (value, key) {
@@ -244,19 +244,18 @@ export default {
}) })
} }
if (this.isTable) { if (this.isTable) {
this.table.tableData = response.data.result this.table.tableData = response.data.data.result
this.table.tableColumns = chartParams.columns this.table.tableColumns = chartParams.columns
// this.table.tableColumns = this.getTableTitle(response.data.result)
this.table.currentPageData = this.getTargetPageData(1, this.table.pageSize, this.table.tableData) this.table.currentPageData = this.getTargetPageData(1, this.table.pageSize, this.table.tableData)
} else if (this.isSingleValue) { } else if (this.isSingleValue) {
if (chartParams && chartParams.dataKey) { if (chartParams && chartParams.dataKey) {
if (response.data.result && (response.data.result[chartParams.dataKey] || response.data.result[chartParams.dataKey] === 0)) { if (response.data.data.result && (response.data.data.result[chartParams.dataKey] || response.data.data.result[chartParams.dataKey] === 0)) {
this.chartData = response.data.result[chartParams.dataKey] this.chartData = response.data.data.result[chartParams.dataKey]
} else if (response.data.result && (response.data.result[chartParams.dataKey + 'Value'] || response.data.result[chartParams.dataKey + 'Value'] === 0)) { } else if (response.data.data.result && (response.data.data.result[chartParams.dataKey + 'Value'] || response.data.data.result[chartParams.dataKey + 'Value'] === 0)) {
this.chartData = { this.chartData = {
value: response.data.result[chartParams.dataKey + 'Value'], value: response.data.data.result[chartParams.dataKey + 'Value'],
p50: response.data.result[chartParams.dataKey + 'P50'], p50: response.data.data.result[chartParams.dataKey + 'P50'],
p90: response.data.result[chartParams.dataKey + 'P90'] p90: response.data.data.result[chartParams.dataKey + 'P90']
} }
} else { } else {
this.chartData = null this.chartData = null
@@ -267,7 +266,7 @@ export default {
} else { } else {
this.isError = true this.isError = true
this.noData = true this.noData = true
this.errorInfo = response.msg || response.message || 'Unknown' this.errorInfo = response.data.message || 'Unknown'
} }
}).finally(() => { }).finally(() => {
if (this.needTimeout && this.firstRender) { if (this.needTimeout && this.firstRender) {

View File

@@ -81,7 +81,7 @@ import { getTypeCategory } from '@/views/charts/charts/tools'
import { urlParamsHandler, overwriteUrl, getDnsMapData, computeScore } from '@/utils/tools' import { urlParamsHandler, overwriteUrl, getDnsMapData, computeScore } from '@/utils/tools'
import ChartList from '@/views/charts2/ChartList' import ChartList from '@/views/charts2/ChartList'
import { useStore } from 'vuex' import { useStore } from 'vuex'
import { get } from '@/utils/http' import axios from 'axios'
export default { export default {
name: 'Panel', name: 'Panel',
@@ -446,14 +446,14 @@ export default {
} }
if ((type && condition) || type) { if ((type && condition) || type) {
params.type = params.type || type params.type = params.type || type
get(url, params).then(res => { axios.get(url, { params }).then(res => {
if (res.code === 200) { if (res.status === 200) {
const data = { const data = {
establishLatencyMs: res.data.result.establishLatencyMsAvg || null, establishLatencyMs: res.data.data.result.establishLatencyMsAvg || null,
httpResponseLatency: res.data.result.httpResponseLatencyAvg || null, httpResponseLatency: res.data.data.result.httpResponseLatencyAvg || null,
sslConLatency: res.data.result.sslConLatencyAvg || null, sslConLatency: res.data.data.result.sslConLatencyAvg || null,
tcpLostlenPercent: res.data.result.tcpLostlenPercentAvg || null, tcpLostlenPercent: res.data.data.result.tcpLostlenPercentAvg || null,
pktRetransPercent: res.data.result.pktRetransPercentAvg || null pktRetransPercent: res.data.data.result.pktRetransPercentAvg || null
} }
this.score = computeScore(data) this.score = computeScore(data)
} }

View File

@@ -14,7 +14,7 @@
<script> <script>
import { shallowRef } from 'vue' import { shallowRef } from 'vue'
import { get } from '@/utils/http' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import dnsEventChartByPie from './DnsEventChartByPie' import dnsEventChartByPie from './DnsEventChartByPie'
@@ -62,8 +62,8 @@ export default {
endTime: getSecond(this.timeFilter.endTime) endTime: getSecond(this.timeFilter.endTime)
} }
this.toggleLoading(true) this.toggleLoading(true)
get(api.dnsInsight.eventChart, params).then(res => { axios.get(api.dnsInsight.eventChart, { params }).then(res => {
const data = res.data.result const data = res.data.data.result
this.pieData = [] this.pieData = []
if (data !== undefined && data.length > 0) { if (data !== undefined && data.length > 0) {

View File

@@ -110,7 +110,7 @@
<script> <script>
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { get } from '@/utils/http' import axios from 'axios'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { ref } from 'vue' import { ref } from 'vue'
@@ -206,10 +206,10 @@ export default {
severity: this.tableSeverity severity: this.tableSeverity
} }
this.toggleLoading(true) this.toggleLoading(true)
get(api.dnsInsight.recentEvents, params).then(res => { axios.get(api.dnsInsight.recentEvents, { params }).then(res => {
if (res.code === 200) { if (res.status === 200) {
this.isNoData = res.data.result.length === 0 this.isNoData = res.data.data.result.length === 0
this.tableData = res.data.result this.tableData = res.data.data.result
this.tableData.forEach((t, index) => { this.tableData.forEach((t, index) => {
if (index > 5) { if (index > 5) {
t.type = 'Security Event' t.type = 'Security Event'

View File

@@ -73,8 +73,8 @@ import { unitTypes, chartColor3, chartColor4 } from '@/utils/constants.js'
import { ref, shallowRef } from 'vue' import { ref, shallowRef } from 'vue'
import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools' import { stackedLineTooltipFormatter } from '@/views/charts/charts/tools'
import _ from 'lodash' import _ from 'lodash'
import { get } from '@/utils/http'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import axios from 'axios'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import ChartNoData from '@/views/charts/charts/ChartNoData' import ChartNoData from '@/views/charts/charts/ChartNoData'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
@@ -165,20 +165,20 @@ export default {
const url = this.queryCondition ? api.dnsInsight.drilldownTrafficAnalysis : api.dnsInsight.totalTrafficAnalysis const url = this.queryCondition ? api.dnsInsight.drilldownTrafficAnalysis : api.dnsInsight.totalTrafficAnalysis
get(url, params).then((res) => { axios.get(url, { params }).then(res => {
if (res.code === 200) { if (res.status === 200) {
this.showError = false this.showError = false
this.isNoData = res.data.result.length === 0 this.isNoData = res.data.data.result.length === 0
if (this.isNoData) { if (this.isNoData) {
this.lineTab = '' this.lineTab = ''
this.tabs = _.cloneDeep(dataForDnsTrafficLine.tabs) this.tabs = _.cloneDeep(dataForDnsTrafficLine.tabs)
} else { } else {
this.initData(res.data.result, val, active, show) this.initData(res.data.data.result, val, active, show)
} }
} else { } else {
this.isNoData = false this.isNoData = false
this.showError = true this.showError = true
this.errorMsg = this.errorMsgHandler(res) this.errorMsg = this.errorMsgHandler(res.data)
} }
}).catch(e => { }).catch(e => {
console.error(e) console.error(e)

View File

@@ -125,7 +125,6 @@ import { storageKey, unitTypes, networkTable, operationType, curTabState } from
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { appListChartOption } from '@/views/charts2/charts/options/echartOption' import { appListChartOption } from '@/views/charts2/charts/options/echartOption'
import { shallowRef } from 'vue' import { shallowRef } from 'vue'
import { put } from '@/utils/http'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import _ from 'lodash' import _ from 'lodash'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
@@ -565,8 +564,8 @@ export default {
// 保存变更并且在增、删app后根据当前app数量更改整体高度 // 保存变更并且在增、删app后根据当前app数量更改整体高度
saveChart (toSaveChart) { saveChart (toSaveChart) {
return new Promise(resolve => { return new Promise(resolve => {
put(api.chart, toSaveChart).then(res => { axios.put(api.chart, toSaveChart).then(res => {
if (res.code === 200) { if (res.status === 200) {
this.emitter.emit('reloadChartList') this.emitter.emit('reloadChartList')
resolve() resolve()
} }

View File

@@ -292,15 +292,13 @@ import {
drillDownPanelTypeMapping, drillDownPanelTypeMapping,
commonErrorTip commonErrorTip
} from '@/utils/constants' } from '@/utils/constants'
import { get } from '@/utils/http' import axios from 'axios'
import unitConvert, { valueToRangeValue } from '@/utils/unit-convert' import unitConvert, { valueToRangeValue } from '@/utils/unit-convert'
import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools' import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import _ from 'lodash' import _ from 'lodash'
import axios from 'axios'
import indexedDBUtils from '@/indexedDB' import indexedDBUtils from '@/indexedDB'
import { useRoute } from 'vue-router'
export default { export default {
name: 'NetworkOverviewTabs', name: 'NetworkOverviewTabs',
@@ -473,8 +471,6 @@ export default {
searchColumnWidth (columnType) { searchColumnWidth (columnType) {
if (columnType === 'dillDown') { if (columnType === 'dillDown') {
return '217px' return '217px'
} else {
} }
}, },
async initDropdownList (tabProp) { async initDropdownList (tabProp) {
@@ -503,9 +499,9 @@ export default {
if (!curTableInCode.url.drilldownList) { if (!curTableInCode.url.drilldownList) {
return true return true
} }
get(curTableInCode.url.drilldownList, params).then(async response => { axios.get(curTableInCode.url.drilldownList, { params }).then(async response => {
if (response.code === 200) { if (response.status === 200) {
this.tabSearchColumnValueListShow = response.data.result this.tabSearchColumnValueListShow = response.data.data.result
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) { if (this.$route.params.typeName === fromRoute.dnsServiceInsights) {
if (this.dnsQtypeMapData.size === 0) { if (this.dnsQtypeMapData.size === 0) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
@@ -1624,7 +1620,7 @@ export default {
initSearchInfo () { initSearchInfo () {
// 切换tab的时候需要清除之前tab选中的记录的样式和值 // 切换tab的时候需要清除之前tab选中的记录的样式和值
if (this.curTabProp) { if (this.curTabProp) {
const currentValue = document.getElementById('tabSearchValue' + this.curTabProp).value // const currentValue = document.getElementById('tabSearchValue' + this.curTabProp).value
// 清空记录选中样式 // 清空记录选中样式
this.tabSearchColumnValueListShow.forEach(item => { this.tabSearchColumnValueListShow.forEach(item => {
const selectedDom = document.getElementById(item + this.curTabProp) const selectedDom = document.getElementById(item + this.curTabProp)
@@ -1636,9 +1632,9 @@ export default {
} }
this.curPageNum = 1 this.curPageNum = 1
this.showSearchButton = false, // 搜索按钮是否显示 this.showSearchButton = false // 搜索按钮是否显示
this.showSearchInput = false, // 搜索输入框是否显示 this.showSearchInput = false // 搜索输入框是否显示
this.showSearchList = false, // 下拉列表是否显示 this.showSearchList = false // 下拉列表是否显示
this.showPopover = false// 下拉列表是否显示 this.showPopover = false// 下拉列表是否显示
this.dropDownValue = '' this.dropDownValue = ''
this.tabSearchColumnValueListShow = [] this.tabSearchColumnValueListShow = []

View File

@@ -68,7 +68,7 @@
<script> <script>
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { get } from '@/utils/http' import axios from 'axios'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import ChartError from '@/components/common/Error' import ChartError from '@/components/common/Error'
@@ -150,19 +150,19 @@ export default {
limit: 10, limit: 10,
type: this.metric type: this.metric
} }
get(api.npm.events.dimensionEvents, params).then(res => { axios.get(api.npm.events.dimensionEvents, { params }).then(res => {
if (res.code === 200) { if (res.status === 200) {
this.showError = false this.showError = false
if (!res.data.result || res.data.result.length === 0) { if (!res.data.data.result || res.data.data.result.length === 0) {
this.isNoData = true this.isNoData = true
} }
this.tableData = res.data.result this.tableData = res.data.data.result
} else { } else {
this.isNoData = false this.isNoData = false
this.showError = true this.showError = true
this.errorMsg = this.errorMsgHandler(res) this.errorMsg = this.errorMsgHandler(res.data)
} }
}).catch((e) => { }).catch(e => {
this.isNoData = false this.isNoData = false
this.showError = true this.showError = true
this.errorMsg = this.errorMsgHandler(e) this.errorMsg = this.errorMsgHandler(e)

View File

@@ -17,7 +17,7 @@ import { curTabState, storageKey, unitTypes } from '@/utils/constants'
import { valueToRangeValue } from '@/utils/unit-convert' import { valueToRangeValue } from '@/utils/unit-convert'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { api, getData } from '@/utils/api' import { api, getData } from '@/utils/api'
import { get } from '@/utils/http' import axios from 'axios'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import ChartError from '@/components/common/Error' import ChartError from '@/components/common/Error'
@@ -105,18 +105,18 @@ export default {
params: res.map(r => `'${r.countryRegion}'`).join(',') params: res.map(r => `'${r.countryRegion}'`).join(',')
} }
// 计算分数 // 计算分数
const tcpRequest = get(api.npm.overview.mapTcp, subParams) const tcpRequest = axios.get(api.npm.overview.mapTcp, { params: subParams })
const httpRequest = get(api.npm.overview.mapHttp, subParams) const httpRequest = axios.get(api.npm.overview.mapHttp, { params: subParams })
const sslRequest = get(api.npm.overview.mapSsl, subParams) const sslRequest = axios.get(api.npm.overview.mapSsl, { params: subParams })
const tcpLostRequest = get(api.npm.overview.mapPacketLoss, subParams) const tcpLostRequest = axios.get(api.npm.overview.mapPacketLoss, { params: subParams })
const packetRetransRequest = get(api.npm.overview.mapPacketRetrans, subParams) const packetRetransRequest = axios.get(api.npm.overview.mapPacketRetrans, { params: subParams })
Promise.all([tcpRequest, httpRequest, sslRequest, tcpLostRequest, packetRetransRequest]).then(res2 => { Promise.all([tcpRequest, httpRequest, sslRequest, tcpLostRequest, packetRetransRequest]).then(res2 => {
const keyPre = ['tcp', 'http', 'ssl', 'tcpLost', 'packetRetrans'] const keyPre = ['tcp', 'http', 'ssl', 'tcpLost', 'packetRetrans']
const mapData = res const mapData = res
res2.forEach((r, i) => { res2.forEach((r, i) => {
if (r.code === 200) { if (r.status === 200) {
mapData.forEach(t => { mapData.forEach(t => {
t[keyPre[i] + 'Score'] = r.data.result.find(d => d.countryRegion === t.countryRegion && d.superAdminArea === t.superAdminArea) t[keyPre[i] + 'Score'] = r.data.data.result.find(d => d.countryRegion === t.countryRegion && d.superAdminArea === t.superAdminArea)
}) })
} else { } else {
this.showError = true this.showError = true

View File

@@ -126,7 +126,7 @@ export default {
side: this.side side: this.side
} }
params.country = n || '' params.countryRegion = n || ''
this.toggleLoading(true) this.toggleLoading(true)
let url let url

View File

@@ -56,10 +56,10 @@ import { valueToRangeValue } from '@/utils/unit-convert'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import axios from 'axios' import axios from 'axios'
import { get } from '@/utils/http'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import ChartError from '@/components/common/Error' import ChartError from '@/components/common/Error'
import _ from 'lodash' import _ from 'lodash'
export default { export default {
name: 'NpmMap', name: 'NpmMap',
components: { ChartError }, components: { ChartError },
@@ -120,7 +120,7 @@ export default {
startTime: getSecond(this.timeFilter.startTime), startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime), endTime: getSecond(this.timeFilter.endTime),
side: this.trafficDirection.toLowerCase(), side: this.trafficDirection.toLowerCase(),
country: this.location countryRegion: this.location
} }
axios.get(api.npm.location.map, { params: params }).then(response => { axios.get(api.npm.location.map, { params: params }).then(response => {
if (response.data.code === 200) { if (response.data.code === 200) {
@@ -129,24 +129,23 @@ export default {
// 计算分数 // 计算分数
this.showError = false this.showError = false
params.countryRegion = params.countryRegion ? `'${params.countryRegion}'` : '' params.countryRegion = params.countryRegion ? `'${params.countryRegion}'` : ''
const tcpRequest = get(api.npm.location.mapTcp, params) const tcpRequest = axios.get(api.npm.location.mapTcp, { params })
const httpRequest = get(api.npm.location.mapHttp, params) const httpRequest = axios.get(api.npm.location.mapHttp, { params })
const sslRequest = get(api.npm.location.mapSsl, params) const sslRequest = axios.get(api.npm.location.mapSsl, { params })
const tcpLostRequest = get(api.npm.location.mapPacketLoss, params) const tcpLostRequest = axios.get(api.npm.location.mapPacketLoss, { params })
const packetRetransRequest = get(api.npm.location.mapPacketRetrans, params) const packetRetransRequest = axios.get(api.npm.location.mapPacketRetrans, { params })
Promise.all([tcpRequest, httpRequest, sslRequest, tcpLostRequest, packetRetransRequest]).then(res2 => { Promise.all([tcpRequest, httpRequest, sslRequest, tcpLostRequest, packetRetransRequest]).then(res2 => {
const keyPre = ['tcp', 'http', 'ssl', 'tcpLost', 'packetRetrans'] const keyPre = ['tcp', 'http', 'ssl', 'tcpLost', 'packetRetrans']
const mapData = res const mapData = res
let msg = '' let msg = ''
res2.forEach((r, i) => { res2.forEach((r, i) => {
if (r.code === 200) { if (r.status === 200) {
mapData.forEach(t => { mapData.forEach(t => {
const find = r.data.result.find(d => d.countryRegion === t.countryRegion && t.superAdminArea === d.superAdminArea) t[keyPre[i] + 'Score'] = r.data.data.result.find(d => d.countryRegion === t.countryRegion && t.superAdminArea === d.superAdminArea)
t[keyPre[i] + 'Score'] = find
}) })
} else { } else {
this.showError = true this.showError = true
msg = msg + ',' + r.message msg = msg + ',' + r.data.message
if (msg.indexOf(',') === 0) { if (msg.indexOf(',') === 0) {
msg = msg.substring(1, msg.length) msg = msg.substring(1, msg.length)
} }

View File

@@ -135,7 +135,7 @@ import {
pieForSeverity pieForSeverity
} from '@/views/detections/options/detectionOptions' } from '@/views/detections/options/detectionOptions'
import { api, getData } from '@/utils/api' import { api, getData } from '@/utils/api'
import { get } from '@/utils/http' import axios from 'axios'
import { extensionEchartY, reverseSortBy } from '@/utils/tools' import { extensionEchartY, reverseSortBy } from '@/utils/tools'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import Loading from '@/components/common/Loading' import Loading from '@/components/common/Loading'
@@ -610,13 +610,13 @@ export default {
pageSize: this.pageObj.pageSize, pageSize: this.pageObj.pageSize,
pageNo: this.pageObj.pageNo pageNo: this.pageObj.pageNo
} }
get(api.detection[this.pageType].listBasic, params).then(response => { axios.get(api.detection[this.pageType].listBasic, { params }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.listData = response.data.result this.listData = response.data.data.result
} else { } else {
this.listData = [] this.listData = []
console.error(response.message) console.error(response.data.message)
this.$message.error(response.message) this.$message.error(response.data.message)
} }
}) })
getData(api.detection[this.pageType].listCount, params).then(data => { getData(api.detection[this.pageType].listCount, params).then(data => {

View File

@@ -91,7 +91,7 @@
import { eventSeverityColor, unitTypes, riskLevelMapping } from '@/utils/constants' import { eventSeverityColor, unitTypes, riskLevelMapping } from '@/utils/constants'
import { api, getData } from '@/utils/api' import { api, getData } from '@/utils/api'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { get } from '@/utils/http' import axios from 'axios'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { markRaw } from 'vue' import { markRaw } from 'vue'
import { metricOption } from '@/views/detections/options/detectionOptions' import { metricOption } from '@/views/detections/options/detectionOptions'
@@ -205,16 +205,18 @@ export default {
url = api.detection.performanceEvent.highDnsResponseTimeMetric url = api.detection.performanceEvent.highDnsResponseTimeMetric
} }
if (url) { if (url) {
get(url, { axios.get(url, {
appName: this.detection.appName, params: {
startTime: this.searchStartTime, appName: this.detection.appName,
endTime: this.searchEndTime, startTime: this.searchStartTime,
eventType: this.detection.eventType endTime: this.searchEndTime,
eventType: this.detection.eventType
}
}).then((response) => { }).then((response) => {
if (response.code === 200) { if (response.status === 200) {
resolve(response.data.result[0]) resolve(response.data.data.result[0])
} else { } else {
reject(response) reject(response.data)
} }
}) })
} else { } else {

View File

@@ -94,7 +94,7 @@
import { api, getData } from '@/utils/api' import { api, getData } from '@/utils/api'
import { eventSeverityColor, unitTypes, topDomain } from '@/utils/constants' import { eventSeverityColor, unitTypes, topDomain } from '@/utils/constants'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { get } from '@/utils/http' import axios from 'axios'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { markRaw } from 'vue' import { markRaw } from 'vue'
import { metricOption } from '@/views/detections/options/detectionOptions' import { metricOption } from '@/views/detections/options/detectionOptions'
@@ -237,16 +237,18 @@ export default {
url = api.detection.performanceEvent.highDnsResponseTimeMetric url = api.detection.performanceEvent.highDnsResponseTimeMetric
} }
if (url) { if (url) {
get(url, { axios.get(url, {
domain: this.detection.domain, params: {
startTime: this.searchStartTime, domain: this.detection.domain,
endTime: this.searchEndTime, startTime: this.searchStartTime,
eventType: this.detection.eventType endTime: this.searchEndTime,
eventType: this.detection.eventType
}
}).then((response) => { }).then((response) => {
if (response.code === 200) { if (response.status === 200) {
resolve(response.data.result[0]) resolve(response.data.data.result[0])
} else { } else {
reject(response) reject(response.data)
} }
}) })
} else { } else {

View File

@@ -84,7 +84,7 @@
import { api, getData } from '@/utils/api' import { api, getData } from '@/utils/api'
import { unitTypes } from '@/utils/constants' import { unitTypes } from '@/utils/constants'
import { getSecond } from '@/utils/date-util' import { getSecond } from '@/utils/date-util'
import { get } from '@/utils/http' import axios from 'axios'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { markRaw } from 'vue' import { markRaw } from 'vue'
import { metricOption } from '@/views/detections/options/detectionOptions' import { metricOption } from '@/views/detections/options/detectionOptions'
@@ -198,16 +198,18 @@ export default {
url = api.detection.performanceEvent.highDnsResponseTimeMetric url = api.detection.performanceEvent.highDnsResponseTimeMetric
} }
if (url) { if (url) {
get(url, { axios.get(url, {
serverIp: this.detection.serverIp, params: {
startTime: this.searchStartTime, serverIp: this.detection.serverIp,
endTime: this.searchEndTime, startTime: this.searchStartTime,
eventType: this.detection.eventType endTime: this.searchEndTime,
eventType: this.detection.eventType
}
}).then((response) => { }).then((response) => {
if (response.code === 200) { if (response.status === 200) {
resolve(response.data.result[0]) resolve(response.data.data.result[0])
} else { } else {
reject(response) reject(response.data)
} }
}) })
} else { } else {

View File

@@ -268,7 +268,7 @@
</template> </template>
<script> <script>
import { get } from '@/utils/http' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
import { getMillisecond } from '@/utils/date-util' import { getMillisecond } from '@/utils/date-util'
import { eventSeverityColor, unitTypes } from '@/utils/constants' import { eventSeverityColor, unitTypes } from '@/utils/constants'
@@ -338,15 +338,17 @@ export default {
queryBasic () { queryBasic () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
get(api.detection.securityEvent.overviewBasic, { axios.get(api.detection.securityEvent.overviewBasic, {
eventId: this.detection.eventId, params: {
startTime: this.detection.startTime, eventId: this.detection.eventId,
endTime: this.detection.endTime startTime: this.detection.startTime,
endTime: this.detection.endTime
}
}).then((response) => { }).then((response) => {
if (response.code === 200) { if (response.status === 200) {
resolve(response.data.result[0]) resolve(response.data.data.result[0])
} else { } else {
reject(response) reject(response.data)
} }
}) })
} catch (e) { } catch (e) {
@@ -357,15 +359,17 @@ export default {
queryEvent () { queryEvent () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
get(api.detection.securityEvent.overviewEvent, { axios.get(api.detection.securityEvent.overviewEvent, {
startTime: this.detection.startTime, params: {
offenderIp: this.detection.offenderIp, startTime: this.detection.startTime,
victimIp: this.detection.victimIp offenderIp: this.detection.offenderIp,
victimIp: this.detection.victimIp
}
}).then((response) => { }).then((response) => {
if (response.code === 200) { if (response.status === 200) {
resolve(response.data.result) resolve(response.data.data.result)
} else { } else {
reject(response) reject(response.data)
} }
}) })
} catch (e) { } catch (e) {

View File

@@ -41,7 +41,7 @@
</template> </template>
<script> <script>
import { get } from '@/utils/http' import axios from 'axios'
import { api } from '@/utils/api' import { api } from '@/utils/api'
export default { export default {
@@ -88,31 +88,31 @@ export default {
if (params) { if (params) {
searchParams = { ...searchParams, ...params } searchParams = { ...searchParams, ...params }
} }
get(this.url, searchParams).then(response => { axios.get(this.url, { params: searchParams }).then(response => {
if (response.code === 200) { if (response.status === 200) {
if (response.data.statusList) { if (response.data.data.statusList) {
this.statusList = [] this.statusList = []
response.data.statusList.forEach(item => { response.data.data.statusList.forEach(item => {
this.statusList.push({ status: item.status, label: this.switchStatus(item.status) }) this.statusList.push({ status: item.status, label: this.switchStatus(item.status) })
this.checkStatus.push(item.status) this.checkStatus.push(item.status)
}) })
} }
this.categoryList = response.data.categoryList this.categoryList = response.data.data.categoryList
if (response.data.categoryList) { if (response.data.data.categoryList) {
response.data.categoryList.forEach(item => { response.data.data.categoryList.forEach(item => {
this.checkCategory.push(item.value) this.checkCategory.push(item.value)
}) })
} }
this.typeList = response.data.typeList this.typeList = response.data.data.typeList
if (response.data.typeList) { if (response.data.data.typeList) {
response.data.typeList.forEach(item => { response.data.data.typeList.forEach(item => {
this.checkType.push(item.value) this.checkType.push(item.value)
}) })
} }
} else { } else {
console.error(response) console.error(response.data)
} }
}).finally(() => { }).finally(() => {
// this.initTypeData() // this.initTypeData()

View File

@@ -215,7 +215,7 @@ import { unitTypes } from '@/utils/constants'
import { valueToRangeValue } from '@/utils/unit-convert' import { valueToRangeValue } from '@/utils/unit-convert'
import Chart from '@/views/charts/Chart' import Chart from '@/views/charts/Chart'
import _ from 'lodash' import _ from 'lodash'
import { get } from '@/utils/http' import axios from 'axios'
import relatedServer from '@/mixins/relatedServer' import relatedServer from '@/mixins/relatedServer'
import { dateFormatByAppearance, getMillisecond } from '@/utils/date-util' import { dateFormatByAppearance, getMillisecond } from '@/utils/date-util'
import Loading from '@/components/common/Loading' import Loading from '@/components/common/Loading'
@@ -336,9 +336,9 @@ export default {
}, },
chartGetMap () { chartGetMap () {
this.loadingMap = true this.loadingMap = true
get((this.trafficUrlMap), this.getQueryParams()).then(response => { axios.get(this.trafficUrlMap, { params: this.getQueryParams() }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.chartData = response.data.result this.chartData = response.data.data.result
} }
this.loadingMap = false this.loadingMap = false
}) })

View File

@@ -219,7 +219,7 @@ import { unitTypes } from '@/utils/constants'
import { valueToRangeValue } from '@/utils/unit-convert' import { valueToRangeValue } from '@/utils/unit-convert'
import Chart from '@/views/charts/Chart' import Chart from '@/views/charts/Chart'
import _ from 'lodash' import _ from 'lodash'
import { get } from '@/utils/http' import axios from 'axios'
import relatedServer from '@/mixins/relatedServer' import relatedServer from '@/mixins/relatedServer'
import { dateFormatByAppearance, getMillisecond } from '@/utils/date-util' import { dateFormatByAppearance, getMillisecond } from '@/utils/date-util'
import Loading from '@/components/common/Loading' import Loading from '@/components/common/Loading'
@@ -341,26 +341,26 @@ export default {
}, },
chartGetMap () { chartGetMap () {
this.loadingMap = true this.loadingMap = true
get(this.trafficUrlMap, this.getQueryParams()).then(response => { axios.get(this.trafficUrlMap, { params: this.getQueryParams() }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.chartData = response.data.result this.chartData = response.data.data.result
} }
this.loadingMap = false this.loadingMap = false
}) })
}, },
getBasicProperties () { getBasicProperties () {
get(this.basicProperties, this.getQueryParams()).then(response => { axios.get(this.basicProperties, { params: this.getQueryParams() }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.entityData = { this.entityData = {
...this.entityData, ...this.entityData,
domainCategory: response.data.result.domainCategory, domainCategory: response.data.data.result.domainCategory,
domainCategoryGroup: response.data.result.domainCategoryGroup, domainCategoryGroup: response.data.data.result.domainCategoryGroup,
domainDescription: response.data.result.domainDescription, domainDescription: response.data.data.result.domainDescription,
domainReputationScore: response.data.result.domainReputationScore, domainReputationScore: response.data.data.result.domainReputationScore,
domainWhoisAddress: response.data.result.domainWhoisAddress, domainWhoisAddress: response.data.data.result.domainWhoisAddress,
domainWhoisOrg: response.data.result.domainWhoisOrg, domainWhoisOrg: response.data.data.result.domainWhoisOrg,
domainIcpCompanyName: response.data.result.domainIcpCompanyName, domainIcpCompanyName: response.data.data.result.domainIcpCompanyName,
domainIcpSiteLicense: response.data.result.domainIcpSiteLicense domainIcpSiteLicense: response.data.data.result.domainIcpSiteLicense
} }
} }
}) })

View File

@@ -252,7 +252,6 @@ import { unitTypes, countryNameIdMapping } from '@/utils/constants'
import { valueToRangeValue } from '@/utils/unit-convert' import { valueToRangeValue } from '@/utils/unit-convert'
import Chart from '@/views/charts/Chart' import Chart from '@/views/charts/Chart'
import _ from 'lodash' import _ from 'lodash'
import { get } from '@/utils/http'
import relatedServer from '@/mixins/relatedServer' import relatedServer from '@/mixins/relatedServer'
import { dateFormatByAppearance, getMillisecond, getSecond } from '@/utils/date-util' import { dateFormatByAppearance, getMillisecond, getSecond } from '@/utils/date-util'
import Loading from '@/components/common/Loading' import Loading from '@/components/common/Loading'
@@ -422,9 +421,9 @@ export default {
}, },
chartGetMap () { chartGetMap () {
this.loadingMap = true this.loadingMap = true
get((this.trafficUrlMap), this.getQueryParams()).then(response => { axios.get(this.trafficUrlMap, { params: this.getQueryParams() }).then(response => {
if (response.code === 200) { if (response.status === 200) {
this.chartData = response.data.result this.chartData = response.data.data.result
} }
this.loadingMap = false this.loadingMap = false
}) })
@@ -441,7 +440,7 @@ export default {
} }
axios.get(api.entity.entityList.ipRelatedPort, { params: params }).then(res => { axios.get(api.entity.entityList.ipRelatedPort, { params: params }).then(res => {
if (res.data.code === 200 && res.data.data.result.length) { if (res.status === 200 && res.data.data.result.length) {
this.openPort = '' this.openPort = ''
res.data.data.result.forEach(item => { res.data.data.result.forEach(item => {
this.openPort += item.port + '/' + item.l7Protocol + ',' this.openPort += item.port + '/' + item.l7Protocol + ','
@@ -485,11 +484,6 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
//.type-content {
// margin-bottom:15px;
// display:flex;
// flex-flow: row wrap;
// width:100%;
.data-item { .data-item {
display: flex; display: flex;
justify-content: center; justify-content: center;

View File

@@ -82,7 +82,7 @@
</template> </template>
<script> <script>
import { get } from '@/utils/http' import axios from 'axios'
import ReportTable from '@/components/table/report/ReportTable' import ReportTable from '@/components/table/report/ReportTable'
import cnDataList from '@/components/table/CnDataList' import cnDataList from '@/components/table/CnDataList'
import dataListMixin from '@/mixins/data-list' import dataListMixin from '@/mixins/data-list'
@@ -220,9 +220,9 @@ export default {
methods: { methods: {
queryGetTempData () { queryGetTempData () {
this.builtinLeftLoading = true this.builtinLeftLoading = true
get(api.reportCategory, { pageSize: 999 }).then(res => { axios.get(api.reportCategory, { params: { pageSize: 999 } }).then(res => {
if (res.code === 200) { if (res.status === 200) {
this.builtinReportLeftMenu = res.data.list.map(c => { this.builtinReportLeftMenu = res.data.data.list.map(c => {
return { return {
...c, ...c,
config: c.config ? JSON.parse(c.config) : {} config: c.config ? JSON.parse(c.config) : {}
@@ -265,27 +265,20 @@ export default {
} }
if (!this.isInit) { if (!this.isInit) {
get(listUrl, this.searchLabel).then(response => { axios.get(listUrl, { params: this.searchLabel }).then(response => {
// this.tools.loading = false if (response.status === 200) {
// this.builtinRightLoading = false for (let i = 0; i < response.data.data.list.length; i++) {
// this.loading = false response.data.data.list[i].status = response.data.data.list[i].status + ''
if (response.code === 200) {
for (let i = 0; i < response.data.list.length; i++) {
response.data.list[i].status = response.data.list[i].status + ''
} }
this.$nextTick(() => { this.$nextTick(() => {
this.tableData = response.data.list.map(item => { this.tableData = response.data.data.list.map(item => {
return { return {
...item, ...item,
config: item.config ? JSON.parse(item.config) : {} config: item.config ? JSON.parse(item.config) : {}
} }
}) })
this.pageObj.total = response.data.total this.pageObj.total = response.data.data.total
if (!this.tableData || this.tableData.length === 0) { this.isNoData = !this.tableData || this.tableData.length === 0;
this.isNoData = true
} else {
this.isNoData = false
}
}) })
// TODO 回到顶部 // TODO 回到顶部
} else { } else {