无人机管理后台前端(已迁走)
张含笑
2025-08-11 610176e05dd8e3878896f124a69f286bb2a77c79
feat:文件夹下载
1 files modified
63 ■■■■■ changed files
src/views/dataCenter/dataCenter.vue 63 ●●●●● patch | view | raw | blame | history
src/views/dataCenter/dataCenter.vue
@@ -144,8 +144,9 @@
    <el-pagination
      :current-page="switchFolders ? FolderListParams.page : jobListParams.current"
      :page-size="switchFolders ? FolderListParams.page_size : jobListParams.size"
      :page-sizes="[10, 20, 30, 40]"
      background
      layout="total,size  prev, pager, next, jumper"
       layout="total, sizes, prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
@@ -419,7 +420,9 @@
  page: 1,
  page_size: 30,
startTime: jobListParams.searchParams.startTime?.slice(0, 10),
    endTime: jobListParams.searchParams.endTime?.slice(0, 10)
    endTime: jobListParams.searchParams.endTime?.slice(0, 10),
   waylineName:'',
});
const tableData = ref([]);
@@ -430,8 +433,6 @@
    orderByCreateTime: jobListParams.orderByCreateTime,
    ...jobListParams.searchParams,
  };
  console.log('jobListParams',jobListParams);
  getaiImagesPageAPI(params, {
    current: jobListParams.current,
    size: jobListParams.size,
@@ -459,14 +460,12 @@
const getFolderList=()=>{
 const apiParams = {
    ...FolderListParams, 
    // type:'0'
  };
  console.log('apiParams',FolderListParams);
  getJobIdsBySnApi(apiParams)
        .then(res => {
    folderList.value = res.data.data.records.map(i => ({ ...i, checked: false }))
    total.value = res.data.data.total
        console.log('文件夹', res.data.data);
    total.value = res.data.data.total
        })
        .finally(() => {
          loadings.value = false; 
@@ -483,25 +482,33 @@
// 切换文件夹
 const handleswitchFolders = () => {
     switchFolders.value = !switchFolders.value;
     jobListParams.current = 1;
     FolderListParams.page = 1;
     fetchData();
   };
// 查询
const searchClick = params => {
  if(switchFolders.value){
  FolderListParams.page = 1
  FolderListParams.page_size=30
      FolderListParams.startTime = params.startTime?.slice(0, 10);
  FolderListParams.endTime = params.endTime?.slice(0, 10);
getFolderList()
  }else{
  jobListParams.current = 1;
  jobListParams.size = 10;
  jobListParams.searchParams = params;
 getaiImagesPage()
const searchClick = async (params) => {
  loadings.value = true;
  total.value = 0;
  if (switchFolders.value) {
    // 文件夹逻辑
    FolderListParams.page = 1;
    FolderListParams.page_size = 30;
    FolderListParams.startTime = params.startTime?.slice(0, 10);
    FolderListParams.endTime = params.endTime?.slice(0, 10);
    FolderListParams.waylineName=params.jobName,
    // FolderListParams.deviceSn = params.deviceSn
    await getFolderList();
  } else {
    // 表格逻辑
    jobListParams.current = 1;
    jobListParams.size = 10;
    jobListParams.searchParams = params;
    await getaiImagesPage();
  }
  loadings.value = false;
};
const handleSizeChange = (val) => {
  if (switchFolders.value) {
@@ -591,9 +598,20 @@
    });
  }
};
// 文件夹打包下载
async function folderDownload() {
    const jobId = folderList.value.filter(i => i.checked).map(i => i.job_id)
    if (!jobId?.length) return ElMessage.warning('请选择文件夹')
    const res = await getDownloadStatusApi({type: 'dpsjzx'})
    if (!['CANCELLED','COMPLETED'].includes(res.data.data?.status || 'COMPLETED')){
        return ElMessage.warning('还有正在处理的')
    }
    await downloadApi({ wayLineJobIds:jobId, withFolder: true, resultType: 0, type:'dpsjzx' })
}
// 下载
const downloadFile = () => {
  fileDownload();
 switchFolders.value?folderDownload(): fileDownload();
};
const detailDownLoad = val => {
  const suffix = val.link?.split('.').pop();
@@ -798,7 +816,6 @@
  isMapInitialized.value = false;
}
function handleCellClick(row, column) {
  console.log(row,column.no)
  if (column.no === 5) {
    navigator.clipboard.writeText(row.nickName).then(() => {
      ElMessage.success('复制文件名称成功')