美文网首页
循环里面找相同的集合

循环里面找相同的集合

作者: 糖醋里脊120625 | 来源:发表于2021-11-12 13:54 被阅读0次
     userPermissions(index, rowData) {
          var that = this;
          this.$get(canTeenAnalysisI.treesidelist).then(function (response) {
            if (response.code == 200) {
    
              that.sunlighttreeData = response.data.filter((item, index, arr) => {
                return item.menuType == "1"
              });
              that.ShangYuantreeData = response.data.filter((item, index, arr) => {
                return item.menuType == "0"
              });
            } else {
              that.$message(response.message);
            }
          });
    
    
          that.ShangYuanmorenxuanz=[];
          that.sunlightmorenxuanz=[];
          that.dialogFormVisible = true;
          that.rowDataId = rowData.eiId;
          this.$get(canTeenAnalysisI.alluserfuladmin+ "?enterpriseId=" + that.rowDataId).then((res) => {
              if (res.data) {
                that.$refs.sunlighttree.setCheckedKeys([], false);
                that.$refs.ShangYuantree.setCheckedKeys([], false);
                that.Getecho(res.data.split(","))
              }
            }
          );
        },
        Getecho(resdata){
          this.ShangYuanrepeatdata=[];
          this.sunlightrepeatdata=[];
          var that=this
          that.sunlighttreeData.forEach((item, index) => {
            that.sunlightEachloop(item.menuId,resdata)
            if(item.children){
              item.children.forEach((each, index) => {
                that.sunlightEachloop(each.menuId,resdata)
              });
    
            }
          });
          that.ShangYuantreeData.forEach((item, index) => {
            that.ShangYuanEachloop(item.menuId,resdata)
            if(item.children){
              item.children.forEach((each, index) => {
                that.ShangYuanEachloop(each.menuId,resdata)
              });
    
            }
          });
        },
        ShangYuanEachloop(id,list){
          var that=this;
          list.forEach((item, index) => {
            if(id==item){
              this.ShangYuanrepeatdata= this.ShangYuanrepeatdata.concat(item)
            }
          });
          this.ShangYuanmorenxuanz= this.ShangYuanrepeatdata;
        },
    

    相关文章

      网友评论

          本文标题:循环里面找相同的集合

          本文链接:https://www.haomeiwen.com/subject/kvfozltx.html