From f4a243741c62c3d3bb27c66e61622a43c701c483 Mon Sep 17 00:00:00 2001 From: fly-l <1420031550@qq.com> Date: Tue, 27 Jun 2023 15:24:13 +0800 Subject: [PATCH] 2023-06-27 --- .vs/SGGL_SeDin/v17/.wsuo | Bin 253440 -> 253952 bytes .../AttachFile/OnlineEditing.aspx | 295 ++++++++++++++++++ .../AttachFile/OnlineEditing.aspx.cs | 74 +++++ .../AttachFile/OnlineEditing.aspx.designer.cs | 17 + SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs | 5 +- SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 8 + .../Controllers/FileUploadController.cs | 40 +++ SGGL/WebAPI/WebAPI.csproj | 1 + 8 files changed, 439 insertions(+), 1 deletion(-) create mode 100644 SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx create mode 100644 SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs create mode 100644 SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs diff --git a/.vs/SGGL_SeDin/v17/.wsuo b/.vs/SGGL_SeDin/v17/.wsuo index 761316d14e3338b74b45e83f52f37acc207838d1..809a674edfd39e657b53fc68672d2e7ea9ef8201 100644 GIT binary patch delta 3195 zcmeI!dvFs)9KiA0ODZY7v?Wa&3Vj49QbJn@6lf61}@Z+r91W z-rY8=N^4k?Hm}CW)HE#(oe^5wbCC$>RicONrspS5?prl>!IE8~r<|&9G0q~vhCeB? zDYroSOpU@Kh1oH#ODvolJF1i%>M2moEJD+c5VIznS2?PvxGG1HSXZ%h@(nb3a*STF zwnsTG^^8jxrgKu|DTmo%eu0HXs&jRbcu|8^1MUFze>HjR*~uK$VAbH``RaH?{+^Oy zsFrF-9i!PN4{4#HFEhfrRb-Hm2h|{Yt0JjetRjhs8pw%gTC1T_)$KnK{HN3;HE>NH z&aAfR3CVi0kkhh8Tea>4<2U!%1+!`lQ!Mj%*FHzJRiqN_l+cHaIBJZ10`W;y?Sl);Z?r~Zj)Ze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1<^n*0lyY22%_%AI{O9~aO6mhTo{Gy83nn@iiBoo0FKv?CghVs)Z+p0K zx-2V&_sX)h@Wl`Ewpp7bz3r4{o$@>lmnI97-^)ko;ei9RcOVURQSe>+oc&w*kES`p zqTDYQ`pfcng|lV3n?6yx3YQk;{q*U$o&1WY@X>j>w@~^~_U9EZeWTn*US&_i*hp;m Lh0o?^7iH-$)+@x5 diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx new file mode 100644 index 00000000..baeb48a5 --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx @@ -0,0 +1,295 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OnlineEditing.aspx.cs" Inherits="FineUIPro.Web.AttachFile.OnlineEditing" %> + + + + + + + + + + Spire.Office + + + + + + + + + + +
+
+ +
+
+ +
+
+
+
+ + + + diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs new file mode 100644 index 00000000..6e839f74 --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.cs @@ -0,0 +1,74 @@ +using BLL; +using RestSharp; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace FineUIPro.Web.AttachFile +{ + public partial class OnlineEditing : System.Web.UI.Page + { + #region 定义参数 + public string UserId + { + get + { + return (string)ViewState["UserId"]; + } + set + { + ViewState["UserId"] = value; + } + } + public string UserName + { + get + { + return (string)ViewState["UserName"]; + } + set + { + ViewState["UserName"] = value; + } + } + public string PCUrl + { + get + { + return (string)ViewState["PCUrl"]; + } + set + { + ViewState["PCUrl"] = value; + } + } + public string CanSave + { + get + { + return (string)ViewState["CanSave"]; + } + set + { + ViewState["CanSave"] = value; + } + } + #endregion + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + UserId = Request.Params["UserId"]; + CanSave = Request.Params["CanSave"]; + PCUrl = Request.Params["PCUrl"]; + UserName=BLL.Person_PersonsService.GetPersonsNameById(UserId); + CanSave = "true"; + } + } + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs new file mode 100644 index 00000000..ec9d1dd5 --- /dev/null +++ b/SGGL/FineUIPro.Web/AttachFile/OnlineEditing.aspx.designer.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.AttachFile +{ + + + public partial class OnlineEditing + { + } +} diff --git a/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs b/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs index 62c4f202..7fa8c579 100644 --- a/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/Plan/MainPlan.aspx.cs @@ -395,7 +395,10 @@ namespace FineUIPro.Web.CQMS.Plan { if (!string.IsNullOrEmpty(Grid1.SelectedRowID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", Grid1.SelectedRowID, "查看 -"))); + var ins = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(Grid1.SelectedRowID); + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/OnlineEditing.aspx?UserId={0}&PCUrl={1}", this.CurrUser.PersonId, ins.FilePath))); + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", Grid1.SelectedRowID, "查看 -"))); PageContext.RegisterStartupScript(Window1.GetHideReference()); } diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index 274887f7..10841f40 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -233,6 +233,7 @@ + @@ -5780,6 +5781,13 @@ Look.aspx + + OnlineEditing.aspx + ASPXCodeBehind + + + OnlineEditing.aspx + player.aspx ASPXCodeBehind diff --git a/SGGL/WebAPI/Controllers/FileUploadController.cs b/SGGL/WebAPI/Controllers/FileUploadController.cs index d75f4e5e..a6584bff 100644 --- a/SGGL/WebAPI/Controllers/FileUploadController.cs +++ b/SGGL/WebAPI/Controllers/FileUploadController.cs @@ -3,7 +3,9 @@ using System; using System.Configuration; using System.Drawing; using System.IO; +using System.Net.Http; using System.Text; +using System.Threading.Tasks; using System.Web; using System.Web.Http; @@ -136,7 +138,45 @@ namespace WebAPI.Controllers return responeData; } #endregion + /// + /// 在线编辑回调保存文件 + /// + /// + /// + [HttpPost] + public async Task DownloadDocument([FromBody] Model.ToDoItem toDoItem) + { + HttpClient _httpClient = new HttpClient(); + try + { + // 发送 GET 请求以获取文件内容 + var response = await _httpClient.GetAsync(toDoItem.UrlStr); + response.EnsureSuccessStatusCode(); + string savePath = ""; + if (!string.IsNullOrEmpty(toDoItem.PCUrl)) + { + savePath = ConfigurationManager.AppSettings["localRoot"]+toDoItem.PCUrl; + + } + if (savePath != null) + { + // 将文件内容保存到本地 + using (var fileStream = File.Create(savePath)) + { + await response.Content.CopyToAsync(fileStream); + } + + Console.WriteLine("文件已成功下载并保存到本地。"); + + } + + } + catch (Exception ex) + { + Console.WriteLine($"下载文件时出现错误:{ex.Message}"); + } + } #region 附件上传 /// /// 附件上传 diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj index 48bf43b9..1267a121 100644 --- a/SGGL/WebAPI/WebAPI.csproj +++ b/SGGL/WebAPI/WebAPI.csproj @@ -301,6 +301,7 @@ +