feat(AppWeightManage): 添加删除功能

- 重构 handleDelete 方法,通过 API 删除数据
- 更新删除按钮点击事件,传入正确的 id 参数
- 删除成功后重新获取数据,保持列表同步
This commit is contained in:
aixianling
2024-12-26 18:16:00 +08:00
parent 971742b392
commit 0d3d8f23bb

View File

@@ -48,9 +48,15 @@ export default {
}
})
},
handleDelete(index) {
handleDelete(id) {
this.$confirm("确定删除该条数据?").then(() => {
this.detail.detailList.splice(index, 1)
this.instance.post("/api/breed/weight/del", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
this.getDetail()
}
})
})
},
submit() {
@@ -109,7 +115,7 @@ export default {
<template slot-scope="{row,$index}">
<div class="table-options">
<el-button type="text" @click="dialog=true,form=row">编辑</el-button>
<el-button type="text" class="deleteBtn" @click="handleDelete($index)">删除</el-button>
<el-button type="text" class="deleteBtn" @click="handleDelete(row.id)">删除</el-button>
</div>
</template>
</el-table-column>