feat(xumu): 优化耳标编辑功能

- 在提交时,如果处于编辑状态,将当前详情数据构建成 detailList 数组- 保留原有逻辑,确保新增和编辑操作都能正常进行
This commit is contained in:
aixianling
2025-01-08 15:02:37 +08:00
parent 5efd2a1d3f
commit 66a721c1eb

View File

@@ -55,6 +55,10 @@ export default {
},
submit() {
this.$refs.detail.validate().then(() => {
if (this.isEdit) {
const {biochipEarNumber, electronicEarNumber, originalEarNumber, picture, variety, category, age, weight} = this.detail
this.detail.detailList = [{biochipEarNumber, electronicEarNumber, originalEarNumber, picture, variety, category, age, weight}]
}
this.instance.post("/api/breed/earTag/addOrEdit", this.detail).then(res => {
if (res?.code == 0) {
this.$confirm("是否要返回列表?", "提交成功").then(() => this.back())