fix: add error handling to Barcodes, Tasks, Logs, Sync views
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -183,7 +183,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Search, Refresh, Plus, Connection, Right, Setting } from '@element-plus/icons-vue'
|
||||
import { Search, Refresh, Connection, Right, Setting } from '@element-plus/icons-vue'
|
||||
import api from '../api'
|
||||
import { useDebounce } from '../composables/useDebounce'
|
||||
|
||||
@@ -337,7 +337,9 @@ async function deleteItem(row: any) {
|
||||
await api.delete(`/barcodes/${row.barcode}`)
|
||||
ElMessage.success('已删除')
|
||||
loadData()
|
||||
} catch {}
|
||||
} catch (err: any) {
|
||||
if (err !== 'cancel') ElMessage.error('删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadData)
|
||||
|
||||
@@ -152,7 +152,9 @@ async function loadStats() {
|
||||
try {
|
||||
const res = await api.get('/logs/stats')
|
||||
Object.assign(logStats, res.data)
|
||||
} catch {}
|
||||
} catch {
|
||||
ElMessage.error('加载统计数据失败')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -123,7 +123,9 @@ async function checkStatus() {
|
||||
try {
|
||||
const res = await api.get('/sync/status')
|
||||
syncStatus.value = res.data
|
||||
} catch {}
|
||||
} catch {
|
||||
ElMessage.error('检查同步状态失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function doPush() {
|
||||
|
||||
@@ -195,7 +195,9 @@ async function loadStats() {
|
||||
try {
|
||||
const res = await api.get('/tasks/stats')
|
||||
Object.assign(taskStats, res.data)
|
||||
} catch {}
|
||||
} catch {
|
||||
ElMessage.error('加载统计数据失败')
|
||||
}
|
||||
}
|
||||
|
||||
function showDetail(row: any) {
|
||||
|
||||
Reference in New Issue
Block a user