From 5bcbd90662d19331a4dde9047d2aa52e8ab5666c Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期三, 30 八月 2023 10:55:32 +0800 Subject: [PATCH] bug修复(4825 4830) --- src/views/supplierManage/supplier/AddNewProduct.vue | 52 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/views/supplierManage/supplier/AddNewProduct.vue b/src/views/supplierManage/supplier/AddNewProduct.vue index 3fdb08e..9a04616 100644 --- a/src/views/supplierManage/supplier/AddNewProduct.vue +++ b/src/views/supplierManage/supplier/AddNewProduct.vue @@ -76,27 +76,39 @@ // 淇濆瓨 saveClick() { console.log(this.editConfig.infomation) - if (this.editConfig.title === "娣诲姞") { - createProduct({ - list: this.tableData - }).then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message.success("娣诲姞鎴愬姛") - this.$parent.getProductList() - } - }) + for (let i = 0; i < this.tableData.length; i++) { + if (this.tableData[i].name.length === 0) { + this.isNoProduct = true + break + } else { + this.isNoProduct = false + } + } + if (this.isNoProduct) { + this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖") } else { - const params = this.saveParams() - updateProduct(params).then((res) => { - console.log(res) - this.editConfig.visible = false - if (res.code === 200) { - this.$message.success("缂栬緫鎴愬姛") - this.$parent.getProductList() - } - }) + if (this.editConfig.title === "娣诲姞") { + createProduct({ + list: this.tableData + }).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("娣诲姞鎴愬姛") + this.$parent.getProductList() + } + }) + } else { + const params = this.saveParams() + updateProduct(params).then((res) => { + console.log(res) + this.editConfig.visible = false + if (res.code === 200) { + this.$message.success("缂栬緫鎴愬姛") + this.$parent.getProductList() + } + }) + } } }, saveParams() { -- Gitblit v1.8.0