瀏覽代碼

人群包模块 前端页面接口联调

jiayufei 4 年之前
父節點
當前提交
97fa06678b

+ 2 - 0
src/views/modules/crowd-control/components/tree-select/tree-select.less

@@ -30,6 +30,8 @@
         border: 1px solid #ccc;
         .class-left-content {
             padding: 0 10px;
+            height: 348px;
+            overflow-y: auto;
             .left-content-p {
                 height: 25px;
                 line-height: 25px;

+ 8 - 13
src/views/modules/crowd-control/components/tree-select/tree-select.vue

@@ -69,17 +69,6 @@ export default {
             leftTreeNoData: false
         };
     },
-    watch: {
-        applyTypeOption: {
-            handler(newName) {
-                if (newName.length > 100) {
-                    this.$message.error('最多不能超过100个');
-                    this.applyTypeOption = newName.splice(0, 99);
-                }
-            },
-            immediate: true
-        }
-    },
     mounted() {
         this.getAccountId();
     },
@@ -168,9 +157,15 @@ export default {
             this.autoExpandParent = false;
         },
         onCheck(checkedKeys) {
-            this.checkedKeys = checkedKeys;
             this.nodes(this.treeData, checkedKeys);
             this.applyTypeOption = [...this.selectRightData];
+            const changeSelectData = [...this.selectRightData].map(item => item.key);
+            if (this.applyTypeOption.length > 100) {
+                const lastOptionKey = this.applyTypeOption[99].key;
+                const lastIndex = changeSelectData.findIndex(item => item === lastOptionKey);
+                this.checkedKeys = changeSelectData.slice(0, lastIndex + 1);
+                this.applyTypeOption = [...this.selectRightData].slice(0, 100);
+            }
             this.$emit('applyType', this.applyTypeOption);
         },
         nodes(data, checkedKeys) {
@@ -178,7 +173,7 @@ export default {
                 if (item.children) {
                     this.nodes(item.children, checkedKeys);
                 }
-                else {
+                else { 
                     if (checkedKeys.indexOf(item.key) !== -1) {
                         this.selectRightData.add(item);
                     }

+ 1 - 2
src/views/modules/crowd-control/crowd-control.vue

@@ -390,8 +390,7 @@ export default {
                     }).catch(error => {
                         console.log(error, 'eeee');
                     });
-                },
-                onCancel() {}
+                }
             });
         },
         handleAcountRelaxTable() {