diff --git a/src/components/mycomponent/dialog/productListAddDialog.vue b/src/components/mycomponent/dialog/productListAddDialog.vue index d08d00f..81edbe6 100644 --- a/src/components/mycomponent/dialog/productListAddDialog.vue +++ b/src/components/mycomponent/dialog/productListAddDialog.vue @@ -375,32 +375,33 @@ }, // 新增 save() { - const index = this.addInfo.productPicture.indexOf(this.imageUrl) - if (index > -1) { - this.addInfo.productPicture = this.addInfo.productPicture.substring(this.imageUrl.length) - } - debugger - this.addInfo.paramValueList = this.paramValueList.map(item => { - return { - paramId: item.paramId, - paramName: item.paramName, - paramValue: item.paramValue + this.$refs['dataForm'].validate((valid) => { + const index = this.addInfo.productPicture.indexOf(this.imageUrl) + if (index > -1) { + this.addInfo.productPicture = this.addInfo.productPicture.substring(this.imageUrl.length) } - }) - if (this.title === '新增产品') { - add(this.addInfo).then(res => { - Message.success('保存成功') - this.$emit('refresh') - this.dialogStatus = false + this.addInfo.paramValueList = this.paramValueList.map(item => { + return { + paramId: item.paramId, + paramName: item.paramName, + paramValue: item.paramValue + } }) - } else { - update(this.addInfo).then(res => { - Message.success('更新成功') - this.$emit('refresh') - this.dialogStatus = false - }) + if (this.title === '新增产品') { + add(this.addInfo).then(res => { + Message.success('保存成功') + this.$emit('refresh') + this.dialogStatus = false + }) + } else { + update(this.addInfo).then(res => { + Message.success('更新成功') + this.$emit('refresh') + this.dialogStatus = false + }) + } } - } + }) } }