数据大屏优化
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
using BLL;
|
||||
using FineUIPro.Web.DataShow;
|
||||
using FineUIPro.Web.SysManage;
|
||||
using FineUIPro.Web.ZHGL.DataSync;
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using NPOI.POIFS.Crypt.Dsig;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Services;
|
||||
using System.Web.UI.WebControls;
|
||||
@@ -17,11 +14,40 @@ namespace FineUIPro.Web.common
|
||||
{
|
||||
public partial class main : PageBase
|
||||
{
|
||||
///// <summary>
|
||||
///// 单位id
|
||||
///// </summary>
|
||||
//public string UnitId
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return (string)ViewState["UnitId"];
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// ViewState["UnitId"] = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
//var ssss = Request;
|
||||
//string unitId = string.Empty;
|
||||
//unitId = this.CurrUser.LastUnitId;
|
||||
//string unitIdw = string.Empty;
|
||||
//string urlReferrer = Request.UrlReferrer.ToString();
|
||||
//if (!string.IsNullOrWhiteSpace(urlReferrer))
|
||||
//{
|
||||
// unitId = urlReferrer.Split('=')[1];
|
||||
// this.UnitId = unitId;
|
||||
//}
|
||||
//var sss = this.CurrUser;
|
||||
//if (!string.IsNullOrEmpty(Request.QueryString["unitId"]))
|
||||
//{
|
||||
// this.UnitId = Request.QueryString["unitId"];
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +63,19 @@ namespace FineUIPro.Web.common
|
||||
var page = new main();
|
||||
MainSevice mainSevice = new MainSevice(page.CurrUser.UserId);
|
||||
|
||||
string unitId = page.CurrUser.UnitId;
|
||||
if (CommonService.IsSuperAdminManage(page.CurrUser.UserId) || (!string.IsNullOrWhiteSpace(unitId) && unitId == Const.UnitId_XJYJ))
|
||||
{
|
||||
unitId = !string.IsNullOrWhiteSpace(page.CurrUser.LastUnitId) ? page.CurrUser.LastUnitId : Const.UnitId_XJYJ;
|
||||
}
|
||||
|
||||
//获取数据
|
||||
var hsseData = Task.Run(() => mainSevice.GetHsseData()).Result;
|
||||
//var hiddenDangerList = mainSevice.GetDataHiddenDangerDetailItems();
|
||||
|
||||
//获取项目数据
|
||||
int unitType = CommonService.GetUnitTypeByUserId(page.CurrUser.UserId);
|
||||
//int unitType = CommonService.GetUnitTypeByUserId(page.CurrUser.UserId);
|
||||
int unitType = CommonService.GetUnitTypeByUnitId(unitId);
|
||||
var projects = new List<Base_Project>();
|
||||
|
||||
if (unitType == 0)
|
||||
@@ -51,7 +84,8 @@ namespace FineUIPro.Web.common
|
||||
}
|
||||
else if (unitType == 1)
|
||||
{
|
||||
projects = Funs.DB.Base_Project.Where(x => x.UnitId == page.CurrUser.UnitId && x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
|
||||
projects = Funs.DB.Base_Project.Where(x => x.UnitId == unitId && x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
|
||||
//projects = Funs.DB.Base_Project.Where(x => x.UnitId == page.CurrUser.UnitId && x.MapCoordinates != null && (x.IsDelete == null || x.IsDelete == false)).ToList();
|
||||
}
|
||||
|
||||
//获取安全生产开始日期
|
||||
@@ -62,14 +96,20 @@ namespace FineUIPro.Web.common
|
||||
//事故事件
|
||||
var list = AccidentWarningService.GetYearsTodayList();
|
||||
|
||||
|
||||
var dateNow = DateTime.Now.ToString("yyyy-MM");
|
||||
//风险
|
||||
var getHazardFactorList = Funs.DB.Sp_HazardFactor_Statistics(dateNow.Split('-')[0], dateNow.Split('-')[1], "").ToList();
|
||||
string hfUnitId = !string.IsNullOrWhiteSpace(unitId) && unitId == Const.UnitId_XJYJ ? string.Empty : unitId;
|
||||
//安全危害因素
|
||||
var getHazardFactorList = Funs.DB.Sp_HazardFactor_Statistics(dateNow.Split('-')[0], dateNow.Split('-')[1], hfUnitId, string.Empty).ToList();
|
||||
var lowRisk = getHazardFactorList.Where(x => x.Title == "低风险").FirstOrDefault();
|
||||
var generalRisk = getHazardFactorList.Where(x => x.Title == "一般风险").FirstOrDefault();
|
||||
var largerRisk = getHazardFactorList.Where(x => x.Title == "较大风险").FirstOrDefault();
|
||||
var majorRisk = getHazardFactorList.Where(x => x.Title == "重大风险").FirstOrDefault();
|
||||
//职业健康危害因素
|
||||
var getHazardFactorOccHealthList = Funs.DB.Sp_HazardFactorOccHealth_Statistics(dateNow.Split('-')[0], dateNow.Split('-')[1], hfUnitId, string.Empty).ToList();
|
||||
var lowRiskOcc = getHazardFactorOccHealthList.Where(x => x.Title == "低风险").FirstOrDefault();
|
||||
var generalRiskOcc = getHazardFactorOccHealthList.Where(x => x.Title == "一般风险").FirstOrDefault();
|
||||
var largerRiskOcc = getHazardFactorOccHealthList.Where(x => x.Title == "较大风险").FirstOrDefault();
|
||||
var majorRiskOcc = getHazardFactorOccHealthList.Where(x => x.Title == "重大风险").FirstOrDefault();
|
||||
|
||||
//构造返回数据
|
||||
return new
|
||||
@@ -96,7 +136,7 @@ namespace FineUIPro.Web.common
|
||||
},
|
||||
projectInfo = new
|
||||
{
|
||||
workSafetyStartDateTip= $"安全生产开始日期:{workSafetyStartDate}",
|
||||
workSafetyStartDateTip = $"安全生产开始日期:{workSafetyStartDate}",
|
||||
workSafetyDay1 = (workSafetyDays % 10),
|
||||
workSafetyDay10 = ((workSafetyDays % 100) / 10),
|
||||
workSafetyDay100 = ((workSafetyDays % 1000) / 100),
|
||||
@@ -118,11 +158,18 @@ namespace FineUIPro.Web.common
|
||||
value = p.MapCoordinates.Split(','),
|
||||
}).ToList(),
|
||||
hazardFactor = new
|
||||
{
|
||||
{//安全危害因素
|
||||
lowRiskNum = lowRisk != null ? lowRisk.Num : 0,
|
||||
generalRiskNum = generalRisk != null ? generalRisk.Num : 0,
|
||||
largerRiskNum = largerRisk != null ? largerRisk.Num : 0,
|
||||
majorRiskNum = majorRisk != null ? majorRisk.Num : 0,
|
||||
},
|
||||
hazardFactorOcc = new
|
||||
{//职业健康危害因素
|
||||
lowRiskNum = lowRiskOcc != null ? lowRiskOcc.Num : 0,
|
||||
generalRiskNum = generalRiskOcc != null ? generalRiskOcc.Num : 0,
|
||||
largerRiskNum = largerRiskOcc != null ? largerRiskOcc.Num : 0,
|
||||
majorRiskNum = majorRiskOcc != null ? majorRiskOcc.Num : 0,
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -132,5 +179,34 @@ namespace FineUIPro.Web.common
|
||||
return new { success = false, msg = ex.Message };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目跳转地址
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
[WebMethod]
|
||||
public static object ViewProject(string projectId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var page = new main();
|
||||
string url = string.Empty;
|
||||
string msg = string.Empty;
|
||||
if ((page.CurrUser.IsOffice == true && !string.IsNullOrEmpty(page.CurrUser.RoleId)) || (page.CurrUser.IsOffice == false || !page.CurrUser.IsOffice.HasValue))
|
||||
{
|
||||
url = "../indexProject.aspx?projectId=" + projectId;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "您没有权限进入项目管理模块!";
|
||||
}
|
||||
return new { success = true, data = url, msg = msg };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new { success = false, msg = ex.Message };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user