还原
This commit is contained in:
1 parent
280ccf4de8
commit
032f048a16
25 files changed
+2673
-718
No files matched your search
@@ -0,0 +1,223 @@
|
||||
<template>
|
||||
<div class="operator-station">
|
||||
<div class="operator-group selection-actions" v-if="hasSelection">
|
||||
<template v-if="true">
|
||||
<a-tooltip title="下载" v-if="!isDirectorySelected && isSingleItem">
|
||||
<a-button type="text" :icon="h(DownloadOutlined)" :disabled="!canAmend"
|
||||
@click="onDownload">下载</a-button>
|
||||
</a-tooltip>
|
||||
|
||||
<a-tooltip title="还原" >
|
||||
<a-button type="text" :icon="h(UndoOutlined)" :disabled="!canDelete"
|
||||
@click="$emit('restore', selectedItems)" >还原</a-button>
|
||||
</a-tooltip>
|
||||
|
||||
<a-tooltip title="删除">
|
||||
<a-button type="text" :icon="h(DeleteOutlined)" :disabled="!canCreate"
|
||||
@click="$emit('delete', selectedItems)">彻底删除</a-button>
|
||||
</a-tooltip>
|
||||
|
||||
<template v-if="isSingleVideo">
|
||||
<a-tooltip title="播放">
|
||||
<a-button type="text" :icon="h(PlayCircleOutlined, { style: { color: 'red' } })"
|
||||
@click="onPlayVideo">播放</a-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
|
||||
<template v-if="isSingleAudio">
|
||||
<a-tooltip v-if="selectedItem.IsPlay != 'Y'" title="播放">
|
||||
<a-button type="text" :icon="h(PlayCircleOutlined, { style: { color: 'red' } })"
|
||||
@click="onPlayAudio">播放</a-button>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-else-if="selectedItem.IsPause != 'Y'" title="暂停">
|
||||
<a-button type="text" :icon="h(PauseCircleOutlined)" @click="onPauseAudio">暂停</a-button>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-else title="继续">
|
||||
<a-button type="text" :icon="h(PlayCircleOutlined, { style: { color: 'red' } })"
|
||||
@click="onContinueAudio">继续</a-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<a-divider type="vertical" v-if="hasSelection" />
|
||||
|
||||
<div style="display: none">
|
||||
<a-upload v-if="canCreate" v-model:file-list="fileList" name="file" :before-upload="onBeforeUpload"
|
||||
:headers="headers" :show-upload-list="false" :action="uploadUrl" ref="uploadRef">
|
||||
</a-upload>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, h } from "vue";
|
||||
import {
|
||||
UploadOutlined,
|
||||
FolderAddOutlined,
|
||||
DownloadOutlined,
|
||||
ShareAltOutlined,
|
||||
NotificationOutlined,
|
||||
UnorderedListOutlined,
|
||||
PlayCircleOutlined,
|
||||
PauseCircleOutlined,
|
||||
EyeOutlined,
|
||||
EditOutlined,
|
||||
ScissorOutlined,
|
||||
DeleteOutlined,
|
||||
UndoOutlined,
|
||||
DownOutlined,
|
||||
} from "@ant-design/icons-vue";
|
||||
import { DmsFileUploadViewDisplayData } from "@/data/auto/dmsFileUploadViewDisplayData";
|
||||
import type { UploadProps } from "ant-design-vue";
|
||||
|
||||
const props = defineProps<{
|
||||
selectedItems: DmsFileUploadViewDisplayData[];
|
||||
uploadUrl: string;
|
||||
headers: any;
|
||||
canCreate: boolean;
|
||||
canAmend: boolean;
|
||||
canDelete: boolean;
|
||||
canView: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits([
|
||||
"create-folder",
|
||||
"before-upload",
|
||||
"download",
|
||||
"share",
|
||||
"publish",
|
||||
"view-preview",
|
||||
"play-video",
|
||||
"play-audio",
|
||||
"pause-audio",
|
||||
"continue-audio",
|
||||
"preview",
|
||||
"rename",
|
||||
"move",
|
||||
"delete",
|
||||
"restore",
|
||||
]);
|
||||
|
||||
const fileList = ref<UploadProps["fileList"]>([]);
|
||||
const uploadRef = ref<any>(null);
|
||||
|
||||
const hasSelection = computed(() => props.selectedItems.length > 0);
|
||||
const isDirectorySelected = computed(() =>
|
||||
props.selectedItems.some((s) => s.IsDirectoryIndc == "Y"),
|
||||
);
|
||||
const isSingleItem = computed(() => props.selectedItems.length === 1);
|
||||
|
||||
const selectedItem = computed(() => {
|
||||
return props.selectedItems[0] || ({} as DmsFileUploadViewDisplayData);
|
||||
});
|
||||
|
||||
const selectedOrderKey = computed(() => {
|
||||
return selectedItem.value?.OrderKey || selectedItem.value?.OrgFileName || "";
|
||||
});
|
||||
|
||||
const isImage = (key: string) => {
|
||||
if (!key) return false;
|
||||
return /\.(png|jpe?g|gif|bmp|webp)$/i.test(key);
|
||||
};
|
||||
|
||||
const isVideo = (key: string) => {
|
||||
if (!key) return false;
|
||||
return /\.(mp4|m3u8|rm|mpeg|mov|wmv|avi)$/i.test(key);
|
||||
};
|
||||
|
||||
const isAudio = (key: string) => {
|
||||
if (!key) return false;
|
||||
return /\.(mp3|wav|flac|aac|ogg|wma)$/i.test(key);
|
||||
};
|
||||
|
||||
const isSingleVideo = computed(() => {
|
||||
return isSingleItem.value && isVideo(selectedOrderKey.value);
|
||||
});
|
||||
|
||||
const isSingleAudio = computed(() => {
|
||||
return isSingleItem.value && isAudio(selectedOrderKey.value);
|
||||
});
|
||||
|
||||
const publishTooltip = computed(() => {
|
||||
if (isImage(selectedOrderKey.value)) return "发布相册";
|
||||
if (isVideo(selectedOrderKey.value)) return "发布影视专辑";
|
||||
if (isAudio(selectedOrderKey.value)) return "发布音乐专辑";
|
||||
return "发布";
|
||||
});
|
||||
|
||||
const previewTooltip = computed(() => {
|
||||
if (isImage(selectedOrderKey.value)) return "相册展览";
|
||||
if (isVideo(selectedOrderKey.value)) return "影视厅播放";
|
||||
if (isAudio(selectedOrderKey.value)) return "音乐厅播放";
|
||||
return "预览";
|
||||
});
|
||||
|
||||
const triggerUpload = () => {
|
||||
uploadRef.value?.$el?.querySelector("input")?.click();
|
||||
};
|
||||
|
||||
const onBeforeUpload: UploadProps["beforeUpload"] = (file) => {
|
||||
emit("before-upload", file);
|
||||
return false;
|
||||
};
|
||||
|
||||
const onDownload = () => {
|
||||
emit("download", props.selectedItems);
|
||||
};
|
||||
|
||||
const onShare = () => {
|
||||
emit("share", props.selectedItems);
|
||||
};
|
||||
|
||||
const onPublish = () => {
|
||||
emit("publish", props.selectedItems);
|
||||
};
|
||||
|
||||
const onViewPreview = () => {
|
||||
emit("view-preview", props.selectedItems);
|
||||
};
|
||||
|
||||
const onPlayVideo = () => {
|
||||
emit("play-video", selectedItem.value);
|
||||
};
|
||||
|
||||
const onPlayAudio = () => {
|
||||
emit("play-audio", selectedItem.value);
|
||||
};
|
||||
|
||||
const onPauseAudio = () => {
|
||||
emit("pause-audio", selectedItem.value);
|
||||
};
|
||||
|
||||
const onContinueAudio = () => {
|
||||
emit("continue-audio", selectedItem.value);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.operator-station {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 6px 12px;
|
||||
background: #fafafa;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.operator-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.main-actions :deep(.ant-btn) {
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.selection-actions :deep(.ant-btn) {
|
||||
padding: 4px 8px;
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -112,6 +112,16 @@ class DmsFileService{
|
||||
)
|
||||
};
|
||||
|
||||
async RestoreDmsFile(data: number) {
|
||||
return request<any>(
|
||||
{
|
||||
url: "/DmsFile/RestoreDmsFile?key="+data,
|
||||
method: "post",
|
||||
data,
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
async DeleteLog(data: number) {
|
||||
return request<any>(
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,912 @@
|
||||
<template>
|
||||
<a-spin size="large" :spinning="loading">
|
||||
<search
|
||||
@on-submit="onSubmit"
|
||||
@on-print="onPrint"
|
||||
@on-reset="onReset"
|
||||
@use-pagination="onPagination"
|
||||
rowSelectionType="checkbox"
|
||||
:scrollx="200"
|
||||
:loading="loading"
|
||||
:pagination="result"
|
||||
@on-select-change="onSelectChange"
|
||||
>
|
||||
<template #control> </template>
|
||||
|
||||
<template #headerCell="{ column }">
|
||||
<template
|
||||
v-if="column.dataIndex === DmsFileUploadDeleteLogViewDisplayData.URL"
|
||||
>
|
||||
<span
|
||||
style="color: darkgoldenrod; font-size: large; cursor: pointer"
|
||||
@click.prevent="onChangeFolder(rootPath)"
|
||||
>
|
||||
<LaptopOutlined
|
||||
style="color: darkgoldenrod; font-size: larger"
|
||||
title="返回顶层"
|
||||
/>返回顶层
|
||||
</span>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template
|
||||
v-if="column.dataIndex === DmsFileUploadDeleteLogViewDisplayData.URL"
|
||||
>
|
||||
<template v-if="!fileTypePolicy.isImage(record.OrderKey)">
|
||||
<template v-if="record.IsDirectoryIndc == 'Y'">
|
||||
<a-card hoverable style="width: 300px">
|
||||
<a-card-meta>
|
||||
<template #description>
|
||||
<span
|
||||
style="
|
||||
color: darkgoldenrod;
|
||||
margin-left: 4pxr;
|
||||
cursor: pointer;
|
||||
font-size: 26px;
|
||||
"
|
||||
@click.prevent="onChangeFolder(record.FileName)"
|
||||
>
|
||||
<FolderOutlined
|
||||
style="color: darkgoldenrod; font-size: 48px"
|
||||
title="打开文件夹"
|
||||
/>{{ record.OrgFileName }}
|
||||
</span>
|
||||
</template>
|
||||
</a-card-meta>
|
||||
<template #actions> </template>
|
||||
</a-card>
|
||||
</template>
|
||||
<template v-else-if="fileTypePolicy.isVideo(record.OrderKey)">
|
||||
<a-card style="width: 300px">
|
||||
<template #cover>
|
||||
<img
|
||||
style="height: 200px"
|
||||
:src="record.FormattedPic.replace('.m3u8', '.png')"
|
||||
:title="record.OrgFileName"
|
||||
/>
|
||||
</template>
|
||||
<a-card-meta>
|
||||
<template #description>
|
||||
<a-flex>
|
||||
<cust-icon-font
|
||||
size="26"
|
||||
type="icon-foldervideo"
|
||||
v-if="record.TranscodeIndc == 'Y'"
|
||||
@click.prevent="
|
||||
onUrlVideoPlay(record.Url, record.OrgFileName)
|
||||
"
|
||||
/>
|
||||
<cust-icon-font
|
||||
v-else
|
||||
size="26"
|
||||
type="icon-mp3-play"
|
||||
@click.prevent="onVideoPlay(record.FileId)"
|
||||
/>
|
||||
<span
|
||||
style="
|
||||
color: darkgoldenrod;
|
||||
margin-left: 4pxr;
|
||||
margin-top: 2px;
|
||||
"
|
||||
>
|
||||
{{ record.OrgFileName }}
|
||||
</span>
|
||||
</a-flex>
|
||||
</template>
|
||||
</a-card-meta>
|
||||
<template #actions> </template>
|
||||
</a-card>
|
||||
</template>
|
||||
<template v-else>
|
||||
<DownloadOutlined
|
||||
style="color: rgb(19, 185, 190); font-size: larger"
|
||||
title="下载"
|
||||
@click.prevent="
|
||||
onDownloadFile(record.FileId, record.OrgFileName)
|
||||
"
|
||||
/>
|
||||
<span>{{ record.OrgFileName }}</span>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-card hoverable style="width: 300px">
|
||||
<template #cover>
|
||||
<img
|
||||
style="height: 200px"
|
||||
:src="record.Url"
|
||||
:title="record.OrgFileName"
|
||||
@click.prevent="
|
||||
onViewPictureFile(record.FileId, record.OrgFileName)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
<a-card-meta>
|
||||
<template #description>
|
||||
<span style="color: darkgoldenrod; margin-left: 4pxr">
|
||||
<DownloadOutlined
|
||||
style="color: rgb(19, 185, 190); font-size: larger"
|
||||
title="原图下载"
|
||||
@click.prevent="
|
||||
onDownloadFile(record.FileId, record.OrgFileName)
|
||||
"
|
||||
/>
|
||||
{{ record.OrgFileName }}
|
||||
</span>
|
||||
</template>
|
||||
</a-card-meta>
|
||||
<template #actions> </template>
|
||||
</a-card>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<template #footer>
|
||||
<div class="page-footer">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="24" :sm="24">
|
||||
<a-row v-if="isEdit" :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button type="primary" @click.prevent="onCancel"
|
||||
>取消</a-button
|
||||
>
|
||||
<a-button type="primary" @click.prevent="onSave"
|
||||
>确定</a-button
|
||||
>
|
||||
</a-space>
|
||||
</a-row>
|
||||
<a-row v-if="!isEdit" :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<!-- <a-button type="primary" v-if="canAmend" :icon="h(FileImageOutlined)"
|
||||
:disabled="!(keys && keys.length > 0)" @click.prevent="onViewPic">预览</a-button> -->
|
||||
<a-popconfirm
|
||||
title="确定是否删除记录?"
|
||||
ok-text="是"
|
||||
cancel-text="否"
|
||||
@confirm="onDelete"
|
||||
>
|
||||
<a-button
|
||||
type="primary"
|
||||
danger
|
||||
:icon="h(DeleteOutlined)"
|
||||
v-if="canDelete"
|
||||
:disabled="!(keys && keys.length > 0)"
|
||||
>永久删除</a-button
|
||||
>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</template>
|
||||
</search>
|
||||
<a-image
|
||||
:width="1024"
|
||||
:style="{ display: 'none' }"
|
||||
:preview="{
|
||||
visible,
|
||||
onVisibleChange: setPicVisible,
|
||||
}"
|
||||
:src="imageSrc"
|
||||
/>
|
||||
<dmsFolder @on-submit="onReload"></dmsFolder>
|
||||
<videoPlay></videoPlay>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
reactive,
|
||||
inject,
|
||||
defineComponent,
|
||||
onMounted,
|
||||
ref,
|
||||
unref,
|
||||
provide,
|
||||
h,
|
||||
} from "vue";
|
||||
import { BindOption } from "@/data/custom/bindOption";
|
||||
import { SelectOption } from "@/data/auto/selectOption";
|
||||
import search from "@/components/basic/Search.vue";
|
||||
import {
|
||||
DeleteOutlined,
|
||||
PictureOutlined,
|
||||
LaptopOutlined,
|
||||
ScissorOutlined,
|
||||
UploadOutlined,
|
||||
FolderAddOutlined,
|
||||
DownloadOutlined,
|
||||
FolderOutlined,
|
||||
FileImageOutlined,
|
||||
} from "@ant-design/icons-vue";
|
||||
import { DmsFileEntity } from "@/data/auto/dmsFileEntity";
|
||||
import { DmsFileResultData } from "@/data/auto/dmsFileResultData";
|
||||
import { DmsFileUploadDeleteLogViewDisplayData } from "@/data/auto/dmsFileUploadDeleteLogViewDisplayData";
|
||||
import { SearchFilter } from "@/data/auto/searchFilter";
|
||||
import dmsFileService from "@/service/master/dmsFileService";
|
||||
import { DmsFileSearchCriteria } from "@/data/auto/dmsFileSearchCriteria";
|
||||
|
||||
import { SearchCriteriaResultData } from "@/data/auto/searchCriteriaResultData";
|
||||
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 { GridColumnInfo } from "@/data/auto/gridColumnInfo";
|
||||
import { useGridColumnInfo } from "@/hooks/gridColumnInfo";
|
||||
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 { bsInfo } from "@/utils/browser";
|
||||
import axios from "axios";
|
||||
import { getuid } from "process";
|
||||
import VideoPlay from "./PlayVideo.vue";
|
||||
import {
|
||||
enquiryMethodKey,
|
||||
searchCriteriaManagerKey,
|
||||
masterOperationToEnquiryMethodKey,
|
||||
MasterOperationToEnquiryModelOption,
|
||||
layoutProviderMethodKey,
|
||||
} from "@/injections";
|
||||
import { useOrderedChildren } from "@/hooks/use-ordered-children";
|
||||
import { SearchCriteriaContext } from "@/injections";
|
||||
import fileTypePolicy from "@/policy/custom/fileTypePolicy";
|
||||
//page from-----------------------------------------------------------------------------------------------------------------------------------
|
||||
//================inject================
|
||||
//报表名称
|
||||
const layoutProviderMethod = inject(layoutProviderMethodKey);
|
||||
|
||||
//================inject================
|
||||
|
||||
const widthColumn = ref<string>("3%");
|
||||
if (bsInfo.size.sm) {
|
||||
widthColumn.value = "8%";
|
||||
} else {
|
||||
widthColumn.value = "3%";
|
||||
}
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
const isEdit = ref<boolean>(false);
|
||||
const canView = ref<boolean>(false);
|
||||
const canAmend = ref<boolean>(false);
|
||||
const canDelete = ref<boolean>(false);
|
||||
const canCreate = ref<boolean>(false);
|
||||
const modalTitle = ref<string>("新增文件夹");
|
||||
const rootPath = ref<string>("");
|
||||
const imageSrc = ref<string>("");
|
||||
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 columns = ref([
|
||||
{
|
||||
title: "",
|
||||
dataIndex: DmsFileUploadDeleteLogViewDisplayData.URL,
|
||||
sorter: false,
|
||||
width: "50%",
|
||||
sequence: 1,
|
||||
hidden: "N",
|
||||
},
|
||||
]);
|
||||
|
||||
const viewOption = {
|
||||
Value: "default",
|
||||
SelectOptions: [{ BindValue: "default", DisplayName: "默认" }],
|
||||
Columns: [{ BindValue: "default", BindColumn: columns }],
|
||||
};
|
||||
|
||||
const bindOptions = ref<BindOption[]>([]);
|
||||
const datas = ref<DmsFileUploadDeleteLogViewDisplayData[]>([]);
|
||||
const pagingParams = ref<PagingParams>({ pageSize: 20, page: 1 });
|
||||
const result = ref<SearchCriteriaResultData>(new SearchCriteriaResultData());
|
||||
|
||||
const data = ref<DmsFileResultData>(new DmsFileResultData());
|
||||
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 videoSrc = ref<string>("");
|
||||
const videoType = ref<string>("");
|
||||
const {
|
||||
children: items,
|
||||
addChild: addItem,
|
||||
removeChild: removeItem,
|
||||
} = useOrderedChildren<SearchCriteriaContext>();
|
||||
|
||||
//================provide================
|
||||
//初始化查询条件UI
|
||||
provide(enquiryMethodKey, {
|
||||
getLayoutSetting: () => {
|
||||
return {
|
||||
controlLeft: 16,
|
||||
controlRight: 8,
|
||||
space: true,
|
||||
soltLeft: 24,
|
||||
soltRight: 24,
|
||||
};
|
||||
},
|
||||
getBindOptions: () => {
|
||||
return unref(bindOptions);
|
||||
},
|
||||
getViewOption: () => {
|
||||
return unref(viewOption);
|
||||
},
|
||||
getDatas: () => {
|
||||
return datas;
|
||||
},
|
||||
});
|
||||
|
||||
provide(
|
||||
searchCriteriaManagerKey,
|
||||
reactive({
|
||||
items,
|
||||
addItem,
|
||||
removeItem,
|
||||
}),
|
||||
);
|
||||
|
||||
// provide("bindOptions", bindOptions);
|
||||
provide("dmsFolderModal", dmsFolderModal);
|
||||
provide("dmsFolderTitle", dmsFolderTitle);
|
||||
provide("dmsFolderIsRename", dmsFolderIsRename);
|
||||
provide("dmsFolderIsMove", dmsFolderIsMove);
|
||||
provide("DmsFileEntity", entity);
|
||||
//控制按键多行显示,可以单列24或者多列
|
||||
//provide("layoutSetting", { controlLeft: 20, controlRight: 4, soltLeft: 8, soltRight: 8 });
|
||||
//space: true 控制按键单行显示
|
||||
// provide("layoutSetting", { controlLeft: 16, controlRight: 8, space: true });
|
||||
// provide("viewOption", viewOption);
|
||||
provide("videoPlayModal", videoPlayModal);
|
||||
provide("videoSrc", videoSrc);
|
||||
provide("videoType", videoType);
|
||||
//table数据源
|
||||
// provide("datas", datas);
|
||||
//================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();
|
||||
|
||||
onSearchByFilePath(rootPath.value);
|
||||
});
|
||||
|
||||
const beforeUpload: UploadProps["beforeUpload"] = (file) => {
|
||||
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 = file.uid;
|
||||
|
||||
uploadChunk(chunks, file.name, uid, i);
|
||||
|
||||
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) {
|
||||
uploadChunk(chunks, fileName, uid, index + 1);
|
||||
} else if (index == chunks.length) {
|
||||
onReSearch();
|
||||
loading.value = false;
|
||||
}
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const CHUNK_SIZE = 512 * 1024; // 设置每个分片的大小为1MB
|
||||
|
||||
const splitFile = (file: any) => {
|
||||
const 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;
|
||||
};
|
||||
|
||||
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 onChangeFolder = async (fvalue: string) => {
|
||||
onSearchByFilePath(fvalue);
|
||||
};
|
||||
|
||||
const onVideoPlay = async (fid: number) => {
|
||||
videoType.value = "video/mp4";
|
||||
videoPlayModal.value = true;
|
||||
//从服务器取出
|
||||
dmsFileService
|
||||
.FindDeleteLogM3u8Path(fid)
|
||||
.then((res) => {
|
||||
videoSrc.value = res;
|
||||
})
|
||||
.catch(() => {
|
||||
videoPlayModal.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onPreviewFile = async (username: string, orderKey: string) => {
|
||||
loading.value = true;
|
||||
getPreviewFile(username, orderKey);
|
||||
};
|
||||
|
||||
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();
|
||||
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;
|
||||
const downloadUrl = window.URL.createObjectURL(new Blob([mergedData]));
|
||||
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(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
const onDownloadFile = async (fid: number, fname: string) => {
|
||||
GetOrgPictureFile(fid, fname, false);
|
||||
};
|
||||
|
||||
const GetOrgPictureFile = async (
|
||||
fid: number,
|
||||
fname: string,
|
||||
preview: boolean,
|
||||
) => {
|
||||
if (fileTypePolicy.isVideo(fname)) {
|
||||
// onVideoPlay(keys.value[0].FileId);
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
|
||||
dmsFileService
|
||||
.FindDmsFileDeleteLogByKey(fid)
|
||||
.then((res) => {
|
||||
let fs: string[] = res.OrderKey.replace("scale_", "").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";
|
||||
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 onReset = () => {
|
||||
keys.value = [];
|
||||
result.value.Total = 0;
|
||||
setBindOptionValue(
|
||||
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
||||
rootPath.value,
|
||||
"",
|
||||
[rootPath.value],
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
const onUrlVideoPlay = (url: string, title: string) => {
|
||||
videoType.value = "m3u8";
|
||||
videoSrc.value = url;
|
||||
videoPlayModal.value = true;
|
||||
};
|
||||
|
||||
const onViewPic = () => {
|
||||
if (keys.value.length == 0) return;
|
||||
|
||||
if (keys.value[0].IsDirectoryIndc == "Y") {
|
||||
onChangeFolder(keys.value[0].FileName);
|
||||
} else if (
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("png") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("jpg") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("jpeg") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("gif") > 0
|
||||
) {
|
||||
onPreviewFile(keys.value[0].CreatedBy, keys.value[0].OrderKey);
|
||||
} else if (
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("mp4") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("rm") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("mpeg") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("mov") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("wmv") > 0 ||
|
||||
keys.value[0].OrgFileName.toLowerCase().indexOf("avi") > 0
|
||||
) {
|
||||
onVideoPlay(keys.value[0].FileId);
|
||||
} else {
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "未知格式无法预览",
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const visible = ref<boolean>(false);
|
||||
const setPicVisible = (value: boolean): void => {
|
||||
visible.value = value;
|
||||
};
|
||||
|
||||
const onDelete = async () => {
|
||||
if (keys.value.length == 0) return;
|
||||
|
||||
for (let element of keys.value) {
|
||||
await dmsFileService.DeleteLog(element.FileId);
|
||||
}
|
||||
|
||||
notification.info({
|
||||
message: "系统提示:",
|
||||
description: "记录删除成功",
|
||||
placement: "topRight",
|
||||
});
|
||||
onReload();
|
||||
};
|
||||
|
||||
const onSave = () => {
|
||||
isEdit.value = false;
|
||||
};
|
||||
|
||||
const onCancel = () => {
|
||||
isEdit.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 = currFilePath.value = rps[0].BindValue;
|
||||
}
|
||||
|
||||
bindOption = ubo.getBindSelectOption(
|
||||
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
||||
"当前目录",
|
||||
SearchFilterTypePolicy.SINGLE_SELECTION,
|
||||
SearchFilterOperatorPolicy.SINGLE,
|
||||
rps,
|
||||
);
|
||||
|
||||
bindOptions.value.push(bindOption);
|
||||
|
||||
bindOption = ubo.getBindOption(
|
||||
DmsFileUploadDeleteLogViewDisplayData.DB_CREATED_DATETIME,
|
||||
"创建日期",
|
||||
SearchFilterTypePolicy.DATE,
|
||||
SearchFilterOperatorPolicy.DATE_BETWEEN,
|
||||
);
|
||||
bindOptions.value.push(bindOption);
|
||||
|
||||
setBindOptionValue(
|
||||
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
||||
currFilePath.value,
|
||||
"",
|
||||
[currFilePath.value],
|
||||
false,
|
||||
);
|
||||
};
|
||||
|
||||
//table from-----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
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;
|
||||
isSearched.value = true;
|
||||
c.Filter = filters;
|
||||
c.limit = pagingParams.value.pageSize;
|
||||
c.page = pagingParams.value.page ?? 1;
|
||||
c.GridColumns = [];
|
||||
currentSearchCriteria.value = c;
|
||||
|
||||
await findBySearchCriteria(c);
|
||||
};
|
||||
|
||||
const onPrint = async () => {
|
||||
loading.value = true;
|
||||
let c: DmsFileSearchCriteria = new DmsFileSearchCriteria();
|
||||
if (currentFilter.value.length > 0) c.Filter = currentFilter.value;
|
||||
else c.Filter = [];
|
||||
|
||||
c.limit = pagingParams.value.pageSize;
|
||||
c.page = pagingParams.value.page ?? 1;
|
||||
c.GridColumns = useGridColumnInfo().getGridColumnInfo(unref(columns));
|
||||
c.ReportName = layoutProviderMethod?.getLayoutProvider().layoutTitle!;
|
||||
try {
|
||||
let sss = await dmsFileService.PrintBySearchCriteria(c);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
data.value = await dmsFileService.FindDeleteLogBySearchCriteria(c);
|
||||
result.value.Total = data.value.Total;
|
||||
result.value.Page = data.value.Page;
|
||||
result.value.Limit = data.value.Limit;
|
||||
if (data.value.Logs)
|
||||
data.value.Logs = orderBy(
|
||||
data.value.Logs,
|
||||
(x) => x.IsDirectoryIndc,
|
||||
"desc",
|
||||
);
|
||||
|
||||
datas.value = data.value.Logs;
|
||||
loading.value = false;
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const onPagination = async (params: PagingParams) => {
|
||||
try {
|
||||
if (!isSearched.value) return;
|
||||
let c: DmsFileSearchCriteria = new DmsFileSearchCriteria();
|
||||
|
||||
if (currentFilter.value.length > 0) c.Filter = currentFilter.value;
|
||||
else c.Filter = [];
|
||||
|
||||
c.limit = params.pageSize;
|
||||
c.page = params.page ?? 1;
|
||||
if (params.sortField) c.orderby = params.sortField!;
|
||||
if (params.sortOrder)
|
||||
c.orderbytag = params.sortOrder?.toString().substring(0, 4)!;
|
||||
c.GridColumns = [];
|
||||
loading.value = true;
|
||||
currentSearchCriteria.value = c;
|
||||
await findBySearchCriteria(c);
|
||||
} 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));
|
||||
};
|
||||
|
||||
const onReload = async () => {
|
||||
await initBindOption();
|
||||
setBindOptionValue(
|
||||
DmsFileUploadDeleteLogViewDisplayData.DB_FILE_PATH,
|
||||
currFilePath.value,
|
||||
"",
|
||||
[currFilePath.value],
|
||||
false,
|
||||
);
|
||||
await findBySearchCriteria(unref(currentSearchCriteria));
|
||||
};
|
||||
//table end-----------------------------------------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
Reference in new issue
Block a user