1
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.DCGL.ServerCheck
|
||||
{
|
||||
public partial class CheckRectifyEdit : PageBase
|
||||
{
|
||||
private static string proType;
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
@@ -40,6 +43,7 @@ namespace FineUIPro.Web.DCGL.ServerCheck
|
||||
{
|
||||
this.GetButtonPower();
|
||||
this.CheckRectifyId = Request.Params["CheckRectifyId"];
|
||||
proType = Request.Params["proType"] ?? string.Empty;
|
||||
if (!string.IsNullOrEmpty(this.CheckRectifyId))
|
||||
{
|
||||
var rectify = Funs.DB.DCGL_Check_CheckRectify.FirstOrDefault(x => x.CheckRectifyId == this.CheckRectifyId);
|
||||
@@ -72,8 +76,8 @@ namespace FineUIPro.Web.DCGL.ServerCheck
|
||||
Grid1.DataBind();
|
||||
//if (CheckRectifyItems.FirstOrDefault(x => x.DangerPoint.Length > 1) == null)
|
||||
//{
|
||||
this.Grid1.Columns[1].Hidden = true;
|
||||
this.Grid1.Columns[2].Hidden = true;
|
||||
//this.Grid1.Columns[1].Hidden = true;
|
||||
//this.Grid1.Columns[2].Hidden = true;
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -95,11 +99,29 @@ namespace FineUIPro.Web.DCGL.ServerCheck
|
||||
|
||||
if (attachFile != null)
|
||||
{
|
||||
CNCECPath = !string.IsNullOrWhiteSpace(CNCECPath) ? CNCECPath : "https://qhse.cncecoa.com/QHSE/";
|
||||
url = BLL.UploadAttachmentService.ShowImage(CNCECPath, attachFile.AttachUrl);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取整改后图片(放于Img中)
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertImaUrlByImage(object id)
|
||||
{
|
||||
string url = string.Empty;
|
||||
string httpUrl = string.Empty;
|
||||
httpUrl = Funs.SGGLUrl;
|
||||
var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == id.ToString());
|
||||
if (attachFile != null)
|
||||
{
|
||||
url = BLL.UploadAttachmentService.ShowImage(httpUrl, attachFile.AttachUrl);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
@@ -207,7 +229,14 @@ namespace FineUIPro.Web.DCGL.ServerCheck
|
||||
if (buttonList.Contains(BLL.Const.BtnSave))
|
||||
{
|
||||
this.btnSave.Hidden = false;
|
||||
this.btnSaveUp.Hidden = false;
|
||||
if (proType == "1")
|
||||
{
|
||||
this.btnSaveUp.Hidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.btnSaveUp.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,5 +253,85 @@ namespace FineUIPro.Web.DCGL.ServerCheck
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 导出
|
||||
|
||||
/// <summary>
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOutExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Response.ClearContent();
|
||||
var unitProjectName = $"{this.lbUnitName.Text}{this.lbProjectName.Text}";
|
||||
string filename = Funs.GetNewFileName();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(unitProjectName + "隐患问题表" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||||
Response.ContentType = "application/excel";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
this.Grid1.PageSize = this.Grid1.RecordCount;
|
||||
//this.BindGrid();
|
||||
Response.Write(GetGridTableHtml(Grid1));
|
||||
Response.End();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出方法
|
||||
/// </summary>
|
||||
/// <param name="grid"></param>
|
||||
/// <returns></returns>
|
||||
private string GetGridTableHtml(Grid grid)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
||||
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
||||
sb.Append("<tr>");
|
||||
sb.AppendFormat("<td colspan=\"11\" style=\"line-height:50px;text-align:center;vertical-align:middle;\">集团督查检查隐患列表</td>", "");
|
||||
sb.Append("</tr>");
|
||||
sb.Append("<tr>");
|
||||
foreach (GridColumn column in grid.Columns)
|
||||
{
|
||||
if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "Punish" && column.ColumnID != "Del" && column.ColumnID != "CheckRectifyItemId" && column.ColumnID != "WindowAtt1")
|
||||
{
|
||||
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
||||
}
|
||||
}
|
||||
sb.Append("</tr>");
|
||||
foreach (GridRow row in grid.Rows)
|
||||
{
|
||||
sb.Append("<tr>");
|
||||
foreach (GridColumn column in grid.Columns)
|
||||
{
|
||||
if (column.ColumnID != "ckbIsSelected" && column.ColumnID != "Punish" && column.ColumnID != "Del" && column.ColumnID != "CheckRectifyItemId" && column.ColumnID != "WindowAtt1")
|
||||
{
|
||||
string html = row.Values[column.ColumnIndex].ToString();
|
||||
if (column.ColumnID == "tfPageIndex")
|
||||
{
|
||||
html = (row.FindControl("lblPageIndex") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfRiskExists")
|
||||
{
|
||||
html = (row.FindControl("lbRiskExists") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfImageUrl1")
|
||||
{
|
||||
html = (row.FindControl("lbImageUrl1") as AspNet.Label).Text;
|
||||
}
|
||||
if (column.ColumnID == "tfImageUrl2")
|
||||
{
|
||||
html = (row.FindControl("tfImageUrl2") as AspNet.Label).Text;
|
||||
}
|
||||
sb.AppendFormat("<td>{0}</td>", html);
|
||||
}
|
||||
}
|
||||
sb.Append("</tr>");
|
||||
}
|
||||
sb.Append("</table>");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user