|
|
@ -18,7 +18,7 @@ export class CanvasShareDataService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isChange = false; // 数据 是否改动
|
|
|
|
isChange: boolean = false; // 数据 是否改动
|
|
|
|
|
|
|
|
|
|
|
|
selectTemplateData: any; // 选择当前 模板数据
|
|
|
|
selectTemplateData: any; // 选择当前 模板数据
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +70,7 @@ export class CanvasShareDataService { |
|
|
|
['泡沫枪', '泡沫枪'], |
|
|
|
['泡沫枪', '泡沫枪'], |
|
|
|
['泡沫发生器', '泡沫发生器'], |
|
|
|
['泡沫发生器', '泡沫发生器'], |
|
|
|
['消防管网', '消防管网'], |
|
|
|
['消防管网', '消防管网'], |
|
|
|
['泡沫管网', '泡沫管网'], |
|
|
|
['泡沫管网', '消防管网'], |
|
|
|
['DCS控制室', 'DCS控制室'] |
|
|
|
['DCS控制室', 'DCS控制室'] |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
@ -85,45 +85,45 @@ export class CanvasShareDataService { |
|
|
|
|
|
|
|
|
|
|
|
//分段上传
|
|
|
|
//分段上传
|
|
|
|
sectionUpload(companyId: string, file) { |
|
|
|
sectionUpload(companyId: string, file) { |
|
|
|
const data = { filename: file.name }; |
|
|
|
let data = { filename: file.name } |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
this.http.post(`/api/NewMultipartUpload/PlanPlatform/${companyId}/DisposalNode`, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传
|
|
|
|
this.http.post(`/api/NewMultipartUpload/PlanPlatform/${companyId}/DisposalNode`, {}, { params: data }).subscribe(async (data: any) => { //初始化分段上传
|
|
|
|
const objectName = data.objectName; |
|
|
|
let objectName = data.objectName |
|
|
|
const uploadId = data.uploadId; |
|
|
|
let uploadId = data.uploadId |
|
|
|
const PartNumberETag = []; // 每次返回需要保存的信息
|
|
|
|
let PartNumberETag = []; //每次返回需要保存的信息
|
|
|
|
//分块 处理
|
|
|
|
//分块 处理
|
|
|
|
const fileSize = file.size || null; // 上传文件的总大小
|
|
|
|
let fileSize = file.size || null //上传文件的总大小
|
|
|
|
const shardSize = 5 * 1024 * 1024; // 5MB一个分片
|
|
|
|
let shardSize = 5 * 1024 * 1024 //5MB一个分片
|
|
|
|
const allSlice = Math.ceil(fileSize / shardSize); // 总文件/5MB===共分多少段
|
|
|
|
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < allSlice; i++) { //循环分段上传
|
|
|
|
for (let i = 0; i < allSlice; i++) { //循环分段上传
|
|
|
|
const start = i * shardSize; // 切割文件开始位置
|
|
|
|
let start = i * shardSize //切割文件开始位置
|
|
|
|
const end = Math.min(fileSize, start + shardSize); // 切割文件结束位置
|
|
|
|
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
|
|
|
|
const formData = new FormData(); |
|
|
|
let formData = new FormData() |
|
|
|
formData.append('file', file.slice(start, end)); |
|
|
|
formData.append("file", file.slice(start, end)) |
|
|
|
|
|
|
|
|
|
|
|
//同步写法实现异步调用
|
|
|
|
//同步写法实现异步调用
|
|
|
|
const result = await new Promise((resolve, reject) => { |
|
|
|
let result = await new Promise((resolve, reject) => { |
|
|
|
// await 需要后面返回一个 promise 对象
|
|
|
|
// await 需要后面返回一个 promise 对象
|
|
|
|
this.http.post(`/api/MultipartUpload/PlanPlatform/${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { |
|
|
|
this.http.post(`/api/MultipartUpload/PlanPlatform/${objectName}?uploadId=${uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { |
|
|
|
const msg = { partNumber: data.partNumber || null, eTag: data.eTag || null }; |
|
|
|
let msg = { "partNumber": data.partNumber || null, "eTag": data.eTag || null } |
|
|
|
resolve(msg); // 调用 promise 内置方法处理成功
|
|
|
|
resolve(msg) // 调用 promise 内置方法处理成功
|
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
PartNumberETag.push(result); |
|
|
|
PartNumberETag.push(result) |
|
|
|
|
|
|
|
|
|
|
|
if (PartNumberETag.length === allSlice) { //分块上传完成
|
|
|
|
if (PartNumberETag.length === allSlice) { //分块上传完成
|
|
|
|
const data = PartNumberETag; |
|
|
|
let data = PartNumberETag |
|
|
|
const paramsData = { uploadId }; |
|
|
|
let paramsData = { uploadId: uploadId } |
|
|
|
this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${objectName}`, data, { params: paramsData }).subscribe(data => { |
|
|
|
this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${objectName}`, data, { params: paramsData }).subscribe(data => { |
|
|
|
resolve(objectName); |
|
|
|
resolve(objectName) |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}//for循环
|
|
|
|
}//for循环
|
|
|
|
|
|
|
|
|
|
|
|
//分块 处理
|
|
|
|
//分块 处理
|
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 处置节点 筛选出 匹配数据 匹配不到 return undefined
|
|
|
|
// 处置节点 筛选出 匹配数据 匹配不到 return undefined
|
|
|
@ -294,7 +294,22 @@ export class CanvasShareDataService { |
|
|
|
facility.Id = ''; |
|
|
|
facility.Id = ''; |
|
|
|
facility.Name = this.facilityAssetsName.get(item.Name); |
|
|
|
facility.Name = this.facilityAssetsName.get(item.Name); |
|
|
|
facility.AssetName = item.Name; |
|
|
|
facility.AssetName = item.Name; |
|
|
|
facility.PropertyInfos = item.PropertyInfos; |
|
|
|
facility.PropertyInfos = []; |
|
|
|
|
|
|
|
item.PropertyInfos.forEach(e => { |
|
|
|
|
|
|
|
var p: PropertyInfo = new PropertyInfo(); |
|
|
|
|
|
|
|
p.Enabled = e.Enabled; |
|
|
|
|
|
|
|
p.Order = e.Order; |
|
|
|
|
|
|
|
p.PhysicalUnit = e.PhysicalUnit; |
|
|
|
|
|
|
|
p.PropertyName = e.PropertyName; |
|
|
|
|
|
|
|
p.PropertyType = e.PropertyType; |
|
|
|
|
|
|
|
p.PropertyValue = e.PropertyValue.toString(); |
|
|
|
|
|
|
|
p.Required = e.Required; |
|
|
|
|
|
|
|
p.RuleName = e.RuleName; |
|
|
|
|
|
|
|
p.RuleValue = e.RuleValue; |
|
|
|
|
|
|
|
p.Tag = e.Tag; |
|
|
|
|
|
|
|
p.Visible = e.Visible; |
|
|
|
|
|
|
|
facility.PropertyInfos.push(p); |
|
|
|
|
|
|
|
}); |
|
|
|
facility.SitePlanId = item.FloorId; |
|
|
|
facility.SitePlanId = item.FloorId; |
|
|
|
list.push(facility); |
|
|
|
list.push(facility); |
|
|
|
} |
|
|
|
} |
|
|
@ -315,7 +330,22 @@ export class CanvasShareDataService { |
|
|
|
facility.Id = ''; |
|
|
|
facility.Id = ''; |
|
|
|
facility.Name = this.facilityAssetsName.get(item.Name); |
|
|
|
facility.Name = this.facilityAssetsName.get(item.Name); |
|
|
|
facility.AssetName = item.Name; |
|
|
|
facility.AssetName = item.Name; |
|
|
|
facility.PropertyInfos = item.PropertyInfos; |
|
|
|
facility.PropertyInfos = []; |
|
|
|
|
|
|
|
item.PropertyInfos.forEach(e => { |
|
|
|
|
|
|
|
var p: PropertyInfo = new PropertyInfo(); |
|
|
|
|
|
|
|
p.Enabled = e.Enabled; |
|
|
|
|
|
|
|
p.Order = e.Order; |
|
|
|
|
|
|
|
p.PhysicalUnit = e.PhysicalUnit; |
|
|
|
|
|
|
|
p.PropertyName = e.PropertyName; |
|
|
|
|
|
|
|
p.PropertyType = e.PropertyType; |
|
|
|
|
|
|
|
p.PropertyValue = e.PropertyValue.toString(); |
|
|
|
|
|
|
|
p.Required = e.Required; |
|
|
|
|
|
|
|
p.RuleName = e.RuleName; |
|
|
|
|
|
|
|
p.RuleValue = e.RuleValue; |
|
|
|
|
|
|
|
p.Tag = e.Tag; |
|
|
|
|
|
|
|
p.Visible = e.Visible; |
|
|
|
|
|
|
|
facility.PropertyInfos.push(p); |
|
|
|
|
|
|
|
}); |
|
|
|
facility.BuildingAreaId = item.FloorId; |
|
|
|
facility.BuildingAreaId = item.FloorId; |
|
|
|
list.push(facility); |
|
|
|
list.push(facility); |
|
|
|
} |
|
|
|
} |
|
|
@ -406,7 +436,7 @@ export class CompanyFacilityAssetInfo { |
|
|
|
public Id: string; |
|
|
|
public Id: string; |
|
|
|
public Name: string; |
|
|
|
public Name: string; |
|
|
|
public AssetName: string; |
|
|
|
public AssetName: string; |
|
|
|
public PropertyInfos: string; |
|
|
|
public PropertyInfos: PropertyInfo[]; |
|
|
|
public AssetId: string; |
|
|
|
public AssetId: string; |
|
|
|
public CompanyId: string; |
|
|
|
public CompanyId: string; |
|
|
|
public SitePlanId: string; |
|
|
|
public SitePlanId: string; |
|
|
@ -418,7 +448,7 @@ export class BuildingFacilityAssetInfo { |
|
|
|
public Id: string; |
|
|
|
public Id: string; |
|
|
|
public Name: string; |
|
|
|
public Name: string; |
|
|
|
public AssetName: string; |
|
|
|
public AssetName: string; |
|
|
|
public PropertyInfos: string; |
|
|
|
public PropertyInfos: PropertyInfo[]; |
|
|
|
public AssetId: string; |
|
|
|
public AssetId: string; |
|
|
|
public BuildingId: string; |
|
|
|
public BuildingId: string; |
|
|
|
public BuildingAreaId: string; |
|
|
|
public BuildingAreaId: string; |
|
|
|