FileService

new FileService()

文件管理的service

Mixes In

Methods

_getEcpFilesTree(root, defer)promise

获取ECP文件,递归循环请求文件 能获取完整的文件树结构。
Name Type Description
root Object
defer Promise
Returns:

_getHcityFilesTree()

获取hcity文件

addProjectFile(file, parentId)Promise

添加至项目文件数据库中
Name Type Description
file File
parentId string
Returns:

checkUploadRights()String

验证是否有上传权限
Returns:

compileUrl(urlTemp, data)

编译url模板
Name Type Description
urlTemp String 需要编译的url模板
data Object | undefined 传递的参数,内置参数有 depot, projectCode, modelName, version这些参数不需要赋值,系统自动赋值
Example:
// 1.内置参数
var url = 'projData/{depot}/{projectCode}';
var result = compileUrl(url); // 'projData/ecp/test

// 2.可自定义参数
var url = 'projData/{depot}/{projectCode}/{key}';
var result = compileUrl(url, {key: '123'}); // 'projData/ecp/test/123

// 3.可选参数,识别参数前面的,和/字符
var url = 'projData/{depot}/{projectCode}{/key}';
var result = compileUrl(url, {key: '123'}); // 'projData/ecp/test/123
var result = compileUrl(url); // 'projData/ecp/test

var url = 'projData/{depot}{,projectCode}{,key}';
var result = compileUrl(url, {key: '123'}); // 'projData/ecp,test,123
var result = compileUrl(url); // 'projData/ecp,test

getEcpFileBlob(id)Promise

Ecp模式获取文件流
Name Type Description
id String
Returns:

getFiles()Promise

获取文件数组
Returns:

getFilesById(id)Promise

根据文件夹id获取文件目录
Name Type Description
id String
Returns:

getHcityFileBlob(id, id, ext)Promise

Hcity模式获取文件流
Name Type Description
id String
id String
ext String
Returns:

getHistoryFiles(id)Promise

获取文件历史版本
Name Type Description
id String
Returns:

getHttp()axios

获取HCity服务的client
Returns:

uploadFile()Promise

获取上传文件路径
Returns: