页面提交

This commit is contained in:
2024-05-20 02:22:12 +08:00
parent ccab4e7401
commit 46efe986a8
6 changed files with 174 additions and 13 deletions
@@ -9,6 +9,7 @@ using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RestSharp;
namespace FineUIPro.Web.CQMS.WBS.Control
{
@@ -29,16 +30,19 @@ namespace FineUIPro.Web.CQMS.WBS.Control
/// </summary>
public void DataBrid()
{
string strSql = @"select a.ControlId,a.ProjectId,a.ParentId,a.ControlCode,a.ControlLevel,a.PlanId,a.PlanTypeId,a.SubItemsId,a.DetectionItems,a.BasedCriterion,a.QualityRecordName,a.RecordNumber,a.Subcontractors,a.OperateTime,a.Sort from Control_PointCropping as a order by a.ControlLevel,a.Sort asc";
string strSql = @"select * from(select a.ControlId,a.ProjectId,a.ParentId,a.ControlCode,a.ControlLevel,a.PlanId,a.PlanTypeId,a.SubItemsId,a.DetectionItems,a.BasedCriterion,a.QualityRecordName,a.RecordNumber,a.Subcontractors,a.OperateTime,a.Sort,a.States,a.Partition from Control_PointCropping as a where isnull(a.ProjectId,'')='' ";
string strSql1 = "select a.ControlId,a.ProjectId,a.ParentId,a.ControlCode,a.ControlLevel,a.PlanId,a.PlanTypeId,a.SubItemsId,a.DetectionItems,a.BasedCriterion,a.QualityRecordName,a.RecordNumber,a.Subcontractors,a.OperateTime,a.Sort,a.States,a.Partition from Control_PointCropping as a where a.ProjectId=@ProjectId ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(sDetectionItems.Text.Trim()))
{
strSql += " and a.DetectionItems like '%@DetectionItems%'";
strSql1 += " and a.DetectionItems like '%@DetectionItems%'";
listStr.Add(new SqlParameter("@DetectionItems", this.sDetectionItems.Text.Trim()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
var zxsql = strSql + " union all " + strSql1 + " ) as t order by t.ControlLevel,t.Sort asc";
DataTable tb = SQLHelper.GetDataTableRunText(zxsql, parameter);
Grid1.DataSource = tb;
Grid1.DataBind();
}
@@ -48,13 +52,17 @@ namespace FineUIPro.Web.CQMS.WBS.Control
/// </summary>
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
{
string rowID = e.RowID;
if (e.CommandName == "Delete")
{
string rowID = e.RowID;
DeleteRowByIDInternal(rowID);
DataBrid();
ShowNotify("删除成功!");
}
else if (e.CommandName == "fileView")
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", "-1", rowID, Const.InspectTailTerm)));
}
}
/// <summary>
@@ -62,11 +70,22 @@ namespace FineUIPro.Web.CQMS.WBS.Control
/// </summary>
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
int controlLevel = Grid1.DataKeys[e.RowIndex][2] != null ? int.Parse(Grid1.DataKeys[e.RowIndex][2].ToString()) : 2;
if (controlLevel < 2)
if (Grid1.DataKeys[e.RowIndex][0].ToString() == "595fd674-ca2b-4557-a7c7-1be1096c3825")
{
e.TreeNodeExpanded = true;
}
var states = int.Parse(Grid1.DataKeys[e.RowIndex][3].ToString());
GridColumn isDelete = Grid1.FindColumn("Delete");
if (states == 0)
{
e.CellAttributes[isDelete.ColumnIndex]["data-yc"] = "yc";
}
//int controlLevel = Grid1.DataKeys[e.RowIndex][2] != null ? int.Parse(Grid1.DataKeys[e.RowIndex][2].ToString()) : 2;
//if (controlLevel < 2)
//{
// e.TreeNodeExpanded = true;
//}
}
#endregion
@@ -94,6 +113,12 @@ namespace FineUIPro.Web.CQMS.WBS.Control
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var states = int.Parse(Grid1.DataKeys[rowIndex][3].ToString());
if (states == 0)
{
ShowNotify("系统内置数据,无删除权限!");
return;
}
DeleteRowByIDInternal(rowID);
}
DataBrid();
@@ -141,8 +166,13 @@ namespace FineUIPro.Web.CQMS.WBS.Control
ShowNotify("请选择一条数据!", MessageBoxIcon.Warning);
return;
}
var rowIndex = Grid1.SelectedRowIndex;
var states = int.Parse(Grid1.DataKeys[rowIndex][3].ToString());
if (states == 0 && !IsEditdata())
{
ShowNotify("系统内置数据,无编辑权限!");
return;
}
var rowId = Grid1.DataKeys[rowIndex][0].ToString();
var parentId = Grid1.DataKeys[rowIndex][1] != null ? Grid1.DataKeys[rowIndex][1].ToString() : string.Empty;
PageContext.RegisterStartupScript(Window1.GetShowReference($"PointCroppingEdit.aspx?ControlId={rowId}&ParentId={parentId}", "编辑"));
@@ -156,6 +186,13 @@ namespace FineUIPro.Web.CQMS.WBS.Control
DataBrid();
}
/// <summary>
/// 附件关闭
/// </summary>
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
}
/// <summary>
/// 右击修改
/// </summary>
@@ -203,6 +240,21 @@ namespace FineUIPro.Web.CQMS.WBS.Control
}
}
/// <summary>
/// 判断是否存在删除权限
/// </summary>
/// <returns></returns>
public bool IsEditdata()
{
var result = false;
var userids = new List<string>() { Const.sysglyId, Const.hfnbdId, Const.sedinId };
if (userids.Contains(this.CurrUser.UserId))
{
result = true;
}
return result;
}
#endregion
}