jiayufei před 4 roky
rodič
revize
0857351f55

+ 6 - 2
src/views/modules/crowd-control/components/tree-select/tree-select.vue

@@ -231,13 +231,13 @@ export default {
         },
         onCheck(checkedKeys) {
             console.log(checkedKeys, 'checkedKeys-checkedKeys');
-            this.checkedKeys = checkedKeys;
+            // this.checkedKeys = checkedKeys;
             this.nodes(this.treeData, checkedKeys);
             console.log(this.selectRightData, 'this.selectRightData');
             this.applyTypeOption = this.Es6duplicate([...this.selectRightData], 'key');
             console.log(this.applyTypeOption, 'this.applyTypeOption');
             const changeSelectData = this.applyTypeOption.map(item => item.key);
-            // this.checkedKeys = changeSelectData;
+            this.checkedKeys = changeSelectData;
             if (this.applyTypeOption.length > 100) {
                 const lastOptionKey = this.applyTypeOption[99].key;
                 const lastIndex = changeSelectData.findIndex(item => item === lastOptionKey);
@@ -247,6 +247,10 @@ export default {
             this.$emit('applyType', this.applyTypeOption);
         },
         nodes(data, checkedKeys) {
+            if (!checkedKeys.length) {
+                this.selectRightData = new Set();
+                return;
+            }
             data.forEach(item => {
                 if (item.children) {
                     this.nodes(item.children, checkedKeys);