feat(xumu): 优化耳标编辑功能
- 在提交时,如果处于编辑状态,将当前详情数据构建成 detailList 数组- 保留原有逻辑,确保新增和编辑操作都能正常进行
This commit is contained in:
@@ -55,6 +55,10 @@ export default {
|
|||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
this.$refs.detail.validate().then(() => {
|
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 => {
|
this.instance.post("/api/breed/earTag/addOrEdit", this.detail).then(res => {
|
||||||
if (res?.code == 0) {
|
if (res?.code == 0) {
|
||||||
this.$confirm("是否要返回列表?", "提交成功").then(() => this.back())
|
this.$confirm("是否要返回列表?", "提交成功").then(() => this.back())
|
||||||
|
|||||||
Reference in New Issue
Block a user