Skip to content

Commit

Permalink
fix: 修复资源文档上传失败的问题
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 20021
  • Loading branch information
Carlmac committed Oct 9, 2024
1 parent 7ba6c95 commit 7e49719
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/dashboard-front/src/views/resource/setting/import-doc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ import { useCommon } from '@/store';
import cookie from 'cookie';
import { useSelection, useGetGlobalProperties } from '@/hooks';
import TmplExampleSideslider from '@/views/resource/setting/comps/tmpl-example-sideslider.vue';
import { UploadFile } from 'bkui-vue/lib/upload/upload.type';
interface IFile extends UploadFile {
response?: {
data: {
resource: object,
resource_doc: object,
}[]
}
}
const { t } = useI18n();
const common = useCommon();
Expand Down Expand Up @@ -290,14 +300,15 @@ const handleUploadSuccess = async (e: any, file: any) => {
};
// 上传完成的方法
const handleUploadDone = async (response: any) => {
if (response[0].status === 'fail') {
const handleUploadDone = async (fileList: IFile[]) => {
const file = fileList[fileList.length - 1];
if (!file.response) {
return Message({ theme: 'error', message: t('上传失败') });
}
const res = response[0].response.data;
const data = res.map((e: any) => ({ ...e, ...e.resource, ...e.resource_doc }));
const res = file.response.data;
const data = res.map(e => ({ ...e, ...e.resource, ...e.resource_doc }));
tableData.value = data;
checkData.value = data.filter((e: any) => !!e.resource); // 有资源文档的才默认选中
checkData.value = data.filter(e => !!e.resource); // 有资源文档的才默认选中
curView.value = 'resources';
nextTick(() => {
selections.value = JSON.parse(JSON.stringify(checkData.value));
Expand Down

0 comments on commit 7e49719

Please sign in to comment.