Element 级联限制第一级选中

 
              

  assessedChange(val) {
      let nodesObj = this.$refs["cascader"].getCheckedNodes();
      let planUsersList = nodesObj.filter(
        (item) => !(item.parent && item.parent.checked)
      ); //如果子集全选,则只存入父级node
      nodesObj = nodesObj.filter(
        (item) => (item.parent && item.parent.value != "merge" && !item.parent.isStop)
      );
      this.planForm.planUsersList = this.planUsersFormat(planUsersList);
      this.planForm.depList = this.planUsersFormat(nodesObj);
      //是否与上次的类型相同

      let changeFlag = false;
      let changeItem = null;
      if (this.shareScopeEnd.length === 0) {
        // debugger
        this.planForm.assessed = val;
      } else {
        //与原数组比对
        this.planForm.assessed.forEach((item) => {
          //与原数组的类型相同
          if (item[0] !== this.shareScopeEnd[0][0]) {
            changeFlag = true;
            // changeItem = this.planForm.assessed.slice(0,this.shareScopeEnd.length);
            changeItem = _lodash.xor(val,this.shareScopeEnd)//补集
          }
        });
      }
      if (changeFlag) {
        this.planForm.assessed = changeItem
        // this.planForm.assessed.push(changeItem)
      }
      this.shareScopeEnd = this.planForm.assessed;
    },

你可能感兴趣的:(Element 级联限制第一级选中)