This commit is contained in:
itcsx committed 2026-09-13 19:01:48 +08:00
1 parent 7f5bf3c68d
commit 816209fc35
37 files changed
+3236 -4515

No files matched your search

@@ -4,9 +4,9 @@
<Toolbar :path-stack="pathStack" :root-path="rootPath" :loading="loading" @go-top="onGoTop" @go-back="onGoBack"
@refresh="onReSearch" @search="onSearchByName" @breadcrumb-click="onBreadcrumbClick" />
<OperatorStationDelete :selected-items="keys" :upload-url="uploadUrl" :headers="headers" :can-create="canCreate"
<OperatorStationDelete :selected-items="keys" :can-create="canCreate"
:can-amend="canAmend" :can-delete="canDelete" :can-view="canView" @create-folder="onCreate"
@before-upload="beforeUpload" @download="onDownloadSelected" @share="onShareSelected"
@download="onDownloadSelected" @share="onShareSelected"
@publish="onPublishSelected" @view-preview="onViewPreviewSelected" @play-video="onUrlVideoPlayItem"
@play-audio="onPlayAudioItem" @pause-audio="onPauseAudio" @continue-audio="onContinueAudio"
@preview="onPreviewSelected" @rename="onAmendSelected" @move="onMoveSelected" @delete="onDeleteSelected"
@@ -76,11 +76,7 @@ import { SearchFilterTypePolicy } from "@/data/custom/searchFilterTypePolicy";
import { notification } from "ant-design-vue";
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
import dmsFolder from "./DmsFolderModal.vue";
import { useLoginProfileStore } from "@/store/modules/loginProfile";
import type { UploadProps } from "ant-design-vue";
import { WebSitePolicy } from "@/policy/custom/webSitePolicy";
import { orderBy } from "lodash-es";
import axios from "axios";
import VideoPlay from "./PlayVideo.vue";
import { Howl } from "howler";
import { PublishVideoEntity } from "@/data/auto/publishVideoEntity";
@@ -88,7 +84,6 @@ import publishVideoService from "@/service/master/publishVideoService";
import { useWindowSize } from "@vueuse/core";
import fileTypePolicy from "@/policy/custom/fileTypePolicy";
import { PublishAudioEntity } from "@/data/auto/publishAudioEntity";
import { v4 as uuidv4 } from "uuid";
import { FamilyFolderFavoriteViewEntity } from "@/data/auto/familyFolderFavoriteViewEntity";
import { DmsFileEntity } from "@/data/auto/dmsFileEntity";
import { PublishData } from "@/data/auto/publishData";
@@ -122,22 +117,8 @@ const route = useRoute();
const router = useRouter();
const previousFilePath = ref<string>("");
const fileList = ref<UploadProps["fileList"]>([]);
const uploadUrl = ref<string>(WebSitePolicy.WebApiRoot + "DmsFile/UploadFile");
if (process.env.NODE_ENV === "development") {
uploadUrl.value = WebSitePolicy.WebApiRootDev + "/DmsFile/UploadFile";
} else {
uploadUrl.value = WebSitePolicy.WebApiRoot + "/DmsFile/UploadFile";
}
const currFilePath = ref<string>("");
const headers = ref({
Authorization: useLoginProfileStore().getToken(),
"Content-Type": "multipart/form-data",
FilePath: currFilePath.value,
});
const bindOptions = ref<BindOption[]>([]);
const datas = ref<DmsFileUploadDeleteLogViewDisplayData[]>([]);
const pagingParams = ref<PagingParams>({ pageSize: 999999, page: 1 });
@@ -288,97 +269,6 @@ onMounted(async () => {
onSearchByFilePath(rootPath.value);
});
const beforeUpload: UploadProps["beforeUpload"] = async (file) => {
if (!file || typeof file.size !== "number") {
return false;
}
loading.value = true;
fileList.value = [...(fileList.value || []), file];
const chunks = splitFile(file);
let bindOption: BindOption = bindOptions.value.filter(
(x) => x.BindValue == DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
)[0];
currFilePath.value = headers.value.FilePath = bindOption.Value;
let i = 1;
let fileSize = file.size;
let uid: string = uuidv4();
spinTip.value = "上传中(1/" + chunks.length + ")...";
await uploadChunk(chunks, file.name, uid, i);
spinTip.value = "加载中...";
return false;
};
const uploadChunk = async (
chunks: any,
fileName: string,
uid: string,
index: number,
) => {
const formData = new FormData();
const fileExtension = fileName.split(".").pop();
formData.append(
fileName,
chunks[index - 1],
uid +
"-" +
index.toString() +
"-" +
chunks.length.toString() +
"." +
fileExtension,
);
if (process.env.NODE_ENV === "development") {
axios.defaults.baseURL = WebSitePolicy.WebApiRootDev;
axios.defaults.withCredentials = true;
} else {
axios.defaults.baseURL = WebSitePolicy.WebApiRoot;
}
try {
let response = await axios.create().request({
url: "/DmsFile/UploadFile",
method: "post",
data: formData,
headers: headers.value,
});
if (response.status == 200 && index < chunks.length) {
spinTip.value = "上传中(" + (index + 1) + "/" + chunks.length + ")...";
await uploadChunk(chunks, fileName, uid, index + 1);
} else if (index == chunks.length) {
let sec: number = 2500;
if (index > 25) sec = index * 100;
spinTip.value = "加载中...";
setTimeout(function () {
onReSearch();
}, sec);
}
} catch (error) {
loading.value = false;
spinTip.value = "加载中...";
}
};
const CHUNK_SIZE = 1024 * 1024;
const splitFile = (file: any) => {
const chunks: Blob[] = [];
if (!file || typeof file.size !== "number" || typeof file.slice !== "function") {
return chunks;
}
let start = 0;
while (start < file.size) {
const end = Math.min(start + CHUNK_SIZE, file.size);
const chunk = file.slice(start, end);
chunks.push(chunk);
start += CHUNK_SIZE;
}
return chunks;
};
const onSelectChange = (selected: DmsFileUploadDeleteLogViewDisplayData[]) => {
keys.value = selected;
};
@@ -617,7 +507,6 @@ const onSearchByFilePath = async (fvalue: string) => {
);
previousFilePath.value = unref(currFilePath.value);
currFilePath.value = fvalue;
headers.value.FilePath = fvalue;
isSearched.value = true;
if (currentSearchCriteria.value && fvalue && fvalue.length > 0) {
currentSearchCriteria.value.Filter = [];