修改项目级项目访问权限

This commit is contained in:
2024-09-13 14:57:02 +08:00
parent c628c83364
commit 4063e5b7cf
2 changed files with 39 additions and 17 deletions
+37 -15
View File
@@ -326,7 +326,7 @@
/// 获取userId参与项目下拉框
/// </summary>
/// <returns></returns>
public static List<Model.Base_Project> GetProjectByUserIdStateDropDownList(string userId, string state)
public static List<Model.Base_Project> GetProjectByUserIdStateDropDownList(string userId, string state,string urlType="")
{
if (userId == Const.sysglyId || userId == Const.hfnbdId || userId == Const.sedinId)
{
@@ -340,20 +340,42 @@
{
/// 获取角色类型
var getRoleP = Funs.DB.Sys_RolePower.FirstOrDefault(x => x.RoleId == getUser.RoleId && x.IsOffice == false);
if (getRoleP != null)
//如果是项目级别,获取到他的类型后,并且还要单位是五环的
if (!string.IsNullOrEmpty(urlType))
{
return (from x in Funs.DB.Base_Project
where x.ProjectState == state
orderby x.ProjectCode descending
select x).ToList();
//五环的能看所有项目,否则只能看项目用户中有自己或者所属单位是自己单位的
if (getRoleP != null && getUser.UnitId== Const.UnitId_CWCEC)
{
return (from x in Funs.DB.Base_Project
where x.ProjectState == state
orderby x.ProjectCode descending
select x).ToList();
}
else
{
return (from x in Funs.DB.Base_Project
join y in Funs.DB.Project_ProjectUser on x.ProjectId equals y.ProjectId
where ( (y.UserId == userId && y.IsPost == true)|| x.UnitId== getUser.UnitId) && x.ProjectState == state
orderby x.ProjectCode descending
select x).Distinct().ToList();
}
}
else
{
return (from x in Funs.DB.Base_Project
join y in Funs.DB.Project_ProjectUser on x.ProjectId equals y.ProjectId
where y.UserId == userId && y.IsPost == true && x.ProjectState == state
orderby x.ProjectCode descending
select x).Distinct().ToList();
else {
if (getRoleP != null)
{
return (from x in Funs.DB.Base_Project
where x.ProjectState == state
orderby x.ProjectCode descending
select x).ToList();
}
else
{
return (from x in Funs.DB.Base_Project
join y in Funs.DB.Project_ProjectUser on x.ProjectId equals y.ProjectId
where y.UserId == userId && y.IsPost == true && x.ProjectState == state
orderby x.ProjectCode descending
select x).Distinct().ToList();
}
}
}
else
@@ -459,11 +481,11 @@
/// <param name="dropName"></param>
/// <param name="userId"></param>
/// <param name="isShowPlease"></param>
public static void InitProjectShortNameByStateDropDownList(FineUIPro.DropDownList dropName, string userId, string state, bool isShowPlease)
public static void InitProjectShortNameByStateDropDownList(FineUIPro.DropDownList dropName, string userId, string state, bool isShowPlease,string urlType="")
{
dropName.DataValueField = "ProjectId";
dropName.DataTextField = "ProjectName";
var projectlist = GetProjectByUserIdStateDropDownList(userId, state);
var projectlist = GetProjectByUserIdStateDropDownList(userId, state, urlType);
dropName.DataSource = projectlist;
dropName.DataBind();
if (projectlist.Count() == 0)