|
|
@@ -27,17 +27,16 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mediaList-table" v-if="state.mode === 'table'">
|
|
|
- <a-table :scroll="{ x: '100%', y: 500 }" :childrenColumnName="null" rowKey="file_id"
|
|
|
- :loading="state.listLoading" :columns="columns" :dataSource="state.list" :rowClassName="rowClassName"
|
|
|
- :pagination="paginationConfig"
|
|
|
+ <a-table :scroll="{ x: '100%', y: 500 }" :childrenColumnName="null" rowKey="id" :loading="state.listLoading"
|
|
|
+ :columns="columns" :dataSource="state.list" :rowClassName="rowClassName" :pagination="paginationConfig"
|
|
|
:rowSelection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }">
|
|
|
<!-- 文件夹名称 -->
|
|
|
- <template #file_name="{ record }">
|
|
|
- <a-tooltip :title="record.file_name">
|
|
|
+ <template #dir_name="{ record }">
|
|
|
+ <a-tooltip :title="record.dir_name">
|
|
|
<div class="fileName" @click="onClickFile(record)">
|
|
|
<img :src="fileSrc">
|
|
|
<div>
|
|
|
- {{ record.file_name }}
|
|
|
+ {{ record.dir_name }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</a-tooltip>
|
|
|
@@ -69,7 +68,7 @@
|
|
|
<a-card-meta>
|
|
|
<template #description>
|
|
|
<div>
|
|
|
- {{ item.file_name }}
|
|
|
+ {{ item.dir_name }}
|
|
|
</div>
|
|
|
</template>
|
|
|
</a-card-meta>
|
|
|
@@ -87,12 +86,11 @@ import { reactive, onMounted } from 'vue';
|
|
|
import { MenuOutlined, AppstoreOutlined, DownloadOutlined, EnvironmentOutlined } from '@ant-design/icons-vue';
|
|
|
import Search from './components/Search.vue';
|
|
|
import fileSrc from '/@/assets/media/file.svg';
|
|
|
-import { getMediaFiles, downloadMediaFile } from '/@/api/media';
|
|
|
+import { apis } from '/@/api/custom';
|
|
|
import { downloadFile } from '/@/utils/common';
|
|
|
import router from '/@/router/index';
|
|
|
|
|
|
interface State {
|
|
|
- workspaceId: string,
|
|
|
listLoading: boolean,
|
|
|
list: any[],
|
|
|
selectedRowKeys: string[],
|
|
|
@@ -100,7 +98,6 @@ interface State {
|
|
|
};
|
|
|
|
|
|
const state: State = reactive({
|
|
|
- workspaceId: localStorage.getItem('workspace_id') || '',
|
|
|
listLoading: false,
|
|
|
list: [],
|
|
|
selectedRowKeys: [],
|
|
|
@@ -127,7 +124,7 @@ const paginationConfig = reactive({
|
|
|
const fetchList = async () => {
|
|
|
state.listLoading = true;
|
|
|
try {
|
|
|
- const res = await getMediaFiles(state.workspaceId, { page: paginationConfig.current, page_size: paginationConfig.pageSize });
|
|
|
+ const res = await apis.fetchMediaFileList({ 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;
|
|
|
@@ -146,15 +143,15 @@ onMounted(async () => {
|
|
|
const columns = [
|
|
|
{
|
|
|
title: '文件夹名称',
|
|
|
- dataIndex: 'file_name',
|
|
|
+ dataIndex: 'dir_name',
|
|
|
width: 250,
|
|
|
ellipsis: true,
|
|
|
- sorter: (a: any, b: any) => a.file_name.localeCompare(b.file_name),
|
|
|
- slots: { customRender: 'file_name' }
|
|
|
+ sorter: (a: any, b: any) => a.dir_name.localeCompare(b.dir_name),
|
|
|
+ slots: { customRender: 'dir_name' }
|
|
|
},
|
|
|
{
|
|
|
title: '设备型号',
|
|
|
- dataIndex: 'drone',
|
|
|
+ dataIndex: 'device_name',
|
|
|
width: 150,
|
|
|
ellipsis: true,
|
|
|
},
|
|
|
@@ -178,17 +175,17 @@ const columns = [
|
|
|
},
|
|
|
{
|
|
|
title: '航线名称',
|
|
|
- dataIndex: 'create_time',
|
|
|
+ dataIndex: 'wayline_name',
|
|
|
width: 150,
|
|
|
},
|
|
|
{
|
|
|
title: '任务类型',
|
|
|
- dataIndex: 'create_time',
|
|
|
+ dataIndex: 'template_type',
|
|
|
width: 150,
|
|
|
},
|
|
|
{
|
|
|
title: '创建人',
|
|
|
- dataIndex: 'create_time',
|
|
|
+ dataIndex: 'username',
|
|
|
width: 150,
|
|
|
},
|
|
|
{
|
|
|
@@ -215,7 +212,7 @@ const onClickBatchDownload = async () => {
|
|
|
|
|
|
// 点击文件夹
|
|
|
const onClickFile = (record: any) => {
|
|
|
- router.push({ path: `/media/${record.file_id}` })
|
|
|
+ router.push({ path: `/media/${record.id}` })
|
|
|
}
|
|
|
|
|
|
// 勾选
|
|
|
@@ -227,12 +224,12 @@ const onSelectChange = (selectedRowKeys: string[]) => {
|
|
|
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);
|
|
|
+ // const res = await downloadMediaFile(state.workspaceId, record.id);
|
|
|
+ // if (!res) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // const data = new Blob([res]);
|
|
|
+ // downloadFile(data, record.dir_name);
|
|
|
} catch (e) {
|
|
|
console.error(e);
|
|
|
} finally {
|