|
@@ -54,7 +54,8 @@
|
|
|
:tableData="tableData"
|
|
|
@openModelLog="queryModelLog"
|
|
|
@replaceModel="repliaceModel"
|
|
|
- :ceshiList="ceshiList"
|
|
|
+ @closeUpdateFile="removePersentList"
|
|
|
+ :persentList="persentList"
|
|
|
></floorTable>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
@@ -153,16 +154,8 @@ export default {
|
|
|
updataData: {
|
|
|
model: {}
|
|
|
},
|
|
|
- ceshiList: [
|
|
|
- {
|
|
|
- Id: "239ce3d4c33811e993aceb3be9a05be5",
|
|
|
- precent: 0
|
|
|
- },
|
|
|
- {
|
|
|
- Id: "7d30fd76c33b11e993ac11710b8cb126",
|
|
|
- precent: 0
|
|
|
- }
|
|
|
- ]
|
|
|
+ persentList: [], //请求进度列表
|
|
|
+ uploadClassList: [] //请求list 用与缓存多个请求问题
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -240,25 +233,26 @@ export default {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
request.queryFloorList(data, res => {
|
|
|
res.Content.map(item => {
|
|
|
- Object.assign(item, { isDown:false, precent: 0 });
|
|
|
+ // 显示进度条
|
|
|
+ if (item.Status == 3) {
|
|
|
+ Object.assign(item, { isDown: false, precent: 0 });
|
|
|
+ } else {
|
|
|
+ Object.assign(item, { isDown: true, precent: 0 });
|
|
|
+ if (this.persentList.length != 0) {
|
|
|
+ this.persentList.forEach(pItem => {
|
|
|
+ if (item.Id == pItem.Id) {
|
|
|
+ Object.assign(item, { isDown: true, precent: 0 });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
this.tableData = res.Content;
|
|
|
this.loading = false;
|
|
|
resolve();
|
|
|
- //测试代码
|
|
|
- this.ceshi();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- ceshi() {
|
|
|
- // let a = setInterval(() => {
|
|
|
- // this.ceshiList[0].precent += 5 ;
|
|
|
- // this.ceshiList[1].precent += 8
|
|
|
- // if (this.ceshiList[0] >= 100) {
|
|
|
- // clearInterval(a);
|
|
|
- // }
|
|
|
- // }, 1000);
|
|
|
- },
|
|
|
//添加楼层文件
|
|
|
addFloorFile() {
|
|
|
this.addFloorFileVisible = true;
|
|
@@ -273,105 +267,184 @@ export default {
|
|
|
},
|
|
|
// 上传模型文件
|
|
|
uploadModelFIle(data) {
|
|
|
-
|
|
|
// 在列表中添加
|
|
|
- this.ceshiList.push({
|
|
|
+ this.persentList.push({
|
|
|
Id: data.FloorModelId,
|
|
|
precent: 0
|
|
|
});
|
|
|
- // 获取当前文件夹下所有模型文件
|
|
|
- this.queryFloorFile(this.currentFolderId).then(() => {
|
|
|
- // 开始上传文件
|
|
|
- // 开始处理数据
|
|
|
- let formData = new FormData();
|
|
|
- formData.append(
|
|
|
- "model",
|
|
|
- JSON.stringify({
|
|
|
- FloorModelId: data.FloorModelId,
|
|
|
- Id: data.CurrentModelId
|
|
|
- })
|
|
|
- );
|
|
|
- formData.append("file", data.Form.file.raw);
|
|
|
- // 处理数据结束
|
|
|
+ let uploadClass = this.uploadClass();
|
|
|
+ this.uploadClassList.push({
|
|
|
+ obj: new uploadClass(data),
|
|
|
+ Id: data.FloorModelId
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 上传文件的类
|
|
|
+ uploadClass() {
|
|
|
+ let that = this;
|
|
|
+ return class {
|
|
|
+ constructor(data) {
|
|
|
+ this.upload(data);
|
|
|
+ }
|
|
|
+ upload(data) {
|
|
|
+ that.queryFloorFile(that.currentFolderId).then(() => {
|
|
|
+ // 开始上传文件
|
|
|
+ // 开始处理数据
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append(
|
|
|
+ "model",
|
|
|
+ JSON.stringify({
|
|
|
+ FloorModelId: data.FloorModelId,
|
|
|
+ Id: data.CurrentModelId
|
|
|
+ })
|
|
|
+ );
|
|
|
+ formData.append("file", data.Form.file.raw);
|
|
|
+ // 处理数据结束
|
|
|
|
|
|
- // 修改isdown得值
|
|
|
- this.tableData.map(item => {
|
|
|
- if (item.Id == data.FloorModelId) {
|
|
|
- item.isDown = true;
|
|
|
- item.precent = 0;
|
|
|
- }
|
|
|
- });
|
|
|
+ // 修改isdown得值
|
|
|
+ that.tableData.map(item => {
|
|
|
+ if (item.Id == data.FloorModelId) {
|
|
|
+ item.isDown = true;
|
|
|
+ item.precent = 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- // 开始上传
|
|
|
- request.uploadModelFile(
|
|
|
- formData,
|
|
|
- this.projectId,
|
|
|
- res => {
|
|
|
- let loaded = res.loaded, //加载量
|
|
|
- total = res.total; //文件大小
|
|
|
- this.$nextTick(() => {
|
|
|
- let precent = Math.round((loaded / total) * 100);
|
|
|
- // this.$refs.floorTable.filterTag(data.FloorModelId, precent);
|
|
|
- this.ceshiList.map(item => {
|
|
|
- if (item.Id == data.FloorModelId) {
|
|
|
- item.precent = precent
|
|
|
+ // 开始上传
|
|
|
+ request.uploadModelFile(
|
|
|
+ formData,
|
|
|
+ that.projectId,
|
|
|
+ res => {
|
|
|
+ let loaded = res.loaded, //加载量
|
|
|
+ total = res.total; //文件大小
|
|
|
+ that.$nextTick(() => {
|
|
|
+ let precent = Math.round((loaded / total) * 100);
|
|
|
+ // this.$refs.floorTable.filterTag(data.FloorModelId, precent);
|
|
|
+ if (that.persentList.length != 0) {
|
|
|
+ that.persentList.map(item => {
|
|
|
+ if (item.Id == data.FloorModelId) {
|
|
|
+ item.precent = precent;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ val => {
|
|
|
+ if (val.data.Result === "success") {
|
|
|
+ if (that.persentList.length != 0) {
|
|
|
+ that.persentList.forEach((item, index) => {
|
|
|
+ if (item.Id == data.FloorModelId) {
|
|
|
+ item.precent = 101;
|
|
|
+ that.persentList.splice(index, 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ that.$message({
|
|
|
+ message: "文件上传成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (that.persentList.length != 0) {
|
|
|
+ that.persentList.forEach((item, index) => {
|
|
|
+ if (item.Id == data.FloorModelId) {
|
|
|
+ item.precent = 101;
|
|
|
+ that.persentList.splice(index, 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ that.$message({
|
|
|
+ message: val.data.Message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- (val) => {
|
|
|
- if (val.Result.Result === "success") {
|
|
|
- this.ceshiList = [];
|
|
|
- this.$message({
|
|
|
- message: "文件上传成功",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
},
|
|
|
//更新模型文件;
|
|
|
updateModelFile(data) {
|
|
|
- this.ceshiList.push({
|
|
|
- Id:data.FloorModelId,
|
|
|
- precent:0
|
|
|
- })
|
|
|
+ this.persentList.push({
|
|
|
+ Id: data.replaceModelItem.Id,
|
|
|
+ precent: 0
|
|
|
+ });
|
|
|
// 修改isdown得值
|
|
|
this.tableData.map(item => {
|
|
|
- if (item.Id == data.FloorModelId) {
|
|
|
+ if (item.Id == data.replaceModelItem.Id) {
|
|
|
item.isDown = true;
|
|
|
item.precent = 0;
|
|
|
}
|
|
|
});
|
|
|
// 开始上传
|
|
|
- request.upDateModelFile(
|
|
|
- data,
|
|
|
- this.projectId,
|
|
|
- this.userInfo.username,
|
|
|
- res => {
|
|
|
- let loaded = res.loaded, //加载量
|
|
|
- total = res.total; //文件大小
|
|
|
- this.$nextTick(() => {
|
|
|
- let precent = Math.round((loaded / total) * 100);
|
|
|
- // this.$refs.floorTable.filterTag(data.FloorModelId, precent);
|
|
|
- this.ceshiList.map(item => {
|
|
|
- if (item.Id == data.FloorModelId) {
|
|
|
- item.precent = precent
|
|
|
+ let updataclass = this.updateModelClass();
|
|
|
+ this.uploadClassList.push({
|
|
|
+ obj: new updataclass(data),
|
|
|
+ Id: data.replaceModelItem.Id
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 更新文件的类
|
|
|
+ updateModelClass() {
|
|
|
+ let that = this;
|
|
|
+ // 开始上传
|
|
|
+ return class {
|
|
|
+ constructor(data) {
|
|
|
+ this.upDateModel(data);
|
|
|
+ }
|
|
|
+ upDateModel(data) {
|
|
|
+ request.upDateModelFile(
|
|
|
+ data,
|
|
|
+ that.projectId,
|
|
|
+ that.userInfo.username,
|
|
|
+ res => {
|
|
|
+ let loaded = res.loaded, //加载量
|
|
|
+ total = res.total; //文件大小
|
|
|
+ that.$nextTick(() => {
|
|
|
+ let precent = Math.round((loaded / total) * 100);
|
|
|
+ // this.$refs.floorTable.filterTag(data.FloorModelId, precent);
|
|
|
+ if (that.persentList.length != 0) {
|
|
|
+ that.persentList.map(item => {
|
|
|
+ if (item.Id == data.replaceModelItem.Id) {
|
|
|
+ item.precent = precent;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
- },
|
|
|
- (val) => {
|
|
|
- if (val.Result.Result === "success") {
|
|
|
- this.ceshiList = [];
|
|
|
- this.$message({
|
|
|
- message: "文件上传成功",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
+ },
|
|
|
+ val => {
|
|
|
+ if (val.data.Result === "success") {
|
|
|
+ if (that.persentList.length != 0) {
|
|
|
+ that.persentList.forEach((item, index) => {
|
|
|
+ if (item.Id == data.replaceModelItem.Id) {
|
|
|
+ item.precent = 101;
|
|
|
+ that.persentList.splice(index, 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ that.$message({
|
|
|
+ message: "文件上传成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (that.persentList.length != 0) {
|
|
|
+ that.persentList.forEach((item, index) => {
|
|
|
+ if (item.Id == data.FloorModelId) {
|
|
|
+ item.precent = 101;
|
|
|
+ that.persentList.splice(index, 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ that.$message({
|
|
|
+ message: val.data.Message,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- );
|
|
|
+ );
|
|
|
+ }
|
|
|
+ };
|
|
|
},
|
|
|
//查看模型日志
|
|
|
queryModelLog(item) {
|
|
@@ -386,6 +459,27 @@ export default {
|
|
|
request.queryModelFile(this.FloorModelId, res => {
|
|
|
this.logData = res.Content;
|
|
|
});
|
|
|
+ },
|
|
|
+ // 删除上传列表item
|
|
|
+ removePersentList(item) {
|
|
|
+ this.uploadClassList.forEach((i, index) => {
|
|
|
+ if (item.Id == i.Id) {
|
|
|
+ this.$delete(this.uploadClassList, index);
|
|
|
+ // this.uploadClassList.splice(index,0)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.persentList.forEach((i, index) => {
|
|
|
+ if (item.Id == i.Id) {
|
|
|
+ this.$delete(this.persentList, index);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.queryFloorFile(this.currentFolderId);
|
|
|
+ this.$message({
|
|
|
+ message: "中止上传!",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|