From 46b1ca002c0d1d1f12ae669cba234f2438e1d9a5 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Thu, 08 May 2025 14:02:59 +0800
Subject: [PATCH] 算法仓库调整

---
 src/views/algorithmRepository/algorithmRepository.vue |   77 +++++++++++++++++++++++++++-----------
 1 files changed, 55 insertions(+), 22 deletions(-)

diff --git a/src/views/algorithmRepository/algorithmRepository.vue b/src/views/algorithmRepository/algorithmRepository.vue
index ccda450..ac63bf2 100644
--- a/src/views/algorithmRepository/algorithmRepository.vue
+++ b/src/views/algorithmRepository/algorithmRepository.vue
@@ -2,14 +2,20 @@
   <basic-container>
     <div class="algorithContainer">
       <div class="algorithItem" v-if="!showDetail">
-        <div class="item" v-for="(item, index) in AlgorithmData" :key="index">
+        <div
+          class="item"
+          v-for="(item, index) in AlgorithmData"
+          :key="index"
+          :class="{ 'active-bg': activeItem === item.dictValue }"
+          @click="jumpDatail(item)"
+        >
           <img class="imgicon" :src="`${baseUrl}/后台-算法仓库/${item.dictValue}.png`" alt="" />
           <div>{{ item.dictValue }}</div>
           <div
-            :class="item.dictValue === '病虫害' ? 'stopStatus' : 'normalStatus'"
-            @click="jumpDatail(item)"
+            :class="!statusSign && item.dictValue === nameSign ? 'stopStatus' : 'normalStatus'"
+            @click.stop="changeStatus(item)"
           >
-            {{ item.dictValue === '病虫害' ? '停用状态' : '正常状态' }}
+            {{ !statusSign && item.dictValue === nameSign ? '停用状态' : '正常状态' }}
           </div>
         </div>
       </div>
@@ -19,7 +25,12 @@
           <div class="searchBox">
             <div class="item">
               <div class="itemchild">模糊查询:</div>
-              <el-input v-model="params.name" class="filter-item" placeholder="请输入事件名称" clearable></el-input>
+              <el-input
+                v-model="params.name"
+                class="filter-item"
+                placeholder="请输入事件名称"
+                clearable
+              ></el-input>
             </div>
             <div class="item">
               <el-date-picker
@@ -41,17 +52,23 @@
             </div>
           </div>
           <div class="search-btn">
+            <el-button type="primary" icon="el-icon-back" @click="goback">返回</el-button>
             <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
             <el-button icon="el-icon-delete" @click="handleReset">清空</el-button>
           </div>
         </div>
 
-        <div class="pictureitem" v-if="detailData.length > 0" v-loading="loading"  element-loading-text="加载中">
+        <div
+          class="pictureitem"
+          v-if="detailData.length > 0"
+          v-loading="loading"
+          element-loading-text="加载中"
+        >
           <div class="imgitem" v-for="(item, index) in detailData" :key="index">
-            <img :src="item.url" alt=""/>
+            <img :src="item.url" alt="" />
             <div class="info">
               <div class="name">{{ item.name }}</div>
-              <div class="time">{{ item.create_time.slice(5, 16).replace("-", "/", 1) }}</div>
+              <div class="time">{{ item.create_time.slice(5, 16).replace('-', '/', 1) }}</div>
             </div>
           </div>
         </div>
@@ -113,26 +130,28 @@
     }
   });
 };
+const activeItem = ref(null);
 const jumpDatail = val => {
-  if (val.dictValue === '病虫害') {
-    showDetail.value = false;
-  } else {
-    showDetail.value = true;
-    params.value.ai_type_key = val.dictKey;
-  }
-
+  showDetail.value = true;
+  activeItem.value = val.dictValue;
+  params.value.ai_type_key = val.dictKey;
   getList();
+};
+const statusSign = ref(true);
+const nameSign = ref('');
+const changeStatus = val => {
+  nameSign.value = val.dictValue;
+  statusSign.value = !statusSign.value;
 };
 // 详情
 const getList = () => {
   getalgorithmList(params.value).then(res => {
     loading.value = true;
-    // console.log('详情', res.data.data);
     detailData.value = res.data.data.records;
-    total.value=res.data.data.total
-   setTimeout(() =>{
-			loading.value = false
-		},1000)
+    total.value = res.data.data.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 1000);
   });
 };
 // 机巢查询
@@ -155,6 +174,10 @@
   params.value.device_name = '';
   params.value.name = '';
   getList();
+};
+const goback = () => {
+  showDetail.value = false;
+  activeItem.value = null;
 };
 // 分页大小改变
 const handleSizeChange = val => {
@@ -193,6 +216,15 @@
       height: 100px;
       margin-bottom: 47px;
     }
+    &:hover {
+      background: url('/src/assets/images/ht-sfbg-hover.png') no-repeat center;
+      background-size: 100% 100%;
+    }
+    &.active-bg {
+      background: url('/src/assets/images/ht-sfbg-click.png') no-repeat center;
+      background-size: 100% 100%;
+    }
+
     .normalStatus {
       width: 116px;
       height: 43px;
@@ -217,6 +249,7 @@
       font-size: 16px;
       color: #464747;
       margin-top: 23px;
+      cursor: pointer;
     }
     .normalStatus:hover {
       background: rgba(6, 217, 87, 0.2);
@@ -279,8 +312,8 @@
       white-space: nowrap;
       margin-right: 5px;
       font-weight: 400;
-font-size: 14px;
-color: #363636;
+      font-size: 14px;
+      color: #363636;
     }
     .item {
       display: flex;

--
Gitblit v1.9.3