Bladeren bron

feat:校验子商品不超过十条

snow 1 jaar geleden
bovenliggende
commit
5b95b187c4

+ 12 - 0
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -1260,6 +1260,18 @@ export default {
     onChildProdChange(index = null, type = "view") {
       this.modalType = type;
 
+      if (type === "add") {
+        if (this.editIndex !== -1) {
+          this.$message.warning("当前有正在编辑的子商品,请先保存");
+          return;
+        }
+
+        if (this.childTableData.length === 10) {
+          this.$message.warning("子商品最多不能超过十条");
+          return;
+        }
+      }
+
       if (type === "view" && index !== null) {
         this.editItem = { ...this.childTableData[index] };
       } else {

+ 12 - 0
src/views/goodStore/supplierGoodsCost/components/baseForm.vue

@@ -1264,6 +1264,18 @@ export default {
     onChildProdChange(index = null, type = "view") {
       this.modalType = type;
 
+      if (type === "add") {
+        if (this.editIndex !== -1) {
+          this.$message.warning("当前有正在编辑的子商品,请先保存");
+          return;
+        }
+
+        if (this.childTableData.length === 10) {
+          this.$message.warning("子商品最多不能超过十条");
+          return;
+        }
+      }
+
       if (type === "view" && index !== null) {
         this.editItem = { ...this.childTableData[index] };
       } else {