From 78bf59d8e0106ccf2acdd5bc4e3a6e510e1e5cbf Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Wed, 17 Sep 2025 13:58:32 +0800
Subject: [PATCH] feat:更新代码

---
 src/views/flightLog/flightLog.vue |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/views/flightLog/flightLog.vue b/src/views/flightLog/flightLog.vue
index 942effc..ecaf5a1 100644
--- a/src/views/flightLog/flightLog.vue
+++ b/src/views/flightLog/flightLog.vue
@@ -54,8 +54,8 @@
 				<el-table-column label="操作" width="200" align="center">
 					<template #default="scope">
             <!-- <el-button icon="el-icon-view" type="text" @click="handleDetail(scope.row)">查看</el-button> -->
-						<!-- <el-button icon="el-icon-delete" type="text" @click="handleDelete">删除</el-button> -->
-            <el-button type="text" @click="handleStar(scope.row)"><el-icon><Star /></el-icon>收藏</el-button>
+						<!-- <el-button icon="el-icon-delete" type="text" @click="handleDelete">删除</el-button> --> 
+            <el-button type="text" @click="handleStar(scope.row)"><el-icon><Star /></el-icon>{{ scope.row.is_favorite ? '取消收藏':'收藏' }}</el-button>
             <el-button type="text" @click="handleExport(scope.row)"><el-icon><Download /></el-icon>导出</el-button>
 					</template>
 				</el-table-column>
@@ -97,7 +97,7 @@
 	</el-dialog> -->
 </template>
 <script setup>
-import { getHistoryTrack, exportFlyLog, addStar, updateDroneFlight } from '@/api/logs';
+import { getHistoryTrack, cancelStar, addStar, updateDroneFlight } from '@/api/logs';
 import { flightLogPage } from '@/api/airspace/airspace';
 import { downloadXls } from '@/utils/util';
 import { exportBlob } from '@/api/common'
@@ -158,7 +158,10 @@
 }
 
 function handleAll() {
+  params.value.isFavorite = false
+  params.value.page = 1
   tabType.value = '全部'
+  getList()
 }
 
 function handleStartList() {
@@ -182,9 +185,18 @@
 
 // 收藏
 function handleStar(row) {
-  addStar({ flight_log_id: row.id }).then(res => {
-    getList()
-  })
+  console.log(row, '5555')
+  if (row.is_favorite) {
+    cancelStar(row.id).then(res => {
+      ElMessage.success('取消收藏成功')
+      getList()
+    })
+  } else {
+    addStar({ flight_log_id: row.id }).then(res => {
+      ElMessage.success('收藏成功')
+      getList()
+    })
+  }
 }
 
 // 打标签

--
Gitblit v1.9.3