diff --git a/.vs/SGGL_SeDin/v17/.wsuo b/.vs/SGGL_SeDin/v17/.wsuo index 761316d1..809a674e 100644 Binary files a/.vs/SGGL_SeDin/v17/.wsuo and b/.vs/SGGL_SeDin/v17/.wsuo differ 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 @@ +