From 96da8aa6eb08a004f0b4d613a50d97079d544125 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Wed, 11 Jun 2025 18:02:35 +0800
Subject: [PATCH] feat:接口调试

---
 src/views/dataCenter/components/searchData.vue |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/views/dataCenter/components/searchData.vue b/src/views/dataCenter/components/searchData.vue
index b2531fb..0fe2a96 100644
--- a/src/views/dataCenter/components/searchData.vue
+++ b/src/views/dataCenter/components/searchData.vue
@@ -97,8 +97,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,7 +114,7 @@
 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',
@@ -152,20 +152,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: '', //文件名称
   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,8 +185,16 @@
     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();
 };
@@ -209,7 +219,7 @@
     searchForm.deviceSn = signDevice_sn.value;
   }
   // 所属部门重新请求值
-  searchForm.create_dept = '';
+ 
   deptData.value = [];
   getDeptsByAreaCode();
 };
@@ -248,6 +258,14 @@
   handleNodeClick({ id: userAreaCode.value });
   handleSearch();
 };
+// 下载
+const downloadFun =()=>{
+  emit('downFun');
+}
+// 全部下载
+const allDownloadFun =()=>{ 
+    emit('allDownFun');
+}
 onMounted(() => {
   requestDockInfo();
 });

--
Gitblit v1.9.3