From e52521dc7a3e52cf53e2ab2b4e1c71cfe0b4a10d Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 15 Aug 2025 16:48:28 +0800
Subject: [PATCH] feat:更换接口

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

diff --git a/src/views/job/components/SearchBox.vue b/src/views/job/components/SearchBox.vue
index 9a53df5..89ac36e 100644
--- a/src/views/job/components/SearchBox.vue
+++ b/src/views/job/components/SearchBox.vue
@@ -23,6 +23,7 @@
             v-model="searchForm.device_sn"
             placeholder="请选择"
             clearable
+            @change="handleSearch"
           >
             <el-option
               v-for="item in machineData"
@@ -57,14 +58,26 @@
             </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="222"
+          ref="algorithmRef"
+            :setWidth="160"
             :showAlgorithm="true"
             @algorithmChange="algorithmChange"
           />
         </el-form-item>
-        <el-form-item label="所属部门:" v-if="isExpand">
+        <!-- <el-form-item label="所属部门:" v-if="isExpand">
           <el-select
             :teleported="false"
             v-model="searchForm.create_dept"
@@ -78,7 +91,7 @@
               :value="item.id"
             />
           </el-select>
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="任务状态:" v-if="isExpand">
           <el-select
             :teleported="false"
@@ -88,6 +101,7 @@
             multiple
             collapse-tags
             collapse-tags-tooltip
+              @change="handleSearch"
           >
             <el-option
               v-for="item in statusOptions"
@@ -103,22 +117,12 @@
             v-model="searchForm.is_circle_job"
             placeholder="请选择"
             clearable
+            @change="handleSearch"
           >
             <el-option label="周期任务" :value="1" />
             <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 +140,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;
@@ -153,7 +159,7 @@
   ai_types: [], // 算法类型
   area_code: userAreaCode.value, // 区域code
   create_dept: '', // 创建部门
-  date_enum: 'TODAY', // 日期枚举,可用值:TODAY,CURRENT_WEEK,CURRENT_MONTH,CURRENT_YEAR
+  date_enum: 'CURRENT_MONTH', // 日期枚举,可用值:TODAY,CURRENT_WEEK,CURRENT_MONTH,CURRENT_YEAR
   device_sn: '', // 设备编号
   end_date: null, // 结束时间
   industry_type: '', // 行业key
@@ -179,6 +185,7 @@
 
 const algorithmChange = val => {
   searchForm.ai_types = val;
+  handleSearch()
 };
 
 const businessChange = val => {
@@ -225,13 +232,14 @@
   searchForm.create_dept = '';
   deptData.value = [];
   getDeptsByAreaCode();
+  handleSearch();
 };
 
 // 日期 和周期
 let timeList = ['today', 'week', 'month', 'year'];
 let timeListStr = ['今日', '本周', '本月', '本年'];
 let timeListEnum = ['TODAY', 'CURRENT_WEEK', 'CURRENT_MONTH', 'CURRENT_YEAR'];
-let checked = ref('today');
+let checked = ref('month');
 
 let timeClick = (item, index) => {
   if (checked.value === item){
@@ -270,6 +278,7 @@
 const handleDateChange = val => {
   checked.value = null
   searchForm.date_enum = undefined
+  handleSearch()
 };
 
 // 重置
@@ -279,9 +288,11 @@
     searchForm[key] = '';
   });
   searchForm.ai_types = [];
-  searchForm.date_enum = 'TODAY';
+  searchForm.date_enum = 'CURRENT_MONTH';
   searchForm.area_code = userAreaCode.value;
-  checked.value = 'today';
+  checked.value = 'month';
+  signDevice_sn.value = ''
+	algorithmRef.value?.clear()
   handleNodeClick({ id: userAreaCode.value });
   handleSearch();
 };
@@ -338,8 +349,10 @@
     const dateArray = [date, date];
 
     dateRange.value = dateArray;
+    const find = store.state.tags.bsTagList.find(i => i.path === '/job/jobstatistics')
+          find && (find.query = {})
   }
-    // 查询一次
+      // 查询一次
     handleSearch()
 });
 </script>
@@ -360,7 +373,7 @@
     display: flex;
     flex-wrap: wrap;
     align-items: center;
-    gap: 20px 12px; // 设置行间距和列间距
+    gap: 20px 15px; // 设置行间距和列间距
 
     .more {
       cursor: pointer;
@@ -369,11 +382,12 @@
       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;
@@ -387,6 +401,7 @@
         display: flex;
         justify-content: center;
         align-items: center;
+        // margin-left: px;
         img {
           width: 14px;
           height: 14px;

--
Gitblit v1.9.3