|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="mediaDetail">
|
|
|
- <Search :selectedRowKeys="state.selectedRowKeys" :onClickDownload="onClickBatchDownload"
|
|
|
- :onClickSearch="async () => { }" :onClickReset="async () => { }" />
|
|
|
+ <Search :fetchList="fetchList" :selectedRowKeys="state.selectedRowKeys" :onClickDownload="onClickBatchDownload"
|
|
|
+ :onClickDelete="onClickBatchDelete" :onClickSearch="async () => { }" :onClickReset="async () => { }" />
|
|
|
<div style="background: #FFFFFF;padding: 20px;">
|
|
|
<div class="mediaDetail-info">
|
|
|
<div class="mediaDetail-info-left">
|
|
|
@@ -21,7 +21,7 @@
|
|
|
已选/全部:
|
|
|
</div>
|
|
|
<div>
|
|
|
- 0/175
|
|
|
+ {{ state.selectedRowKeys.length }}/{{ paginationConfig.total }}
|
|
|
</div>
|
|
|
</div>
|
|
|
<a-button style="padding:0 5px;" :type="state.mode === 'table' ? 'primary' : 'default'"
|
|
|
@@ -44,8 +44,7 @@
|
|
|
<a-tooltip :title="record.file_name">
|
|
|
<div class="fileName" @click="onClickLookFile(record)">
|
|
|
<div>
|
|
|
- <img :src="record" v-if="1">
|
|
|
- <img :src="record" v-else>
|
|
|
+ <img :src="pictureSrc">
|
|
|
</div>
|
|
|
<div>
|
|
|
{{ record.file_name }}
|
|
|
@@ -57,13 +56,13 @@
|
|
|
<template #action="{ record }">
|
|
|
<div class="flex-align-center flex-row" style="color: #2d8cf0">
|
|
|
<a-tooltip title="照片位置" v-if="1">
|
|
|
- <EnvironmentOutlined style="margin-right: 10px;" @click="onClickTrajectory" />
|
|
|
+ <EnvironmentOutlined style="margin-right: 10px;" @click="onClickPhotoPosition" />
|
|
|
</a-tooltip>
|
|
|
<a-tooltip title="重命名" v-else-if="1">
|
|
|
- <EditOutlined style="margin-right: 10px;" @click="onClickTrajectory" />
|
|
|
+ <EditOutlined style="margin-right: 10px;" @click="onClickRechristen" />
|
|
|
</a-tooltip>
|
|
|
<a-tooltip title="删除" v-else-if="1">
|
|
|
- <DeleteOutlined style="margin-right: 10px;" @click="onClickTrajectory" />
|
|
|
+ <DeleteOutlined style="margin-right: 10px;" @click="onClickDelete" />
|
|
|
</a-tooltip>
|
|
|
<a-tooltip title="压缩下载">
|
|
|
<DownloadOutlined @click="onClickDownload(record)" />
|
|
|
@@ -77,15 +76,15 @@
|
|
|
:dataSource="state.list" :pagination="paginationConfig">
|
|
|
<template #renderItem="{ item }">
|
|
|
<a-list-item>
|
|
|
- <a-card hoverable @click="onClickFile(item)">
|
|
|
+ <a-card hoverable @click="onClickLookFile(item)">
|
|
|
<template #cover>
|
|
|
<div style="display: flex;justify-content:center;align-items: center;">
|
|
|
- <img style="width: 70%;" :src="fileSrc" />
|
|
|
+ <img style="width: 70%;margin: 10px;" :src="pictureSrc" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<a-card-meta>
|
|
|
<template #description>
|
|
|
- <div>
|
|
|
+ <div class="mediaDetail-list-name">
|
|
|
{{ item.file_name }}
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -97,34 +96,34 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <ImageModal :visible="state.imageModalVisible" :onClose="imageModalOnClickClose" />
|
|
|
+ <FileInfo :fileId="state.fileId" :onClose="fileInfoOnClickClose" v-if="state.fileInfoVisible" />
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { reactive, onMounted } from 'vue';
|
|
|
import { MenuOutlined, AppstoreOutlined, EditOutlined, DeleteOutlined, DownloadOutlined, EnvironmentOutlined } from '@ant-design/icons-vue';
|
|
|
import Search from './components/Search.vue';
|
|
|
-import ImageModal from './components/ImageModal.vue';
|
|
|
-import { getMediaFiles, downloadMediaFile } from '/@/api/media';
|
|
|
-import { downloadFile } from '/@/utils/common';
|
|
|
+import FileInfo from './components/FileInfo.vue';
|
|
|
+import pictureSrc from '/@/assets/media/picture.svg';
|
|
|
+import { apis } from '/@/api/custom';
|
|
|
import router from '/@/router/index';
|
|
|
|
|
|
interface State {
|
|
|
- workspaceId: string,
|
|
|
listLoading: boolean,
|
|
|
list: any[],
|
|
|
selectedRowKeys: string[],
|
|
|
mode: 'table' | 'list',
|
|
|
- imageModalVisible: boolean,
|
|
|
+ fileId: string,
|
|
|
+ fileInfoVisible: boolean,
|
|
|
};
|
|
|
|
|
|
const state: State = reactive({
|
|
|
- workspaceId: localStorage.getItem('workspace_id') || '',
|
|
|
listLoading: false,
|
|
|
list: [],
|
|
|
selectedRowKeys: [],
|
|
|
mode: 'table',
|
|
|
- imageModalVisible: false,
|
|
|
+ fileId: '',
|
|
|
+ fileInfoVisible: false,
|
|
|
})
|
|
|
|
|
|
const paginationConfig = reactive({
|
|
|
@@ -147,7 +146,8 @@ const paginationConfig = reactive({
|
|
|
const fetchList = async () => {
|
|
|
state.listLoading = true;
|
|
|
try {
|
|
|
- const res = await getMediaFiles(state.workspaceId, { page: paginationConfig.current, page_size: paginationConfig.pageSize });
|
|
|
+ const dirId = router.currentRoute.value.params?.id;
|
|
|
+ const res = await apis.fetchFileListByFolder(dirId as string, { page: paginationConfig.current, page_size: paginationConfig.pageSize });
|
|
|
state.list = res.data.list;
|
|
|
paginationConfig.current = res.data.pagination.page;
|
|
|
paginationConfig.pageSize = res.data.pagination.page_size;
|
|
|
@@ -180,9 +180,12 @@ const columns = [
|
|
|
},
|
|
|
{
|
|
|
title: '容量大小',
|
|
|
- dataIndex: 'is_original',
|
|
|
+ dataIndex: 'size',
|
|
|
width: 150,
|
|
|
ellipsis: true,
|
|
|
+ customRender: ({ text }: any) => {
|
|
|
+ return text || '--';
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '创建时间',
|
|
|
@@ -192,13 +195,19 @@ const columns = [
|
|
|
},
|
|
|
{
|
|
|
title: '媒体类型',
|
|
|
- dataIndex: 'create_time',
|
|
|
+ dataIndex: 'media_name',
|
|
|
width: 150,
|
|
|
+ customRender: ({ text }: any) => {
|
|
|
+ return text || '--';
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '照片类型',
|
|
|
- dataIndex: 'create_time',
|
|
|
+ dataIndex: 'picture_type',
|
|
|
width: 150,
|
|
|
+ customRender: ({ text }: any) => {
|
|
|
+ return text || '--';
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
title: '操作',
|
|
|
@@ -222,6 +231,11 @@ const onClickBatchDownload = async () => {
|
|
|
console.log(state.selectedRowKeys, '点击批量下载');
|
|
|
}
|
|
|
|
|
|
+// 点击批量删除
|
|
|
+const onClickBatchDelete = async () => {
|
|
|
+ console.log(state.selectedRowKeys, '点击批量删除');
|
|
|
+}
|
|
|
+
|
|
|
// 点击返回
|
|
|
const onClickGoBack = () => {
|
|
|
router.push({ path: '/media' })
|
|
|
@@ -234,35 +248,42 @@ const onSelectChange = (selectedRowKeys: string[]) => {
|
|
|
|
|
|
// 点击查看文件
|
|
|
const onClickLookFile = (record: any) => {
|
|
|
- state.imageModalVisible = true;
|
|
|
+ state.fileId = record.file_id;
|
|
|
+ state.fileInfoVisible = true;
|
|
|
+}
|
|
|
+
|
|
|
+// 文件信息-点击关闭
|
|
|
+const fileInfoOnClickClose = () => {
|
|
|
+ state.fileId = '';
|
|
|
+ state.fileInfoVisible = false;
|
|
|
}
|
|
|
|
|
|
-// 图片弹出层-点击关闭
|
|
|
-const imageModalOnClickClose = () => {
|
|
|
- state.imageModalVisible = false;
|
|
|
+// 点击照片位置
|
|
|
+const onClickPhotoPosition = () => {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// 点击重命名
|
|
|
+const onClickRechristen = () => {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// 点击删除
|
|
|
+const onClickDelete = () => {
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 点击下载
|
|
|
const onClickDownload = async (record: any) => {
|
|
|
state.listLoading = true;
|
|
|
try {
|
|
|
- const res = await downloadMediaFile(state.workspaceId, record.file_id);
|
|
|
- if (!res) {
|
|
|
- return
|
|
|
- }
|
|
|
- const data = new Blob([res]);
|
|
|
- downloadFile(data, record.file_name);
|
|
|
+
|
|
|
} catch (e) {
|
|
|
console.error(e);
|
|
|
} finally {
|
|
|
state.listLoading = false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// 点击轨迹回放
|
|
|
-const onClickTrajectory = () => {
|
|
|
- router.push({ path: '/trajectory' })
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
@@ -303,6 +324,14 @@ const onClickTrajectory = () => {
|
|
|
margin-right: 5px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ &-list {
|
|
|
+ &-name {
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.ant-table {
|