|
84 | 84 | </div> |
85 | 85 | </div> |
86 | 86 | </el-dropdown-item> |
| 87 | + <el-dropdown-item> |
| 88 | + <el-upload |
| 89 | + ref="elUploadRef" |
| 90 | + :file-list="[]" |
| 91 | + action="#" |
| 92 | + multiple |
| 93 | + :auto-upload="false" |
| 94 | + :show-file-list="false" |
| 95 | + :limit="1" |
| 96 | + :on-change="(file: any, fileList: any) => importApplication(file)" |
| 97 | + > |
| 98 | + <div class="flex align-center"> |
| 99 | + <el-avatar shape="square" class="mt-4" :size="36" style="background: none"> |
| 100 | + <img src="@/assets/application/icon_import_app.svg" alt="" /> |
| 101 | + </el-avatar> |
| 102 | + <div class="pre-wrap ml-8"> |
| 103 | + <div class="lighter">{{ $t('views.application.importApplication') }}</div> |
| 104 | + </div> |
| 105 | + </div> |
| 106 | + </el-upload> |
| 107 | + </el-dropdown-item> |
87 | 108 | <el-dropdown-item @click="openCreateFolder" divided> |
88 | 109 | <div class="flex align-center"> |
89 | 110 | <AppIcon iconName="app-folder" style="font-size: 32px"></AppIcon> |
@@ -418,6 +439,28 @@ function refreshFolder() { |
418 | 439 | getFolder() |
419 | 440 | getList() |
420 | 441 | } |
| 442 | +const elUploadRef = ref() |
| 443 | +const importApplication = (file: any) => { |
| 444 | + const formData = new FormData() |
| 445 | + formData.append('file', file.raw, file.name) |
| 446 | + elUploadRef.value.clearFiles() |
| 447 | + ApplicaitonApi.importApplication(formData, loading) |
| 448 | + .then(async (res: any) => { |
| 449 | + if (res?.data) { |
| 450 | + getList() |
| 451 | + } |
| 452 | + }) |
| 453 | + .catch((e) => { |
| 454 | + if (e.code === 400) { |
| 455 | + MsgConfirm(t('common.tip'), t('views.application.tip.professionalMessage'), { |
| 456 | + cancelButtonText: t('common.confirm'), |
| 457 | + confirmButtonText: t('common.professional'), |
| 458 | + }).then(() => { |
| 459 | + window.open('https://maxkb.cn/pricing.html', '_blank') |
| 460 | + }) |
| 461 | + } |
| 462 | + }) |
| 463 | +} |
421 | 464 |
|
422 | 465 | onMounted(() => { |
423 | 466 | getFolder() |
|
0 commit comments