Ver Fonte

文案库

jiayufei há 4 anos atrás
pai
commit
269f73d2d3
1 ficheiros alterados com 21 adições e 7 exclusões
  1. 21 7
      src/views/modules/copy-library/copy-library.vue

+ 21 - 7
src/views/modules/copy-library/copy-library.vue

@@ -576,6 +576,7 @@ export default {
             defaultFormList: [],
             titleFiledResult: 0,
             examinForm: this.$form.createForm(this),
+            changeShowmasterData: [],
             masterTimes: [] // 选择素材的时间选择
         };
     },
@@ -746,7 +747,11 @@ export default {
             this.hendleMaterialInfo();
         },
         handleSelectMaterial() {
-            this.hendleMaterialInfo();
+            this.masterPag = {
+                page: 1,
+                size: 10
+            };
+            this.handleRefreshMaster();
             this.visibleMatemal = true;
         },
         // 选择素材的取消按钮
@@ -760,19 +765,28 @@ export default {
         handleOkShow() {
             const defaultList = this.viedoDefaultList;
             const defaultCheckValue = this.viedoCheckValue;
-            let finallyIds = new Set();
             let changeSelectMaterData = defaultList.filter(item => {
                 if (defaultCheckValue.includes(item.id)) {
                     return item;
                 }
             });
-            finallyIds = this.modalSelectMaterial.concat(changeSelectMaterData).map(item => item.id);
-            this.modalSelectMaterial = defaultList.filter(item => {
-                if (finallyIds.includes(item.id)) {
-                    return item;
+            this.changeShowmasterData = this.changeShowmasterData.concat(changeSelectMaterData);
+            this.$nextTick(() => {
+                let temp = {};	//	用于name判断
+                let result = []; // 最后的新数组
+                this.changeShowmasterData.map((item, index) => {
+                    if (!temp[item.id]) {
+                        result.push(item);
+                        temp[item.id] = true;
+                    }
+                });
+                if (result.length > 8) {
+                    this.$message.error('最多上传8个素材');
+                    return;
                 }
+                this.modalSelectMaterial = [...result];
+                this.handleCancelAll();
             });
-            this.handleCancelAll();
         },
         handleFormLayoutChange(e) {
             const defaultValue = e.target.value;