无人机管理后台前端(已迁走)
张含笑
2025-06-26 974394f7a0496fa8e37dd326b6f9313e14caa708
src/views/dataCenter/components/searchData.vue
@@ -37,6 +37,7 @@
            popper-class="custom-date-picker"
            v-model="dateRange"
            type="daterange"
            :clearable="false"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
@@ -88,7 +89,7 @@
      </div>
      <div class="search-first">
        <el-form-item label="文件名称:">
          <el-input v-model="searchForm.nickName" placeholder="请输入" clearable />
          <el-input v-model="searchForm.name" placeholder="请输入" clearable />
        </el-form-item>
        <div class="search-btn">
          <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
@@ -97,8 +98,8 @@
      </div>
      <div class="search-first">
        <div class="search-btn">
          <el-button type="primary" icon="el-icon-download">全部下载</el-button>
          <el-button type="success" plain icon="el-icon-download">下载</el-button>
          <el-button type="primary" icon="el-icon-download" @click="allDownloadFun">全部下载</el-button>
          <el-button type="success" plain icon="el-icon-download" @click="downloadFun">下载</el-button>
        </div>
      </div>
    </el-form>
@@ -114,13 +115,17 @@
const store = useStore();
const userAreaCode = computed(() => store.getters.userInfo.detail.areaCode);
const selectedAreaCode = computed(() => store.state.user.selectedAreaCode);
const emit = defineEmits(['search']);
const emit = defineEmits(['search','downFun','allDownFun']);
const treeProps = {
  label: 'name',
  value: 'id',
  children: 'childrens',
};
const fileFormatOption = [
{
    value: '',
    label: '全部',
  },
  {
    value: '0',
    label: '照片',
@@ -134,7 +139,7 @@
    label: 'AI识别',
  },
  {
    value: '3',
    value: '5',
    label: '全景',
  },
  {
@@ -152,20 +157,22 @@
    label: '红外',
  },
];
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')]
const dateRange = ref(timeRange);
const timeFormat = 'YYYY-MM-DD HH:mm:ss';
const searchForm = reactive({
  jobName: '', //任务名称
  nickName: '', //文件名称
  name: '', //文件名称
  areaCode: userAreaCode.value, // 区域code
  endTime: null, // 结束时间
  startTime: null, // 开始时间
  endTime:  endTime.format(timeFormat), // 结束时间
  startTime: startTime.format(timeFormat), // 开始时间
  deviceSn: '', // 所属机巢
  resultType: '', //文件格式
  photoType: '', //文件类别
});
const dateRange = ref([]);
const timeFormat = 'YYYY-MM-DD HH:mm:ss';
// 部门
let deptTreeData = ref([]);
// 机巢
@@ -183,10 +190,18 @@
    if (diff > 31) {
      ElMessage.warning('日期范围不能超过31天');
      dateRange.value = [];
      // 重置为默认时间范围
      setTimeout(() => {
        dateRange.value = timeRange;
      }, 0);
      return;
    }
    // 更新搜索表单中的时间
    searchForm.startTime = start.format(timeFormat);
    searchForm.endTime = end.format(timeFormat);
  }
  handleSearch();
  //handleSearch();
};
// 部门下得机巢
const requestDockInfo = () => {
@@ -209,7 +224,7 @@
    searchForm.deviceSn = signDevice_sn.value;
  }
  // 所属部门重新请求值
  searchForm.create_dept = '';
  deptData.value = [];
  getDeptsByAreaCode();
};
@@ -235,19 +250,32 @@
      ? dayjs(dateRange?.value[1]).endOf('day').format(timeFormat)
      : null,
  };
  console.log('searchForm', params);
  // 调用父组件方法
  emit('search', params);
};
// 清空
const handleReset = () => {
  dateRange.value = [];
  Object.keys(searchForm).forEach(key => {
    searchForm[key] = '';
  });
  dateRange.value = timeRange;
searchForm.jobName = ''
searchForm.name = ''
searchForm.areaCode = userAreaCode.value
searchForm.endTime = endTime.format(timeFormat)
searchForm.startTime = startTime.format(timeFormat)
searchForm.deviceSn = ''
searchForm.resultType = ''
searchForm.photoType = ''
  handleNodeClick({ id: userAreaCode.value });
  handleSearch();
};
// 下载
const downloadFun =()=>{
  emit('downFun');
}
// 全部下载
const allDownloadFun =()=>{
    emit('allDownFun');
}
onMounted(() => {
  requestDockInfo();
});