2023-03-14 增加公司模板设置界面

This commit is contained in:
2023-03-14 22:04:28 +08:00
parent a6909295b5
commit dabe09d39f
23 changed files with 1414 additions and 52 deletions
+1 -1
View File
@@ -36,7 +36,7 @@
<f:Button ID="btnNew" Icon="Add" EnablePostBack="true" Hidden="true"
runat="server">
</f:Button>
<f:Button ID="imgBtnFile" Text="文件" ToolTip="查看" Icon="PageWhiteWord" runat="server"
<f:Button ID="imgBtnFile" Text="查看文件" ToolTip="查看" Icon="PageWhiteWord" runat="server"
OnClick="imgBtnFile_Click">
</f:Button>
</Items>
@@ -57,7 +57,8 @@
<f:Button ID="imgBtnFile" Text="文件" ToolTip="上传及查看" Icon="TableCell" runat="server"
OnClick="imgBtnFile_Click">
</f:Button>
<f:DropDownList ID="drpCompanyTemplate" runat="server" Width="300px" Hidden="true" Label="公司模板" LabelAlign="Right" EnableEdit="true">
</f:DropDownList>
<f:Button ID="btnEditWord" Icon="PageWhiteWord" OnClick="btnEditWord_Click" runat="server" Text="编辑文档" ToolTip="编辑文档" >
</f:Button>
</Items>
@@ -58,6 +58,8 @@ namespace FineUIPro.Web.CQMS.Plan
this.drpPerson.DataSource = (from x in Funs.DB.Person_Persons where x.UnitId == Const.UnitId_SEDIN && x.DepartId == Const.Depart_constructionId select x).ToList();
this.drpPerson.DataBind();
Funs.FineUIPleaseSelect(this.drpPerson);
BLL.Base_CompanytemplateService.InitBase_CompanyTemplateDownList(drpCompanyTemplate, true);
IsHiddendrpCompanyTemplate();
if (!string.IsNullOrEmpty(MainPlanId))
{
Model.Plan_MainPlan MainPlan = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
@@ -484,25 +486,61 @@ namespace FineUIPro.Web.CQMS.Plan
if (!Directory.Exists(newPath))
{
Directory.CreateDirectory(newPath);
}
if (e.EventArgument == "Yes")
{
if (!File.Exists(path))
{
File.Copy(rootPath + Const.CQMSPlanTemplateUrl, path);
}
}
else if (e.EventArgument == "No")
if (drpCompanyTemplate.SelectedValue!=Const._Null)
{
if (!File.Exists(path))
{
var stream= File.Create(path);
stream.Close();
}
var template = BLL.Base_CompanytemplateService.GetBase_CompanyTemplateById(drpCompanyTemplate.SelectedValue);
File.Copy(rootPath + template.FilePath, path);
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", MainPlanId, "查看 -")));
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
}
private void GetCompanyTemplate()
{
string rootPath = Funs.RootPath;
var model = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
string filepath = model.FilePath;
string path = rootPath + filepath;
DirectoryInfo pathInfo = new DirectoryInfo(path);
string newPath = pathInfo.Parent.FullName;
if (!Directory.Exists(newPath))
{
Directory.CreateDirectory(newPath);
}
if (drpCompanyTemplate.SelectedValue != Const._Null)
{
var template = BLL.Base_CompanytemplateService.GetBase_CompanyTemplateById(drpCompanyTemplate.SelectedValue);
File.Copy(rootPath + template.FilePath, path);
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSMainPlan", MainPlanId, "查看 -")));
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
}
/// <summary>
/// 是否隐藏选择模板
/// </summary>
protected void IsHiddendrpCompanyTemplate()
{
if (!string.IsNullOrEmpty(MainPlanId))
{
Model.Plan_MainPlan MainPlan = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
if (!File.Exists(Funs.RootPath + MainPlan.FilePath))
{
drpCompanyTemplate.Hidden= false;
}
}
else
{
drpCompanyTemplate.Hidden = false;
}
}
protected void btnEditWord_Click(object sender, EventArgs e)
{
@@ -512,12 +550,12 @@ namespace FineUIPro.Web.CQMS.Plan
Model.Plan_MainPlan MainPlan = BLL.CQMS_MainPlanService.GetMainPlanByMainPlanId(MainPlanId);
if (!File.Exists(Funs.RootPath + MainPlan.FilePath))
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
String.Empty,
MessageBoxIcon.Question,
PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
PageManager1.GetCustomEventReference("No")));
GetCompanyTemplate();
//PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
// String.Empty,
// MessageBoxIcon.Question,
// PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
// PageManager1.GetCustomEventReference("No")));
}
else
{
@@ -529,14 +567,9 @@ namespace FineUIPro.Web.CQMS.Plan
else
{
SaveMainPlan("save");
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
String.Empty,
MessageBoxIcon.Question,
PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
PageManager1.GetCustomEventReference("No")));
GetCompanyTemplate();
}
//PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}", filepath, "查看 -")));
}
//PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}", filepath, "查看 -")));
}
}
}
@@ -113,6 +113,15 @@ namespace FineUIPro.Web.CQMS.Plan
/// </remarks>
protected global::FineUIPro.Button imgBtnFile;
/// <summary>
/// drpCompanyTemplate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpCompanyTemplate;
/// <summary>
/// btnEditWord 控件。
/// </summary>
+1 -1
View File
@@ -96,7 +96,7 @@
</f:Button>
<f:Button ID="btnNew" ToolTip="编制" Icon="Add" EnablePostBack="false" runat="server">
</f:Button>
<f:Button ID="imgBtnFile" Text="文件" ToolTip="查看" Icon="PageWhiteWord" runat="server"
<f:Button ID="imgBtnFile" Text="查看文件" ToolTip="查看" Icon="PageWhiteWord" runat="server"
OnClick="imgBtnFile_Click">
</f:Button>
</Items>
@@ -117,6 +117,9 @@
<f:Label runat="server" Text="<span style='color:red;'>*</span>附件:" EncodeText="false" ShowRedStar="true" Label="附件:" CssStyle="padding-left:48px" Width="110px" CssClass="marginr" ShowLabel="false" ></f:Label>
<f:Button ID="imgBtnFile" Text="附件" ToolTip="上传及查看" Icon="TableCell" OnClick="imgBtnFile_Click" runat="server">
</f:Button>
<f:DropDownList ID="drpCompanyTemplate" runat="server" Width="300px" Hidden="true" Label="公司模板" LabelAlign="Right" EnableEdit="true" >
</f:DropDownList>
<f:Button ID="btnEditWord" Icon="PageWhiteWord" OnClick="btnEditWord_Click" runat="server" Text="编辑文档" ToolTip="编辑文档" >
</f:Button>
</Items>
@@ -71,6 +71,8 @@ namespace FineUIPro.Web.CQMS.Plan
//CommonService.GetAllButtonList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.SubPlanMenuId);
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
SubPlanId = Request.Params["SubPlanId"];
BLL.Base_CompanytemplateService.InitBase_CompanyTemplateDownList(drpCompanyTemplate, true);
IsHiddendrpCompanyTemplate();
if (!string.IsNullOrWhiteSpace(SubPlanId))
{
HFSubPlanId.Text = SubPlanId;
@@ -832,11 +834,8 @@ namespace FineUIPro.Web.CQMS.Plan
if (!File.Exists(Funs.RootPath + model.FilePath))
{
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
String.Empty,
MessageBoxIcon.Question,
PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
PageManager1.GetCustomEventReference("No")));
GetCompanyTemplate();
}
else
{
@@ -849,13 +848,54 @@ namespace FineUIPro.Web.CQMS.Plan
{
SaveSubPlan("save");
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否使用公司模板?",
String.Empty,
MessageBoxIcon.Question,
PageManager1.GetCustomEventReference("Yes"), // 第一个参数 false 用来指定当前不是AJAX请求
PageManager1.GetCustomEventReference("No")));
GetCompanyTemplate();
}
//PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}", filepath, "查看 -")));
}
private void GetCompanyTemplate()
{
string rootPath = Funs.RootPath;
var model = BLL.CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
string filepath = model.FilePath;
string path = rootPath + filepath;
DirectoryInfo pathInfo = new DirectoryInfo(path);
string newPath = pathInfo.Parent.FullName;
if (!Directory.Exists(newPath))
{
Directory.CreateDirectory(newPath);
}
if (drpCompanyTemplate.SelectedValue != Const._Null)
{
var template = BLL.Base_CompanytemplateService.GetBase_CompanyTemplateById(drpCompanyTemplate.SelectedValue);
File.Copy(rootPath + template.FilePath, path);
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSSubPlan", SubPlanId, "查看 -")));
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
}
protected void IsHiddendrpCompanyTemplate()
{
if (!string.IsNullOrEmpty(SubPlanId))
{
Model.Plan_SubPlan SubPlan = BLL.CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
if (!File.Exists(Funs.RootPath + SubPlan.FilePath))
{
drpCompanyTemplate.Hidden = false;
}
}
else
{
drpCompanyTemplate.Hidden = false;
}
}
}
}
@@ -158,6 +158,15 @@ namespace FineUIPro.Web.CQMS.Plan
/// </remarks>
protected global::FineUIPro.Button imgBtnFile;
/// <summary>
/// drpCompanyTemplate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpCompanyTemplate;
/// <summary>
/// btnEditWord 控件。
/// </summary>