无人机管理后台前端(已迁走)
张含笑
2025-08-11 b87037236854234659cc749b2739f2cc9b910a7a
feat:添加文件夹
4 files modified
1 files added
204 ■■■■ changed files
.env.development 2 ●●● patch | view | raw | blame | history
src/api/dataCenter/dataCenter.js 8 ●●●●● patch | view | raw | blame | history
src/assets/images/dataCenter/filePackage.png patch | view | raw | blame | history
src/views/dataCenter/components/searchData.vue 12 ●●●● patch | view | raw | blame | history
src/views/dataCenter/dataCenter.vue 182 ●●●● patch | view | raw | blame | history
.env.development
@@ -21,7 +21,7 @@
# 服务地址
VITE_APP_URL = https://wrj.shuixiongit.com/api
#VITE_APP_URL= http://192.168.1.168 rjg
#VITE_APP_URL= http://192.168.1.168
#VITE_APP_URL= http://192.168.1.33
#新大屏地址
VITE_APP_DASHBOARD_URL = 'https://wrj.shuixiongit.com/command-center-dashboard/'
src/api/dataCenter/dataCenter.js
@@ -81,3 +81,11 @@
          },
    })
}
// 获取机场下的文件夹
export const getJobIdsBySnApi = (params, dockSn) => {
    return request({
        url: `/drone-device-core/wayline/api/v1/workspaces/getJobIdsBySn`,
        method: 'get',
        params,
    })
}
src/assets/images/dataCenter/filePackage.png
src/views/dataCenter/components/searchData.vue
@@ -107,6 +107,8 @@
<!--          <el-button type="primary" icon="el-icon-download" @click="allDownloadFun"-->
<!--            >全部下载</el-button-->
<!--          >-->
        <el-button type="primary"  @click="handleswitchFolders" >切换文件夹</el-button>
          <div class="downloadBtn" @click="htsjzx === 100 && downloadFun()">
            <el-progress v-if="htsjzx !== 100" :percentage="htsjzx" :show-text="false" striped striped-flow :duration="1" />
            <div class="downloadBtnText">
@@ -136,7 +138,7 @@
const selectedAreaCode = computed(() => store.state.user.selectedAreaCode);
const htsjzx = computed(() => store.state.common.downloadProgress?.htsjzx || 100)
const emit = defineEmits(['search', 'downFun', 'allDownFun']);
const emit = defineEmits(['search', 'downFun', 'allDownFun','handleswitchFolders']);
const startTime = dayjs().subtract(6, 'day').startOf('day');
const endTime = dayjs().endOf('day');
const timeRange = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')];
@@ -322,7 +324,10 @@
    ElMessage.success('取消成功')
  })
}
// 切换文件夹
const handleswitchFolders =()=>{
  emit('handleswitchFolders');
}
onMounted(() => {
  requestDockInfo();
  getDownloadStatusApi({type: 'htsjzx'}).then(res =>{
@@ -346,9 +351,12 @@
    justify-content: space-between;
    .search-btn {
    display: flex;
    align-items: center;
      margin-right: 32px;
      .downloadBtn{
      margin-left: 10px;
        position: relative;
        display: flex;
        align-items: center;
src/views/dataCenter/dataCenter.vue
@@ -7,9 +7,10 @@
        @search="searchClick"
        @downFun="downloadFile"
        @allDownFun="aLLDownloadFile"
        @handleswitchFolders="handleswitchFolders"
      ></searchData>
      <!-- 表格部分 -->
      <div class="dataTable">
      <div class="dataTable" v-if="!switchFolders" >
        <el-table
        border
         stripe
@@ -122,19 +123,34 @@
          </el-table-column>
        </el-table>
      </div>
      <!-- 文件夹 -->
      <div class="fileshow" v-else v-loading="loadings ">
          <div
                class="filePackage"
                v-for="(folderItem, fileIndex) in folderList"
                :key="fileIndex"
                @click.stop="foldersOpen(folderItem)"
              >
                <img :src="fileimg" alt="" />
                <el-checkbox v-model="folderItem.checked" @click.stop />
                <div class="itemName" :title="folderItem.name">
                  <div>{{ folderItem.name }}</div>
                    </div>
          </div>
      </div>
      <!-- 分页 -->
      <div class="pagination">
        <el-pagination
          v-model:current-page="jobListParams.current"
          v-model:page-size="jobListParams.size"
          :page-sizes="[10, 20, 30, 40]"
          background
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    <el-pagination
      :current-page="switchFolders ? FolderListParams.page : jobListParams.current"
      :page-size="switchFolders ? FolderListParams.page_size : jobListParams.size"
      background
      layout="total,size  prev, pager, next, jumper"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
      <!-- 查看弹框 -->
      <el-dialog
        v-model="dialogVisible"
@@ -278,6 +294,11 @@
</template>
<script setup>
import fileimg from '@/assets/images/dataCenter/filePackage.png'
import { getShowImg, getSmallImg, getzsSmallImg } from '@/utils/util';
import { onMounted, watch } from 'vue';
import dayjs from 'dayjs';
import ElTooltipCopy from '@/components/ElTooltipCopy.vue';
import videoplay from '@/assets/images/dataCenter/videoplay.png';
import positionicon from '@/assets/images/dataCenter/positionicon.png';
import { useStore } from 'vuex';
@@ -308,12 +329,9 @@
  deleteFileMultipleApi,
  downloadApi,
  updataTitleApi,
  getOrthoimageInfo, getDownloadStatusApi
  getOrthoimageInfo, getDownloadStatusApi,getJobIdsBySnApi
} from '@/api/dataCenter/dataCenter';
import { getShowImg, getSmallImg, getzsSmallImg } from '@/utils/util';
import { onMounted, watch } from 'vue';
import dayjs from 'dayjs';
import ElTooltipCopy from '@/components/ElTooltipCopy.vue';
const switchFolders = ref(false)
function bytesToMB(bytes, decimalPlaces = 2) {
  if (typeof bytes !== 'number' || bytes < 0) return '0';
@@ -397,6 +415,12 @@
  orderByCreateTime: true,
  searchParams: { startTime: timeRange[0], endTime: timeRange[1] },
});
const FolderListParams = reactive({
  page: 1,
  page_size: 30,
startTime: jobListParams.searchParams.startTime?.slice(0, 10),
    endTime: jobListParams.searchParams.endTime?.slice(0, 10)
});
const tableData = ref([]);
// 获取列表数据
@@ -406,7 +430,8 @@
    orderByCreateTime: jobListParams.orderByCreateTime,
    ...jobListParams.searchParams,
  };
  console.log('jobListParams',jobListParams);
  getaiImagesPageAPI(params, {
    current: jobListParams.current,
    size: jobListParams.size,
@@ -423,27 +448,76 @@
      }));
    })
    .catch(error => {
      // 可选:这里可以添加错误处理逻辑
      console.error('获取数据失败:', error);
    })
    .finally(() => {
      loadings.value = false; // 无论成功失败都会执行
      loadings.value = false;
    });
};
const folderList = ref([])
// 获取文件夹数据
const getFolderList=()=>{
 const apiParams = {
    ...FolderListParams,
  };
  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);
        })
        .finally(() => {
          loadings.value = false;
        })
}
// 获取数据时使用各自的分页参数
const fetchData = () => {
  if (switchFolders.value) {
    getFolderList();
  } else {
    getaiImagesPage();
  }
};
// 切换文件夹
 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();
 getaiImagesPage()
  }
};
const handleSizeChange = val => {
  jobListParams.size = val;
  getaiImagesPage();
const handleSizeChange = (val) => {
  if (switchFolders.value) {
    FolderListParams.page_size = val;
  } else {
    jobListParams.size = val;
  }
  fetchData();
};
const handleCurrentChange = val => {
  jobListParams.current = val;
  getaiImagesPage();
const handleCurrentChange = (val) => {
  if (switchFolders.value) {
    FolderListParams.page = val;
  } else {
    jobListParams.current = val;
  }
  fetchData();
};
// 多选
const selectedRows = ref([]);
@@ -733,6 +807,7 @@
}
onMounted(() => {
  getaiImagesPage();
  getFolderList()
  // 监听打开全景事件
  EventBus.on('open-panorama', params => {
    panoramaParamsShow.value = params.show;
@@ -781,7 +856,60 @@
      cursor: pointer;
    }
  }
    .fileshow {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 10px;
  overflow: auto;
            .filePackage {
                width: 260px;
                height: 146px;
                border-radius: 4px 4px 4px 4px;
                position: relative;
                background: #ddd;
                cursor: pointer;
                img {
                    width: 111px;
                    height: 111px;
                    margin-left: 56px;
                }
                .el-checkbox {
                    position: absolute;
                    top: 0;
                    left: 6px;
                }
                .itemName {
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    height: 23px;
                    width: 100%;
                    background: rgba(22, 56, 101, 0.3);
                    border-radius: 0px 0px 4px 4px;
                    font-family: Source Han Sans CN, Source Han Sans CN;
                    font-weight: 400;
                    font-size: 14px;
                    color: #ffffff;
                    line-height: 23px;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    div {
                        white-space: nowrap;
                    }
                    img {
                        width: 14px;
                        height: 14px;
                        cursor: pointer;
                    }
                }
            }
        }
  .pagination {
    display: flex;
    justify-content: end;