1. 实现前端删除饲喂计划
2. 修复后端delete接口bug
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
frontend/dist/index.html
vendored
4
frontend/dist/index.html
vendored
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>猪场管理系统</title>
|
||||
<script type="module" crossorigin src="/assets/index.80d29e01.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index.398ac6b2.css">
|
||||
<script type="module" crossorigin src="/assets/index.0581bd6d.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index.42c8d2d4.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -130,12 +130,13 @@ export default {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/v1/feed/plan/delete/${planId}`, {
|
||||
method: 'DELETE',
|
||||
const response = await fetch('/api/v1/feed/plan/delete', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + localStorage.getItem('authToken')
|
||||
}
|
||||
},
|
||||
body: JSON.stringify({ id: planId })
|
||||
})
|
||||
|
||||
const data = await response.json()
|
||||
@@ -143,13 +144,13 @@ export default {
|
||||
if (response.ok && data.code === 0) {
|
||||
// 删除成功,重新加载列表
|
||||
await this.loadPlans()
|
||||
alert('删除成功')
|
||||
this.$message?.success('删除成功') || alert('删除成功')
|
||||
} else {
|
||||
alert('删除失败: ' + data.message)
|
||||
this.$message?.error('删除失败: ' + data.message) || alert('删除失败: ' + data.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('删除饲喂计划失败:', error)
|
||||
alert('删除饲喂计划失败: ' + error.message)
|
||||
this.$message?.error('删除饲喂计划失败: ' + error.message) || alert('删除饲喂计划失败: ' + error.message)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user