CN-1400 fix: 调整知识库智能学习启停功能

This commit is contained in:
chenjinsong
2023-10-23 18:42:32 +08:00
parent d0aa64fb9c
commit 643ada9172
3 changed files with 13 additions and 10 deletions

View File

@@ -391,17 +391,18 @@ export default {
switchLearning () {
const hint = this.aiTaggingList.find(d => d.knowledgeId === this.switchKnowledgeId)
const toStatus = hint.status === 0 ? 1 : 0
axios.patch(api.knowledgeBaseEnable, { list: [{ knowledgeId: this.switchKnowledgeId, status: toStatus }] }).then(res => {
const url = toStatus === 0 ? api.knowledgeBaseLearningStop : api.knowledgeBaseLearningStart
axios.post(`${url}?knowledgeId=${hint.knowledgeId}`).then(res => {
if (res.status === 200) {
hint.status = toStatus
this.$message.success(this.$t('tip.success'))
} else {
console.error(res.message)
this.errorMsgHandler(res)
this.$message.error(this.errorMsgHandler(res))
}
}).catch(e => {
console.error(e)
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
}).finally(() => {
this.showConfirmSwitch = false
})

View File

@@ -38,6 +38,8 @@ export const api = {
knowledgeBase: apiVersion + '/knowledgeBase',
knowledgeBaseList: apiVersion + '/knowledgeBase/list',
knowledgeBaseEnable: apiVersion + '/knowledgeBase/status',
knowledgeBaseLearningStart: apiVersion + '/knowledgeBase/intelligence-learning/start',
knowledgeBaseLearningStop: apiVersion + '/knowledgeBase/intelligence-learning/stop',
knowledgeBaseStatistics: apiVersion + '/knowledgeBase/statistics',
updateKnowledgeUrl: apiVersion + '/knowledgeBase/items/batch',
knowledgeBaseLog: apiVersion + '/knowledgeBase/audit/log',

View File

@@ -307,7 +307,7 @@ export default {
}).catch(e => {
console.error(e)
this.filterData[this.pageType][0].data = []
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
})
},
/** 初始化顶部大柱状图 */
@@ -376,7 +376,7 @@ export default {
}
}).catch(e => {
console.error(e)
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
}).finally(() => {
this.$nextTick(() => {
this.loading = false
@@ -415,7 +415,7 @@ export default {
}).catch(e => {
console.error(e)
this.filterData[this.pageType][1].data = []
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
})
},
initEventTypeData (params) {
@@ -450,7 +450,7 @@ export default {
}).catch(e => {
console.error(e)
this.filterData[this.pageType][2].data = []
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
})
},
/** 第二个饼图和左侧filter的eventType */
@@ -486,7 +486,7 @@ export default {
}).catch(e => {
console.error(e)
this.filterData[this.pageType][2].data = []
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
})
},
/** 横向柱状图和左侧filter的offenderIp */
@@ -530,7 +530,7 @@ export default {
this.filterData[this.pageType][4].data = []
this.filterData[this.pageType][4].showMore = false
this.filterData[this.pageType][4].showIndex = 9
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
})
},
@@ -546,7 +546,7 @@ export default {
this.filterData[this.pageType][3].data = []
this.filterData[this.pageType][3].showMore = false
this.filterData[this.pageType][3].showIndex = 9
this.errorMsgHandler(e)
this.$message.error(this.errorMsgHandler(e))
})
},
initActiveEntity (params) {