无人机管理后台前端(已迁走)
张含笑
2025-08-15 eb9f31d07609e8711fd7f9332fcf523b724faff2
feat:文件夹调整
2 files modified
113 ■■■■■ changed files
src/views/dataCenter/components/searchData.vue 6 ●●●●● patch | view | raw | blame | history
src/views/dataCenter/dataCenter.vue 107 ●●●●● patch | view | raw | blame | history
src/views/dataCenter/components/searchData.vue
@@ -273,16 +273,13 @@
  // 处理机巢数据
  searchForm.deviceSn = '';
  machineData.value = '';
  const droneList = await getDeviceRegion({ areaCode: data.id });
  machineData.value = droneList?.data?.data;
  // 默认选中值
  if (signDevice_sn.value) {
    searchForm.deviceSn = signDevice_sn.value;
  }
  // 所属部门重新请求值
  deptData.value = [];
  getDeptsByAreaCode();
  handleSearch();
@@ -323,6 +320,7 @@
  searchForm.deviceSn = '';
  searchForm.resultType = '';
  searchForm.photoType = '';
  searchForm.wayLineJobId=''
  handleNodeClick({ id: userAreaCode.value });
  handleSearch();
};
@@ -342,7 +340,7 @@
}
// 切换文件夹
const handleswitchFolders =()=>{
  emit('handleswitchFolders');
  emit('handleswitchFolders',machineData.value);
}
onMounted(() => {
  requestDockInfo();
src/views/dataCenter/dataCenter.vue
@@ -12,25 +12,38 @@
          @handleswitchFolders="handleswitchFolders"
      ></searchData>
      <!-- 文件夹 -->
      <div class="fileshow" v-if="switchFolders"  v-loading="loadings "   element-loading-text="加载中">
          <div
                class="filePackage"
                v-for="(folderItem, fileIndex) in folderList"
                :key="fileIndex"
                @click.stop="foldersOpen(folderItem)"
      <div v-if="switchFolders"  v-loading="loadings "   element-loading-text="加载中">
            <el-table
         class="custom-header custom-body"
          v-loading="loadings"
          element-loading-text="加载中"
          :data="folderList"
            @selection-change="foldersSelectionChange"
        >
          <el-table-column type="selection" width="55" />
          <el-table-column label="序号" type="index" width="60">
            <template #default="{ $index }">
              {{
                ($index + 1 + (jobListParams.current - 1) * jobListParams.size)
                  .toString()
                  .padStart(2, '0')
              }}
            </template>
          </el-table-column>
          <el-table-column property="name" label="任务名称" show-overflow-tooltip />
          <el-table-column property="nickname" label="所属机巢" />
          <el-table-column label="操作" align="center">
            <template #default="scope">
              <el-button icon="el-icon-view" type="text" @click="foldersOpen(scope.row)"
                >查看</el-button
              >
                <img :src="fileimg" alt="" />
                <el-checkbox v-model="folderItem.checked" @click.stop />
                <div class="itemName" :title="folderItem.name">
                  <div>{{ folderItem.name }}</div>
                    </div>
          </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 表格部分 -->
      <div class="dataTable" v-else>
        <el-table
        border
         stripe
        <el-table
          v-loading="loadings"
          element-loading-text="加载中"
          :data="tableData"
@@ -418,11 +431,11 @@
  searchParams: { startTime: timeRange[0], endTime: timeRange[1] },
});
const FolderListParams = reactive({
  page: 1,
  page_size: 30,
    page: 1,
    page_size: 10,
    startTime: jobListParams.searchParams.startTime?.slice(0, 10),
    endTime: jobListParams.searchParams.endTime?.slice(0, 10),
   waylineName:'',
     waylineName:'',
   
});
const tableData = ref([]);
@@ -434,6 +447,9 @@
    orderByCreateTime: jobListParams.orderByCreateTime,
    ...jobListParams.searchParams,
  };
  if( searchjobId.value === ''){
    params.wayLineJobId = ''
  }
  getaiImagesPageAPI(params, {
    current: jobListParams.current,
    size: jobListParams.size,
@@ -458,14 +474,27 @@
};
const folderList = ref([])
// 获取文件夹数据
const getFolderList=()=>{
const getFolderList=(nestDataList)=>{
 loadings.value = true;
 const apiParams = {
    ...FolderListParams, 
  };
  getJobIdsBySnApi(apiParams)
        .then(res => {
    folderList.value = res.data.data.records.map(i => ({ ...i, checked: false }))
     folderList.value = res.data.data.records?.map(i=>{
       let nickname = '';
      nestDataList?.forEach(nestItem=>{
      if(i.device_sn === nestItem.device_sn){
        nickname = nestItem.nickname
      }
      })
       return {
          ...i,
          nickname: nickname,
          checked: false
        };
     })
    total.value = res.data.data.total  
        })
        .finally(() => {
@@ -473,37 +502,38 @@
        })
}
const searchjobId = ref('')
// 文件夹查看
const foldersOpen = (val)=>{
    loadings.value = true;
    tableData.value=[]
    searchjobId.value = val.job_id
    switchFolders.value = false
}
// 获取数据时使用各自的分页参数
const fetchData = () => {
 loadings.value = true;
const fetchData = (val) => {
  if (switchFolders.value) {
    getFolderList();
    getFolderList(val);
  } else {
    getaiImagesPage();  
  }
};
// 切换文件夹
 const handleswitchFolders = () => {
 const handleswitchFolders = (val) => {
 searchjobId.value = ''
     switchFolders.value = !switchFolders.value;
     jobListParams.current = 1;
     FolderListParams.page = 1;
     fetchData();
     fetchData(val);
   };
// 查询
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);
    FolderListParams.waylineName=params.jobName,
    FolderListParams.page_size = 10;
    FolderListParams.startTime = params?.startTime?.slice(0, 10);
    FolderListParams.endTime = params?.endTime?.slice(0, 10);
    FolderListParams.waylineName=params?.jobName,
    getFolderList()
  }else{
     jobListParams.current = 1;
@@ -538,9 +568,16 @@
  tableData.value.forEach(item => {
    item.checked = val.some(selected => selected.id === item.id);
  });
  selectedRows.value = val;
};
// 文件夹多选
const foldersSelectedRows = ref([]);
const foldersSelectionChange =(val)=>{
 folderList.value.forEach(item => {
    item.checked = val.some(foldersselected => foldersselected.id === item.id);
  });
  foldersSelectedRows.value = val;
}
// 删除
const deleteDetail = val => {
  ElMessageBox.confirm('您确定删除吗?', '提示', {
@@ -605,7 +642,7 @@
};
// 文件夹打包下载
async function folderDownload() {
    const jobId = folderList.value.filter(i => i.checked).map(i => i.job_id)
    const jobId =  foldersSelectedRows.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')){
@@ -615,7 +652,6 @@
}
// 下载
const downloadFile = () => {
 switchFolders.value?folderDownload(): fileDownload();
};
const detailDownLoad = val => {
@@ -986,8 +1022,11 @@
:deep(.custom-header th.el-table__cell) {
  color: rgba(0, 0, 0, 0.85);
  background: #fafafa;
  height: 60px !important;
}
:deep(.custom-body .el-table__body tr) {
  height: 53px !important;
}
// 弹框
.detailContainer {
  display: flex;