Browse Source

improve: 采集

From-wh 2 years ago
parent
commit
e0da680a60
1 changed files with 7 additions and 5 deletions
  1. 7 5
      template/admin/src/pages/product/productAdd/index.vue

+ 7 - 5
template/admin/src/pages/product/productAdd/index.vue

@@ -2108,10 +2108,9 @@ export default {
         this.oneFormValidate = [data.attr];
         this.oneFormValidate = [data.attr];
       }
       }
       this.formValidate.header = [];
       this.formValidate.header = [];
-      this.generate(0, isCopy);
-      if (isCopy) this.manyFormValidate = data.attrs;
+      this.generate(0, isCopy, data.attrs);
       // this.manyFormValidate = data.attrs;
       // this.manyFormValidate = data.attrs;
-      this.$set(this, 'manyFormValidate', data.attrs);
+      // this.$set(this, 'manyFormValidate', data.attrs);
       this.spec_type = data.spec_type;
       this.spec_type = data.spec_type;
       this.formValidate.is_virtual = data.is_virtual;
       this.formValidate.is_virtual = data.is_virtual;
       if (data.spec_type === 0) {
       if (data.spec_type === 0) {
@@ -2507,7 +2506,7 @@ export default {
       this.showIput = true;
       this.showIput = true;
     },
     },
     // 立即生成
     // 立即生成
-    generate(type, isCopy) {
+    generate(type, isCopy, arr) {
       generateAttrApi(
       generateAttrApi(
         {
         {
           attrs: this.attrs,
           attrs: this.attrs,
@@ -2523,6 +2522,9 @@ export default {
           if (this.$route.params.id !== '0' && (this.$route.query.type != -1 || type) && !isCopy) {
           if (this.$route.params.id !== '0' && (this.$route.query.type != -1 || type) && !isCopy) {
             this.manyFormValidate = info.value;
             this.manyFormValidate = info.value;
           }
           }
+          if (isCopy) {
+            this.manyFormValidate = arr;
+          }
           let header = info.header;
           let header = info.header;
           if ([1, 2].includes(this.formValidate.virtual_type)) {
           if ([1, 2].includes(this.formValidate.virtual_type)) {
             this.columnsInstalM = header;
             this.columnsInstalM = header;
@@ -2532,7 +2534,7 @@ export default {
             this.columnsInstalM = info.header;
             this.columnsInstalM = info.header;
           }
           }
           this.checkAllGroup(this.formValidate.is_sub);
           this.checkAllGroup(this.formValidate.is_sub);
-          if (!this.$route.params.id && this.formValidate.spec_type === 1) {
+          if (!this.$route.params.id && this.formValidate.spec_type === 1 && !isCopy) {
             this.manyFormValidate.map((item) => {
             this.manyFormValidate.map((item) => {
               item.pic = this.formValidate.image;
               item.pic = this.formValidate.image;
             });
             });