husq
2023-09-25 d8ef42326909eb6f6c8a7fb5bb9038a47f95e97e
src/components/MediaPanel.vue
@@ -55,16 +55,16 @@
</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)
@@ -78,8 +78,8 @@
})
const subFileTypeOptions = [
  {value: 0, label: '普通图片'},
  {value: 1, label: '全景图'},
  { value: 0, label: '普通图片' },
  { value: 1, label: '全景图' },
]
const payloadOptions = []
@@ -96,7 +96,7 @@
    title: '文件名称',
    dataIndex: 'file_name',
    ellipsis: true,
    slots: {customRender: 'name'}
    slots: { customRender: 'name' }
  },
  // {
  //   title: '文件路径',
@@ -127,7 +127,7 @@
  },
  {
    title: '操作',
    slots: {customRender: 'action'}
    slots: { customRender: 'action' }
  }
]
const body: IPage = {
@@ -165,27 +165,27 @@
  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
@@ -194,13 +194,13 @@
  })
}
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) {