ソースを参照

删除无用文件

林倩 3 年 前
コミット
b4b933d307
2 ファイル変更0 行追加69 行削除
  1. 0 35
      src/utils/array.js
  2. 0 34
      src/utils/eval.js

+ 0 - 35
src/utils/array.js

@@ -1,35 +0,0 @@
-/**
- * author: linqian
- * description: 数组操作函数库
- * date: 2021-07-09 09:50
- */
-// 从树形数据中递归筛选目标值
-function valInDeep(arr = [], val, id, childs) {
-    return arr.reduce((flat, item) => {
-      return flat.concat(item[id] == val ? item : valInDeep(item[childs] || [], val, id, childs));
-    }, []);
-  }
-  
-  // 将树形数据向下递归为一维数组
-  function flattenDeep(arr = [], childs) {
-    return arr.reduce((flat, item) => {
-      return flat.concat(item, item[childs] ? flattenDeep(item[childs], childs) : [] );
-    }, []);
-  }
-  
-  // 将树形数据向上将此支线递归为一维数组
-  function flattenDeepParents(arr, parent) {
-    return arr.reduce((flat, item) => {
-      return flat.concat(item[parent] || [], item[parent] ? flattenDeepParents([item[parent]], parent) : [] );
-    }, []);
-  }
-  
-  // 根据条件递归祖先元素
-  function regDeepParents(row, parent, cb) {
-      if(row[parent]){
-        cb && cb(row[parent]);
-        regDeepParents(row[parent], parent, cb);
-      }
-  }
-  
-  export { valInDeep, flattenDeep, flattenDeepParents, regDeepParents }

+ 0 - 34
src/utils/eval.js

@@ -1,34 +0,0 @@
-/**
- * @Author: jianglei
- * @Date:   2017-10-12 12:06:49
- */
- "use strict";
- import Vue from "vue";
- export default function treeToArray(
-   data,
-   expandAll,
-   parent = null,
-   level = null
- ) {
-   let tmp = [];
-   Array.from(data).forEach(function(record) {
-     if (record._expanded === undefined) {
-       Vue.set(record, "_expanded", expandAll);
-     }
-     let _level = 1;
-     if (level !== undefined && level !== null) {
-       _level = level + 1;
-     }
-     Vue.set(record, "_level", _level);
-     if (parent) {
-      // Vue.set(record, "parent", parent);
-      Vue.set(record, "parent", parent);
-     }
-     tmp.push(record);
-     if (record.child && record.child.length > 0) {
-       const children = treeToArray(record.child, expandAll, record, _level);
-      //  tmp = tmp.concat(children);
-     }
-   });
-   return tmp;
- }