From 4a20d39fa202892d8c9cdf715c53c43935f7bd2d Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Sun, 27 Aug 2023 20:34:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=86=E7=8A=B6=E6=80=81=E7=A0=81?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=AD=97=E6=AE=B5=E4=BB=8Ecode=E6=8D=A2?= =?UTF-8?q?=E4=B8=BAhttp=20status?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/knowledgeBaseTableForCard.vue | 21 +++++++++--------- .../entityDetail/EntityDetailBasicInfo.vue | 4 ++-- .../charts/entityDetail/EntityDetailLine.vue | 2 +- .../charts/entityDetail/EntityDetailTabs.vue | 22 +++++++++---------- .../charts2/charts/linkMonitor/LinkBlock.vue | 4 ++-- .../charts/linkMonitor/LinkTrafficLine.vue | 6 ++--- .../charts/linkMonitor/LinkTrafficSankey.vue | 6 ++--- .../LinkTrafficDrillDownList.vue | 6 ++--- .../networkOverview/NetworkOverviewApps.vue | 14 ++++++------ .../networkOverview/NetworkOverviewLine.vue | 2 +- .../networkOverview/NetworkOverviewTabs.vue | 8 +++---- src/views/detectionsNew/DetectionDrawer.vue | 2 +- src/views/entityExplorer/entityList/Row.vue | 2 +- 13 files changed, 50 insertions(+), 49 deletions(-) diff --git a/src/components/table/setting/knowledgeBaseTableForCard.vue b/src/components/table/setting/knowledgeBaseTableForCard.vue index 7ada17c9..082a460c 100644 --- a/src/components/table/setting/knowledgeBaseTableForCard.vue +++ b/src/components/table/setting/knowledgeBaseTableForCard.vue @@ -263,17 +263,18 @@ export default { }, uploadSuccess (response) { this.uploadLoading = false - this.uploaded = response.code === 200 - if (response.code === 200) { - this.$message.success(this.$t('tip.success')) - this.showAddUpdateDialog = false - axios.get(api.knowledgeBaseLog + '/' + this.updateKnowledge.knowledgeId, { params: { pageSize: 999 } }).then(res => { - this.updateHistoryList = res.data.data.list - this.currentVersion = this.updateHistoryList[0].commitVersion + 1 - }) - } else { + this.uploaded = true + /* this.uploaded = response.code === 200 + if (response.code === 200) { */ + this.$message.success(this.$t('tip.success')) + this.showAddUpdateDialog = false + axios.get(api.knowledgeBaseLog + '/' + this.updateKnowledge.knowledgeId, { params: { pageSize: 999 } }).then(res => { + this.updateHistoryList = res.data.data.list + this.currentVersion = this.updateHistoryList[0].commitVersion + 1 + }) + /* } else { this.$message.error(this.$t('tip.uploadFailed', { msg: response.message })) - } + } */ }, beforeUpload (file) { this.uploadLoading = true diff --git a/src/views/charts2/charts/entityDetail/EntityDetailBasicInfo.vue b/src/views/charts2/charts/entityDetail/EntityDetailBasicInfo.vue index 9c3f7694..691597e4 100644 --- a/src/views/charts2/charts/entityDetail/EntityDetailBasicInfo.vue +++ b/src/views/charts2/charts/entityDetail/EntityDetailBasicInfo.vue @@ -108,7 +108,7 @@ export default { let basicInfoError = '' if (tagData) { const res = tagData.data - if (res.code === 200) { + if (tagData.status === 200) { Object.keys(res.data).forEach(k => { if (k !== 'userDefinedTags' && res.data[k]) { Object.keys(res.data[k]).forEach(k2 => { @@ -132,7 +132,7 @@ export default { } if (basicInfoData) { const res = basicInfoData.data - if (res.code === 200) { + if (basicInfoData.status === 200) { switch (this.entity.entityType) { case 'ip': { if (res.data.asn) { diff --git a/src/views/charts2/charts/entityDetail/EntityDetailLine.vue b/src/views/charts2/charts/entityDetail/EntityDetailLine.vue index 3849f5ce..7e65fb7e 100644 --- a/src/views/charts2/charts/entityDetail/EntityDetailLine.vue +++ b/src/views/charts2/charts/entityDetail/EntityDetailLine.vue @@ -223,7 +223,7 @@ export default { axios.get(`${api.entity.throughput}/${this.entity.entityType}`, { params: params }).then(response => { const res = response.data - if (res.code === 200) { + if (response.status === 200) { this.isNoData = res.data.result.length === 0 this.showError = false if (this.isNoData) { diff --git a/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue b/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue index 56d27581..a2ce312c 100644 --- a/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue +++ b/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue @@ -120,7 +120,7 @@ export default { const performance = axios.get(`${api.entity.performance}/${this.entityType}`, { params: params }) Promise.all([informationAggregation, openPort, security, performance]).then(response => { - if (response[0].data.code === 200) { + if (response[0].status === 200) { const list = [] response[0].data.data.result.forEach(r => { Object.keys(r).forEach(k => { @@ -148,13 +148,13 @@ export default { this.initSetTag(entityDetailTabsName.informationAggregation, list.length) } - if (response[1].data.code === 200) { + if (response[1].status === 200) { this.initSetTag(entityDetailTabsName.openPort, response[1].data.data.result.length) } - if (response[2].data.code === 200) { + if (response[2].status === 200) { this.initSetTag(entityDetailTabsName.securityEvent, response[2].data.data.result.length) } - if (response[3].data.code === 200) { + if (response[3].status === 200) { this.initSetTag(entityDetailTabsName.performanceEvent, response[3].data.data.result.length) } }) @@ -186,22 +186,22 @@ export default { switch (this.entity.entityType) { case 'ip': { - const len1 = res0.code === 200 ? res0.data.result.length : 0 - const len2 = res1.code === 200 ? res1.data.result.length : 0 + const len1 = res[0].status === 200 ? res0.data.result.length : 0 + const len2 = res[1].status === 200 ? res1.data.result.length : 0 this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2) break } case 'domain': { const res2 = res[2].data - const len1 = res0.code === 200 ? res0.data.result.length : 0 - const len2 = res1.code === 200 ? res1.data.result.length : 0 - const len3 = res2.code === 200 ? res2.data.result.length : 0 + const len1 = res[0].status === 200 ? res0.data.result.length : 0 + const len2 = res[1].status === 200 ? res1.data.result.length : 0 + const len3 = res[2].status === 200 ? res2.data.result.length : 0 this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2 + len3) break } case 'app': { - const len1 = res0.code === 200 ? res0.data.result.length : 0 - const len2 = res1.code === 200 ? res1.data.result.length : 0 + const len1 = res[0].status === 200 ? res0.data.result.length : 0 + const len2 = res[1].status === 200 ? res1.data.result.length : 0 this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2) break } diff --git a/src/views/charts2/charts/linkMonitor/LinkBlock.vue b/src/views/charts2/charts/linkMonitor/LinkBlock.vue index 93a85572..8dc5e428 100644 --- a/src/views/charts2/charts/linkMonitor/LinkBlock.vue +++ b/src/views/charts2/charts/linkMonitor/LinkBlock.vue @@ -192,7 +192,7 @@ export default { const res = [] res[0] = response[0].data res[1] = response[1].data - if (res[0].code === 200) { + if (response[0].status === 200) { this.showError1 = false const linkData = res[0].data.result @@ -252,7 +252,7 @@ export default { this.errorMsg1 = this.errorMsgHandler(res[0]) } - if (res[1].code === 200) { + if (response[1].status === 200) { this.showError2 = false const nextHopData = res[1].data.result diff --git a/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue b/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue index f79b4937..24632eac 100644 --- a/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue +++ b/src/views/charts2/charts/linkMonitor/LinkTrafficLine.vue @@ -163,9 +163,9 @@ export default { } } this.loading = true - axios.get(api.linkMonitor.totalTrafficAnalysis, { params: params }).then((res) => { - res = res.data - if (res.code === 200) { + axios.get(api.linkMonitor.totalTrafficAnalysis, { params: params }).then(response => { + const res = response.data + if (response.status === 200) { this.showError = false this.isNoData = res.data.result.length === 0 if (this.isNoData) { diff --git a/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue b/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue index 9a507aa9..e831ab67 100644 --- a/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue +++ b/src/views/charts2/charts/linkMonitor/LinkTrafficSankey.vue @@ -112,9 +112,9 @@ export default { url = n === 0 ? api.linkMonitor.quadrupleIngressAnalysis : api.linkMonitor.quadrupleEgressAnalysis } this.toggleLoading(true) - axios.get(url, { params: params }).then(res => { - res = res.data - if (res.code === 200) { + axios.get(url, { params }).then(response => { + const res = response.data + if (response.status === 200) { this.showError = false if (n === 0) { this.ingress = res.data.result.length === 0 diff --git a/src/views/charts2/charts/linkMonitor/localComponents/LinkTrafficDrillDownList.vue b/src/views/charts2/charts/linkMonitor/localComponents/LinkTrafficDrillDownList.vue index d375303c..533fa21b 100644 --- a/src/views/charts2/charts/linkMonitor/localComponents/LinkTrafficDrillDownList.vue +++ b/src/views/charts2/charts/linkMonitor/localComponents/LinkTrafficDrillDownList.vue @@ -142,9 +142,9 @@ export default { } } this.loading = true - axios.get(api.linkMonitor.networkAnalysis, { params: params }).then(res => { - res = res.data - if (res.code === 200) { + axios.get(api.linkMonitor.networkAnalysis, { params: params }).then(response => { + const res = response.data + if (response.status === 200) { this.showError = false this.isNoData = res.data.result.length === 0 const data = { diff --git a/src/views/charts2/charts/networkOverview/NetworkOverviewApps.vue b/src/views/charts2/charts/networkOverview/NetworkOverviewApps.vue index eb5d132a..07282b2f 100644 --- a/src/views/charts2/charts/networkOverview/NetworkOverviewApps.vue +++ b/src/views/charts2/charts/networkOverview/NetworkOverviewApps.vue @@ -263,7 +263,7 @@ export default { } }) } - if (res[0].data.code === 200 && res[1].data.code === 200) { + if (res[0].status === 200 && res[1].status === 200) { this.showError = false const prevData = res[0].data.data.result const data = res[1].data.data.result @@ -468,9 +468,9 @@ export default { } if (parseFloat(this.appTypeTab) === 0) { params.type = 'overviewProvide' - axios.get(api.dict, { params: params }).then(res => { - res = res.data - if (res.code === 200 && res.data.list) { + axios.get(api.dict, { params: params }).then(response => { + const res = response.data + if (response.status === 200 && res.data.list) { res.data.list = res.data.list.filter(l => !this.appData.some(pd => pd.type === 'provider' && pd.name === l.value)) this.pageObj.pages = res.data.pages res.data.list.forEach(t => { @@ -494,9 +494,9 @@ export default { }) } else if (parseFloat(this.appTypeTab) === 1) { params.type = 'overviewApp' - axios.get(api.dict, { params: params }).then(res => { - res = res.data - if (res.code === 200) { + axios.get(api.dict, { params: params }).then(response => { + const res = response.data + if (response.status === 200) { res.data.list = res.data.list.filter(l => !this.appData.some(pd => pd.type === 'app' && pd.name === l.value)) this.pageObj.pages = res.data.pages res.data.list.forEach(t => { diff --git a/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue b/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue index 461d03d1..905dab8b 100644 --- a/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue +++ b/src/views/charts2/charts/networkOverview/NetworkOverviewLine.vue @@ -174,7 +174,7 @@ export default { axios.get(api.netWorkOverview.totalTrafficAnalysis, { params: params }).then(response => { const res = response.data - if (res.code === 200) { + if (response.status === 200) { this.isNoData = res.data.result.length === 0 this.showError = false if (this.isNoData) { diff --git a/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue b/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue index 78534a0b..fa182c00 100644 --- a/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue +++ b/src/views/charts2/charts/networkOverview/NetworkOverviewTabs.vue @@ -444,7 +444,7 @@ export default { } const requestUrl = this.getCurUrl() axios.get(requestUrl, { params: queryParams }).then(response => { - if (response.data.code === 200) { + if (response.status === 200) { this.showError = false this.errorMsg = '' this.chartData = response.data.data.result @@ -926,7 +926,7 @@ export default { this.customTableTitles.forEach(tableColumn => { if (tableColumn.columnType === tableColumnType.chainRatio && tableColumn.isInMainUrl && tableDataTmp && tableDataTmp.length > 0) { axios.get(self.gerCycleUrl(), { params: queryParams }).then(response => { - if (response.data.code === 200) { + if (response.status === 200) { tableColumn.showError = false tableColumn.errorMsg = '' cycleTotalList = response.data.data.result @@ -992,7 +992,7 @@ export default { this.customTableTitles.forEach(tableColumn => { if (tableColumn.columnType === tableColumnType.chainRatio && !tableColumn.isInMainUrl) { axios.get(self.gerColumnUrl(tableColumn), { params: queryParams }).then(response => { - if (response.data.code === 200) { + if (response.status === 200) { if (!tableColumn.showError) { tableColumn.showError = false tableColumn.errorMsg = '' @@ -1032,7 +1032,7 @@ export default { cycle: tableColumn.cycle } axios.get(self.gerColumnUrl(tableColumn), { params: queryCycleParams }).then(response => { - if (response.data.code === 200) { + if (response.status === 200) { if (!tableColumn.showError) { tableColumn.showError = false tableColumn.errorMsg = '' diff --git a/src/views/detectionsNew/DetectionDrawer.vue b/src/views/detectionsNew/DetectionDrawer.vue index 63128ce2..e59d3c8a 100644 --- a/src/views/detectionsNew/DetectionDrawer.vue +++ b/src/views/detectionsNew/DetectionDrawer.vue @@ -155,7 +155,7 @@ export default { ] axios.get(`${api.detection.detail}/${this.drawerInfo.ruleId}`).then(res => { - if (res.data.code === 200) { + if (res.status === 200) { this.detailData = res.data.data } }).catch(err => { diff --git a/src/views/entityExplorer/entityList/Row.vue b/src/views/entityExplorer/entityList/Row.vue index 99a4fc76..4585c5c3 100644 --- a/src/views/entityExplorer/entityList/Row.vue +++ b/src/views/entityExplorer/entityList/Row.vue @@ -276,7 +276,7 @@ export default { } axios.get(`${url}?resource=${this.entity.entityValue}`).then(responese => { const res = responese.data - if (res.code === 200) { + if (responese.status === 200) { Object.keys(res.data).forEach(k => { if (k !== 'userDefinedTags' && res.data[k]) { Object.keys(res.data[k]).forEach(k2 => {