FileNode

new FileNode(opts)

文件树节点类
Name Type Description
opts Object
Name Type Description
id String 文件id
parentId String 文件父节点id
name String 文件name
fileType FileType 文件类型
path String 文件路径
version String 文件版本
fileSize String 文件大小
creatorId String 创建人id
creatorName String 创建人name
createdTime String 创建日期
updatorId String 更新人id
updatorName String 更新人name
updatedTime String 更新日期
description String 描述

Members

children : Array.<FileNode>

该文件夹的子节点

createdTime : String

创建日期

creatorId : String

创建人id

creatorName : String

创建人name

description : String

更新日期

ext : String

文件扩展名

fileSize : number

文件大小

fileSizeStr : number

文件大小

fileType : FileType

文件类型

history : Array.<FileNode>

该文件的历史版本

id : String

文件id

name : String

文件name,根节点name必须为"资料"

parentId : String

文件父节点id parentName/name

path : String

文件路径

updatedTime : String

更新日期

updatorId : String

更新人id

updatorName : String

更新人name

version : number

文件版本

Methods

addChild(node, index)

插入子节点
Name Type Description
node FileNode
index Number 插入位置,默认为最后一位

createChild(obj)FileNode

新建节点
Name Type Description
obj Object
Returns:

firstLeafNode(fn)

查找当前节点下符合条件的第一个叶子节点
Name Type Description
fn function | undefined 回调函数(node) => Boolean,如果有其中node是所遍历到的节点

forEach(fn)

遍历当前节点和所有后代节点
Name Type Description
fn function | undefined 回调函数(node, isLeaf) => {},如果有其中node是所遍历到的节点,isLeaf所遍历到的节点是否是叶子节点

forEachLeaf(fn)

遍历当前节点下的所有是叶子节点的后代节点
Name Type Description
fn function | undefined 回调函数(node) => {},如果有其中node是所遍历到的节点

getChildById(obj)FileNode

获取节点
Name Type Description
obj Object
Returns:

getChildByName(obj)FileNode

获取节点
Name Type Description
obj Object
Returns:

getExtends()String

获取文件扩展名
Returns:

getFileSizeStr(opts)

获取文件大小字符串
Name Type Description
opts Object
Example:
{
 fileType: {FileType},
 fileSize: {Number}
}

getType(opts)

Name Type Description
opts Object
Example:
{
 fileType: {FileType},
 name: {String}
}

removeChild(name)FileNode

根据文件名删除节点
Name Type Description
name String
Returns: