This commit is contained in:
2025-04-07 17:43:30 +08:00
commit 8a2c192129
12175 changed files with 2742596 additions and 0 deletions
@@ -0,0 +1,124 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SafetyOrganization.aspx.cs"
Inherits="FineUIPro.Web.HSSE.SecuritySystem.SafetyOrganization" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>安全组织机构</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
Layout="HBox" EnableCollapse="true" Width="300" Title="安全组织机构" TitleToolTip="安全组织机构"
ShowBorder="true" ShowHeader="true" AutoScroll="true" BodyPadding="5px" IconFont="ArrowCircleLeft">
<Items>
<f:Tree ID="trSafetyOrganization" EnableCollapse="true" ShowHeader="false" ShowBorder="false"
EnableIcons="true" Title="安全组织机构" OnNodeCommand="trSafetyOrganization_NodeCommand"
AutoLeafIdentification="true" AutoScroll="true" runat="server" EnableTextSelection="True"
EnableSingleClickExpand="true">
</f:Tree>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="安全组织机构"
TitleToolTip="安全组织机构" AutoScroll="true">
<Items>
<f:Grid ID="Grid1" Width="870px" ShowBorder="true" ShowHeader="false" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="PersonId" AllowSorting="true"
OnSort="Grid1_Sort" SortField="CardNo" SortDirection="ASC" EnableColumnLines="true" DataIDField="PersonId" ForceFit="true"
AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:Button ID="btnNewItem" ToolTip="新增" Icon="Add" runat="server" OnClick="btnNewItem_Click"
Hidden="true">
</f:Button>
<f:Button ID="btnEditItem" ToolTip="编辑" Icon="Pencil" runat="server" OnClick="btnEditItem_Click"
Hidden="true">
</f:Button>
<f:Button ID="btnDeleteItem" ToolTip="删除" Icon="Delete" ConfirmText="确定删除当前数据?" OnClick="btnDeleteItem_Click"
Hidden="true" runat="server">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:TemplateField ColumnID="tfNumber" Width="55px" HeaderText="序号" HeaderTextAlign="Center"
TextAlign="Center">
<ItemTemplate>
<asp:Label ID="lblNumber" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="150px" ColumnID="WorkPostName" DataField="WorkPostName" SortField="WorkPostName" FieldType="String"
HeaderTextAlign="Center" TextAlign="Left" HeaderText="岗位">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="PersonName" DataField="PersonName" SortField="PersonName"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" HeaderText="姓名">
</f:RenderField>
<%-- <f:RenderField Width="120px" ColumnID="Telephone" DataField="Telephone" SortField="Telephone"
FieldType="String" HeaderTextAlign="Center" TextAlign="Right" HeaderText="电话">
</f:RenderField>--%>
<f:RenderField Width="110px" ColumnID="Telephone" DataField="Telephone" SortField="Telephone"
FieldType="String" HeaderTextAlign="Center" TextAlign="Right" HeaderText="手机">
</f:RenderField>
<%-- <f:RenderField Width="110px" ColumnID="EMail" DataField="EMail" SortField="EMail"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" HeaderText="邮箱">
</f:RenderField>--%>
<f:RenderField Width="150px" ColumnID="Remark" DataField="Remark" SortField="Remark" FieldType="String"
HeaderTextAlign="Center" TextAlign="Left" HeaderText="职责">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
</Items>
</f:Panel>
<f:Window ID="Window2" Title="编辑" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="true" runat="server" OnClose="Window2_Close" IsModal="true"
Width="800px" Height="400px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
runat="server" Text="编辑" Hidden="true" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Icon="Delete" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除"
Hidden="true">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,353 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.SecuritySystem
{
public partial class SafetyOrganization : PageBase
{
#region 定义项
/// <summary>
/// 主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
this.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
{
this.ProjectId = Request.Params["projectId"];
}
////权限按钮方法
this.GetButtonPower();
this.InitTreeMenu();
}
}
#region 加载树
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
this.trSafetyOrganization.Nodes.Clear();
TreeNode rootNode = new TreeNode
{
Text = "安全组织机构",
NodeID = "0",
Expanded = true
};
this.trSafetyOrganization.Nodes.Add(rootNode);
BoundTree(rootNode.Nodes);
}
/// <summary>
/// 加载树
/// </summary>
/// <param name="nodes"></param>
/// <param name="menuId"></param>
private void BoundTree(TreeNodeCollection nodes)
{
var unitLists = BLL.ProjectUnitService.GetProjectUnitListByProjectId(this.ProjectId);
if (unitLists.Count() > 0)
{
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
{
unitLists = unitLists.Where(x => x.UnitId == this.CurrUser.UnitId).ToList();
}
TreeNode tn = null;
foreach (var dr in unitLists)
{
tn = new TreeNode();
var unitName = BLL.UnitService.GetUnitNameByUnitId(dr.UnitId);
if (unitName != null)
{
tn.Text = unitName;
}
tn.NodeID = dr.UnitId;
tn.EnableClickEvent = true;
var gunitType = BLL.ConstValue.GetConstByConstValueAndGroupId(dr.UnitType, BLL.ConstValue.Group_ProjectUnitType);
if (gunitType != null)
{
tn.ToolTip = gunitType.ConstText + ":" + unitName;
}
//tn.ToolTip = "编号:" + dr.SafetyOrganizationCode + ";<br/>机构名称:" + dr.SafetyOrganizationName + ";<br/>职责:" + dr.Duties + ";<br/>组成文件:" + dr.BundleFile + ";<br/>机构人员:" + dr.AgencyPersonnel;
nodes.Add(tn);
}
}
}
#endregion
#region 绑定Grid
/// <summary>
/// 绑定Grid
/// </summary>
private void BindGrid()
{
string unitIdSelect = string.Empty;
if (this.trSafetyOrganization.SelectedNode != null)
{
unitIdSelect = this.trSafetyOrganization.SelectedNode.NodeID;
}
string strSql = @"SELECT p.PersonId,p.CardNo,p.PersonName,p.ProjectId,p.UnitId,w.WorkPostName,p.Telephone,w.Remark
FROM SitePerson_Person AS P
LEFT JOIN Base_WorkPost AS W ON P.WorkPostId =W.WorkPostId
WHERE (w.PostType='1'or w.PostType='4') AND p.ProjectId= '" + this.ProjectId + "' AND p.UnitId='" + unitIdSelect + "'";
List<SqlParameter> listStr = new List<SqlParameter>();
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region 获取按钮权限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
//var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.ProjectSafetyOrganizationMenuId);
//if (buttonList.Count() > 0)
//{
// if (buttonList.Contains(BLL.Const.BtnAdd))
// {
// this.btnNewItem.Hidden = false;
// }
// if (buttonList.Contains(BLL.Const.BtnModify))
// {
// this.btnEditItem.Hidden = false;
// this.btnMenuEdit.Hidden = false;
// }
// if (buttonList.Contains(BLL.Const.BtnDelete))
// {
// this.btnDeleteItem.Hidden = false;
// this.btnMenuDelete.Hidden = false;
// }
//}
}
#endregion
#region GV 排序 翻页事件
/// <summary>
/// Grid1排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
BindGrid();
}
/// <summary>
/// 分页下拉选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 页码变化事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
#endregion
#region GV 编辑 事件
/// <summary>
/// 双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
this.EditData();
}
/// <summary>
/// 编辑明细按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnEditItem_Click(object sender, EventArgs e)
{
this.EditData();
}
/// <summary>
/// 右键编辑事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
this.EditData();
}
/// <summary>
/// 编辑数据方法
/// </summary>
private void EditData()
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("SafetyOrganizationEdit.aspx?SafetyOrganizationId={0}", Grid1.SelectedRowID, "编辑 - ")));
}
/// <summary>
/// 增加明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNewItem_Click(object sender, EventArgs e)
{
if (this.trSafetyOrganization.SelectedNode != null)
{
if (this.trSafetyOrganization.SelectedNode.Nodes.Count == 0 && !string.IsNullOrEmpty(this.trSafetyOrganization.SelectedNode.NodeID) && this.trSafetyOrganization.SelectedNode.NodeID != "0")
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("SafetyOrganizationEdit.aspx?UnitId={0}", this.trSafetyOrganization.SelectedNode.NodeID, "编辑 - ")));
}
else
{
ShowNotify("请选择末级节点!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 删除明细按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDeleteItem_Click(object sender, EventArgs e)
{
this.DeleteData();
}
/// <summary>
/// 右键删除事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
this.DeleteData();
}
/// <summary>
/// 删除方法
/// </summary>
private void DeleteData()
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
//var getV = BLL.SafetyOrganizationService.GetSafetyOrganizationById(rowID);
//if (getV != null)
//{
// BLL.LogService.AddSys_Log(this.CurrUser, getV.Names, getV.SafetyOrganizationId, BLL.Const.ProjectSafetyOrganizationMenuId, BLL.Const.BtnDelete);
// BLL.SafetyOrganizationService.DeleteSafetyOrganization(rowID);
//}
}
BindGrid();
ShowNotify("删除数据成功!");
}
}
#endregion
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window2_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
/// <summary>
/// Tree点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void trSafetyOrganization_NodeCommand(object sender, TreeCommandEventArgs e)
{
BindGrid();
}
#region 导出按钮
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
string filename = Funs.GetNewFileName();
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("安全组织机构" + filename, System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Grid1.PageSize = 5000;
this.BindGrid();
Response.Write(GetGridTableHtml(Grid1));
Response.End();
}
#endregion
}
}
@@ -0,0 +1,195 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.SecuritySystem {
public partial class SafetyOrganization {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// trSafetyOrganization 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree trSafetyOrganization;
/// <summary>
/// panelCenterRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// btnNewItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNewItem;
/// <summary>
/// btnEditItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnEditItem;
/// <summary>
/// btnDeleteItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDeleteItem;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// lblNumber 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumber;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,63 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SafetyOrganizationEdit.aspx.cs"
Inherits="FineUIPro.Web.HSSE.SecuritySystem.SafetyOrganizationItemEdit" Async="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>编辑安全组织机构明细</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtSortIndex" runat="server" Label="序号" MaxLength="50">
</f:TextBox>
<f:TextBox ID="txtPost" runat="server" Label="职务" Required="true" ShowRedStar="true"
MaxLength="50" FocusOnPageLoad="true">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtNames" runat="server" Label="姓名" Required="true" ShowRedStar="true"
MaxLength="10">
</f:TextBox>
<f:TextBox ID="txtTelephone" runat="server" Label="电话" MaxLength="20">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtMobilePhone" runat="server" Label="手机" MaxLength="20">
</f:TextBox>
<f:TextBox ID="txtEMail" runat="server" Label="邮箱" MaxLength="50">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtDuty" runat="server" Label="职责" MaxLength="2000" Height="72px">
</f:TextArea>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
</body>
</html>
@@ -0,0 +1,106 @@
using BLL;
using System;
namespace FineUIPro.Web.HSSE.SecuritySystem
{
public partial class SafetyOrganizationItemEdit : PageBase
{
#region 定义项
public string SafetyOrganizationId
{
get
{
return (string)ViewState["SafetyOrganizationId"];
}
set
{
ViewState["SafetyOrganizationId"] = value;
}
}
public string UnitId
{
get
{
return (string)ViewState["UnitId"];
}
set
{
ViewState["UnitId"] = value;
}
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.SafetyOrganizationId = Request.Params["SafetyOrganizationId"];
this.UnitId = Request.Params["UnitId"];
if (!string.IsNullOrEmpty(this.SafetyOrganizationId))
{
var item = BLL.SafetyOrganizationService.GetSafetyOrganizationById(this.SafetyOrganizationId);
if (item != null)
{
this.txtPost.Text = item.Post;
this.txtNames.Text = item.Names;
this.txtTelephone.Text = item.Telephone;
this.txtMobilePhone.Text = item.MobilePhone;
this.txtEMail.Text = item.EMail;
this.txtDuty.Text = item.Duty;
this.txtSortIndex.Text = item.SortIndex;
}
}
if (Request.Params["value"] == "0")
{
this.btnSave.Hidden=true;
}
}
}
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
Model.SecuritySystem_SafetyOrganization newItem = new Model.SecuritySystem_SafetyOrganization
{
Post = this.txtPost.Text.Trim(),
Names = this.txtNames.Text.Trim(),
Telephone = this.txtTelephone.Text.Trim(),
MobilePhone = this.txtMobilePhone.Text.Trim(),
EMail = this.txtEMail.Text.Trim(),
Duty = this.txtDuty.Text.Trim(),
SortIndex = this.txtSortIndex.Text.Trim()
};
if (string.IsNullOrEmpty(this.SafetyOrganizationId))
{
newItem.ProjectId = this.CurrUser.LoginProjectId;
newItem.UnitId = this.UnitId;
newItem.SafetyOrganizationId = this.SafetyOrganizationId;
this.SafetyOrganizationId = SQLHelper.GetNewID(typeof(Model.SecuritySystem_SafetyOrganization));
newItem.SafetyOrganizationId = this.SafetyOrganizationId;
BLL.SafetyOrganizationService.AddSafetyOrganization(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Names, newItem.SafetyOrganizationId, BLL.Const.ProjectSafetyOrganizationMenuId, BLL.Const.BtnAdd);
}
else
{
newItem.SafetyOrganizationId = this.SafetyOrganizationId;
BLL.SafetyOrganizationService.UpdateSafetyOrganization(newItem);
BLL.LogService.AddSys_Log(this.CurrUser, newItem.Names, newItem.SafetyOrganizationId,BLL.Const.ProjectSafetyOrganizationMenuId,BLL.Const.BtnModify);
}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
}
@@ -0,0 +1,132 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.SecuritySystem {
public partial class SafetyOrganizationItemEdit {
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtSortIndex 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtSortIndex;
/// <summary>
/// txtPost 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtPost;
/// <summary>
/// txtNames 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtNames;
/// <summary>
/// txtTelephone 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtTelephone;
/// <summary>
/// txtMobilePhone 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtMobilePhone;
/// <summary>
/// txtEMail 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtEMail;
/// <summary>
/// txtDuty 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtDuty;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
}
}
@@ -0,0 +1,72 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SafetyOrganizationPic.aspx.cs"
Inherits="FineUIPro.Web.HSSE.SecuritySystem.SafetyOrganizationPic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>安全组织机构</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
Layout="HBox" EnableCollapse="true" Width="300" Title="安全组织机构" TitleToolTip="安全组织机构"
ShowBorder="true" ShowHeader="true" AutoScroll="true" BodyPadding="5px" IconFont="ArrowCircleLeft">
<Items>
<f:Tree ID="trSafetyOrganization" EnableCollapse="true" ShowHeader="false" ShowBorder="false"
EnableIcons="true" Title="安全组织机构" OnNodeCommand="trSafetyOrganization_NodeCommand"
AutoLeafIdentification="true" AutoScroll="true" runat="server" EnableTextSelection="True"
EnableSingleClickExpand="true">
</f:Tree>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="安全组织机构"
TitleToolTip="安全组织机构" AutoScroll="true">
<Items>
<f:SimpleForm ID="SimpleForm1" IsFluid="true" BodyPadding="10px" EnableCollapse="false"
ShowBorder="true" Title="组织机构图" ShowHeader="true" runat="server">
<Tools>
<f:Tool runat="server" ID="btnDeleteItem" Icon="Delete" Text="删除组织机构图" EnablePostBack="true" OnClick="btnDelete_Click">
</f:Tool>
<f:Tool runat="server" ID="btnNewItem" IconFont="_Upload" Text="上传组织机构图" EnablePostBack="false">
<Listeners>
<f:Listener Event="click" Handler="onUploadClick" />
</Listeners>
</f:Tool>
</Tools>
<Items>
<f:FileUpload runat="server" ID="filePhoto" ShowRedStar="false" ShowEmptyLabel="true" LabelWidth="0"
ButtonText="上传组织机构图" ButtonOnly="true" Required="false" ButtonIcon="ImageAdd" Hidden="true"
AutoPostBack="true" OnFileSelected="filePhoto_FileSelected">
</f:FileUpload>
<f:Image ID="imgPhoto" CssClass="photo" LabelWidth="0" ShowEmptyLabel="true" runat="server">
</f:Image>
</Items>
</f:SimpleForm>
</Items>
</f:Panel>
</Items>
</f:Panel>
</form>
<script type="text/javascript">
var filePhotoClientID = '<%= filePhoto.ClientID %>';
function onUploadClick(event) {
F(filePhotoClientID).el.find('.f-field-fileupload-fileinput').click();
}
</script>
</body>
</html>
@@ -0,0 +1,236 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web.UI.WebControls;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Newtonsoft.Json.Linq;
using System.Configuration;
namespace FineUIPro.Web.HSSE.SecuritySystem
{
public partial class SafetyOrganizationPic : PageBase
{
#region 定义项
/// <summary>
/// 主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
{
this.ProjectId = Request.Params["projectId"];
}
////权限按钮方法
this.GetButtonPower();
this.InitTreeMenu();
}
}
#region 加载树
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
this.trSafetyOrganization.Nodes.Clear();
TreeNode rootNode = new TreeNode
{
Text = "安全组织机构",
NodeID = "0",
Expanded = true
};
this.trSafetyOrganization.Nodes.Add(rootNode);
BoundTree(rootNode.Nodes);
}
/// <summary>
/// 加载树
/// </summary>
/// <param name="nodes"></param>
/// <param name="menuId"></param>
private void BoundTree(TreeNodeCollection nodes)
{
var unitLists = BLL.ProjectUnitService.GetProjectUnitListByProjectId(this.ProjectId);
if (unitLists.Count() > 0)
{
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
{
unitLists = unitLists.Where(x => x.UnitId == this.CurrUser.UnitId).ToList();
}
TreeNode tn = null;
foreach (var dr in unitLists)
{
tn = new TreeNode();
var unitName = BLL.UnitService.GetUnitNameByUnitId(dr.UnitId);
if (unitName != null)
{
tn.Text = unitName;
}
tn.NodeID = dr.UnitId;
tn.EnableClickEvent = true;
var gunitType = BLL.ConstValue.GetConstByConstValueAndGroupId(dr.UnitType, BLL.ConstValue.Group_ProjectUnitType);
if (gunitType != null)
{
tn.ToolTip = gunitType.ConstText + ":" + unitName;
}
//tn.ToolTip = "编号:" + dr.SafetyOrganizationCode + ";<br/>机构名称:" + dr.SafetyOrganizationName + ";<br/>职责:" + dr.Duties + ";<br/>组成文件:" + dr.BundleFile + ";<br/>机构人员:" + dr.AgencyPersonnel;
nodes.Add(tn);
}
}
}
#endregion
#region 获取按钮权限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.ProjectSafetyOrganizationMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNewItem.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnDeleteItem.Hidden = false;
}
}
}
#endregion
/// <summary>
/// 增加明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDelete_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(trSafetyOrganization.SelectedNodeID))
{
var unit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == trSafetyOrganization.SelectedNodeID);
unit.OrganizationPic =null;
Funs.DB.SubmitChanges();
this.imgPhoto.ImageUrl =null;
}
else
{
Alert.ShowInTop("请选择一个单位!", MessageBoxIcon.Warning);
}
}
protected void filePhoto_FileSelected(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(trSafetyOrganization.SelectedNodeID))
{
if (filePhoto.HasFile)
{
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
if (string.IsNullOrEmpty(rootUrl))
{
rootUrl = Funs.RootPath;
}
string fileName = filePhoto.ShortFileName;
if (!ValidateFileType(fileName))
{
// 清空文件上传控件
filePhoto.Reset();
ShowNotify("无效的文件类型!");
return;
}
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
filePhoto.SaveAs(rootUrl + "/FileUpload/SafetyOrganizationPic/" + fileName);
imgPhoto.ImageUrl = "~/FileUpload/SafetyOrganizationPic/" + fileName;
var unit = Funs.DB.Project_ProjectUnit.FirstOrDefault(x => x.UnitId == trSafetyOrganization.SelectedNodeID&&x.ProjectId== this.CurrUser.LoginProjectId);
unit.OrganizationPic = "FileUpload/SafetyOrganizationPic/" + fileName;
Funs.DB.SubmitChanges();
// 清空文件上传组件(上传后要记着清空,否则点击提交表单时会再次上传!!)
filePhoto.Reset();
}
}
else
{
Alert.ShowInTop("请选择一个单位!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// Tree点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void trSafetyOrganization_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (!string.IsNullOrEmpty(trSafetyOrganization.SelectedNodeID))
{
var unit = ProjectUnitService.GetProjectUnitByUnitIdProjectId(this.CurrUser.LoginProjectId,trSafetyOrganization.SelectedNodeID);
if (!string.IsNullOrEmpty(unit.OrganizationPic))
{
this.imgPhoto.ImageUrl = "~/" + unit.OrganizationPic;
}
else
{
this.imgPhoto.ImageUrl = null;
}
}
else
{
this.imgPhoto.ImageUrl = null;
}
}
}
}
@@ -0,0 +1,116 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.SecuritySystem
{
public partial class SafetyOrganizationPic
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// trSafetyOrganization 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree trSafetyOrganization;
/// <summary>
/// panelCenterRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.SimpleForm SimpleForm1;
/// <summary>
/// btnDeleteItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tool btnDeleteItem;
/// <summary>
/// btnNewItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tool btnNewItem;
/// <summary>
/// filePhoto 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload filePhoto;
/// <summary>
/// imgPhoto 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Image imgPhoto;
}
}