feat(AppWeightManage): 添加删除功能
- 重构 handleDelete 方法,通过 API 删除数据 - 更新删除按钮点击事件,传入正确的 id 参数 - 删除成功后重新获取数据,保持列表同步
This commit is contained in:
@@ -48,9 +48,15 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleDelete(index) {
|
handleDelete(id) {
|
||||||
this.$confirm("确定删除该条数据?").then(() => {
|
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() {
|
submit() {
|
||||||
@@ -109,7 +115,7 @@ export default {
|
|||||||
<template slot-scope="{row,$index}">
|
<template slot-scope="{row,$index}">
|
||||||
<div class="table-options">
|
<div class="table-options">
|
||||||
<el-button type="text" @click="dialog=true,form=row">编辑</el-button>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|||||||
Reference in New Issue
Block a user