-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Reviewed, transaction id: 17761
- Loading branch information
Showing
27 changed files
with
132 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,62 @@ | ||
// 接口异常通知提示 | ||
import i18n from '@/config/i18n/index.js' | ||
import bus from '@/utils/bus.js' | ||
import i18n from '@/config/i18n/index.js'; | ||
import bus from '@/utils/bus.js'; | ||
export default class ErrorNotify { | ||
constructor(errorInfo, vueInstance) { | ||
const { msg, type, traceId, errorSource, title } = errorInfo | ||
this.type = type | ||
const { msg, type, traceId, errorSource, title } = errorInfo; | ||
this.type = type; | ||
// 标题 | ||
const msgTitle = title || this.getTitleAndContent(msg, true, errorSource) | ||
const msgTitle = title || this.getTitleAndContent(msg, true, errorSource); | ||
|
||
// 详情 | ||
let details = {} | ||
const msgLabel = type === 'success' ? 'success_msg' : 'error_msg' | ||
details[msgLabel] = this.getTitleAndContent(msg, false, errorSource) | ||
let details = {}; | ||
const msgLabel = type === 'success' ? 'success_msg' : 'error_msg'; | ||
details[msgLabel] = this.getTitleAndContent(msg, false, errorSource); | ||
if (traceId) { | ||
details.trace_id = traceId | ||
details.trace_id = traceId; | ||
} | ||
details = JSON.stringify(details) | ||
details = JSON.stringify(details); | ||
|
||
// 助手 | ||
const helperUrl = type === 'success' ? '' : window.MESSAGE_HELPER_URL || '' | ||
const helperUrl = type === 'success' ? '' : window.MESSAGE_HELPER_URL || ''; | ||
|
||
// 工具列表 | ||
const actions = [ | ||
{ id: 'assistant', disabled: !helperUrl }, | ||
{ id: 'details' }, | ||
{ id: 'fix' }, | ||
{ id: 'close' } | ||
] | ||
{ id: 'close' }, | ||
]; | ||
const errorMsgInstance = vueInstance.$bkMessage({ | ||
message: { | ||
title: msgTitle, | ||
details, | ||
assistant: helperUrl, | ||
type: 'key-value' | ||
type: 'key-value', | ||
}, | ||
actions, | ||
theme: type, | ||
ellipsisLine: 2, | ||
ellipsisCopy: true, | ||
extCls: 'interface-exception-notify-message', | ||
onClose: () => { | ||
const index = window.msg_list.findIndex(item => item.msg === msg) | ||
const index = window.msg_list.findIndex(item => item.msg === msg); | ||
if (index > -1) { | ||
window.msg_list.splice(index, 1) | ||
window.msg_list.splice(index, 1); | ||
} | ||
bus.$emit('onCloseErrorNotify', details) | ||
} | ||
}) | ||
vueInstance.errorMsgList.push(errorMsgInstance) | ||
bus.$emit('onCloseErrorNotify', details); | ||
}, | ||
}); | ||
vueInstance.errorMsgList.push(errorMsgInstance); | ||
} | ||
getTitleAndContent (info, isTitle, errorSource) { | ||
let content = isTitle ? '' : info | ||
getTitleAndContent(info, isTitle, errorSource) { | ||
let content = isTitle ? '' : info; | ||
if (isTitle && !content) { | ||
content = this.type === 'success' | ||
? i18n.t('请求成功') | ||
: errorSource === 'result' | ||
? i18n.t('请求异常(外部系统错误或非法操作)') | ||
: i18n.t('请求异常(内部系统发生未知错误)') | ||
content = errorSource === 'result' | ||
? i18n.t('请求异常(外部系统错误或非法操作)') | ||
: i18n.t('请求异常(内部系统发生未知错误)'); | ||
content = this.type === 'success' ? i18n.t('请求成功') : content; | ||
} | ||
return content | ||
return content; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,8 +164,8 @@ | |
required: true, | ||
message: this.$t('必填项'), | ||
trigger: 'change', | ||
}] | ||
} | ||
}], | ||
}, | ||
}; | ||
}, | ||
computed: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.