| | |
| | | <template> |
| | | <!-- <div class="header">媒体文件</div>--> |
| | | <!-- <div class="header">媒体文件</div>--> |
| | | <!--搜索栏--> |
| | | <div class="search-panel-wrapper"> |
| | | <div class="search-part"> |
| | | <a-range-picker :size="searchPanelOptions.size" :format="searchPanelOptions.dateFormat" :valueFormat="searchPanelOptions.valueFormat" v-model:value="timeRangeArr.data" @change="dateChange" style="width: 300px" /> |
| | | <div class="search-panel-wrapper"> |
| | | <div class="search-part"> |
| | | <a-range-picker :size="searchPanelOptions.size" :format="searchPanelOptions.dateFormat" |
| | | :valueFormat="searchPanelOptions.valueFormat" v-model:value="timeRangeArr.data" |
| | | @change="dateChange" style="width: 300px"/> |
| | | </div> |
| | | |
| | | <div class="search-part"> |
| | | <a-select v-model:value="subFileTypeArr" allowClear @change="subFileTypeChange" :options="subFileTypeOptions" |
| | | :maxTagCount="searchPanelOptions.maxTagCount" mode="multiple" |
| | | :size="searchPanelOptions.size" placeholder="所有类型" style="width: 300px"> |
| | | </a-select> |
| | | </div> |
| | | |
| | | <div class="search-part"> |
| | | <a-select v-model:value="payloadArr" allowClear @change="payloadChange" :options="payloadOptions" |
| | | :maxTagCount="searchPanelOptions.maxTagCount" mode="multiple" |
| | | :size="searchPanelOptions.size" placeholder="所有负载" style="width: 300px"> |
| | | </a-select> |
| | | </div> |
| | | |
| | | <div class="search-part"> |
| | | <a-input-search :size="searchPanelOptions.size" v-model:value="searchQuery.name" @change="inputChange" |
| | | placeholder="按文件名称搜索" style="width: 300px"/> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="search-part"> |
| | | <a-select v-model:value="subFileTypeArr" allowClear @change="subFileTypeChange" :options="subFileTypeOptions" :maxTagCount="searchPanelOptions.maxTagCount" mode="multiple" |
| | | :size="searchPanelOptions.size" placeholder="所有类型" style="width: 300px"> |
| | | </a-select> |
| | | </div> |
| | | |
| | | <div class="search-part"> |
| | | <a-select v-model:value="payloadArr" allowClear @change="payloadChange" :options="payloadOptions" :maxTagCount="searchPanelOptions.maxTagCount" mode="multiple" |
| | | :size="searchPanelOptions.size" placeholder="所有负载" style="width: 300px"> |
| | | </a-select> |
| | | </div> |
| | | |
| | | <div class="search-part"> |
| | | <a-input-search :size="searchPanelOptions.size" v-model:value="searchQuery.name" @change="inputChange" placeholder="按文件名称搜索" style="width: 300px"/> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <a-spin :spinning="loading" :delay="1000" tip="downloading" size="large"> |
| | | <div class="media-panel-wrapper"> |
| | | <a-table class="media-table" :columns="columns" :data-source="mediaData.data" row-key="fingerprint" |
| | | :pagination="paginationProp" :scroll="{ x: '100%', y: 600 }" @change="refreshData"> |
| | | <template v-for="col in ['name', 'path']" #[col]="{ text }" :key="col"> |
| | | <a-tooltip :title="text"> |
| | | <a-spin :spinning="loading" :delay="1000" tip="downloading" size="large"> |
| | | <div class="media-panel-wrapper"> |
| | | <a-table class="media-table" :columns="columns" :data-source="mediaData.data" row-key="fingerprint" |
| | | :pagination="paginationProp" :scroll="{ x: '100%', y: 600 }" @change="refreshData"> |
| | | <template v-for="col in ['name', 'path']" #[col]="{ text }" :key="col"> |
| | | <a-tooltip :title="text"> |
| | | <a v-if="col === 'name'">{{ text }}</a> |
| | | <span v-else>{{ text }}</span> |
| | | </a-tooltip> |
| | | </template> |
| | | <template #original="{ text }"> |
| | | {{ text }} |
| | | </template> |
| | | <template #action="{ record }"> |
| | | <a-tooltip title="download"> |
| | | <a class="fz18" @click="downloadMedia(record)"><DownloadOutlined /></a> |
| | | </a-tooltip> |
| | | </template> |
| | | </a-table> |
| | | </div> |
| | | </a-spin> |
| | | </a-tooltip> |
| | | </template> |
| | | <template #original="{ text }"> |
| | | {{ text }} |
| | | </template> |
| | | <template #action="{ record }"> |
| | | <a-tooltip title="download"> |
| | | <a class="fz18" @click="downloadMedia(record)"> |
| | | <DownloadOutlined/> |
| | | </a> |
| | | </a-tooltip> |
| | | </template> |
| | | </a-table> |
| | | </div> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { ref } from '@vue/reactivity' |
| | | import { TableState } from 'ant-design-vue/lib/table/interface' |
| | | import { onMounted, reactive } from 'vue' |
| | | import { IPage } from '../api/http/type' |
| | | import { ELocalStorageKey } from '../types/enums' |
| | | import { downloadFile } from '../utils/common' |
| | | import { downloadMediaFile, getMediaFiles, MediaQueryParam } from '/@/api/media' |
| | | import { DownloadOutlined } from '@ant-design/icons-vue' |
| | | import { message, Pagination } from 'ant-design-vue' |
| | | import { TaskStatus, TaskStatusMap } from '/@/types/task' |
| | | import {ref} from '@vue/reactivity' |
| | | import {TableState} from 'ant-design-vue/lib/table/interface' |
| | | import {onMounted, reactive} from 'vue' |
| | | import {IPage} from '../api/http/type' |
| | | import {ELocalStorageKey} from '../types/enums' |
| | | import {downloadFile} from '../utils/common' |
| | | import {downloadMediaFile, getMediaFiles, MediaQueryParam} from '/@/api/media' |
| | | import {DownloadOutlined} from '@ant-design/icons-vue' |
| | | import {message, Pagination} from 'ant-design-vue' |
| | | import {TaskStatus, TaskStatusMap} from '/@/types/task' |
| | | |
| | | const workspaceId = localStorage.getItem(ELocalStorageKey.WorkspaceId)! |
| | | const loading = ref(false) |
| | |
| | | }) |
| | | |
| | | const subFileTypeOptions = [ |
| | | { value: 0, label: '普通图片' }, |
| | | { value: 1, label: '全景图' }, |
| | | {value: 0, label: '普通图片'}, |
| | | {value: 1, label: '全景图'}, |
| | | ] |
| | | |
| | | const payloadOptions = [ |
| | | ] |
| | | const payloadOptions = [] |
| | | |
| | | const timeRangeArr = reactive({ |
| | | data: [] as string[] |
| | | }) |
| | | const searchQuery = reactive<MediaQueryParam>({ |
| | | }) |
| | | const searchQuery = reactive<MediaQueryParam>({}) |
| | | const subFileTypeArr = reactive([]) |
| | | const payloadArr = reactive([]) |
| | | |
| | |
| | | title: '文件名称', |
| | | dataIndex: 'file_name', |
| | | ellipsis: true, |
| | | slots: { customRender: 'name' } |
| | | slots: {customRender: 'name'} |
| | | }, |
| | | // { |
| | | // title: '文件路径', |
| | |
| | | }, |
| | | { |
| | | title: '操作', |
| | | slots: { customRender: 'action' } |
| | | slots: {customRender: 'action'} |
| | | } |
| | | ] |
| | | const body: IPage = { |
| | |
| | | getFiles() |
| | | }) |
| | | |
| | | function dateChange (value:any) { |
| | | function dateChange(value: any) { |
| | | searchQuery.startTime = value[0] |
| | | searchQuery.endTime = value[1] |
| | | getFiles() |
| | | } |
| | | |
| | | function subFileTypeChange (value:any) { |
| | | function subFileTypeChange(value: any) { |
| | | searchQuery.subFileType = value.join(',') |
| | | getFiles() |
| | | } |
| | | |
| | | function payloadChange (value:any) { |
| | | function payloadChange(value: any) { |
| | | searchQuery.payload = value.join(',') |
| | | getFiles() |
| | | } |
| | | |
| | | function inputChange (searchValue: string) { |
| | | function inputChange(searchValue: string) { |
| | | getFiles() |
| | | } |
| | | |
| | | function getFiles () { |
| | | function getFiles() { |
| | | getMediaFiles(workspaceId, body, searchQuery).then(res => { |
| | | mediaData.data = res.data.list |
| | | paginationProp.total = res.data.pagination.total |
| | |
| | | }) |
| | | } |
| | | |
| | | function refreshData (page: Pagination) { |
| | | function refreshData(page: Pagination) { |
| | | body.page = page?.current! |
| | | body.page_size = page?.pageSize! |
| | | getFiles() |
| | | } |
| | | |
| | | function downloadMedia (media: MediaFile) { |
| | | function downloadMedia(media: MediaFile) { |
| | | loading.value = true |
| | | downloadMediaFile(workspaceId, media.file_id).then(res => { |
| | | if (!res) { |
| | |
| | | .media-panel-wrapper { |
| | | width: 100%; |
| | | padding: 16px; |
| | | |
| | | .media-table { |
| | | background: #fff; |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .action-area { |
| | | color: $primary; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | |
| | | .header { |
| | | width: 100%; |
| | | height: 60px; |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .search-part{ |
| | | .search-part { |
| | | margin-right: 10px; |
| | | } |
| | | |