美文网首页
vue搜索表格递归方法

vue搜索表格递归方法

作者: 吃半个馒头 | 来源:发表于2019-03-01 16:07 被阅读0次
    {"code":"ok","data":[{"id":"00000000000000000000000000000000","num":99,"typeNane":"系统","deptType":"0","simplename":"系统","fullname":"系统","remarks":"系统","address":"福建省","email":"hongyx8@qq.com","telephone":"18450087267","linkman":"黄幸地","createTimeStr":"2019-01-29 09:54:36","creater":"admin","updateTimeStr":"2019-01-29 15:43:28","updater":"admin","status":1,"children":[{"id":"3576b93de7b046699a6d32fae240724f","num":30,"typeNane":"总公司","pid":"00000000000000000000000000000000","pids":"00000000000000000000000000000000","deptType":"1","simplename":"问问猫","fullname":"问问猫总公司","remarks":"总公司","address":"福建省","email":"zcp951yc4@qq.com","telephone":"18450087267","linkman":"洪艳霞","createTimeStr":"2019-01-29 09:54:58","creater":"admin","updateTimeStr":"2019-02-03 14:26:42","updater":"admin","status":1,"children":[{"id":"5eafa59b5f9b41dd97e841b07965d8c5","num":10,"typeNane":"分公司","pid":"3576b93de7b046699a6d32fae240724f","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f","deptType":"2","simplename":"泉州分公司","fullname":"泉州分公司","remarks":"问问猫总公司-泉州分公司","address":"泉州","email":"1045516261@qq.com","telephone":"13311444321","linkman":"黄进安","createTimeStr":"2019-01-29 09:13:53","creater":"admin","updateTimeStr":"2019-02-13 09:29:41","updater":"admin","status":1,"children":[{"id":"67b899ce196442f3a7b60d81f361a32e","num":10,"typeNane":"小区","pid":"5eafa59b5f9b41dd97e841b07965d8c5","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f,5eafa59b5f9b41dd97e841b07965d8c5","deptType":"4","simplename":"万达小区","fullname":"万达小区","remarks":"问问猫总公司-泉州分公司-万达小区","address":"泉州","email":"hongyx8@qq.com","telephone":"18450087267","linkman":"桂满","createTimeStr":"2019-01-29 15:53:22","creater":"admin","updateTimeStr":"2019-02-13 15:00:47","updater":"admin","status":1,"children":[{"id":"6a7a9157eded4b78a70da5464d6833f6","typeNane":"部门","pid":"67b899ce196442f3a7b60d81f361a32e","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f,5eafa59b5f9b41dd97e841b07965d8c5,67b899ce196442f3a7b60d81f361a32e","deptType":"3","simplename":"万达小区-测试部门","fullname":"测试部门","address":"","createTimeStr":"2019-03-01 14:05:44","creater":"admin","updateTimeStr":"2019-03-01 14:05:44","updater":"admin","status":1},{"id":"b7736101724f48bb9bac1907ba286240","typeNane":"部门","pid":"67b899ce196442f3a7b60d81f361a32e","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f,5eafa59b5f9b41dd97e841b07965d8c5,67b899ce196442f3a7b60d81f361a32e","deptType":"3","simplename":"1333","fullname":"1333","remarks":"1","address":"","createTimeStr":"2019-02-20 13:55:21","creater":"admin","updateTimeStr":"2019-03-01 10:53:30","updater":"admin","status":1}]},{"id":"c80d072c9d4e4d5691c05c5c3253f263","num":1,"typeNane":"小区","pid":"5eafa59b5f9b41dd97e841b07965d8c5","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f,5eafa59b5f9b41dd97e841b07965d8c5","deptType":"4","simplename":"百捷小区","fullname":"百捷小区","remarks":"问问猫总公司-泉州分公司-百捷小区","address":"泉州","email":"hongyx8@163.com","telephone":"18159801356","linkman":"满满","createTimeStr":"2019-01-30 10:12:09","creater":"6fb1bc557d9c450493d5d994274c37fd","updateTimeStr":"2019-02-03 16:10:03","updater":"6fb1bc557d9c450493d5d994274c37fd","status":1},{"id":"e689e45baf384d43b1d64b4b9412dab8","typeNane":"小区","pid":"5eafa59b5f9b41dd97e841b07965d8c5","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f,5eafa59b5f9b41dd97e841b07965d8c5","deptType":"4","simplename":"宝珊花园","fullname":"宝珊花园","address":"福建省泉州市东海街道","email":"smilive@qq.com","telephone":"15260975689","linkman":"静安","createTimeStr":"2019-02-03 16:17:05","creater":"admin","updateTimeStr":"2019-02-12 17:59:58","updater":"admin","status":1}]},{"id":"1a19f95c407c45dc85dbdea4b6ee65aa","typeNane":"分公司","pid":"3576b93de7b046699a6d32fae240724f","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f","deptType":"2","simplename":"问问猫-测试分公司","fullname":"测试分公司","address":"1","telephone":"18767828282","createTimeStr":"2019-02-13 15:04:52","creater":"admin","updateTimeStr":"2019-02-13 15:04:52","updater":"admin","status":1,"children":[{"id":"86f0648c283a4504ad64725564ee4001","typeNane":"小区","pid":"1a19f95c407c45dc85dbdea4b6ee65aa","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f,1a19f95c407c45dc85dbdea4b6ee65aa","deptType":"4","simplename":"问问猫-测试分公司-测试小区01","fullname":"测试小区01","address":"1","telephone":"18973829223","createTimeStr":"2019-02-13 15:08:53","creater":"admin","updateTimeStr":"2019-02-13 15:08:53","updater":"admin","status":1}]},{"id":"ac03da3760fc4d1db02c9fe7ca27d496","typeNane":"分公司","pid":"3576b93de7b046699a6d32fae240724f","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f","deptType":"2","simplename":"问问猫-分公司测试","fullname":"分公司测试","address":"2","telephone":"18393839922","createTimeStr":"2019-02-20 14:51:02","creater":"admin","updateTimeStr":"2019-02-20 14:51:02","updater":"admin","status":1,"children":[{"id":"51ee7739b2d14c0db33d682ae3283ed1","typeNane":"部门","pid":"ac03da3760fc4d1db02c9fe7ca27d496","pids":"00000000000000000000000000000000,3576b93de7b046699a6d32fae240724f,ac03da3760fc4d1db02c9fe7ca27d496","deptType":"3","simplename":"问问猫-分公司测试-测试部门","fullname":"测试部门","address":"","createTimeStr":"2019-02-20 14:51:37","creater":"admin","updateTimeStr":"2019-02-20 14:51:37","updater":"admin","status":1}]}]},{"id":"3f9328141bc54ebfb0d8aaa23c2b0672","typeNane":"总公司","pid":"00000000000000000000000000000000","pids":"00000000000000000000000000000000","deptType":"1","simplename":"总公司06","fullname":"总公司06","address":"1","telephone":"18738389292","createTimeStr":"2019-02-20 17:21:16","creater":"admin","updateTimeStr":"2019-02-20 17:21:16","updater":"admin","status":1},{"id":"6ab582e694364851b87f2e4715c4d0dd","typeNane":"总公司","pid":"00000000000000000000000000000000","pids":"00000000000000000000000000000000","deptType":"1","simplename":"总公司04","fullname":"总公司04","address":"1","telephone":"18393839922","createTimeStr":"2019-02-20 14:50:03","creater":"admin","updateTimeStr":"2019-02-20 14:50:03","updater":"admin","status":1},{"id":"c80474f66b53461ab67818cf6111e7c4","typeNane":"总公司","pid":"00000000000000000000000000000000","pids":"00000000000000000000000000000000","deptType":"1","simplename":"测试总公司01","fullname":"测试总公司01","address":"2","telephone":"18673738383","createTimeStr":"2019-02-15 16:30:00","creater":"admin","updateTimeStr":"2019-02-15 16:30:00","updater":"admin","status":1,"children":[{"id":"fb0ab8389786412baf46c4c500202bee","typeNane":"分公司","pid":"c80474f66b53461ab67818cf6111e7c4","pids":"00000000000000000000000000000000,c80474f66b53461ab67818cf6111e7c4","deptType":"2","simplename":"测试总公司01-测试分公司01","fullname":"测试分公司01","address":"1","telephone":"18673738383","createTimeStr":"2019-02-15 16:30:45","creater":"admin","updateTimeStr":"2019-02-15 16:30:45","updater":"admin","status":1}]}]}]}
    
    
    
    public findFullName(searchName, list) {
        list.forEach(item => {
          if (item.fullname === searchName) {
            console.log(item);
            return;
          } else {
            if (item.children) {
              this.findFullName(searchName, item.children);
            }
          }
        });
      }
    
    
    this.findFullName('问问猫公司', data.data);
    
    

    相关文章

      网友评论

          本文标题:vue搜索表格递归方法

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