This commit is contained in:
jackchenyang 2024-05-26 09:07:40 +08:00
parent d2a7ce4d35
commit eedac73a48
4 changed files with 41 additions and 9 deletions

Binary file not shown.

View File

@ -17,7 +17,9 @@
EnableCollapse="true" runat="server" BoxFlex="1" EnableColumnLines="true" DataKeyNames="PipelineCode" EnableCollapse="true" runat="server" BoxFlex="1" EnableColumnLines="true" DataKeyNames="PipelineCode"
AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
SortField="WorkAreaCode,PipelineCode" SortDirection="DESC" OnSort="Grid1_Sort" SortField="WorkAreaCode,PipelineCode" SortDirection="DESC" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange" AllowPaging="true" IsDatabasePaging="true"
PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
OnRowDataBound="Grid1_RowDataBound"
EnableTextSelection="True"> EnableTextSelection="True">
<Toolbars> <Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left"> <f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
@ -65,13 +67,13 @@
<f:RenderField HeaderText="预制检测数量" ColumnID="PMIBySNum" DataField="PMIBySNum" Width="160"></f:RenderField> <f:RenderField HeaderText="预制检测数量" ColumnID="PMIBySNum" DataField="PMIBySNum" Width="160"></f:RenderField>
<f:TemplateField HeaderText="预制检测比例" ColumnID="RateBys" Width="160"> <f:TemplateField HeaderText="预制检测比例" ColumnID="RateBys" Width="160">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="labRateBys" runat="server" Text='<%#Eval("RateBys")+"%" %>'></asp:Label> <asp:Label ID="labRateBys" runat="server" Text='<%#Eval("RateBys") %>'></asp:Label>
</ItemTemplate> </ItemTemplate>
</f:TemplateField> </f:TemplateField>
<f:RenderField HeaderText="安装检测数量" ColumnID="PMIByFNum" DataField="PMIByFNum" Width="160"></f:RenderField> <f:RenderField HeaderText="安装检测数量" ColumnID="PMIByFNum" DataField="PMIByFNum" Width="160"></f:RenderField>
<f:TemplateField HeaderText="安装检测比例" ColumnID="RateByf" Width="160"> <f:TemplateField HeaderText="安装检测比例" ColumnID="RateByf" Width="160">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("RateByf")+"%" %>'></asp:Label> <asp:Label ID="labRateByf" runat="server" Text='<%#Eval("RateByf") %>'></asp:Label>
</ItemTemplate> </ItemTemplate>
</f:TemplateField> </f:TemplateField>
</Columns> </Columns>

View File

@ -7,6 +7,8 @@ using System.Linq;
using System.Web; using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using AspNet = System.Web.UI.WebControls;
using System.Drawing;
namespace FineUIPro.Web.WeldingProcess.PMI namespace FineUIPro.Web.WeldingProcess.PMI
{ {
@ -25,9 +27,10 @@ namespace FineUIPro.Web.WeldingProcess.PMI
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
BLL.Base_UnitService.InitProjectUnitDropDownList(this.drpUnitId, true, this.CurrUser.LoginProjectId, BLL.Const.UnitType_5, Resources.Lan.PleaseSelect);//单位 BLL.Base_UnitService.InitProjectUnitDropDownList(this.drpUnitId, true, this.CurrUser.LoginProjectId, BLL.Const.UnitType_5, Resources.Lan.PleaseSelect);//单位
BLL.Project_WorkAreaService.InitWorkAreaDropDownList(this.drpWorkAreaId, true, this.CurrUser.LoginProjectId, string.Empty, this.drpUnitId.SelectedValue, string.Empty, Resources.Lan.PleaseSelect);//区域 BLL.Project_WorkAreaService.InitWorkAreaDropDownList(this.drpWorkAreaId, true, this.CurrUser.LoginProjectId, string.Empty, this.drpUnitId.SelectedValue, string.Empty, Resources.Lan.PleaseSelect);//区域
} }
} }
/// <summary> /// <summary>
/// 绑定数据 /// 绑定数据
@ -86,7 +89,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI
} }
if (this.drpWorkAreaId.SelectedValue != BLL.Const._Null) if (this.drpWorkAreaId.SelectedValue != BLL.Const._Null)
{ {
sql += " and WorkAreaId=@unitId"; sql += " and WorkAreaId=@workAreaId";
listStr.Add(new SqlParameter("@workAreaId", this.drpWorkAreaId.SelectedValue)); listStr.Add(new SqlParameter("@workAreaId", this.drpWorkAreaId.SelectedValue));
} }
if (this.drpIsALl.SelectedValue!="全部") if (this.drpIsALl.SelectedValue!="全部")
@ -95,7 +98,7 @@ namespace FineUIPro.Web.WeldingProcess.PMI
} }
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text)) if (!string.IsNullOrEmpty(this.txtPipelineCode.Text))
{ {
sql += " and PipelineCode like '%@PipelineCode%'"; sql += " and PipelineCode like '%'+@PipelineCode+'%'";
listStr.Add(new SqlParameter("@PipelineCode", this.txtPipelineCode.Text.Trim())); listStr.Add(new SqlParameter("@PipelineCode", this.txtPipelineCode.Text.Trim()));
} }
SqlParameter[] parameter = listStr.ToArray(); SqlParameter[] parameter = listStr.ToArray();
@ -127,7 +130,31 @@ namespace FineUIPro.Web.WeldingProcess.PMI
BindGrid(); BindGrid();
} }
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
DataRowView row = e.DataItem as DataRowView;
decimal rates =Math.Round(Convert.ToDecimal(row["RateBys"]),2);
decimal ratef = Math.Round(Convert.ToDecimal(row["RateByf"]), 2);
AspNet.Label itemLable = e.Row.FindControl("labRateBys") as AspNet.Label;
if (itemLable !=null && !string.IsNullOrEmpty(itemLable.Text))
{
itemLable.Text = rates.ToString() + "%";
if (rates <= 2)
{
itemLable.ForeColor = Color.Red;
}
}
AspNet.Label labRateByf = e.Row.FindControl("labRateByf") as AspNet.Label;
if(labRateByf!=null && !string.IsNullOrEmpty(labRateByf.Text))
{
labRateByf.Text= ratef.ToString() + "%";
if (ratef <= 2)
{
labRateByf.ForeColor = Color.Red;
}
}
}
/// <summary> /// <summary>
/// 排序 /// 排序
/// </summary> /// </summary>
@ -148,7 +175,10 @@ namespace FineUIPro.Web.WeldingProcess.PMI
protected void BtnAnalyse_Click(object sender, EventArgs e) protected void BtnAnalyse_Click(object sender, EventArgs e)
{ {
BindGrid(); BindGrid();
} }
#endregion #endregion
#region #region

View File

@ -150,13 +150,13 @@ namespace FineUIPro.Web.WeldingProcess.PMI
protected global::System.Web.UI.WebControls.Label labRateBys; protected global::System.Web.UI.WebControls.Label labRateBys;
/// <summary> /// <summary>
/// Label1 控件。 /// labRateByf 控件。
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// 自动生成的字段。 /// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Label Label1; protected global::System.Web.UI.WebControls.Label labRateByf;
/// <summary> /// <summary>
/// ToolbarSeparator1 控件。 /// ToolbarSeparator1 控件。