feat: Add confirm when import workflow template

This commit is contained in:
zhangzhanwei 2025-12-22 10:58:50 +08:00 committed by zhanweizhang7
parent 54e16acee6
commit c38555f9dd
4 changed files with 31 additions and 12 deletions

View File

@ -27,6 +27,8 @@ export default {
saveErrorMessage: 'Saving failed, please check your input or try again later',
loadingErrorMessage: 'Failed to load configuration, please check your input or try again later',
noDocPermission: 'No permission to create documents',
confirmUse: 'Are you sure you want to use',
overwrite: 'overwrite the current workflow',
},
form: {

View File

@ -27,6 +27,8 @@ export default {
saveErrorMessage: '保存失败,请检查输入或稍后再试',
loadingErrorMessage: '加载配置失败,请检查输入或稍后再试',
noDocPermission: '无文档创建权限',
confirmUse: '确定使用',
overwrite: '覆盖当前工作流',
},
form: {
appName: {

View File

@ -24,6 +24,8 @@ export default {
saveErrorMessage: '儲存失敗,請檢查輸入或稍後再試',
loadingErrorMessage: '載入配置失敗,請檢查輸入或稍後再試',
noDocPermission: '無文檔創建權限',
confirmUse: '確定使用',
overwrite: '覆蓋當前工作流',
},
form: {
appName: {

View File

@ -394,22 +394,35 @@ const elUploadRef = ref()
const importKnowledgeWorkflow = (file: any) => {
const formData = new FormData()
formData.append('file', file.raw)
const name = file.name.replace('.kbwf', '')
elUploadRef.value.clearFiles()
loadSharedApi({ type: 'knowledge', isShared: isShared.value, systemType: apiType.value })
.importKnowledgeWorkflow(id, formData, loading)
debugger
MsgConfirm(
t('common.tip'),
`${t('views.application.tip.confirmUse')} ${name} ${t('views.application.tip.overwrite')}?`,
{
confirmButtonText: t('common.confirm'),
cancelButtonText: t('common.cancel'),
},
)
.then(() => {
getDetail()
})
.catch((error: any) => {
if (error.code === 400) {
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
cancelButtonText: t('common.confirm'),
confirmButtonText: t('common.professional'),
}).then(() => {
window.open('https://maxkb.cn/pricing.html', '_blank')
loadSharedApi({ type: 'knowledge', isShared: isShared.value, systemType: apiType.value })
.importKnowledgeWorkflow(id, formData, loading)
.then(() => {
getDetail()
})
.catch((error: any) => {
if (error.code === 400) {
MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), {
cancelButtonText: t('common.confirm'),
confirmButtonText: t('common.professional'),
}).then(() => {
window.open('https://maxkb.cn/pricing.html', '_blank')
})
}
})
}
})
.catch(() => {})
}
function exportKnowledgeWorkflow(name: string, id: string) {