diff --git a/DataBase/版本日志/SGGLDB_V2025-12-08-xiaj(事故警示).sql b/DataBase/版本日志/SGGLDB_V2025-12-08-xiaj(事故警示).sql index 33f6bbb..6951954 100644 --- a/DataBase/版本日志/SGGLDB_V2025-12-08-xiaj(事故警示).sql +++ b/DataBase/版本日志/SGGLDB_V2025-12-08-xiaj(事故警示).sql @@ -18,7 +18,6 @@ END GO -drop table Accident_Warning --¹ʾʾ IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'Accident_Warning') AND type = N'U') BEGIN diff --git a/SGGL/BLL/Accident/AccidentWarningService.cs b/SGGL/BLL/Accident/AccidentWarningService.cs index 8022f90..c9e9f77 100644 --- a/SGGL/BLL/Accident/AccidentWarningService.cs +++ b/SGGL/BLL/Accident/AccidentWarningService.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; +using FineUIPro; namespace BLL { @@ -99,5 +100,32 @@ namespace BLL db.SubmitChanges(); } } + + + /// + /// 事故类型下拉 + /// + /// + /// + public static void InitAccidentTypeDropDownList(DropDownList dropName, bool isShowPlease) + { + dropName.DataValueField = "string"; + dropName.DataTextField = "string"; + dropName.DataSource = GetAccidentTypeDropDownList(); + dropName.DataBind(); + if (isShowPlease) + { + Funs.FineUIPleaseSelect(dropName); + } + } + + /// + /// 事故类型下拉 + /// + /// + public static List GetAccidentTypeDropDownList() + { + return (from x in Funs.DB.Accident_Warning select x.Type).Distinct().OrderBy(x => x).ToList(); + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx b/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx index 8ac654b..7891ccd 100644 --- a/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx +++ b/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx @@ -21,9 +21,11 @@ - + + diff --git a/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.cs b/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.cs index 65b7294..f95ee9a 100644 --- a/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.cs +++ b/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.cs @@ -47,6 +47,7 @@ namespace FineUIPro.Web.Accident //} //this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); GetButtonPower(); + BLL.AccidentWarningService.InitAccidentTypeDropDownList(this.drpType, true); // 绑定表格 this.BindGrid(); } @@ -64,7 +65,7 @@ namespace FineUIPro.Web.Accident List listStr = new List(); if (!string.IsNullOrEmpty(this.txtSearch.Text.Trim())) { - sb.Append("and (Code like @txtSearch or Title like @txtSearch or Type like @txtSearch or Address like @txtSearch or Source like @txtSearch ) "); + sb.Append("and (Code like @txtSearch or Title like @txtSearch or Address like @txtSearch or Source like @txtSearch ) "); listStr.Add(new SqlParameter("@txtSearch", "%" + this.txtSearch.Text.Trim() + "%")); } //if (!string.IsNullOrEmpty(this.txtType.Text.Trim())) @@ -72,6 +73,11 @@ namespace FineUIPro.Web.Accident // sb.Append("and (Type like @txtType ) "); // listStr.Add(new SqlParameter("@txtType", "%" + this.txtType.Text.Trim() + "%")); //} + if (!string.IsNullOrWhiteSpace(this.drpType.SelectedValue) && this.drpType.SelectedValue != Const._Null) + { + sb.Append("and Type = @Type "); + listStr.Add(new SqlParameter("@Type", this.drpType.SelectedValue)); + } if (!string.IsNullOrEmpty(this.txtAccidentDateStart.Text.Trim())) { sb.Append("and AccidentDate >= @AccidentDateStart "); @@ -91,6 +97,17 @@ namespace FineUIPro.Web.Accident Grid1.DataBind(); } + /// + /// 事故类型下拉触发事件 + /// + /// + /// + protected void drpType_SelectedIndexChanged(object sender, EventArgs e) + { + BindGrid(); + } + + #region 分页 排序 /// /// 改变索引事件 diff --git a/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.designer.cs b/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.designer.cs index a1e10a6..4e5e2bd 100644 --- a/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Accident/AccidentWarning.aspx.designer.cs @@ -68,6 +68,15 @@ namespace FineUIPro.Web.Accident /// protected global::FineUIPro.TextBox txtSearch; + /// + /// drpType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpType; + /// /// txtAccidentDateStart 控件。 /// diff --git a/SGGL/FineUIPro.Web/Accident/AccidentWarningDataIn.aspx.cs b/SGGL/FineUIPro.Web/Accident/AccidentWarningDataIn.aspx.cs index 2f96b31..504a7c6 100644 --- a/SGGL/FineUIPro.Web/Accident/AccidentWarningDataIn.aspx.cs +++ b/SGGL/FineUIPro.Web/Accident/AccidentWarningDataIn.aspx.cs @@ -125,7 +125,7 @@ namespace FineUIPro.Web.Accident conn.Close(); conn.Dispose(); - AddDatasetToSQL(ds.Tables[0], 6); + AddDatasetToSQL(ds.Tables[0], 8); hdCheckResult.Text = "1"; } catch (Exception exc) @@ -180,10 +180,10 @@ namespace FineUIPro.Web.Accident errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故类型", Reason = "此项为必填项!" }); } string row2 = pds.Rows[i][2].ToString(); - if (string.IsNullOrEmpty(row2)) - { - errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故地点", Reason = "此项为必填项!" }); - } + //if (string.IsNullOrEmpty(row2)) + //{ + // errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故地点", Reason = "此项为必填项!" }); + //} string row3 = pds.Rows[i][3].ToString(); if (!string.IsNullOrEmpty(row3)) { @@ -202,7 +202,7 @@ namespace FineUIPro.Web.Accident } if (!string.IsNullOrWhiteSpace(row0) && !string.IsNullOrWhiteSpace(row1) && !string.IsNullOrWhiteSpace(row2) && !string.IsNullOrWhiteSpace(row3)) { - var acc = oldViewInfos.Where(x => x.Title == row0 && x.Address == row1 && x.Type == row2 && x.AccidentDate == Convert.ToDateTime(row2.Trim())); + var acc = oldViewInfos.Where(x => x.Title == row0 && x.Address == row1 && x.Type == row2 && x.AccidentDate == Convert.ToDateTime(row3.Trim())); if (acc.Any()) { errorInfos.Add(new ErrorInfo { Row = (i + 2).ToString(), Column = "事故标题", Reason = "此项事故已存在!" }); @@ -293,7 +293,7 @@ namespace FineUIPro.Web.Accident conn.Close(); conn.Dispose(); - AddDatasetToSQL2(ds.Tables[0], 6); + AddDatasetToSQL2(ds.Tables[0], 8); } catch (Exception ex) { diff --git a/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx b/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx index ed762b1..6302245 100644 --- a/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx +++ b/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx @@ -28,8 +28,10 @@ - - + <%-- + --%> + + diff --git a/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.cs b/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.cs index 2ac7109..cfc50c2 100644 --- a/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.cs @@ -1,5 +1,7 @@ using BLL; +using Microsoft.Office.Interop.Word; using System; +using System.Data.SqlClient; using System.Web; namespace FineUIPro.Web.Accident @@ -36,6 +38,7 @@ namespace FineUIPro.Web.Accident { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); + BLL.AccidentWarningService.InitAccidentTypeDropDownList(this.drpType, true); this.Id = Request.Params["Id"]; if (!string.IsNullOrEmpty(this.Id)) { @@ -45,7 +48,10 @@ namespace FineUIPro.Web.Accident this.txtCode.Text = model.Code; this.txtTitle.Text = model.Title; this.txtContent.Text = model.Content; + //this.txtType.Text = model.Type; + this.drpType.SelectedValue = model.Type; this.txtAddress.Text = model.Address; + this.txtSource.Text = model.Source; this.txtResponsibleUnit.Text = model.ResponsibleUnit; this.txtRemarks.Text = model.Remarks; if (model.AccidentDate != null) @@ -79,6 +85,11 @@ namespace FineUIPro.Web.Accident /// protected void btnSave_Click(object sender, EventArgs e) { + if (string.IsNullOrWhiteSpace(this.drpType.SelectedValue) || this.drpType.SelectedValue == Const._Null) + { + Alert.ShowInTop("请选择事故类型", MessageBoxIcon.Warning); + return; + } this.SaveData(); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } @@ -92,7 +103,8 @@ namespace FineUIPro.Web.Accident model.Code = this.txtCode.Text.Trim(); model.Title = this.txtTitle.Text.Trim(); model.Content = this.txtContent.Text.Trim(); - model.Type = this.txtType.Text.Trim(); + //model.Type = this.txtType.Text.Trim(); + model.Type = this.drpType.SelectedValue; model.Address = this.txtAddress.Text.Trim(); model.Source = this.txtSource.Text.Trim(); model.ResponsibleUnit = this.txtResponsibleUnit.Text.Trim(); diff --git a/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.designer.cs index 19018fb..415253a 100644 --- a/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Accident/AccidentWarningEdit.aspx.designer.cs @@ -60,13 +60,13 @@ namespace FineUIPro.Web.Accident protected global::FineUIPro.TextBox txtTitle; /// - /// txtType 控件。 + /// drpType 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.TextBox txtType; + protected global::FineUIPro.DropDownList drpType; /// /// txtAccidentDate 控件。 diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/事故警示导入模板.xls b/SGGL/FineUIPro.Web/File/Excel/DataIn/事故警示导入模板.xls index 29916ea..8215127 100644 Binary files a/SGGL/FineUIPro.Web/File/Excel/DataIn/事故警示导入模板.xls and b/SGGL/FineUIPro.Web/File/Excel/DataIn/事故警示导入模板.xls differ