1100 lines
32 KiB
Vue
1100 lines
32 KiB
Vue
<template>
|
|
<a-spin size="large" :spinning="loading" :tip="spinTip">
|
|
<div class="dms-file-enquiry">
|
|
<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" :can-create="canCreate"
|
|
:can-amend="canAmend" :can-delete="canDelete" :can-view="canView" @create-folder="onCreate"
|
|
@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"
|
|
@restore="onRestoreSelected" />
|
|
|
|
<MyComputer :datas="datas" v-model:selected-keys="keys" @select-change="onSelectChange"
|
|
@open-folder="onOpenFolder" @open-file="onOpenFile" @preview-image="onPreviewOrgFile" />
|
|
</div>
|
|
|
|
<a-image :width="1024" :style="{ display: 'none' }" :preview="{
|
|
visible,
|
|
onVisibleChange: setPicVisible,
|
|
}" :src="imageSrc" />
|
|
<dmsFolder @on-submit="onReload"></dmsFolder>
|
|
<VideoPlayModal v-model:open="videoPlayModal" :videos="videoPlayList" :start-index="videoPlayIndex"
|
|
:title="videoPlayTitle" :fullscreen="width < 640" />
|
|
<dragModal v-model:open="showModalShare" width="60%" title="分享管理查询" :mask-closable="false" :fullscreen="width < 640"
|
|
@ok="handleSelectShare">
|
|
<DmsFileShareModal ref="shareEnquiry"></DmsFileShareModal>
|
|
</dragModal>
|
|
<dragModal v-model:open="showModalPublishPhoto" width="60%" title="相册专辑查询" :mask-closable="false"
|
|
:fullscreen="width < 640" @ok="handleSelectPublishPhoto">
|
|
<PublishPhotoEnquiry ref="publishPhotoEnquiry"></PublishPhotoEnquiry>
|
|
</dragModal>
|
|
<dragModal v-model:open="showModalPublishAudio" width="60%" title="音乐专辑查询" :mask-closable="false"
|
|
:fullscreen="width < 640" @ok="handleSelectPublishAudio">
|
|
<PublishAudioEnquiry ref="publishAudioEnquiry"></PublishAudioEnquiry>
|
|
</dragModal>
|
|
<dragModal v-model:open="showModalPublishVideo" width="60%" title="影视专辑查询" :mask-closable="false"
|
|
:fullscreen="width < 640" @ok="handleSelectPublishVideo">
|
|
<PublishVideoEnquiry ref="publishVideoEnquiry"></PublishVideoEnquiry>
|
|
</dragModal>
|
|
</a-spin>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import {
|
|
reactive,
|
|
onMounted,
|
|
onUnmounted,
|
|
ref,
|
|
unref,
|
|
h,
|
|
provide,
|
|
} from "vue";
|
|
import { BindOption } from "@/data/custom/bindOption";
|
|
import { SelectOption } from "@/data/auto/selectOption";
|
|
import { DmsFileUploadDeleteLogViewDisplayData } from "@/data/auto/dmsFileUploadDeleteLogViewDisplayData";
|
|
import { SearchFilter } from "@/data/auto/searchFilter";
|
|
import dmsFileService from "@/service/master/dmsFileService";
|
|
import publishPhotoService from "@/service/master/publishPhotoService";
|
|
import publishAudioService from "@/service/master/publishAudioService";
|
|
import { DmsFileSearchCriteria } from "@/data/auto/dmsFileSearchCriteria";
|
|
import dragModal from "@/components/basic/DragModal.vue";
|
|
import DmsFileShareModal from "./DmsFileShareModal.vue";
|
|
import PublishPhotoEnquiry from "./PublishPhotoEnquiry.vue";
|
|
import PublishAudioEnquiry from "./PublishAudioEnquiry.vue";
|
|
import PublishVideoEnquiry from "./PublishVideoEnquiry.vue";
|
|
import { FamilyGroupFolderEntity } from "@/data/auto/familyGroupFolderEntity";
|
|
import {
|
|
PermissionContext,
|
|
usePermissionContext,
|
|
} from "@/hooks/PermissionContext";
|
|
import { useRoute, useRouter } from "vue-router";
|
|
import { useBindOption } from "@/hooks/useBindOption";
|
|
import { SearchFilterOperatorPolicy } from "@/data/custom/searchFilterOperatorPolicy";
|
|
import { SearchFilterTypePolicy } from "@/data/custom/searchFilterTypePolicy";
|
|
import { notification } from "ant-design-vue";
|
|
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
|
|
import dmsFolder from "./DmsFolderModal.vue";
|
|
import { orderBy } from "lodash-es";
|
|
import { Howl } from "howler";
|
|
import { PublishVideoEntity } from "@/data/auto/publishVideoEntity";
|
|
import publishVideoService from "@/service/master/publishVideoService";
|
|
import { useWindowSize } from "@vueuse/core";
|
|
import fileTypePolicy from "@/policy/custom/fileTypePolicy";
|
|
import { PublishAudioEntity } from "@/data/auto/publishAudioEntity";
|
|
import { FamilyFolderFavoriteViewEntity } from "@/data/auto/familyFolderFavoriteViewEntity";
|
|
import { DmsFileEntity } from "@/data/auto/dmsFileEntity";
|
|
import { PublishData } from "@/data/auto/publishData";
|
|
import { PublishPhotoEntity } from "@/data/auto/publishPhotoEntity";
|
|
|
|
import MyComputer from "@/components/basic/MyComputer.vue";
|
|
import Toolbar from "@/components/basic/Toolbar.vue";
|
|
import OperatorStationDelete from "@/components/basic/OperatorStationDelete.vue";
|
|
import VideoPlayModal from "@/components/basic/VideoPlayModal.vue";
|
|
import type { VideoItem } from "@/components/basic/VideoPlayer.vue";
|
|
import { PublishVideoDetailDisplayData } from "@/data/auto/publishVideoDetailDisplayData";
|
|
|
|
interface BreadcrumbItem {
|
|
value: string;
|
|
displayName: string;
|
|
}
|
|
|
|
const { width } = useWindowSize();
|
|
|
|
const showModalShare = ref<boolean>(false);
|
|
const sharedFileRecord = ref<DmsFileUploadDeleteLogViewDisplayData | null>(null);
|
|
const showModalPublishPhoto = ref<boolean>(false);
|
|
const showModalPublishAudio = ref<boolean>(false);
|
|
const showModalPublishVideo = ref<boolean>(false);
|
|
const spinTip = ref<string>("加载中...");
|
|
const loading = ref<boolean>(false);
|
|
const canView = ref<boolean>(false);
|
|
const canAmend = ref<boolean>(false);
|
|
const canDelete = ref<boolean>(false);
|
|
const canCreate = ref<boolean>(false);
|
|
const rootPath = ref<string>("");
|
|
const imageSrc = ref<string>("");
|
|
const route = useRoute();
|
|
const router = useRouter();
|
|
const previousFilePath = ref<string>("");
|
|
|
|
const currFilePath = ref<string>("");
|
|
|
|
const bindOptions = ref<BindOption[]>([]);
|
|
const datas = ref<DmsFileUploadDeleteLogViewDisplayData[]>([]);
|
|
const pagingParams = ref<PagingParams>({ pageSize: 999999, page: 1 });
|
|
const result = ref<SearchCriteriaResultData>(new SearchCriteriaResultData());
|
|
|
|
const currentFilter = ref<SearchFilter[]>([]);
|
|
const isSearched = ref<boolean>(false);
|
|
const currentSearchCriteria = ref<DmsFileSearchCriteria>(
|
|
new DmsFileSearchCriteria(),
|
|
);
|
|
|
|
const keys = ref<DmsFileUploadDeleteLogViewDisplayData[]>([]);
|
|
const dmsFolderModal = ref<boolean>(false);
|
|
const dmsFolderTitle = ref<string>("新建文件夹");
|
|
const dmsFolderIsRename = ref<boolean>(false);
|
|
const dmsFolderIsMove = ref<boolean>(false);
|
|
const entity = ref<DmsFileEntity>(new DmsFileEntity());
|
|
const videoPlayModal = ref<boolean>(false);
|
|
const videoPlayList = ref<VideoItem[]>([]);
|
|
const videoPlayIndex = ref<number>(0);
|
|
const videoPlayTitle = ref<string>("");
|
|
const visible = ref<boolean>(false);
|
|
|
|
const pathStack = ref<BreadcrumbItem[]>([]);
|
|
|
|
interface PublishPhotoEnquiry {
|
|
keys: PublishPhotoEntity[];
|
|
}
|
|
const publishPhotoEnquiry = ref<PublishPhotoEnquiry | null>(null);
|
|
|
|
interface PublishAudioEnquiry {
|
|
keys: PublishAudioEntity[];
|
|
}
|
|
const publishAudioEnquiry = ref<PublishAudioEnquiry | null>(null);
|
|
|
|
interface PublishVideoEnquiry {
|
|
keys: PublishVideoEntity[];
|
|
}
|
|
const publishVideoEnquiry = ref<PublishVideoEnquiry | null>(null);
|
|
|
|
interface ShareEnquiry {
|
|
keys: FamilyFolderFavoriteViewEntity[];
|
|
}
|
|
const shareEnquiry = ref<ShareEnquiry | null>(null);
|
|
|
|
const sound = ref();
|
|
|
|
const toUploadView = (
|
|
r: Record<string, any>,
|
|
): DmsFileUploadDeleteLogViewDisplayData => r as DmsFileUploadDeleteLogViewDisplayData;
|
|
|
|
onUnmounted(() => {
|
|
sound.value?.stop();
|
|
});
|
|
|
|
const play = (src: string) => {
|
|
sound.value?.stop();
|
|
if (!src || src == undefined || src == "") {
|
|
return;
|
|
}
|
|
|
|
sound.value = new Howl({
|
|
src: src,
|
|
volume: 0.5,
|
|
autoplay: true,
|
|
loop: false,
|
|
html5: true,
|
|
preload: true,
|
|
onend: () => {
|
|
datas.value.forEach((element) => {
|
|
element.IsPlay = "";
|
|
});
|
|
},
|
|
});
|
|
|
|
sound.value.play();
|
|
};
|
|
|
|
const onPauseAudio = (record: DmsFileUploadDeleteLogViewDisplayData) => {
|
|
record.IsPause = "Y";
|
|
sound.value?.pause();
|
|
};
|
|
|
|
const onContinueAudio = (record: DmsFileUploadDeleteLogViewDisplayData) => {
|
|
record.IsPause = "";
|
|
sound.value?.play();
|
|
};
|
|
|
|
const onPlayAudio = (record: DmsFileUploadDeleteLogViewDisplayData) => {
|
|
datas.value.forEach((element) => {
|
|
if (element.FileId == record.FileId && element.IsPlay == "Y") {
|
|
element.IsPlay = "";
|
|
} else if (
|
|
element.FileId == record.FileId &&
|
|
(element.IsPlay == "" ||
|
|
element.IsPlay == null ||
|
|
element.IsPlay == undefined)
|
|
) {
|
|
element.IsPlay = "Y";
|
|
} else {
|
|
element.IsPlay = "";
|
|
}
|
|
record.IsPause = "";
|
|
});
|
|
|
|
if (record.IsPlay == "") {
|
|
sound.value?.stop();
|
|
return;
|
|
}
|
|
|
|
play(record.Url);
|
|
};
|
|
|
|
//================provide================
|
|
provide("dmsFolderModal", dmsFolderModal);
|
|
provide("dmsFolderTitle", dmsFolderTitle);
|
|
provide("dmsFolderIsRename", dmsFolderIsRename);
|
|
provide("dmsFolderIsMove", dmsFolderIsMove);
|
|
provide("DmsFileEntity", entity);
|
|
provide("isModalPublishVideo", showModalPublishVideo);
|
|
provide("isModalPublishAudio", showModalPublishAudio);
|
|
provide("isModalPublishPhoto", showModalPublishPhoto);
|
|
//================provide================
|
|
|
|
defineExpose({
|
|
keys,
|
|
});
|
|
|
|
onMounted(async () => {
|
|
let pContext: PermissionContext = usePermissionContext();
|
|
canView.value = pContext.canView(route.meta.permission as string);
|
|
canAmend.value = pContext.canAmend(route.meta.permission as string);
|
|
canDelete.value = pContext.canDelete(route.meta.permission as string);
|
|
canCreate.value = pContext.canCreate(route.meta.permission as string);
|
|
|
|
await initBindOption();
|
|
|
|
pathStack.value = [
|
|
{ value: rootPath.value, displayName: "我的云盘" },
|
|
];
|
|
|
|
onSearchByFilePath(rootPath.value);
|
|
});
|
|
|
|
const onSelectChange = (selected: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
keys.value = selected;
|
|
};
|
|
|
|
const onViewPreviewPhoto = async (filePath: string) => {
|
|
router.push({ name: "Preview", params: { id: filePath, mode: "list" } });
|
|
};
|
|
|
|
const onViewPreviewAudio = async (filePath: string) => {
|
|
router.push({
|
|
name: "PreviewAudio",
|
|
params: { id: filePath, mode: "list" },
|
|
});
|
|
};
|
|
|
|
const onViewPreviewVideo = async (filePath: string) => {
|
|
router.push({
|
|
name: "PreviewVideo",
|
|
params: { id: filePath, mode: "list" },
|
|
});
|
|
};
|
|
|
|
const onChangeFolder = async (fvalue: string) => {
|
|
onSearchByFilePath(fvalue);
|
|
};
|
|
|
|
/** DMS 记录 → 播放列表项(m3u8 的封面用同名 png 兜底) */
|
|
const toVideoItem = (
|
|
record: DmsFileUploadDeleteLogViewDisplayData,
|
|
): VideoItem => {
|
|
const item = new PublishVideoDetailDisplayData();
|
|
item.Title = record.OrgFileName;
|
|
item.FormattedUrl = record.Url;
|
|
item.FormattedPic = (record.FormattedPic || "").replace(/\.m3u8$/, ".png");
|
|
return item;
|
|
};
|
|
|
|
/** 当前目录里已转码(有 Url)的视频,作为弹窗播放器的播放列表 */
|
|
const buildVideoList = (
|
|
records: DmsFileUploadDeleteLogViewDisplayData[],
|
|
): VideoItem[] =>
|
|
records
|
|
.filter(
|
|
(x) =>
|
|
x.IsDirectoryIndc != "Y" &&
|
|
fileTypePolicy.isVideo(x.OrderKey || x.OrgFileName) &&
|
|
!!x.Url,
|
|
)
|
|
.map(toVideoItem);
|
|
|
|
/** 打开视频弹窗 */
|
|
const openVideoPlay = (list: VideoItem[], index: number, title: string) => {
|
|
sound.value?.stop();
|
|
datas.value.forEach((element) => {
|
|
element.IsPlay = "";
|
|
});
|
|
videoPlayList.value = list;
|
|
videoPlayIndex.value = index < 0 ? 0 : index;
|
|
videoPlayTitle.value = title || "视频播放";
|
|
videoPlayModal.value = true;
|
|
};
|
|
|
|
/** 未转码的视频没有 Url,直接取源片路径播放 */
|
|
const onSourceVideoPlay = async (
|
|
record: DmsFileUploadDeleteLogViewDisplayData,
|
|
) => {
|
|
try {
|
|
loading.value = true;
|
|
const url = await dmsFileService.FindDeleteLogM3u8Path(record.FileId);
|
|
const item = toVideoItem(record);
|
|
item.FormattedUrl = url;
|
|
openVideoPlay([item], 0, record.OrgFileName);
|
|
} catch (error) {
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "视频加载失败",
|
|
placement: "topRight",
|
|
});
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
|
|
const onPreviewFile = async (
|
|
usernameOrRecord: any,
|
|
orderKey?: string,
|
|
) => {
|
|
let username: string;
|
|
let fname: string;
|
|
if (typeof usernameOrRecord === "object") {
|
|
username = usernameOrRecord.CreatedBy;
|
|
fname = usernameOrRecord.OrderKey;
|
|
} else {
|
|
username = usernameOrRecord;
|
|
fname = orderKey!;
|
|
}
|
|
loading.value = true;
|
|
getPreviewFile(username, fname);
|
|
};
|
|
|
|
const onPreviewOrgFile = async (
|
|
usernameOrRecord: any,
|
|
orderKey?: string,
|
|
) => {
|
|
let fileId: number;
|
|
let orgFileName: string;
|
|
if (typeof usernameOrRecord === "object") {
|
|
fileId = usernameOrRecord.FileId;
|
|
orgFileName = usernameOrRecord.OrgFileName;
|
|
} else {
|
|
fileId = usernameOrRecord;
|
|
orgFileName = orderKey!;
|
|
}
|
|
loading.value = true;
|
|
onViewPictureFile(fileId, orgFileName);
|
|
};
|
|
|
|
const getPreviewFile = (username: string, fname: string) => {
|
|
let dms: DmsFileEntity = new DmsFileEntity();
|
|
dms.CreatedBy = username;
|
|
dms.OrderKey = fname;
|
|
dmsFileService
|
|
.DownloadFilePreview(dms)
|
|
.then((res) => {
|
|
const downloadUrl = window.URL.createObjectURL(new Blob([res]));
|
|
imageSrc.value = downloadUrl;
|
|
loading.value = false;
|
|
setPicVisible(true);
|
|
})
|
|
.catch(() => {
|
|
loading.value = false;
|
|
});
|
|
};
|
|
|
|
const DownloadFileCombine = (
|
|
fs: string[],
|
|
mergedData: Uint8Array,
|
|
index: number,
|
|
ttl: number,
|
|
total: number,
|
|
preview: boolean,
|
|
fname: string,
|
|
) => {
|
|
loading.value = true;
|
|
fs[fs.length - 2] = index.toString();
|
|
spinTip.value = "加载中(" + index + "/" + total + ")...";
|
|
dmsFileService
|
|
.DownloadFileCombine(fs.toString().replace(/,/g, "-"))
|
|
.then((res) => {
|
|
mergedData.set(new Uint8Array(res), ttl);
|
|
if (index < total) {
|
|
DownloadFileCombine(
|
|
fs,
|
|
mergedData,
|
|
index + 1,
|
|
ttl + res.byteLength,
|
|
total,
|
|
preview,
|
|
fname,
|
|
);
|
|
} else if (index == total) {
|
|
loading.value = false;
|
|
spinTip.value = "加载中...";
|
|
const downloadUrl = window.URL.createObjectURL(
|
|
new Blob([mergedData as unknown as BlobPart]),
|
|
);
|
|
imageSrc.value = downloadUrl;
|
|
if (!preview) {
|
|
const link = document.createElement("a");
|
|
link.href = downloadUrl;
|
|
link.setAttribute("download", fname);
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
} else {
|
|
setPicVisible(true);
|
|
}
|
|
}
|
|
})
|
|
.catch(() => {
|
|
spinTip.value = "加载中...";
|
|
loading.value = false;
|
|
});
|
|
};
|
|
|
|
const onLastFolder = async () => {
|
|
if (!datas.value || datas.value.length == 0) {
|
|
onSearchByFilePath(previousFilePath.value);
|
|
} else {
|
|
onPreviousFolder();
|
|
}
|
|
};
|
|
|
|
const onPreviousFolder = async () => {
|
|
let filePath: string = "";
|
|
if (datas.value && datas.value.length > 0) filePath = datas.value[0].FilePath;
|
|
dmsFileService.FindFolderNameParentByFolderName(filePath).then((res) => {
|
|
if (res && res.length > 0) onSearchByFilePath(res);
|
|
});
|
|
};
|
|
|
|
const onPublishPhoto = async () => {
|
|
showModalPublishPhoto.value = true;
|
|
};
|
|
|
|
const onPublishAudio = async () => {
|
|
showModalPublishAudio.value = true;
|
|
};
|
|
|
|
const onPublishVideo = async () => {
|
|
showModalPublishVideo.value = true;
|
|
};
|
|
|
|
const onShareFamily = async (record: Record<string, any>) => {
|
|
sharedFileRecord.value = toUploadView(record);
|
|
showModalShare.value = true;
|
|
};
|
|
|
|
const onDownloadFile = async (fid: number, fname: string) => {
|
|
GetOrgPictureFile(fid, fname, false);
|
|
};
|
|
|
|
const GetOrgPictureFile = async (
|
|
fid: number,
|
|
fname: string,
|
|
preview: boolean,
|
|
) => {
|
|
if (fileTypePolicy.isVideo(fname)) {
|
|
return;
|
|
}
|
|
|
|
loading.value = true;
|
|
dmsFileService
|
|
.FindDmsFileDeleteLogByKey(fid)
|
|
.then((res) => {
|
|
let fs: string[] = res.OrderKey.split("-");
|
|
let index: string = fs[fs.length - 2];
|
|
let total: string = fs[fs.length - 1].split(".")[0];
|
|
var mergedData = new Uint8Array((res.FileSize + 1) * 1024);
|
|
let ttl: number = 0;
|
|
fs[fs.length - 2] = "1";
|
|
spinTip.value = "加载中(1/" + total + ")...";
|
|
DownloadFileCombine(
|
|
fs,
|
|
mergedData,
|
|
1,
|
|
ttl,
|
|
parseInt(total),
|
|
preview,
|
|
fname,
|
|
);
|
|
})
|
|
.catch(() => {
|
|
loading.value = false;
|
|
});
|
|
};
|
|
|
|
const onViewPictureFile = async (fid: number, fname: string) => {
|
|
GetOrgPictureFile(fid, fname, true);
|
|
};
|
|
|
|
const onSearchByFilePath = async (fvalue: string) => {
|
|
setBindOptionValue(
|
|
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
|
fvalue,
|
|
"",
|
|
[fvalue],
|
|
false,
|
|
);
|
|
previousFilePath.value = unref(currFilePath.value);
|
|
currFilePath.value = fvalue;
|
|
isSearched.value = true;
|
|
if (currentSearchCriteria.value && fvalue && fvalue.length > 0) {
|
|
currentSearchCriteria.value.Filter = [];
|
|
let filter: SearchFilter;
|
|
filter = new SearchFilter();
|
|
filter.Column = DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH;
|
|
filter.Type = "SingleSelection";
|
|
filter.Operator = "single";
|
|
filter.Value = fvalue;
|
|
currentSearchCriteria.value.Filter.push(filter);
|
|
} else {
|
|
currentSearchCriteria.value.Filter = [];
|
|
}
|
|
|
|
await findBySearchCriteria(unref(currentSearchCriteria));
|
|
};
|
|
|
|
const onViewPic = () => {
|
|
if (keys.value.length == 0) return;
|
|
if (keys.value[0].IsDirectoryIndc == "Y") {
|
|
onChangeFolder(keys.value[0].FileName);
|
|
} else if (fileTypePolicy.isImage(keys.value[0].OrgFileName)) {
|
|
onPreviewFile(keys.value[0].CreatedBy, keys.value[0].OrderKey);
|
|
} else if (fileTypePolicy.isVideo(keys.value[0].OrgFileName)) {
|
|
onUrlVideoPlayItem(keys.value[0]);
|
|
} else {
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "未知格式无法预览",
|
|
placement: "topRight",
|
|
});
|
|
}
|
|
};
|
|
|
|
const setPicVisible = (value: boolean): void => {
|
|
visible.value = value;
|
|
};
|
|
|
|
const onCreate = () => {
|
|
dmsFolderTitle.value = "新增文件夹";
|
|
dmsFolderIsRename.value = false;
|
|
dmsFolderIsMove.value = false;
|
|
dmsFolderModal.value = true;
|
|
entity.value = new DmsFileEntity();
|
|
let bindOption: BindOption = bindOptions.value.filter(
|
|
(x) => x.BindValue == DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
|
)[0];
|
|
|
|
entity.value.FilePath = bindOption.SelectOptions.filter(
|
|
(x) => x.BindValue == bindOption.Value,
|
|
)[0].DisplayName;
|
|
entity.value.OrgFileName = bindOption.Value;
|
|
|
|
currFilePath.value = bindOption.Value;
|
|
};
|
|
|
|
const onAmend = () => {
|
|
if (keys.value[0].IsDirectoryIndc == "Y") {
|
|
dmsFolderTitle.value = "重命名文件夹";
|
|
} else {
|
|
dmsFolderTitle.value = "重命名文件";
|
|
}
|
|
dmsFolderIsRename.value = true;
|
|
dmsFolderModal.value = true;
|
|
dmsFolderIsMove.value = false;
|
|
entity.value = new DmsFileEntity();
|
|
|
|
entity.value.FileId = keys.value[0].FileId;
|
|
entity.value.FilePath = keys.value[0].FolderLocalName;
|
|
if (keys.value[0].CreatedBy == keys.value[0].FolderLocalName) {
|
|
entity.value.FilePath = "";
|
|
}
|
|
entity.value.FileName = keys.value[0].OrgFileName;
|
|
};
|
|
|
|
const onMove = () => {
|
|
if (keys.value[0].IsDirectoryIndc == "Y") {
|
|
dmsFolderTitle.value = "移动文件夹";
|
|
} else {
|
|
dmsFolderTitle.value = "移动文件";
|
|
}
|
|
dmsFolderIsRename.value = false;
|
|
dmsFolderIsMove.value = true;
|
|
dmsFolderModal.value = true;
|
|
|
|
entity.value = new DmsFileEntity();
|
|
|
|
entity.value.FileId = keys.value[0].FileId;
|
|
entity.value.FilePath = keys.value[0].FolderLocalName;
|
|
if (keys.value[0].CreatedBy == keys.value[0].FolderLocalName) {
|
|
entity.value.FilePath = "";
|
|
}
|
|
entity.value.FileName = keys.value[0].FileName;
|
|
entity.value.OrgFileName = keys.value[0].OrgFileName;
|
|
};
|
|
|
|
const onDelete = async () => {
|
|
try {
|
|
loading.value = true;
|
|
for (let i = 0; i < keys.value.length; i++) {
|
|
await dmsFileService.DeleteLog(keys.value[i].FileId);
|
|
}
|
|
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "记录删除成功",
|
|
placement: "topRight",
|
|
});
|
|
await onReload();
|
|
|
|
} catch (error) {
|
|
|
|
}
|
|
finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
|
|
const setBindOptionValue = (
|
|
bindValue: string,
|
|
value: string,
|
|
value1: string,
|
|
values: string[],
|
|
disabled: boolean,
|
|
) => {
|
|
let bindOption: BindOption = bindOptions.value.filter(
|
|
(x) => x.BindValue == bindValue,
|
|
)[0];
|
|
if (!bindOption) return;
|
|
bindOption.Value = value;
|
|
bindOption.Value1 = value1;
|
|
bindOption.Values = values;
|
|
bindOption.disabled = disabled;
|
|
};
|
|
|
|
const initBindOption = async () => {
|
|
let ubo = useBindOption();
|
|
bindOptions.value = [];
|
|
bindOptions.value.splice(0, bindOptions.value.length);
|
|
let bindOption: BindOption = ubo.getBindOption(
|
|
DmsFileUploadDeleteLogViewDisplayData.DB_ORG_FILE_NAME,
|
|
"名称",
|
|
SearchFilterTypePolicy.TEXT,
|
|
SearchFilterOperatorPolicy.CONTAIN,
|
|
);
|
|
bindOptions.value.push(bindOption);
|
|
|
|
let rps: SelectOption[] = await dmsFileService.FindDmsFolderDeleteLogs();
|
|
if (rps && rps.length > 1) {
|
|
rootPath.value = rps[1].BindValue;
|
|
if (!currFilePath.value) {
|
|
currFilePath.value = rps[1].BindValue;
|
|
}
|
|
}
|
|
bindOption = ubo.getBindSelectOption(
|
|
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
|
"当前目录",
|
|
SearchFilterTypePolicy.SINGLE_SELECTION,
|
|
SearchFilterOperatorPolicy.SINGLE,
|
|
rps,
|
|
);
|
|
|
|
bindOptions.value.push(bindOption);
|
|
|
|
setBindOptionValue(
|
|
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
|
currFilePath.value,
|
|
"",
|
|
[currFilePath.value],
|
|
false,
|
|
);
|
|
};
|
|
|
|
result.value.Page = pagingParams.value.page ?? 1;
|
|
result.value.Limit = pagingParams.value.pageSize;
|
|
|
|
const onSubmit = async (filters: SearchFilter[]) => {
|
|
loading.value = true;
|
|
let c: DmsFileSearchCriteria = new DmsFileSearchCriteria();
|
|
currentFilter.value = filters;
|
|
|
|
c.Filter = filters;
|
|
c.limit = pagingParams.value.pageSize;
|
|
c.page = pagingParams.value.page ?? 1;
|
|
c.GridColumns = [];
|
|
currentSearchCriteria.value = c;
|
|
|
|
await findBySearchCriteria(c);
|
|
};
|
|
|
|
const findBySearchCriteria = async (c: DmsFileSearchCriteria) => {
|
|
keys.value = [];
|
|
try {
|
|
if (c.limit == 0) c.limit = pagingParams.value.pageSize;
|
|
if (c.page == 0) c.page = pagingParams.value.page ?? 1;
|
|
|
|
currentFilter.value = c.Filter;
|
|
let data = await dmsFileService.FindDeleteLogBySearchCriteria(c);
|
|
|
|
isSearched.value = true;
|
|
result.value.Total = data.Total;
|
|
result.value.Page = data.Page;
|
|
result.value.Limit = data.Limit;
|
|
|
|
const rawList = data.Logs ?? [];
|
|
// 始终排序,空数组orderBy也安全
|
|
datas.value = orderBy(
|
|
rawList,
|
|
(x: DmsFileUploadDeleteLogViewDisplayData) => x.IsDirectoryIndc,
|
|
"desc",
|
|
);
|
|
loading.value = false;
|
|
if (
|
|
data.Datas &&
|
|
data.Datas.length > 0 &&
|
|
fileTypePolicy.isAudio(data.Datas[0].OrderKey)
|
|
) {
|
|
onPlayAudio(data.Datas[0]);
|
|
onPauseAudio(data.Datas[0]);
|
|
} else {
|
|
sound.value?.stop();
|
|
}
|
|
} catch (error) {
|
|
loading.value = false;
|
|
console.log(error);
|
|
}
|
|
};
|
|
|
|
const onReSearch = async () => {
|
|
setBindOptionValue(
|
|
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
|
currFilePath.value,
|
|
"",
|
|
[currFilePath.value],
|
|
false,
|
|
);
|
|
await findBySearchCriteria(unref(currentSearchCriteria));
|
|
loading.value = false;
|
|
spinTip.value = "加载中...";
|
|
};
|
|
|
|
const onReload = async () => {
|
|
let cfp: string = currFilePath.value;
|
|
await initBindOption();
|
|
setBindOptionValue(
|
|
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
|
cfp,
|
|
"",
|
|
[cfp],
|
|
false,
|
|
);
|
|
await findBySearchCriteria(unref(currentSearchCriteria));
|
|
};
|
|
|
|
const handleSelectShare = async () => {
|
|
if (shareEnquiry.value) {
|
|
if (shareEnquiry.value.keys.length > 0) {
|
|
let fgps: FamilyGroupFolderEntity[] = [];
|
|
let fgp: FamilyGroupFolderEntity;
|
|
shareEnquiry.value.keys.forEach((element) => {
|
|
fgp = new FamilyGroupFolderEntity();
|
|
fgp.FamilyName = element.FamilyName;
|
|
fgp.TopFolderName = element.TopFolderName;
|
|
fgp.FolderName = sharedFileRecord.value?.FileName ?? "";
|
|
fgp.FolderLocalName = sharedFileRecord.value?.OrgFileName ?? "";
|
|
fgp.FilePath = element.FolderName;
|
|
|
|
fgps.push(fgp);
|
|
});
|
|
|
|
await dmsFileService.CreateFamilyGroupFolder(fgps);
|
|
showModalShare.value = false;
|
|
} else {
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "请选择一条记录",
|
|
placement: "topRight",
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
const handleSelectPublishPhoto = async () => {
|
|
if (publishPhotoEnquiry.value) {
|
|
if (publishPhotoEnquiry.value.keys.length > 0) {
|
|
let data: PublishData;
|
|
for (let i = 0; i < keys.value.length; i++) {
|
|
data = new PublishData();
|
|
data.FileId = keys.value[i].FileId;
|
|
data.PublishName = publishPhotoEnquiry.value.keys[0].PublishName;
|
|
|
|
await publishPhotoService.InsertPublishPhotoDetail(data);
|
|
}
|
|
showModalPublishPhoto.value = false;
|
|
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "作品发布成功",
|
|
placement: "topRight",
|
|
});
|
|
} else {
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "请选择一条记录",
|
|
placement: "topRight",
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
const handleSelectPublishAudio = async () => {
|
|
if (publishAudioEnquiry.value) {
|
|
if (publishAudioEnquiry.value.keys.length > 0) {
|
|
let data: PublishData;
|
|
for (let i = 0; i < keys.value.length; i++) {
|
|
data = new PublishData();
|
|
data.FileId = keys.value[i].FileId;
|
|
data.PublishName = publishAudioEnquiry.value.keys[0].PublishName;
|
|
|
|
await publishAudioService.InsertPublishAudioDetail(data);
|
|
}
|
|
showModalPublishAudio.value = false;
|
|
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "专辑发布成功",
|
|
placement: "topRight",
|
|
});
|
|
} else {
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "请选择一条记录",
|
|
placement: "topRight",
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
const handleSelectPublishVideo = async () => {
|
|
if (publishVideoEnquiry.value) {
|
|
if (publishVideoEnquiry.value.keys.length > 0) {
|
|
let data: PublishData;
|
|
for (let i = 0; i < keys.value.length; i++) {
|
|
data = new PublishData();
|
|
data.FileId = keys.value[i].FileId;
|
|
data.PublishName = publishVideoEnquiry.value.keys[0].PublishName;
|
|
|
|
await publishVideoService.InsertPublishVideoDetail(data);
|
|
}
|
|
showModalPublishVideo.value = false;
|
|
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "专辑发布成功",
|
|
placement: "topRight",
|
|
});
|
|
} else {
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "请选择一条记录",
|
|
placement: "topRight",
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
const onGoTop = () => {
|
|
pathStack.value = [{ value: rootPath.value, displayName: "我的云盘" }];
|
|
onSearchByFilePath(rootPath.value);
|
|
};
|
|
|
|
const onGoBack = () => {
|
|
if (pathStack.value.length > 1) {
|
|
pathStack.value.pop();
|
|
const prev = pathStack.value[pathStack.value.length - 1];
|
|
onSearchByFilePath(prev.value);
|
|
}
|
|
};
|
|
|
|
const onBreadcrumbClick = (item: BreadcrumbItem, index: number) => {
|
|
pathStack.value = pathStack.value.slice(0, index + 1);
|
|
onSearchByFilePath(item.value);
|
|
};
|
|
|
|
const onSearchByName = (keyword: string) => {
|
|
let c: DmsFileSearchCriteria = new DmsFileSearchCriteria();
|
|
let filters: SearchFilter[] = [];
|
|
|
|
let filePathFilter: SearchFilter = new SearchFilter();
|
|
filePathFilter.Column = DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH;
|
|
filePathFilter.Type = "SingleSelection";
|
|
filePathFilter.Operator = "single";
|
|
filePathFilter.Value = currFilePath.value;
|
|
filters.push(filePathFilter);
|
|
|
|
if (keyword && keyword.trim()) {
|
|
let nameFilter: SearchFilter = new SearchFilter();
|
|
nameFilter.Column = DmsFileUploadDeleteLogViewDisplayData.DB_ORG_FILE_NAME;
|
|
nameFilter.Type = SearchFilterTypePolicy.TEXT;
|
|
nameFilter.Operator = SearchFilterOperatorPolicy.CONTAIN;
|
|
nameFilter.Value = keyword.trim();
|
|
filters.push(nameFilter);
|
|
}
|
|
|
|
c.Filter = filters;
|
|
c.limit = pagingParams.value.pageSize;
|
|
c.page = 1;
|
|
c.GridColumns = [];
|
|
|
|
currentSearchCriteria.value = c;
|
|
setBindOptionValue(
|
|
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
|
currFilePath.value,
|
|
"",
|
|
[currFilePath.value],
|
|
false,
|
|
);
|
|
pagingParams.value.page = 1;
|
|
findBySearchCriteria(c);
|
|
};
|
|
|
|
const onOpenFolder = (record: DmsFileUploadDeleteLogViewDisplayData) => {
|
|
if (record.IsDirectoryIndc == "Y") {
|
|
pathStack.value.push({
|
|
value: record.FileName,
|
|
displayName: record.OrgFileName,
|
|
});
|
|
onChangeFolder(record.FileName);
|
|
}
|
|
};
|
|
|
|
const onOpenFile = (record: DmsFileUploadDeleteLogViewDisplayData) => {
|
|
if (fileTypePolicy.isImage(record.OrgFileName)) {
|
|
onPreviewFile(record.CreatedBy, record.OrderKey);
|
|
} else if (fileTypePolicy.isVideo(record.OrgFileName)) {
|
|
onUrlVideoPlayItem(record);
|
|
} else if (fileTypePolicy.isAudio(record.OrgFileName)) {
|
|
onPlayAudio(toUploadView(record));
|
|
} else {
|
|
onDownloadFile(record.FileId, record.OrgFileName);
|
|
}
|
|
};
|
|
|
|
const onDownloadSelected = (items: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
items.forEach((item) => {
|
|
if (item.IsDirectoryIndc != "Y") {
|
|
onDownloadFile(item.FileId, item.OrgFileName);
|
|
}
|
|
});
|
|
};
|
|
|
|
const onShareSelected = (items: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
if (items.length > 0) {
|
|
onShareFamily(items[0]);
|
|
}
|
|
};
|
|
|
|
const onPublishSelected = (items: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
if (items.length === 0) return;
|
|
const first = items[0];
|
|
if (fileTypePolicy.isImage(first.OrderKey) || fileTypePolicy.isImage(first.OrgFileName)) {
|
|
onPublishPhoto();
|
|
} else if (fileTypePolicy.isVideo(first.OrderKey) || fileTypePolicy.isVideo(first.OrgFileName)) {
|
|
onPublishVideo();
|
|
} else if (fileTypePolicy.isAudio(first.OrderKey) || fileTypePolicy.isAudio(first.OrgFileName)) {
|
|
onPublishAudio();
|
|
}
|
|
};
|
|
|
|
const onViewPreviewSelected = (items: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
if (items.length === 0) return;
|
|
const first = items[0];
|
|
if (fileTypePolicy.isImage(first.OrderKey) || fileTypePolicy.isImage(first.OrgFileName)) {
|
|
onViewPreviewPhoto(first.FilePath);
|
|
} else if (fileTypePolicy.isVideo(first.OrderKey) || fileTypePolicy.isVideo(first.OrgFileName)) {
|
|
onViewPreviewVideo(first.FilePath);
|
|
} else if (fileTypePolicy.isAudio(first.OrderKey) || fileTypePolicy.isAudio(first.OrgFileName)) {
|
|
onViewPreviewAudio(first.FilePath);
|
|
}
|
|
};
|
|
|
|
/** 播放视频:把当前目录的视频串成播放列表,从点中的那一个开始 */
|
|
const onUrlVideoPlayItem = async (
|
|
record: DmsFileUploadDeleteLogViewDisplayData,
|
|
) => {
|
|
if (!record.Url) {
|
|
await onSourceVideoPlay(record);
|
|
return;
|
|
}
|
|
const list = buildVideoList(datas.value);
|
|
let index = list.findIndex((x) => x.FormattedUrl === record.Url);
|
|
if (index < 0) {
|
|
list.unshift(toVideoItem(record));
|
|
index = 0;
|
|
}
|
|
openVideoPlay(list, index, record.OrgFileName);
|
|
};
|
|
|
|
const onPlayAudioItem = (record: DmsFileUploadDeleteLogViewDisplayData) => {
|
|
onPlayAudio(record);
|
|
};
|
|
|
|
const onPreviewSelected = (items: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
if (items.length > 0) {
|
|
keys.value = items;
|
|
onViewPic();
|
|
}
|
|
};
|
|
|
|
const onAmendSelected = (items: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
if (items.length === 1) {
|
|
keys.value = items;
|
|
onAmend();
|
|
}
|
|
};
|
|
|
|
const onMoveSelected = (items: DmsFileUploadDeleteLogViewDisplayData[]) => {
|
|
if (items.length === 1) {
|
|
keys.value = items;
|
|
onMove();
|
|
}
|
|
};
|
|
|
|
const onRestoreSelected = () => {
|
|
onRestore();
|
|
};
|
|
|
|
const onRestore = async () => {
|
|
try {
|
|
loading.value = true;
|
|
for (let i = 0; i < keys.value.length; i++) {
|
|
await dmsFileService.RestoreDmsFile(keys.value[i].FileId);
|
|
}
|
|
|
|
notification.info({
|
|
message: "系统提示:",
|
|
description: "还原成功",
|
|
placement: "topRight",
|
|
});
|
|
await onReload();
|
|
|
|
} catch (error) {
|
|
|
|
}
|
|
finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
|
|
const onDeleteSelected = () => {
|
|
onDelete();
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.dms-file-enquiry {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: calc(100vh - 120px);
|
|
}
|
|
</style>
|