From 3be2e099bbc05e902dfcfabc403ade0a2aba8ef4 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Mon, 21 Jul 2025 15:12:44 +0800
Subject: [PATCH] feat:数据中心优化

---
 src/views/job/components/SearchBox.vue |   75 +++++++++++++++++++------------------
 1 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/src/views/job/components/SearchBox.vue b/src/views/job/components/SearchBox.vue
index 899b99d..3e5d3db 100644
--- a/src/views/job/components/SearchBox.vue
+++ b/src/views/job/components/SearchBox.vue
@@ -57,9 +57,21 @@
             </div>
           </div>
         </el-form-item>
+        <div class="more" v-if="isExpand" @click="toggleExpand">收起</div>
+        <div class="more" v-else @click="toggleExpand">更多</div>
+        <div class="search-btn" :style="{ bottom: isExpand ? '5px' : '-3px' }">
+          <div class="btn clear" @click="handleReset">
+            <img src="@/assets/images/task/clear.png" />重置
+          </div>
+          <div class="btn search" @click="handleSearch">
+            <img src="@/assets/images/task/search.png" />搜索
+          </div>
+          <!-- <div class="btn add" @click="addTask"><img src="@/assets/images/task/add.png"/>新增</div> -->
+        </div>
         <el-form-item label="任务算法:" v-if="isExpand" class="taskAlgorithm">
           <TaskAlgorithmBusiness
-            :setWidth="162"
+          ref="algorithmRef"
+            :setWidth="160"
             :showAlgorithm="true"
             @algorithmChange="algorithmChange"
           />
@@ -108,17 +120,6 @@
             <el-option label="临时任务" :value="0" />
           </el-select>
         </el-form-item>
-        <div class="more" v-if="isExpand" @click="toggleExpand">收起</div>
-        <div class="more" v-else @click="toggleExpand">更多</div>
-        <div class="search-btn" :style="{ bottom: isExpand ? '5px' : '-3px' }">
-          <div class="btn search" @click="handleSearch">
-            <img src="@/assets/images/task/search.png" />搜索
-          </div>
-          <div class="btn clear" @click="handleReset">
-            <img src="@/assets/images/task/clear.png" />清空
-          </div>
-          <!-- <div class="btn add" @click="addTask"><img src="@/assets/images/task/add.png"/>新增</div> -->
-        </div>
       </div>
     </el-form>
   </div>
@@ -136,6 +137,8 @@
 const store = useStore();
 const userAreaCode = computed(() => store.getters.userInfo.detail.areaCode);
 const selectedAreaCode = computed(() => store.state.user.selectedAreaCode);
+
+const algorithmRef = ref(null)
 const isExpand = ref(false);
 const toggleExpand = () => {
   isExpand.value = !isExpand.value;
@@ -234,12 +237,15 @@
 let checked = ref('today');
 
 let timeClick = (item, index) => {
-  checked.value = item;
-  // dateRange.value = dateRanges[item];
-  dateRange.value = [];
-  // emit('change', dateRanges[item],timeListEnum[index]);
-  searchForm.date_enum = timeListEnum[index];
-  handleSearch();
+  if (checked.value === item){
+    checked.value = null
+    searchForm.date_enum = undefined
+  }else{
+    checked.value = item
+    searchForm.date_enum = timeListEnum[index]
+  }
+  dateRange.value = []
+  handleSearch()
 };
 // 搜索
 const handleSearch = () => {
@@ -265,18 +271,8 @@
   emit('search', params);
 };
 const handleDateChange = val => {
-  if (val && val.length === 2) {
-    const start = dayjs(val[0]);
-    const end = dayjs(val[1]);
-    const diff = end.diff(start, 'day');
-
-    if (diff > 31) {
-      ElMessage.warning('日期范围不能超过31天');
-      dateRange.value = [];
-      return;
-    }
-  }
-  handleSearch();
+  checked.value = null
+  searchForm.date_enum = undefined
 };
 
 // 重置
@@ -289,6 +285,8 @@
   searchForm.date_enum = 'TODAY';
   searchForm.area_code = userAreaCode.value;
   checked.value = 'today';
+  signDevice_sn.value = ''
+	algorithmRef.value?.clear()
   handleNodeClick({ id: userAreaCode.value });
   handleSearch();
 };
@@ -302,7 +300,7 @@
 // watch(
 //   () => store.state.task.jumpTask,
 //   newVal => {
- 
+
 //     if (newVal && Object.keys(newVal).length) {
 //       // 兼容当日任务 计划任务 历史任务传参
 //       if (newVal.clickValue) {
@@ -343,7 +341,7 @@
     const date = dayjs(calendarday.value).format(timeFormat);
 
     const dateArray = [date, date];
-  
+
     dateRange.value = dateArray;
   }
     // 查询一次
@@ -367,7 +365,7 @@
     display: flex;
     flex-wrap: wrap;
     align-items: center;
-    gap: 20px 12px; // 设置行间距和列间距
+    gap: 20px 15px; // 设置行间距和列间距
 
     .more {
       cursor: pointer;
@@ -376,16 +374,17 @@
       color: #1c5cff;
       line-height: 32px;
       font-size: 16px;
+      margin: 0 28px;
     }
 
     .search-btn {
-      position: absolute;
-      right: 0;
+      // position: absolute;
+      // right: 0;
       display: flex;
       justify-content: space-between;
       cursor: pointer;
-      font-size: 14px;
-
+      font-size: 14px;  
+      
       .btn {
         width: 80px;
         height: 32px;
@@ -394,6 +393,7 @@
         display: flex;
         justify-content: center;
         align-items: center;
+        // margin-left: px;
         img {
           width: 14px;
           height: 14px;
@@ -451,6 +451,7 @@
     .el-form-item {
       margin-bottom: 0;
       width: 233px;
+      	margin-right: 20px;
 
       .el-form-item__label {
         color: #363636;

--
Gitblit v1.9.3