diff --git a/Frontend/_graphManagement.html b/Frontend/_graphManagement.html index b17cec6..7e7897a 100644 --- a/Frontend/_graphManagement.html +++ b/Frontend/_graphManagement.html @@ -285,20 +285,22 @@ }) onEvent("click", "a[id^=oriDwgDown]", function () { + let dowLoaEle = YT.Alert.Tip("準備下載中...", "show", true); let rowData = graTable.row($(this).closest("tr")).data(); let apiUrl = baseApiUrl + `/File/Download?type=graph&savename=${rowData.oriSavName}&oriname=${rowData.oriOrgName}`; let extname = rowData.oriOrgName?.split(".").slice(-1) || "dwg"; download(token, apiUrl, rowData.name + "_原設計圖" + "." + extname, function () { - + $(dowLoaEle.ele).YTAlert().hide(); }); }) onEvent("click", "a[id^=donDwgDown]", function () { + let dowLoaEle = YT.Alert.Tip("準備下載中...", "show", true); let rowData = graTable.row($(this).closest("tr")).data(); let apiUrl = baseApiUrl + `/File/Download?type=graph&savename=${rowData.donSavName}&oriname=${rowData.donOrgName}`; let extname = rowData.donOrgName?.split(".").slice(-1) || "dwg"; download(token, apiUrl, rowData.name + "_竣工圖" + "." + extname, function () { - + $(dowLoaEle.ele).YTAlert().hide(); }); }) @@ -522,11 +524,11 @@ $("#graPicName").val(res.data?.name); $("#graLayer").text(levelNameByNodeId(res.data?.layer_id)); if (res.data?.oriSavName != null) { - fileObj = { name: res.data?.oriOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.oriSavName, savename: res.data?.oriSavName }; + fileObj = { name: res.data?.oriOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.oriSavName, savename: res.data?.oriSavName, size:res.data?.oriSize }; uploader["graMyDesignDiagram"][0].dropzone?.displayExistingFile(fileObj); } if (res.data?.donSavName != null) { - fileObj = { name: res.data?.donOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.donSavName, savename: res.data?.oriSavName }; + fileObj = { name: res.data?.donOrgName, dataUrl: baseApiUrl + varGraPath + res.data?.donSavName, savename: res.data?.donSavName, size: res.data?.donSize }; uploader["graMyAsBuilt"][0].dropzone?.displayExistingFile(fileObj); } diff --git a/FrontendWebApi/ApiControllers/GraphManageController.cs b/FrontendWebApi/ApiControllers/GraphManageController.cs index fda52a8..7d86f02 100644 --- a/FrontendWebApi/ApiControllers/GraphManageController.cs +++ b/FrontendWebApi/ApiControllers/GraphManageController.cs @@ -329,14 +329,17 @@ namespace FrontendWebApi.ApiControllers //edit file //原設計圖修改 var new_guid = Guid.NewGuid(); + long? fileSize = gm.oriSize ?? null; //刪除原本檔案 if (gm.oriSavName != null && gii.oriSavName != gm.oriSavName) { FolderFunction folderFunction = new FolderFunction(); folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.oriSavName)); + fileSize = null; } string fileName = gii.oriSavName ?? null; + if (gii.oriOrgName != null && gii.oriFile != null) { fileName = new_guid + "." + gii.oriOrgName.Split('.')[1]; @@ -347,19 +350,24 @@ namespace FrontendWebApi.ApiControllers { gii.oriFile.CopyTo(stream); } + fileSize = gii.oriFile.Length; } + + graph_manage.Add("@oriSize", fileSize); graph_manage.Add("@oriOrgName", gii.oriOrgName); graph_manage.Add("@oriSavName", fileName); fileName = gii.donSavName ?? null; //竣工圖修改 new_guid = Guid.NewGuid(); + fileSize = gm.donSize ?? null; //刪除原本檔案 if (gm.donSavName != null && gii.donSavName != gm.donSavName) { var folderFunction = new FolderFunction(); folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName)); + fileSize = null; } if (gii.donOrgName != null && gii.donFile != null) @@ -372,8 +380,10 @@ namespace FrontendWebApi.ApiControllers { gii.donFile.CopyTo(stream); } - + fileSize = gii.donFile.Length; } + + graph_manage.Add("@donSize", fileSize); graph_manage.Add("@donOrgName", gii.donOrgName); graph_manage.Add("@donSavName", fileName); @@ -428,7 +438,7 @@ namespace FrontendWebApi.ApiControllers } Dictionary graph_manage = new Dictionary(); - + //save file if (gii.oriOrgName != null || gii.donOrgName != null) { @@ -448,6 +458,7 @@ namespace FrontendWebApi.ApiControllers gii.oriFile.CopyTo(stream); } + graph_manage.Add("@oriSize", gii.oriFile.Length); graph_manage.Add("@oriOrgName", gii.oriOrgName); graph_manage.Add("@oriSavName", fileName); } @@ -465,6 +476,7 @@ namespace FrontendWebApi.ApiControllers gii.donFile.CopyTo(stream); } + graph_manage.Add("@donSize", gii.donFile.Length); graph_manage.Add("@donOrgName", gii.donOrgName); graph_manage.Add("@donSavName", fileName); } diff --git a/FrontendWebApi/Models/GraphManage.cs b/FrontendWebApi/Models/GraphManage.cs index c525a78..941006c 100644 --- a/FrontendWebApi/Models/GraphManage.cs +++ b/FrontendWebApi/Models/GraphManage.cs @@ -18,6 +18,8 @@ namespace FrontendWebApi.Models public string oriSavName { get; set; } public string donOrgName { get; set; } public string donSavName { get; set; } + public long? oriSize { get; set; } + public long? donSize { get; set; } } public class GraphInsInfo @@ -35,6 +37,8 @@ namespace FrontendWebApi.Models public int priority { get; set; } public IFormFile oriFile { get; set; } public IFormFile donFile { get; set; } + public long? oriSize{ get; set; } + public long? donSize { get; set; } } public class GraphInfo: Actor diff --git a/FrontendWebApi/wwwroot/upload/graph_manage/de4b6642-73b2-4c96-98a2-15b22a3314c5.dwg b/FrontendWebApi/wwwroot/upload/graph_manage/de4b6642-73b2-4c96-98a2-15b22a3314c5.dwg new file mode 100644 index 0000000..e36c889 Binary files /dev/null and b/FrontendWebApi/wwwroot/upload/graph_manage/de4b6642-73b2-4c96-98a2-15b22a3314c5.dwg differ