1.系统账户数据库优化:
修改“账户类型”的数据类型为VARCHAR2(1024),多个角色时以半角“,”分隔。
加密盐。
密码加密优化;账户登录优化;角色权限管理(作废用户权限);
2.字典类型管理(定义:用户角色)
3.字典数据管理(初始化用户角色数据)
3.角色权限管理
4.系统账户管理,账户类型对应用户角色(可多选)。
| | |
| | | namespace Common |
| | | { |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Runtime.InteropServices; |
| | | using System.Text.RegularExpressions; |
| | | using System.Linq; |
| | | |
| | | public class DataConverter |
| | | { |
| | |
| | | return random; |
| | | } |
| | | |
| | | //字符串转数组 |
| | | public static object[] stringToArray(string str) |
| | | { |
| | | object[] array = str.Split(','); |
| | | return array; |
| | | } |
| | | |
| | | //数组转字符串 |
| | | public static string arrayToString(object[] array) |
| | | { |
| | | if (array == null) |
| | | return ""; |
| | | string str = string.Join(",", array); |
| | | return str; |
| | | } |
| | | |
| | | //数组转换List:string[] str ={ "str","string","abc"}转 List<string> |
| | | public static List<object> arrayToList(object[] array) |
| | | { |
| | | List<object> list = new List<object>(array); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | //List转换数组:List<string>转到string[] |
| | | public static object[] listToArray(List<object> list) |
| | | { |
| | | object[] array = list.ToArray(); |
| | | |
| | | return array; |
| | | } |
| | | |
| | | //字符串转List |
| | | public static List<object> stringToList(string str) |
| | | { |
| | | if (string.IsNullOrEmpty(str)) |
| | | return null; |
| | | |
| | | List<object> list = new List<object>(); |
| | | //字符串转数组,再数组合并 |
| | | list.AddRange(str.Split(',')); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | //数组去重,移除数组中重复数据 |
| | | public static string[] DelRepeatData(string[] array) |
| | | { |
| | | return array.GroupBy(p => p).Select(p => p.Key).ToArray(); |
| | | } |
| | | |
| | | //检查数组格式字符串中是否包含某元素 |
| | | public static bool checkStrForArrayStr(object str, string arrayStr ) |
| | | { |
| | | return stringToArray(arrayStr).Contains(str); |
| | | } |
| | | |
| | | //检查数组中是否包含某元素 |
| | | public static bool checkStrForArray(object str, object[] array) |
| | | { |
| | | return array.Contains(str); |
| | | } |
| | | |
| | | //根据数组字符串转换字典 |
| | | public Dictionary<string, object> arrayStrToDict(object userId, string arrayStr) |
| | | { |
| | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| | | if (string.IsNullOrEmpty(arrayStr)) |
| | | return dictionary; |
| | | |
| | | List<object> list = DataConverter.stringToList(arrayStr); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | dictionary[userId.ToString()] = list[i]; |
| | | } |
| | | return dictionary; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | <Compile Include="GwMoRouteDao.cs" /> |
| | | <Compile Include="GwOrderAuditDao.cs" /> |
| | | <Compile Include="GwOrderDao.cs" /> |
| | | <Compile Include="SysRoleMenuDao.cs" /> |
| | | <Compile Include="SysDictDataDao.cs" /> |
| | | <Compile Include="SysDictTypeDao.cs" /> |
| | | <Compile Include="GwProductDao.cs" /> |
| | |
| | | |
| | | list = new List<KeyValuePair<string, OracleParameter[]>>(); |
| | | list.Add(new KeyValuePair<string, OracleParameter[]>(key2, oracleParameterArray2)); |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | } |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | |
| | | |
| | | //更新个性分配客户集长度为0时 |
| | |
| | | |
| | | list = new List<KeyValuePair<string, OracleParameter[]>>(); |
| | | list.Add(new KeyValuePair<string, OracleParameter[]>(key3, oracleParameterArray2)); |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | } |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 函数描述: 根据系统用户获取有权限客户 |
| | | * userId: 用户ID |
| | | * userType: 用户类型:1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | * userType: 用户类型,多个时以“,”分隔:1-管理员;2-业务员--全员;3-客户经理;4-客服人员;5-财务人员 |
| | | * return: SQL字符串 |
| | | * */ |
| | | public string GetClientPermissions(int userId, int userType, string alias) |
| | | public string GetClientPermissions(int userId, string userType, string alias) |
| | | { |
| | | if (!string.IsNullOrEmpty(alias)) |
| | | { |
| | |
| | | } |
| | | |
| | | string sqlStr = ""; |
| | | //业务员和其他 |
| | | if(userType==2 || userType == 99) |
| | | //业务员 |
| | | if(DataConverter.checkStrForArrayStr(2, userType)) |
| | | { |
| | | sqlStr += " AND " + alias + "CLIENT_ID IN (SELECT CLIENT_ID FROM GW_CLIENT WHERE IS_ENABLE=1 AND (SALESMAN='" + userId + "' ) ) "; |
| | | } |
| | | //业务主管 |
| | | else if (userType == 3) |
| | | //客户经理 |
| | | else if (DataConverter.checkStrForArrayStr(3, userType) ) |
| | | { |
| | | sqlStr += " AND " + alias + "CLIENT_ID IN (SELECT CLIENT_ID FROM GW_CLIENT WHERE IS_ENABLE=1 AND (SALESMAN='" + userId + "' or CUSTOMER_MANAGER='" + userId + "' ) ) "; |
| | | } |
| | | else |
| | | //管理员 |
| | | else if (DataConverter.checkStrForArrayStr(1, userType)) |
| | | { |
| | | //sqlStr += " AND CLIENT_ID IN (SELECT CLIENT_ID FROM GW_CLIENT WHERE IS_ENABLE=1 ) "; |
| | | } |
| | |
| | | /** |
| | | * 函数描述: 根据系统用户获取有权限客户账号 |
| | | * userId: 用户ID |
| | | * userType: 用户类型:1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | * userType: 用户类型,多个时以“,”分隔:1-管理员;2-业务员--全员;3-客户经理;4-客服人员;5-财务人员 |
| | | * return: SQL字符串 |
| | | * */ |
| | | public string GetSpPermissions(int userId, int userType, string alias) |
| | | public string GetSpPermissions(int userId, string userType, string alias) |
| | | { |
| | | if (!string.IsNullOrEmpty(alias)) |
| | | { |
| | |
| | | } |
| | | |
| | | string sqlStr = ""; |
| | | //业务员和其他 |
| | | if (userType == 2 || userType == 99) |
| | | //业务员 |
| | | if (DataConverter.checkStrForArrayStr(2, userType)) |
| | | { |
| | | sqlStr += " AND " + alias + "SP_ID IN (SELECT SP_ID from GW_SP where DEL_FLAG = 0 and CLIENT_ID IN (SELECT CLIENT_ID FROM GW_CLIENT WHERE IS_ENABLE=1 AND (SALESMAN='" + userId + "' ) ) ) "; |
| | | } |
| | | //业务主管 |
| | | else if (userType == 3) |
| | | //客户经理 |
| | | else if (DataConverter.checkStrForArrayStr(3, userType)) |
| | | { |
| | | sqlStr += " AND " + alias + "SP_ID IN (SELECT SP_ID from GW_SP where DEL_FLAG = 0 and CLIENT_ID IN (SELECT CLIENT_ID FROM GW_CLIENT WHERE IS_ENABLE=1 AND (SALESMAN='" + userId + "' or CUSTOMER_MANAGER='" + userId + "' ) ) ) "; |
| | | } |
| | | else |
| | | //管理员 |
| | | else if (DataConverter.checkStrForArrayStr(1, userType)) |
| | | { |
| | | //sqlStr += " AND CLIENT_ID IN (SELECT CLIENT_ID FROM GW_CLIENT WHERE IS_ENABLE=1 ) "; |
| | | } |
| | |
| | | foreach (GwDiverterItem gwDiverterItem in items) |
| | | { |
| | | OracleParameter[] oracleParameterArray2 = new OracleParameter[17] |
| | | { |
| | | new OracleParameter(":DIVERTER_ID", (object) diverter.DiverterID), |
| | | new OracleParameter(":CM_OP_ID", (object) gwDiverterItem.CMOPID), |
| | | new OracleParameter(":CU_OP_ID", (object) gwDiverterItem.CUOPID), |
| | | new OracleParameter(":CT_OP_ID", (object) gwDiverterItem.CTOPID), |
| | | new OracleParameter(":CM_EXT_NO", (object) gwDiverterItem.CMExtNo), |
| | | new OracleParameter(":CU_EXT_NO", (object) gwDiverterItem.CUExtNo), |
| | | new OracleParameter(":CT_EXT_NO", (object) gwDiverterItem.CTExtNo), |
| | | new OracleParameter(":CM_EXT_PARAMS", (object) gwDiverterItem.CMExtParams), |
| | | new OracleParameter(":CU_EXT_PARAMS", (object) gwDiverterItem.CUExtParams), |
| | | new OracleParameter(":CT_EXT_PARAMS", (object) gwDiverterItem.CTExtParams), |
| | | new OracleParameter(":DMODE", (object) gwDiverterItem.Mode), |
| | | new OracleParameter(":SM_MIN_LENGTH", (object) gwDiverterItem.SmMinLength), |
| | | new OracleParameter(":SM_MAX_LENGTH", (object) gwDiverterItem.SmMaxLength), |
| | | new OracleParameter(":SEGMENTS", (object) gwDiverterItem.Segments), |
| | | new OracleParameter(":KEYWORDS", (object) gwDiverterItem.Keywords), |
| | | new OracleParameter(":PROVINCE", (object) gwDiverterItem.Province), |
| | | new OracleParameter(":EXTNO_MODE", (object) gwDiverterItem.ExtNoMode) |
| | | }; |
| | | { |
| | | new OracleParameter(":DIVERTER_ID", (object) diverter.DiverterID), |
| | | new OracleParameter(":CM_OP_ID", (object) gwDiverterItem.CMOPID), |
| | | new OracleParameter(":CU_OP_ID", (object) gwDiverterItem.CUOPID), |
| | | new OracleParameter(":CT_OP_ID", (object) gwDiverterItem.CTOPID), |
| | | new OracleParameter(":CM_EXT_NO", (object) gwDiverterItem.CMExtNo), |
| | | new OracleParameter(":CU_EXT_NO", (object) gwDiverterItem.CUExtNo), |
| | | new OracleParameter(":CT_EXT_NO", (object) gwDiverterItem.CTExtNo), |
| | | new OracleParameter(":CM_EXT_PARAMS", (object) gwDiverterItem.CMExtParams), |
| | | new OracleParameter(":CU_EXT_PARAMS", (object) gwDiverterItem.CUExtParams), |
| | | new OracleParameter(":CT_EXT_PARAMS", (object) gwDiverterItem.CTExtParams), |
| | | new OracleParameter(":DMODE", (object) gwDiverterItem.Mode), |
| | | new OracleParameter(":SM_MIN_LENGTH", (object) gwDiverterItem.SmMinLength), |
| | | new OracleParameter(":SM_MAX_LENGTH", (object) gwDiverterItem.SmMaxLength), |
| | | new OracleParameter(":SEGMENTS", (object) gwDiverterItem.Segments), |
| | | new OracleParameter(":KEYWORDS", (object) gwDiverterItem.Keywords), |
| | | new OracleParameter(":PROVINCE", (object) gwDiverterItem.Province), |
| | | new OracleParameter(":EXTNO_MODE", (object) gwDiverterItem.ExtNoMode) |
| | | }; |
| | | list.Add(new KeyValuePair<string, OracleParameter[]>(key2, oracleParameterArray2)); |
| | | } |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | |
| | | builder.Append(" and DICT_TYPE = '" + bean.DictType + "'"); |
| | | } |
| | | |
| | | if (bean.ParanSource == -1) |
| | | { |
| | | builder.Append(" AND (PARAN_SOURCE != " + bean.ParanSource + " OR PARAN_SOURCE IS NULL) "); |
| | | } |
| | | else |
| | | { |
| | | builder.Append(" AND PARAN_SOURCE = " + bean.ParanSource + " "); |
| | | } |
| | | |
| | | if (bean.Status == -1) |
| | | { |
| | | builder.Append(" AND (STATUS != " + bean.Status + " OR STATUS IS NULL) "); |
| | |
| | | o.DictLabel = oracleReaderWrapper.GetString("DICT_LABEL", ""); |
| | | o.DictType = oracleReaderWrapper.GetString("DICT_TYPE", ""); |
| | | o.DictSort = oracleReaderWrapper.GetInt("DICT_SORT", 1); |
| | | o.ParanSource = oracleReaderWrapper.GetInt("PARAN_SOURCE", 1); |
| | | o.DelFlag = oracleReaderWrapper.GetInt("DEL_FLAG", 0); |
| | | o.Status = oracleReaderWrapper.GetInt("STATUS", 0); |
| | | o.CreateBy = oracleReaderWrapper.GetString("CREATE_BY", ""); |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using Model; |
| | | using Common; |
| | | using Oracle.DataAccess.Client; |
| | | using System.Data.Common; |
| | | |
| | | namespace Dao |
| | | { |
| | | /// <summary> |
| | | /// 角色菜单权限操作 |
| | | /// </summary> |
| | | public class SysRoleMenuDao : IDisposable |
| | | { |
| | | public void Dispose() |
| | | { |
| | | } |
| | | |
| | | private static SysRoleMenuDao _instance; |
| | | public static SysRoleMenuDao Instance |
| | | { |
| | | get { |
| | | if (_instance == null) |
| | | { |
| | | _instance = new SysRoleMenuDao(); |
| | | } |
| | | return _instance; |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<SysRoleMenu> LoadInfoList(string roleId, int menuId, int pageSize, int PageIndex, out int recordcount) |
| | | { |
| | | |
| | | List<SysRoleMenu> list = new List<SysRoleMenu>(); |
| | | recordcount = 0; |
| | | try |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append("from SYS_ROLE_MENU where 1=1 "); |
| | | if (!string.IsNullOrEmpty(roleId)) |
| | | { |
| | | builder.Append(" and ROLE_ID = '" + roleId + "'"); |
| | | } |
| | | |
| | | if (menuId == -1) |
| | | { |
| | | builder.Append(" AND (MENU_ID != " + menuId + " OR MENU_ID IS NULL) "); |
| | | } |
| | | else |
| | | { |
| | | builder.Append(" AND MENU_ID = " + menuId + " "); |
| | | } |
| | | using (OracleDataReader reader = OracleHelper.ExecuteReader("select count(*) as count " + builder.ToString(), OracleHelper.Connection)) |
| | | { |
| | | while (reader.Read()) |
| | | { |
| | | recordcount = this.ReadCount(reader); |
| | | } |
| | | } |
| | | using (OracleDataReader reader2 = OracleHelper.ExecuteReader(PubConstant.doOracleSql(PageIndex, pageSize, recordcount, "select * " + builder.ToString()).ToString() + " order by DICT_TYPE, DICT_SORT ", OracleHelper.Connection )) |
| | | { |
| | | while (reader2.Read()) |
| | | { |
| | | SysRoleMenu o = new SysRoleMenu(); |
| | | if (this.ReadInfo(reader2, o)) |
| | | { |
| | | list.Add(o); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception exception) |
| | | { |
| | | LogHelper.Error(exception); |
| | | return list; |
| | | } |
| | | return list; |
| | | |
| | | } |
| | | |
| | | //根据条件获取数据列表 |
| | | public List<SysRoleMenu> getAllList(SysRoleMenu bean) |
| | | { |
| | | |
| | | List<SysRoleMenu> list = new List<SysRoleMenu>(); |
| | | try |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append("from SYS_ROLE_MENU where 1=1 "); |
| | | if (!string.IsNullOrEmpty(bean.RoleId)) |
| | | { |
| | | builder.Append(" and ROLE_ID = '" + bean.RoleId + "'"); |
| | | } |
| | | |
| | | if (bean.MenuId == -1) |
| | | { |
| | | builder.Append(" AND (MENU_ID != " + bean.MenuId + " OR MENU_ID IS NULL) "); |
| | | } |
| | | else |
| | | { |
| | | builder.Append(" AND MENU_ID = " + bean.MenuId + " "); |
| | | } |
| | | |
| | | using (OracleDataReader reader = OracleHelper.ExecuteReader("select * " + builder.ToString() + " ", OracleHelper.Connection)) |
| | | { |
| | | while (reader.Read()) |
| | | { |
| | | SysRoleMenu o = new SysRoleMenu(); |
| | | if (this.ReadInfo(reader, o)) |
| | | { |
| | | list.Add(o); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception exception) |
| | | { |
| | | LogHelper.Error(exception); |
| | | return list; |
| | | } |
| | | return list; |
| | | |
| | | } |
| | | |
| | | //添加信息 |
| | | public bool Add(SysRoleMenu o) |
| | | { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder.Append("INSERT INTO SYS_ROLE_MENU ( ROLE_ID, MENU_ID ) "); |
| | | stringBuilder.Append(" VALUES (:ROLE_ID, :MENU_ID ) "); |
| | | |
| | | string sql = stringBuilder.ToString(); |
| | | |
| | | return OracleHelper.ExecuteSql(sql, |
| | | OracleHelper.Connection, |
| | | new OracleParameter(":ROLE_ID", (object)o.RoleId), |
| | | new OracleParameter(":MENU_ID", (object)o.MenuId) |
| | | ) > 0; |
| | | } |
| | | |
| | | //删除 |
| | | public bool Delete(SysRoleMenu o) |
| | | { |
| | | return OracleHelper.ExecuteSql("delete from SYS_ROLE_MENU where ROLE_ID=:ROLE_ID AND MENU_ID=:MENU_ID", OracleHelper.Connection, new OracleParameter(":ROLE_ID", (object)o.RoleId), new OracleParameter(":MENU_ID", (object)o.MenuId)) > 0; |
| | | |
| | | } |
| | | |
| | | //获取信息 |
| | | public SysRoleMenu Get(string roleId, int menuId) |
| | | { |
| | | SysRoleMenu o = new SysRoleMenu(); |
| | | using (OracleDataReader reader = OracleHelper.ExecuteReader(string.Format("select * from SYS_ROLE_MENU where ROLE_ID=:ROLE_ID AND MENU_ID=:MENU_ID"), OracleHelper.Connection, new OracleParameter(":ROLE_ID", (object)roleId), new OracleParameter(":MENU_ID", (object)menuId) ) ) |
| | | { |
| | | if (((DbDataReader)reader).Read()) |
| | | { |
| | | this.ReadInfo(reader, o); |
| | | return o; |
| | | } |
| | | } |
| | | return o; |
| | | } |
| | | |
| | | //获取角色权限列表 |
| | | public Dictionary<string, SysMenu> LoadRoleMenuList(string roleId) |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.Append("SELECT sm.* FROM SYS_MENU sm "); |
| | | builder.Append(" LEFT JOIN SYS_ROLE_MENU srm ON srm.MENU_ID = sm.MENU_ID "); |
| | | builder.Append(" WHERE srm.ROLE_ID=:ROLE_ID "); |
| | | |
| | | Dictionary<string, SysMenu> dictionary = new Dictionary<string, SysMenu>(); |
| | | using (OracleDataReader reader = OracleHelper.ExecuteReader(builder.ToString(), OracleHelper.Connection, new OracleParameter(":ROLE_ID", (object)roleId))) |
| | | { |
| | | while (reader != null && ((DbDataReader)reader).Read()) |
| | | { |
| | | OracleReaderWrapper oracleReaderWrapper = new OracleReaderWrapper(reader); |
| | | string menuID = oracleReaderWrapper.GetString("MENU_ID", ""); |
| | | string menuName = oracleReaderWrapper.GetString("MENU_NAME", ""); |
| | | string remark = oracleReaderWrapper.GetString("REMARK", ""); |
| | | string parentID = oracleReaderWrapper.GetString("PARENT_ID", ""); |
| | | int menuLV = oracleReaderWrapper.GetInt("MENU_LV", 0); |
| | | SysMenu sysMenu = new SysMenu(); |
| | | sysMenu.MenuID = menuID; |
| | | sysMenu.MenuName = menuName; |
| | | sysMenu.Remark = remark; |
| | | sysMenu.ParentID = parentID; |
| | | sysMenu.MenuLV = menuLV; |
| | | |
| | | dictionary[menuID] = sysMenu; |
| | | } |
| | | } |
| | | return dictionary; |
| | | } |
| | | |
| | | //修改角色权限 |
| | | public void UpdatePermission(string roleId, string[] menuIDArray) |
| | | { |
| | | List<KeyValuePair<string, OracleParameter[]>> list = new List<KeyValuePair<string, OracleParameter[]>>(); |
| | | string key1 = " DELETE FROM SYS_ROLE_MENU WHERE ROLE_ID=:ROLE_ID "; |
| | | OracleParameter[] oracleParameterArray1 = new OracleParameter[1] |
| | | { |
| | | new OracleParameter(":ROLE_ID", (object) roleId) |
| | | }; |
| | | list.Add(new KeyValuePair<string, OracleParameter[]>(key1, oracleParameterArray1)); |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | if (menuIDArray == null || menuIDArray.Length <= 0) |
| | | return; |
| | | string key2 = "INSERT INTO SYS_ROLE_MENU(ROLE_ID, MENU_ID) VALUES(:ROLE_ID,:MENU_ID)"; |
| | | foreach (string menuId in menuIDArray) |
| | | { |
| | | OracleParameter[] oracleParameterArray2 = new OracleParameter[2] |
| | | { |
| | | new OracleParameter(":ROLE_ID", (object) roleId), |
| | | new OracleParameter(":MENU_ID", (object) menuId) |
| | | }; |
| | | list.Add(new KeyValuePair<string, OracleParameter[]>(key2, oracleParameterArray2)); |
| | | } |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | } |
| | | |
| | | //统计记录数 |
| | | private int ReadCount(OracleDataReader reader) |
| | | { |
| | | OracleReaderWrapper wrapper = new OracleReaderWrapper(reader); |
| | | return wrapper.GetInt("count", 0); |
| | | } |
| | | |
| | | //数据封装 |
| | | private bool ReadInfo(OracleDataReader reader, SysRoleMenu o) |
| | | { |
| | | OracleReaderWrapper oracleReaderWrapper = new OracleReaderWrapper(reader); |
| | | o.RoleId = oracleReaderWrapper.GetString("ROLE_ID", ""); |
| | | o.MenuId = oracleReaderWrapper.GetInt("MENU_ID", 1); |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using System.Configuration; |
| | | using System.Data.Common; |
| | | using System.Text; |
| | | |
| | | namespace Dao |
| | | { |
| | |
| | | if (!((DbDataReader)reader).Read() || !this.ReadInfo(reader, user)) |
| | | return false; |
| | | } |
| | | user.MenuIDList = this.LoadUserMenuList(user.UserID); |
| | | //作废用户权限,改使用角色权限 |
| | | //user.MenuIDList = this.LoadUserMenuList(user.UserID); |
| | | user.MenuIDList = this.LoadUserRoleMenuList(user.UserID); |
| | | return true; |
| | | } |
| | | |
| | |
| | | return list; |
| | | } |
| | | |
| | | //edit:yangzh by 20220615 已作废(已使用用户角色关联权限--LoadUserRoleMenuList(int userID) ) |
| | | public Dictionary<string, SysUserMenu> LoadUserMenuList(int userID) |
| | | { |
| | | Dictionary<string, SysUserMenu> dictionary = new Dictionary<string, SysUserMenu>(); |
| | |
| | | return dictionary; |
| | | } |
| | | |
| | | public Dictionary<string, SysUserMenu> LoadUserRoleMenuList(int userID) |
| | | { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | |
| | | Dictionary<string, SysUserMenu> dictionary = new Dictionary<string, SysUserMenu>(); |
| | | string userType = GetUserRoleByUserId(userID); |
| | | if (!string.IsNullOrEmpty(userType)) |
| | | { |
| | | List<object> list = DataConverter.stringToList(userType); |
| | | if (list.Count > 0) |
| | | { |
| | | stringBuilder.Append(" select sm.* from sys_menu sm "); |
| | | stringBuilder.Append(" left join ( "); |
| | | stringBuilder.Append(" select distinct * from ( "); |
| | | stringBuilder.Append(" select * from sys_role_menu where role_id = " + list[0] + " "); |
| | | |
| | | for (int i = 1; i < list.Count; i++) |
| | | { |
| | | stringBuilder.Append(" union (select * from sys_role_menu where role_id = " + list[i] + ") "); |
| | | |
| | | } |
| | | stringBuilder.Append(" ) bb "); |
| | | stringBuilder.Append(" ) cc on cc.menu_id = sm.menu_id "); |
| | | stringBuilder.Append(" where cc.menu_id is not null "); |
| | | using (OracleDataReader reader = OracleHelper.ExecuteReader(stringBuilder.ToString(), OracleHelper.Connection)) |
| | | { |
| | | while (reader != null && ((DbDataReader)reader).Read()) |
| | | { |
| | | /** |
| | | OracleReaderWrapper oracleReaderWrapper = new OracleReaderWrapper(reader); |
| | | string menuID = oracleReaderWrapper.GetString("MENU_ID", ""); |
| | | string menuName = oracleReaderWrapper.GetString("MENU_NAME", ""); |
| | | string remark = oracleReaderWrapper.GetString("REMARK", ""); |
| | | string parentID = oracleReaderWrapper.GetString("PARENT_ID", ""); |
| | | int menuLV = oracleReaderWrapper.GetInt("MENU_LV", 0); |
| | | SysMenu sysMenu = new SysMenu(); |
| | | sysMenu.MenuID = menuID; |
| | | sysMenu.MenuName = menuName; |
| | | sysMenu.Remark = remark; |
| | | sysMenu.ParentID = parentID; |
| | | sysMenu.MenuLV = menuLV; |
| | | |
| | | dictionary[menuID] = sysMenu; |
| | | **/ |
| | | |
| | | OracleReaderWrapper oracleReaderWrapper = new OracleReaderWrapper(reader); |
| | | string string1 = oracleReaderWrapper.GetString("MENU_ID", ""); |
| | | //string string2 = oracleReaderWrapper.GetString("MENU_DATA", ""); |
| | | string string2 = ""; |
| | | |
| | | dictionary[string1] = new SysUserMenu(string1, string2); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | return dictionary; |
| | | } |
| | | |
| | | public List<SysMenu> LoadSysMenuList() |
| | | { |
| | | List<SysMenu> list = new List<SysMenu>(); |
| | |
| | | return list; |
| | | } |
| | | |
| | | //新加登陆日志 |
| | | //新加登陆日志 |
| | | public List<SysMenu> LoadSysMenuIDList(int menuid, int menulv) |
| | | { |
| | | List<SysMenu> list = new List<SysMenu>(); |
| | |
| | | e.Password = oracleReaderWrapper.GetString("PASSWORD", ""); |
| | | e.Salt = oracleReaderWrapper.GetString("SALT", ""); |
| | | e.UserName = oracleReaderWrapper.GetString("USER_NAME", ""); |
| | | e.UserType = oracleReaderWrapper.GetInt("USER_TYPE", 1); |
| | | e.UserType = oracleReaderWrapper.GetString("USER_TYPE", ""); |
| | | e.ExpireTime = oracleReaderWrapper.GetDateTime("EXPIRE_TIME"); |
| | | e.CreateTime = oracleReaderWrapper.GetDateTime("CREATE_TIME"); |
| | | e.Remark = oracleReaderWrapper.GetString("REMARK", ""); |
| | |
| | | if (reader != null && ((DbDataReader)reader).Read()) |
| | | this.ReadInfo(reader, e); |
| | | } |
| | | e.MenuIDList = this.LoadUserMenuList(userID); |
| | | //作废用户权限,改使用角色权限 |
| | | //e.MenuIDList = this.LoadUserMenuList(userID); |
| | | e.MenuIDList = this.LoadUserRoleMenuList(userID); |
| | | return e; |
| | | } |
| | | |
| | | //根据账户ID获取用户角色集 |
| | | public string GetUserRoleByUserId(int userID) |
| | | { |
| | | SysUser e = new SysUser(); |
| | | using (OracleDataReader reader = OracleHelper.ExecuteReader("SELECT * FROM SYS_USER WHERE USER_ID=:USER_ID", OracleHelper.Connection, new OracleParameter("USER_ID", (object)userID))) |
| | | { |
| | | if (reader != null && ((DbDataReader)reader).Read()) |
| | | this.ReadInfo(reader, e); |
| | | } |
| | | return e.UserType; |
| | | } |
| | | |
| | | public SysUser GetUser(string account) |
| | |
| | | foreach (string str in menuIDArray) |
| | | { |
| | | OracleParameter[] oracleParameterArray2 = new OracleParameter[3] |
| | | { |
| | | new OracleParameter(":USER_ID", (object) userid), |
| | | new OracleParameter(":MENU_ID", (object) str), |
| | | new OracleParameter(":MENU_DATA", (object) "") |
| | | }; |
| | | { |
| | | new OracleParameter(":USER_ID", (object) userid), |
| | | new OracleParameter(":MENU_ID", (object) str), |
| | | new OracleParameter(":MENU_DATA", (object) "") |
| | | }; |
| | | list.Add(new KeyValuePair<string, OracleParameter[]>(key2, oracleParameterArray2)); |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | } |
| | | OracleHelper.ExecuteSqlTran(list, OracleHelper.Connection); |
| | | } |
| | | |
| | | private int ReadCount(OracleDataReader reader) |
| | |
| | | <Compile Include="Model\GwOpGroupItem.cs" /> |
| | | <Compile Include="Model\GwOrderAudit.cs" /> |
| | | <Compile Include="Model\SysDictData.cs" /> |
| | | <Compile Include="Model\SysRoleMenu.cs" /> |
| | | <Compile Include="Model\SysDictType.cs" /> |
| | | <Compile Include="Model\SysFlowNode.cs" /> |
| | | <Compile Include="Model\SysFlow.cs" /> |
| | |
| | | |
| | | public int DictSort { get; set; } //字典排序 |
| | | |
| | | public int ParanSource { get; set; } //数据来源:0-系统内置;1-用户添加 |
| | | |
| | | public int DelFlag { get; set; } //状态:0-停用;1-正常 |
| | | |
| | | public int Status { get; set; } //状态:0-停用;1-正常 |
New file |
| | |
| | | |
| | | using System; |
| | | |
| | | namespace Model |
| | | { |
| | | //角色菜单权限表 |
| | | public class SysRoleMenu |
| | | { |
| | | public string RoleId { get; set; } //角色ID |
| | | |
| | | public int MenuId { get; set; } //菜单ID |
| | | } |
| | | } |
| | |
| | | |
| | | public int Status { get; set; } |
| | | |
| | | public int UserType { get; set; } //用户类型:1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | //public int UserType { get; set; } //用户类型:1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | public string UserType { get; set; } //关联字典数据表的类型为:USER_ROLE。多个角色时以半角“,”分隔。 |
| | | |
| | | public Dictionary<string, SysUserMenu> MenuIDList { get; set; } |
| | | |
| | |
| | | { |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | protected void Page_Load(object sender, EventArgs e) |
| | |
| | | private List<SysUser> _SysUserList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | private string initPwd = ConfigurationManager.AppSettings["initPwd"]; |
| | | |
| | |
| | | <div class="modal-footer"> |
| | | <button class="btn-default btn" data-dismiss="modal" aria-hidden="true"> |
| | | 取消</button> |
| | | <button class="btn btn-primary action-updateProduct"> |
| | | 保存</button> |
| | | <a class="btn btn-primary action-updateProduct"> |
| | | 保存</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Configuration; |
| | | using System.Linq; |
| | | |
| | | public partial class _GwClient : PageBase<SysUser>, IRequiresSessionState |
| | | { |
| | |
| | | { |
| | | continue; |
| | | } |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | if (bean.UserType == 6 || bean.UserType == 99) |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-客户经理;4-客服人员;5-财务人员 |
| | | if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(2, bean.UserType) ) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | continue; |
| | | } |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | if (bean.UserType == 2) |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-客户经理;4-客服人员;5-财务人员 |
| | | if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(3, bean.UserType)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | continue; |
| | | } |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | if (bean.UserType != 1 && bean.UserType != 5 ) |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-客户经理;4-客服人员;5-财务人员 |
| | | if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(4, bean.UserType)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | continue; |
| | | } |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 |
| | | if (bean.UserType != 1 && bean.UserType != 6) |
| | | //过滤用户类型 1-管理员;2-业务员--全员;3-客户经理;4-客服人员;5-财务人员 |
| | | if (!checkStrForArrayStr(1, bean.UserType) && !checkStrForArrayStr(5, bean.UserType)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //检查数组格式字符串中是否包含某元素 |
| | | public static bool checkStrForArrayStr(object str, string arrayStr) |
| | | { |
| | | return stringToArray(arrayStr).Contains(str); |
| | | } |
| | | |
| | | //字符串转数组 |
| | | public static object[] stringToArray(string str) |
| | | { |
| | | object[] array = str.Split(','); |
| | | return array; |
| | | } |
| | | |
| | | } |
| | |
| | | public class GwDm : PageHandler<SysUser> |
| | | { |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context) |
| | |
| | | private List<GwOp> OpList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | public GwSp GwSp { get; protected set; } |
| | |
| | | //private List<GwProduct> _ProductClassList; //产品分类 |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | public override JsonPageResult ProcessRequestInternal(PageContext<SysUser> context) |
| | |
| | | public int _controlFlag = 0; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | protected void Page_Load(object sender, EventArgs e) |
New file |
| | |
| | | <%@ Page Language="C#" masterpagefile="~/Main.master" AutoEventWireup="true" CodeFile="GwProductClasses.aspx.cs" Inherits="_GwProductClasses" %> |
| | | <asp:Content runat="server" ID="Content1" ContentPlaceHolderID="head"> |
| | | <script type="text/javascript" language="javascript"> |
| | | $(document).ready(function() { |
| | | |
| | | //$(document).on("click", "[data-toggle='popover']", function () { |
| | | // $("[data-toggle='popover']").popover(); |
| | | //}) |
| | | var pagination = new Pagination(); |
| | | pagination.setPageIndex(1); |
| | | pagination.setPageSize(50); |
| | | |
| | | function loadPageList() { |
| | | var name = $("#Name").val(); |
| | | //var classes = $("#Classes").val(); |
| | | var classes = 0; |
| | | $.ajax({ |
| | | url: "GwProduct.ashx", |
| | | type: "POST", |
| | | data: { action: "productClassesList", name: name, classes: classes, pageIndex: pagination.getPageIndex(), pageSize: pagination.getPageSize() }, |
| | | success: function(result) { |
| | | if (result.OK) { |
| | | $("#productTable tbody").html(result.Message.Table); |
| | | pagination.setRecordCount(result.Message.TotalCount); |
| | | $("#pagination").html(pagination.getHtml()); |
| | | $("[data-toggle='popover']").popover(); |
| | | } else { |
| | | mytek.alert(result.Message, result.OK); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | $(document).on("click", ".action-modal-add", function() { |
| | | $("#productDialog .modal-title").text("添加产品分类"); |
| | | $("#productDialog #action").val("add"); |
| | | $("#productDialog #id").val("").attr("readonly", false); |
| | | $("#productDialog #name").val(""); |
| | | //$("#productDialog #classes").val(""); |
| | | $("#productDialog #parentId").val(""); |
| | | $("#productDialog #isDnable").val(1); |
| | | $("#productDialog #remark").val(""); |
| | | |
| | | $("#productDialog").modal("show"); |
| | | }); |
| | | |
| | | $("#productForm").ajaxForm({ |
| | | success: function(r) { |
| | | if (r.OK) { |
| | | mytek.alert(r.Message, r.OK, function() { |
| | | $("#productDialog").modal("hide"); |
| | | loadPageList(); |
| | | }); |
| | | } else { |
| | | mytek.alert(r.Message, r.OK); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | //选择图标下拉框 |
| | | $("#icon").on("change", function () { |
| | | console.log("icon:" + $(this).val()); |
| | | if ($(this).val() != "") { |
| | | document.getElementById('showImg').src = "../static/images/productIcon/" + $(this).val(); |
| | | } |
| | | }); |
| | | |
| | | $("#icon").trigger("change"); |
| | | |
| | | //选择类别下拉框,控制相关输入项显示 |
| | | $("#classes").on("change", function () { |
| | | $(".classes-span").hide(); |
| | | $(".classes-span-" + $(this).val()).show(); |
| | | }); |
| | | |
| | | $("#classes").trigger("change"); |
| | | |
| | | /** |
| | | //选择路由类型下拉框,控制相关输入项显示 |
| | | $("#routerType").on("change", function () { |
| | | $(".router-type-span").hide(); |
| | | $(".router-type-span-" + $(this).val()).show(); |
| | | }); |
| | | |
| | | $("#routerType").trigger("change"); |
| | | **/ |
| | | |
| | | $(document).on("click", ".action-modal-edit", function() { |
| | | var id = $(this).data("id"); |
| | | $("#productDialog .modal-title").text("编辑产品分类"); |
| | | $("#productDialog #id").val(id).attr("readonly", true); |
| | | |
| | | $.get("gwProduct.ashx", { "action": "get", id: id }, function(r) { |
| | | if (r.OK) { |
| | | $("#productDialog #action").val("update"); |
| | | $("#productDialog #id").val(r.Message.Id).attr("readonly", false); |
| | | $("#productDialog #name").val(r.Message.Name); |
| | | //$("#productDialog #classes").val(r.Message.Classes); |
| | | $("#productDialog #parentId").val(r.Message.ParentId); |
| | | //$("#productDialog #path").val(r.Message.Path); |
| | | $("#productDialog #isDnable").val(r.Message.IsDnable); |
| | | $("#productDialog #remark").val(r.Message.Remark); |
| | | |
| | | $("#productDialog").modal("show"); |
| | | } |
| | | else { |
| | | mytek.alert(r.Message, r.OK); |
| | | } |
| | | }, "json"); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-update-status", function () { |
| | | //data的属性参数不能含有大写字母。 |
| | | var id = $(this).data("id"); |
| | | var isEnable = $(this).data("is_enable"); |
| | | var statusStr = ""; |
| | | if (isEnable == 0) { |
| | | statusStr = "【停用】"; |
| | | } |
| | | else { |
| | | statusStr = "【启用】"; |
| | | } |
| | | mytek.confirm("是否需要" + statusStr + "该信息?", "确认更新信息状态,请谨慎操作!", function (b) { |
| | | if (b) { |
| | | $.post("gwProduct.ashx", { "action": "updateStatus", id: id, isEnable: isEnable }, function (r) { |
| | | mytek.alert(r.Message, r.OK, function () { |
| | | loadPageList(); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-delete", function() { |
| | | var id = $(this).data("id"); |
| | | mytek.confirm("是否需要删除该信息?", "数据删除后将无法恢复,请谨慎操作!", function(b) { |
| | | if (b) { |
| | | $.post("gwProduct.ashx", { "action": "delete", id: id }, function(result) { |
| | | mytek.alert(result.Message, result.OK, function() { |
| | | loadPageList(); |
| | | }); |
| | | }, |
| | | "json"); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-btn-GwProductQuery", function() { |
| | | pagination.setPageIndex(1); |
| | | loadPageList(); |
| | | }); |
| | | |
| | | $(document).on("click", "a[data-index]", function() { |
| | | pagination.setPageIndex($(this).attr("data-index")); |
| | | loadPageList(); |
| | | }); |
| | | |
| | | //进入页面时执行查询 |
| | | loadPageList(); |
| | | |
| | | }); |
| | | </script> |
| | | </asp:Content> |
| | | <asp:Content runat="server" ID="Content2" ContentPlaceHolderID="title">产品分类管理</asp:Content> |
| | | <asp:Content ID="Content3" ContentPlaceHolderID="content" runat="Server"> |
| | | |
| | | <form name="queryForm" method="get" action="GwProduct.aspx" id="queryForm" class="form-inline" |
| | | id="gwProductTable"> |
| | | <div class="m-b"> |
| | | <div class="form-group"> |
| | | <div class="input-group"> |
| | | <span class="input-group-addon">产品分类名称</span> |
| | | <input type="text" name="Name" id="Name" class="form-control" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group" style="display: none"> |
| | | <div class="input-group"> |
| | | <select name="Classes" id="Classes" class="form-control"> |
| | | <option value="-1">--请选择类别--</option> |
| | | <option value="0" selected>产品分类</option> |
| | | <option value="1">产品</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="input-group"> |
| | | <input type="button" value="查询" class="btn btn-primary action-btn-GwProductQuery" /> |
| | | <input class=" btn btn-warning action-modal-add" value="添加产品分类" type="button" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <table class="table table-striped table-bordered table-hover" id="productTable"> |
| | | <thead> |
| | | <tr class="header"> |
| | | <th>产品分类名称 |
| | | </th> |
| | | <th>父级产品分类 |
| | | </th> |
| | | <th>是否启用 |
| | | </th> |
| | | <th>创建时间 |
| | | </th> |
| | | <th>备注 |
| | | </th> |
| | | <th class="text-center">操作 |
| | | </th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | </tbody> |
| | | </table> |
| | | </form> |
| | | <div id="pagination"> |
| | | </div> |
| | | <div class="footBar"> |
| | | |
| | | </div> |
| | | |
| | | <div class="modal inmodal fade" id="productDialog" tabindex="-1" role="dialog" aria-hidden="true"> |
| | | <div class="modal-dialog modal-lg"> |
| | | <form class="form-horizontal" id="productForm" name="productForm" method="post" action="gwProduct.ashx"> |
| | | <div class="modal-content "> |
| | | <div class="modal-header"> |
| | | <input type="hidden" class="form-control" name="action" id="action" value="update" /> |
| | | <input type="hidden" class="form-control" name="id" id="id" value="" /> |
| | | <button type="button" class="close" data-dismiss="modal"> |
| | | <span aria-hidden="true">×</span><span class="sr-only">Close</span></button> |
| | | <h4 class="modal-title">编辑产品分类资料</h4> |
| | | </div> |
| | | <div class="modal-body"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 名称 <span style="color:red">*</span></label> |
| | | <div class="col-sm-4 "> |
| | | <input type="text" class="form-control" name="name" id="name" value="" /> |
| | | </div> |
| | | </div> |
| | | <input type="hidden" class="form-control" name="classes" id="classes" value="0" /> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 父级分类ID</label> |
| | | <div class="col-sm-4 "> |
| | | <select name="parentId" id="parentId" class="form-control"> |
| | | <%=GetProductClassOptions("0")%> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 是否启用</label> |
| | | <div class="col-sm-4 "> |
| | | <select id="isEnable" name="isEnable" class="form-control"> |
| | | <option value="0" >停用</option> |
| | | <option value="1" selected>启用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 备注</label> |
| | | <div class="col-sm-4"> |
| | | <textarea class="form-control" name="remark" id="remark" rows="4" ></textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="modal-footer"> |
| | | <button class="btn btn-default" data-dismiss="modal" aria-hidden="true"> |
| | | 取消</button> |
| | | <button class="btn btn-primary"> |
| | | 保存</button> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- footBar --> |
| | | <div id="mask" class="mask"> |
| | | <span></span> |
| | | <img src="img/spinning-circles.svg" alt="载入中..." /> |
| | | </div> |
| | | </asp:Content> |
| | | |
| | | |
| | | |
| | |
| | | public class GwSm : PageHandler<SysUser> |
| | | { |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context) |
| | |
| | | private List<GwProduct> _ProductList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | private List<GwOp> OpList |
| | |
| | | private List<GwAp> ApList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | string permissionsSQL = null; |
| | | |
| | |
| | | private List<GwAp> ApList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | string permissionsSQL = null; |
| | | |
| | |
| | | { |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | string permissionsSQL = null; |
| | | |
| | |
| | | { |
| | | private GwStatisV3Dao _Dao = new GwStatisV3Dao(); |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | public override JsonPageResult ProcessRequestInternal(PageContext<Model.SysUser> context) |
| | |
| | | private List<GwAp> ApList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | string permissionsSQL = null; |
| | | |
| | |
| | | <li><a href="Setting.aspx" class="J_menuItem">系统参数设置</a> </li> |
| | | <li><a href="SysDictType.aspx" class="J_menuItem">字典类型管理</a> </li> |
| | | <li><a href="SysDictData.aspx" class="J_menuItem">字典数据管理</a> </li> |
| | | <li><a href="SysRoleMenu.aspx" class="J_menuItem">角色权限管理</a> </li> |
| | | |
| | | </ul> |
| | | </li> |
| | |
| | | { |
| | | string dictLabel = context.GetString("dictLabel"); |
| | | string dictType = context.GetString("dictType"); |
| | | string source = context.GetString("source"); |
| | | |
| | | int recordCount = 0; |
| | | int pageSize = context.GetInt("pageSize", 50); |
| | |
| | | str1 += "<td>" + bean.DictLabel + "</td>"; |
| | | str1 += "<td>" + bean.DictType + "</td>"; |
| | | str1 += "<td>" + bean.DictSort + "</td>"; |
| | | str1 += "<td>" + (bean.ParanSource == 0 ? "系统内置" : "用户添加") + "</td>"; |
| | | str1 += "<td>" + SysUserName(string.IsNullOrEmpty(bean.CreateBy)? 0: int.Parse(bean.CreateBy) ) + "</td>"; |
| | | str1 += "<td>" + bean.CreateTime + "</td>"; |
| | | str1 += "<td>" + (bean.Status == 1 ? "<span class='label label-primary'>正常</span>" : "<span class='label label-default'>停用</span>") + "</td>"; |
| | | str1 += "<td class=\"text-center \">"; |
| | | str1 = bean.Status != 0 ? str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-status=\"0\" class=\"action-update-status btn btn-default btn-xs\"><i class=\"fa fa-toggle-off\"></i> 停用</a> ", (object) bean.DictId ) : str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-status=\"1\" class=\"action-update-status btn btn-primary btn-xs\"><i class=\"fa fa-toggle-on\"/></i> 启用</a> ", (object) bean.DictId ); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-modal-edit btn btn-success btn-xs\"><i class=\"fa fa-edit\"></i> 编辑</a> ", (object) bean.DictId); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-delete btn btn-default btn-xs\"><i class=\"fa fa-trash\"></i> 删除</a> ", (object) bean.DictId); |
| | | if(bean.ParanSource == 1) { |
| | | str1 = bean.Status != 0 ? str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-status=\"0\" class=\"action-update-status btn btn-default btn-xs\"><i class=\"fa fa-toggle-off\"></i> 停用</a> ", (object) bean.DictId ) : str1 + string.Format("<a href=\"javascript:;\" data-id=\"{0}\" data-status=\"1\" class=\"action-update-status btn btn-primary btn-xs\"><i class=\"fa fa-toggle-on\"/></i> 启用</a> ", (object) bean.DictId ); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-modal-edit btn btn-success btn-xs\"><i class=\"fa fa-edit\"></i> 编辑</a> ", (object) bean.DictId); |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-delete btn btn-default btn-xs\"><i class=\"fa fa-trash\"></i> 删除</a> ", (object) bean.DictId); |
| | | } |
| | | |
| | | //根据入口源显示【角色权限】 |
| | | if(source.Equals("SysRoleMenu")) |
| | | str1 += string.Format("<a href=\"javascript:;\" data-id=\"{0}\" class=\"action-permission btn btn-primary btn-xs\"><i class=\"fa fa-cog\"></i> 角色权限</a> ", (object) bean.DictValue); |
| | | str1 += "</td>"; |
| | | str1 += "</tr>"; |
| | | } |
| | | } |
| | | else |
| | | str1 += "<tr><td colspan=\"8\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>"; |
| | | str1 += "<tr><td colspan=\"9\" style=\"padding-left:5px; text-align: center;\">暂无信息</td></tr>"; |
| | | |
| | | return new JsonPageResult(true, new |
| | | { |
| | |
| | | string remark = context.GetString("remark", ""); |
| | | |
| | | if (string.IsNullOrEmpty(dictValue) ) { |
| | | throw new ArgumentException("字典数据键值不能为空,请输入!"); |
| | | if (dictType.Equals("USER_ROLE")) |
| | | { |
| | | throw new ArgumentException("角色编码不能为空,请输入!"); |
| | | } |
| | | else |
| | | { |
| | | throw new ArgumentException("字典数据键值不能为空,请输入!"); |
| | | } |
| | | } |
| | | if (string.IsNullOrEmpty(dictLabel) ) { |
| | | throw new ArgumentException("字典数据标签不能为空,请输入!"); |
| | | if (dictType.Equals("USER_ROLE")) |
| | | { |
| | | throw new ArgumentException("角色名称不能为空,请输入!"); |
| | | } |
| | | else |
| | | { |
| | | throw new ArgumentException("字典数据标签不能为空,请输入!"); |
| | | } |
| | | } |
| | | if (string.IsNullOrEmpty(dictType) ) { |
| | | throw new ArgumentException("字典类型编码不能为空,请输入!"); |
| | |
| | | string remark = context.GetString("remark", ""); |
| | | |
| | | if (string.IsNullOrEmpty(dictValue) ) { |
| | | throw new ArgumentException("字典数据键值不能为空,请输入!"); |
| | | if (dictType.Equals("USER_ROLE")) |
| | | { |
| | | throw new ArgumentException("角色编码不能为空,请输入!"); |
| | | } |
| | | else |
| | | { |
| | | throw new ArgumentException("字典数据键值不能为空,请输入!"); |
| | | } |
| | | } |
| | | if (string.IsNullOrEmpty(dictLabel) ) { |
| | | throw new ArgumentException("字典数据标签不能为空,请输入!"); |
| | | if (dictType.Equals("USER_ROLE")) |
| | | { |
| | | throw new ArgumentException("角色名称不能为空,请输入!"); |
| | | } |
| | | else |
| | | { |
| | | throw new ArgumentException("字典数据标签不能为空,请输入!"); |
| | | } |
| | | } |
| | | if (string.IsNullOrEmpty(dictType) ) { |
| | | throw new ArgumentException("字典类型编码不能为空,请输入!"); |
| | |
| | | if (r.OK) { |
| | | $("#sysDictDataDialog #action").val("update"); |
| | | $("#sysDictDataDialog #dictId").val(r.Message.DictId); |
| | | $("#sysDictDataDialog #dictValue").val(r.Message.DictValue).attr("readonly", false); |
| | | $("#sysDictDataDialog #dictValue").val(r.Message.DictValue).attr("readonly", true); |
| | | $("#sysDictDataDialog #dictLabel").val(r.Message.DictLabel); |
| | | $("#sysDictDataDialog #dictType").val(r.Message.DictType); |
| | | $("#sysDictDataDialog #dictSort").val(r.Message.DictSort); |
| | |
| | | </th> |
| | | <th>字典排序 |
| | | </th> |
| | | <th>参数来源 |
| | | </th> |
| | | <th>创建者 |
| | | </th> |
| | | <th>创建时间 |
| | |
| | | using System.Web.SessionState; |
| | | |
| | | /** |
| | | * 产品管理 |
| | | * 字典数据管理 |
| | | * |
| | | */ |
| | | public partial class _SysDictData : PageBase<SysUser>, IRequiresSessionState |
| | |
| | | using System.Web.SessionState; |
| | | |
| | | /** |
| | | * 产品管理 |
| | | * 字典类型管理 |
| | | * |
| | | */ |
| | | public partial class _SysDictType : PageBase<SysUser>, IRequiresSessionState |
New file |
| | |
| | | <%@ Page Language="C#" masterpagefile="~/Main.master" AutoEventWireup="true" CodeFile="SysRoleMenu.aspx.cs" Inherits="_SysRoleMenu" %> |
| | | <asp:Content runat="server" ID="Content1" ContentPlaceHolderID="head"> |
| | | <script type="text/javascript" language="javascript"> |
| | | $(document).ready(function () { |
| | | var pagination = new Pagination(); |
| | | pagination.setPageIndex(1); |
| | | pagination.setPageSize(50); |
| | | |
| | | function loadPageList() { |
| | | var dictLabel = ""; |
| | | var dictType = "USER_ROLE"; |
| | | var source = "SysRoleMenu"; //入口源 |
| | | $.ajax({ |
| | | url: "SysDictData.ashx", |
| | | type: "POST", |
| | | data: { action: "list", dictLabel: dictLabel, dictType: dictType, source:source, pageIndex: pagination.getPageIndex(), pageSize: pagination.getPageSize() }, |
| | | success: function (result) { |
| | | if (result.OK) { |
| | | $("#sysDictDataTable tbody").html(result.Message.Table); |
| | | pagination.setRecordCount(result.Message.TotalCount); |
| | | $("#pagination").html(pagination.getHtml()); |
| | | $("[data-toggle='popover']").popover(); |
| | | } else { |
| | | mytek.alert(result.Message, result.OK); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | $(document).on("click", ".action-modal-add", function () { |
| | | $("#sysDictDataDialog .modal-title").text("添加角色"); |
| | | $("#sysDictDataDialog #action").val("add"); |
| | | $("#sysDictDataDialog #dictId").val(""); |
| | | $("#sysDictDataDialog #dictValue").val("").attr("readonly", false); |
| | | $("#sysDictDataDialog #dictLabel").val(""); |
| | | $("#sysDictDataDialog #dictType").val("USER_ROLE"); |
| | | $("#sysDictDataDialog #dictSort").val(1); |
| | | $("#sysDictDataDialog #remark").val(""); |
| | | |
| | | $("#sysDictDataDialog .statusCss").hide(); |
| | | |
| | | $("#sysDictDataDialog").modal("show"); |
| | | }); |
| | | |
| | | $("#sysDictDataForm").ajaxForm({ |
| | | success: function (r) { |
| | | if (r.OK) { |
| | | mytek.alert(r.Message, r.OK, function () { |
| | | $("#sysDictDataDialog").modal("hide"); |
| | | loadPageList(); |
| | | }); |
| | | } else { |
| | | mytek.alert(r.Message, r.OK); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | $(document).on("click", ".action-modal-edit", function () { |
| | | var dictId = $(this).data("id"); |
| | | $("#sysDictDataDialog .modal-title").text("编辑角色"); |
| | | |
| | | $.get("SysDictData.ashx", { "action": "getByDictId", dictId: dictId }, function (r) { |
| | | if (r.OK) { |
| | | $("#sysDictDataDialog #action").val("update"); |
| | | $("#sysDictDataDialog #dictId").val(r.Message.DictId); |
| | | $("#sysDictDataDialog #dictValue").val(r.Message.DictValue).attr("readonly", true); |
| | | $("#sysDictDataDialog #dictLabel").val(r.Message.DictLabel); |
| | | $("#sysDictDataDialog #dictType").val(r.Message.DictType); |
| | | $("#sysDictDataDialog #dictSort").val(r.Message.DictSort); |
| | | $("#sysDictDataDialog #status").val(r.Message.Status); |
| | | $("#sysDictDataDialog #remark").val(r.Message.Remark); |
| | | |
| | | $("#sysDictDataDialog .statusCss").show(); |
| | | |
| | | $("#sysDictDataDialog").modal("show"); |
| | | } |
| | | else { |
| | | mytek.alert(r.Message, r.OK); |
| | | } |
| | | }, "json"); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-update-status", function () { |
| | | //data的属性参数不能含有大写字母。 |
| | | var dictId = $(this).data("id"); |
| | | var status = $(this).data("status"); |
| | | var statusStr = ""; |
| | | if (status == 0) { |
| | | statusStr = "【停用】"; |
| | | } |
| | | else { |
| | | statusStr = "【启用】"; |
| | | } |
| | | mytek.confirm("是否需要" + statusStr + "该信息?", "确认更新信息状态,请谨慎操作!", function (b) { |
| | | if (b) { |
| | | $.post("SysDictData.ashx", { "action": "updateStatus", dictId: dictId, status: status }, function (r) { |
| | | mytek.alert(r.Message, r.OK, function () { |
| | | loadPageList(); |
| | | }); |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-delete", function () { |
| | | var dictId = $(this).data("id"); |
| | | mytek.confirm("是否需要删除该信息?", "数据删除后将无法恢复,请谨慎操作!", function (b) { |
| | | if (b) { |
| | | $.post("SysDictData.ashx", { "action": "delete", dictId: dictId }, function (result) { |
| | | mytek.alert(result.Message, result.OK, function () { |
| | | loadPageList(); |
| | | }); |
| | | }, |
| | | "json"); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | $(document).on("click", ".action-btn-SysDictDataQuery", function () { |
| | | pagination.setPageIndex(1); |
| | | loadPageList(); |
| | | }); |
| | | |
| | | $(document).on("click", "a[data-index]", function () { |
| | | pagination.setPageIndex($(this).attr("data-index")); |
| | | loadPageList(); |
| | | }); |
| | | |
| | | //进入页面时执行查询 |
| | | loadPageList(); |
| | | |
| | | |
| | | //打开角色所属权限树 |
| | | $(document).on("click", ".action-permission", function () { |
| | | //var roleId = $("#RoleId").val(); |
| | | var roleId = $(this).data("id"); |
| | | $.get("SysRoleMenu.ashx", { action: "loadRoleMenuList", "roleId": roleId }, function (result) { |
| | | if (!result.OK) { |
| | | mytek.alert(result.Message, result.OK); |
| | | } |
| | | else { |
| | | $("#permissionDialog").data("roleId", roleId); |
| | | $("#permissionDialog #MenuID").prop("checked", false); |
| | | $.each(result.Message, function (i) { |
| | | $("#permissionDialog #MenuID[value='" + this + "']").prop("checked", true); |
| | | }); |
| | | $("#permissionDialog").modal("show"); |
| | | } |
| | | }, "json"); |
| | | }); |
| | | |
| | | //勾选菜单复选框事件 |
| | | $(document).on("click", "#MenuID", function () { |
| | | var id = $(this).val(); |
| | | if (id == 1) { |
| | | $("input[name='MenuID']").prop("checked", $(this).is(":checked")); |
| | | } else { |
| | | $("[data-prentid='" + id + "']").prop("checked", $(this).is(":checked")); |
| | | |
| | | $("input[data-prentid='" + id + "']").each(function () { |
| | | var partentid = $(this).val(); |
| | | $("[data-prentid='" + partentid + "']").prop("checked", $(this).is(":checked")); |
| | | }) |
| | | //$("[data-prentid='" + id + "']").prop("checked", $(this).is(":checked")); |
| | | } |
| | | }); |
| | | |
| | | //保存角色权限 |
| | | $(document).on("click", ".action-update-permission", function () { |
| | | var menuIDArray = []; |
| | | |
| | | //mytek.confirm("是否修改角色权限?", "请谨慎操作!", function (b) { |
| | | // if (b) { |
| | | $("#permissionDialog #MenuID").each(function () { |
| | | if ($(this).is(":checked")) { |
| | | menuIDArray.push($(this).val()); |
| | | } |
| | | }); |
| | | |
| | | var roleId = $("#permissionDialog").data("roleId"); |
| | | $.ajax({ |
| | | url: "SysRoleMenu.ashx", |
| | | type: "POST", |
| | | data: { action: "updatePermission", roleId: roleId, menuIDArray: $.toJSON(menuIDArray) }, |
| | | success: function (result) { |
| | | $("#permissionDialog").modal("hide"); |
| | | if (result.OK) { |
| | | //; |
| | | } else { |
| | | mytek.alert(result.Message, result.OK); |
| | | } |
| | | } |
| | | }); |
| | | // } |
| | | //}); |
| | | }); |
| | | |
| | | }); |
| | | </script> |
| | | </asp:Content> |
| | | <asp:Content runat="server" ID="Content2" ContentPlaceHolderID="title">角色权限管理</asp:Content> |
| | | <asp:Content ID="Content3" ContentPlaceHolderID="content" runat="Server"> |
| | | <!-- |
| | | <form name="queryForm" method="get" action="SysRoleMenu.aspx" id="queryForm" class="form-inline" |
| | | id="sysRoleMenuTable"> |
| | | <div class="m-b"> |
| | | <div class="form-group"> |
| | | <div class="input-group"> |
| | | <span class="input-group-addon">角色名称 <span style="color:red">*</span></span> |
| | | <select name="RoleId" id="RoleId" class="form-control"> |
| | | <!%=UserRoleOptions()%> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="input-group"> |
| | | <input type="button" value="角色权限" class="btn btn-primary action-permission" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | --> |
| | | |
| | | <input class=" btn btn-warning action-modal-add" value="添加角色" type="button" /> |
| | | <table class="table table-striped table-bordered table-hover" id="sysDictDataTable"> |
| | | <thead> |
| | | <tr class="header"> |
| | | <th>角色编码 |
| | | </th> |
| | | <th>角色名称 |
| | | </th> |
| | | <th>所属类型 |
| | | </th> |
| | | <th>角色排序 |
| | | </th> |
| | | <th>参数来源 |
| | | </th> |
| | | <th>创建者 |
| | | </th> |
| | | <th>创建时间 |
| | | </th> |
| | | <th>是否启用 |
| | | </th> |
| | | <th class="text-center">操作 |
| | | </th> |
| | | </tr> |
| | | </thead> |
| | | <tbody> |
| | | </tbody> |
| | | </table> |
| | | |
| | | <div id="pagination"> |
| | | </div> |
| | | <div class="footBar"> |
| | | </div> |
| | | |
| | | <div class="modal inmodal fade" id="sysDictDataDialog" tabindex="-1" role="dialog" aria-hidden="true"> |
| | | <div class="modal-dialog modal-lg"> |
| | | <form class="form-horizontal" id="sysDictDataForm" name="sysDictDataForm" method="post" action="SysDictData.ashx"> |
| | | <div class="modal-content "> |
| | | <div class="modal-header"> |
| | | <input type="hidden" class="form-control" name="action" id="action" value="update" /> |
| | | <input type="hidden" class="form-control" name="dictId" id="dictId" value="" /> |
| | | <button type="button" class="close" data-dismiss="modal"> |
| | | <span aria-hidden="true">×</span><span class="sr-only">Close</span></button> |
| | | <h4 class="modal-title">编辑角色资料</h4> |
| | | </div> |
| | | <div class="modal-body"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 角色编码 <span style="color:red">*</span> |
| | | </label> |
| | | <div class="col-sm-4 "> |
| | | <input type="text" class="form-control" name="dictValue" id="dictValue" value="" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 角色名称 <span style="color:red">*</span> |
| | | </label> |
| | | <div class="col-sm-4 "> |
| | | <input type="text" class="form-control" name="dictLabel" id="dictLabel" value="" /> |
| | | </div> |
| | | </div> |
| | | <input type="hidden" class="form-control" name="dictType" id="dictType" value="USER_ROLE" /> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 角色排序 <span style="color:red">*</span> |
| | | </label> |
| | | <div class="col-sm-4 "> |
| | | <input type="text" class="form-control" name="dictSort" id="dictSort" |
| | | maxlength="8" value="" onkeyup="value=value.replace(/[^\d]/g,'')" |
| | | onpaste="value=value.replace(/[^\d]/g,'')" oncontextmenu="return false" /> |
| | | </div> |
| | | </div> |
| | | <div class="form-group statusCss"> |
| | | <label class="col-sm-2 control-label"> |
| | | 状态</label> |
| | | <div class="col-sm-4 "> |
| | | <select id="status" name="status" class="form-control"> |
| | | <option value="0" >停用</option> |
| | | <option value="1" selected>正常</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label"> |
| | | 备注</label> |
| | | <div class="col-sm-4"> |
| | | <textarea class="form-control" name="remark" id="remark" rows="4" ></textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="modal-footer"> |
| | | <button class="btn btn-default" data-dismiss="modal" aria-hidden="true"> |
| | | 取消</button> |
| | | <button class="btn btn-primary"> |
| | | 保存</button> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="modal inmodal fade" id="permissionDialog" tabindex="-1" role="dialog" |
| | | aria-hidden="true"> |
| | | <div class="modal-dialog"> |
| | | <div class="modal-content animated bounceInRight"> |
| | | <div class="modal-header"> |
| | | <span class="title">设置角色权限</span><a class="close" data-dismiss="modal" aria-hidden="true">×</a></div> |
| | | <div class="modal-body"> |
| | | <%=RenderFunctionTree() %> |
| | | </div> |
| | | <div class="modal-footer"> |
| | | <button class="btn-default btn" data-dismiss="modal" aria-hidden="true"> |
| | | 取消</button> |
| | | <a class="btn btn-primary action-update-permission">保存</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- footBar --> |
| | | <div id="mask" class="mask"> |
| | | <span></span> |
| | | <img src="img/spinning-circles.svg" alt="载入中..." /> |
| | | </div> |
| | | </asp:Content> |
| | | |
| | | |
| | | |
New file |
| | |
| | | |
| | | using Common; |
| | | using Dao; |
| | | using Model; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Web; |
| | | using System.Web.Profile; |
| | | using System.Web.SessionState; |
| | | |
| | | /** |
| | | * 角色权限管理 |
| | | * |
| | | */ |
| | | public partial class _SysRoleMenu : PageBase<SysUser>, IRequiresSessionState |
| | | { |
| | | protected List<SysDictData> UserRoleList; |
| | | |
| | | protected void Page_Load(object sender, EventArgs e) |
| | | { |
| | | //权限控制 |
| | | this.CheckRight("112", FailedOperation.ErrorMsgOnly); |
| | | |
| | | //获取字典数据:USER_ROLE-用户角色 |
| | | using (SysDictDataDao sysDictDataDao = new SysDictDataDao()) |
| | | { |
| | | SysDictData bean = new SysDictData(); |
| | | bean.DelFlag = 0; //正常 |
| | | bean.Status = 1; //启用 |
| | | bean.DictType = "USER_ROLE"; //字典类型为“用户角色” |
| | | this.UserRoleList = sysDictDataDao.getAllList(bean); |
| | | } |
| | | |
| | | } |
| | | |
| | | private string GenerateTextPadding(SysMenu menu) |
| | | { |
| | | return string.Format("<span style=\"width:{0}px;display:inline-block;\"></span>{1}.", (object)(menu.MenuLV * 20), (object)menu.MenuID); |
| | | } |
| | | |
| | | protected string RenderFunctionTree() |
| | | { |
| | | using (UserDao userDao = new UserDao()) |
| | | { |
| | | List<SysMenu> list = userDao.LoadSysMenuList(); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder.Append("<table cellpadding='5'>"); |
| | | foreach (SysMenu menu in list) |
| | | stringBuilder.AppendFormat("<tr><td colspan='2'><span style='padding:5px;'>{2}</span>\r\n <input type=\"checkbox\" id=\"MenuID\" data-prentId='{5}' name=\"MenuID\" value=\"{0}\" {1}/><span style='padding:5px;'>{3} </span> \r\n <span style='padding:5px; color:#666666'>{4}</span></td></tr>", (object)menu.MenuID, (object)"", (object)this.GenerateTextPadding(menu), (object)menu.MenuName, (object)menu.Remark, (object)menu.ParentID); |
| | | stringBuilder.Append("</table>"); |
| | | return stringBuilder.ToString(); |
| | | } |
| | | } |
| | | |
| | | //用户角色下拉 |
| | | public string UserRoleOptions() |
| | | { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | if (this.UserRoleList.Count == 0) |
| | | return "<option value='0'>无</option>"; |
| | | stringBuilder.AppendFormat("<option value=\"{0}\" >{1}</option>", (object)"", (object)"无"); |
| | | foreach (SysDictData bean in this.UserRoleList) |
| | | { /** |
| | | //状态停用过滤 |
| | | if (bean.Status == 0) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | //删除过滤 |
| | | if (bean.DelFlag == 2) |
| | | { |
| | | continue; |
| | | }**/ |
| | | |
| | | stringBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", (object)bean.DictValue, (object)bean.DictLabel); |
| | | } |
| | | return stringBuilder.ToString(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | //修改密码 |
| | | case "updatePwd": |
| | | return UpdatePwd(context); |
| | | //根据数组字符串转换字典 |
| | | case "arrayStrToDict": |
| | | return ArrayStrToDict(context); |
| | | |
| | | default: |
| | | throw new Exception("Invalid Action=" + @string); |
| | |
| | | private JsonPageResult LoadUserMenuList(PageContext<SysUser> context) |
| | | { |
| | | context.CheckRight("104", FailedOperation.PromptOnly); |
| | | return new JsonPageResult(true, (object) this._Dao.LoadUserMenuList(context.GetInt("userid")).Keys); |
| | | //return new JsonPageResult(true, (object) this._Dao.LoadUserMenuList(context.GetInt("userid")).Keys); |
| | | return new JsonPageResult(true, (object) this._Dao.LoadUserRoleMenuList(context.GetInt("userid")).Keys); |
| | | } |
| | | |
| | | private JsonPageResult SaveUser(PageContext<SysUser> context) |
| | |
| | | string string2 = context.GetString("password"); |
| | | string userName = context.GetString("userName"); |
| | | string userType = context.GetString("userType"); |
| | | |
| | | List<string> tmpList = new List<string>(); |
| | | //数组合并 |
| | | tmpList.AddRange( JsonConvert.DeserializeObject<string[]>(context.GetString("userType")) ); |
| | | |
| | | //数组去重 |
| | | string[] tmpArray = DataConverter.DelRepeatData(tmpList.ToArray() ); |
| | | userType = string.Join(",", tmpArray) ; |
| | | |
| | | string string3 = context.GetString("email"); |
| | | string string4 = context.GetString("mobile"); |
| | | int int2 = context.GetInt("emailFlag"); |
| | |
| | | throw new ArgumentException("账户名称已经存在,请重新输入!"); |
| | | |
| | | sysUser.UserName = userName; |
| | | sysUser.UserType = string.IsNullOrEmpty(userType) ? 0 : int.Parse(userType); |
| | | sysUser.UserType = userType; |
| | | sysUser.CreateTime = DateTime.Now; |
| | | |
| | | /** |
| | |
| | | _Dao.UpdatePwd(account, newPwd ); |
| | | |
| | | return new JsonPageResult(true, (object)"修改密码成功!"); |
| | | } |
| | | |
| | | //根据数组字符串转换字典 |
| | | private JsonPageResult ArrayStrToDict(PageContext<Model.SysUser> context) |
| | | { |
| | | string userId = context.GetString("userId"); |
| | | string userType = context.GetString("userType"); |
| | | |
| | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| | | |
| | | List<object> list = DataConverter.stringToList(userType); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | //dictionary[userId.ToString()] = list[i]; |
| | | dictionary[list[i].ToString()] = list[i]; |
| | | } |
| | | |
| | | return new JsonPageResult(true, dictionary.Keys); |
| | | } |
| | | |
| | | } |
| | |
| | | var isVerification = $("#userDialog #isVerification").prop("checked"); |
| | | |
| | | var clientIp = $("#userDialog #clientIp").val(); |
| | | var userRoleArray = []; |
| | | $("#userDialog #_UserRole").each(function () { |
| | | if ($(this).is(":checked")) { |
| | | userRoleArray.push($(this).val()); |
| | | } |
| | | }); |
| | | userType = $.toJSON(userRoleArray); |
| | | |
| | | $.post("sysuser.ashx", { action: "saveUser", userid: userid, account: account, password: password, userName: userName, userType: userType, mobile: mobile, email: email, mobileFlag: mobileFlag, emailFlag: emailFlag, isVerification: isVerification, clientIp: clientIp }, |
| | | function(result) { |
| | |
| | | $("#userDialog #account").val(""); |
| | | //$("#userDialog #password").val(""); |
| | | $("#userDialog #userName").val(""); |
| | | $("#userDialog #userType").val(""); |
| | | //$("#userDialog #userType").val(""); |
| | | $("#userDialog #_UserRole").iCheck("uncheck"); |
| | | |
| | | $("#userDialog #mobile").val(""); |
| | | $("#userDialog #email").val(""); |
| | | $("#userDialog input[name=isVerification]").iCheck("uncheck"); |
| | |
| | | } |
| | | else { |
| | | $("#permissionDialog").data("id", id); |
| | | $("#permissionDialog #MenuID").prop("checked", false); |
| | | $("#permissionDialog #MenuID").prop("checked", false).attr("disabled", "disabled"); |
| | | $.each(result.Message, function(i) { |
| | | $("#permissionDialog #MenuID[value='" + this + "']").prop("checked", true); |
| | | $("#permissionDialog #MenuID[value='" + this + "']").prop("checked", true).attr("disabled", "disabled"); |
| | | }); |
| | | } |
| | | $("#permissionDialog").modal("show"); |
| | |
| | | //编辑时密码框隐藏 |
| | | $(".pwdCss").hide(); |
| | | $("#userDialog #userName").val(user.UserName); |
| | | $("#userDialog #userType").val(user.UserType); |
| | | //$("#userDialog #userType").val(user.UserType); |
| | | $.get("sysuser.ashx", { action: "arrayStrToDict", "userId": id, "userType": user.UserType }, function (r) { |
| | | if (!r.OK) { |
| | | mytek.alert(r.Message, r.OK); |
| | | } |
| | | else { |
| | | $("#userDialog #_UserRole").prop("checked", false); |
| | | $.each(r.Message, function (i) { |
| | | $("#userDialog #_UserRole[value='" + this + "']").prop("checked", true); |
| | | }); |
| | | } |
| | | }, "json"); |
| | | |
| | | $("#userDialog #mobile").val(user.Mobile); |
| | | $("#userDialog #email").val(user.Email); |
| | | $("#userDialog #emailFlag").val(user.EmailFlag); |
| | | $("#userDialog #mobileFlag").val(user.MobileFlag); |
| | | $("#userDialog #isVerification").iCheck(user.IsVerification == 1 ? "check" : "uncheck"); |
| | | $("#userDialog #clientIp").val(user.ClientIp); |
| | | |
| | | $("#userDialog").modal("show"); |
| | | }, "json"); |
| | | }); |
| | |
| | | <label class="col-sm-2 control-label"> |
| | | 账户类型 <span style="color:red">*</span> |
| | | </label> |
| | | <div class="col-sm-4"> |
| | | <div class="col-sm-10"> |
| | | <%=UserRoleList() %> |
| | | <!-- |
| | | <select name="userType" id="userType" class="form-control"> |
| | | <option value=""></option> |
| | | <option value="1">管理员</option> |
| | | <option value="2">业务员</option> |
| | | <option value="3">业务主管</option> |
| | | <option value="4">业务总监</option> |
| | | <option value="5">客服人员</option> |
| | | <option value="6">财务人员</option> |
| | | <option value="99">其他</option> |
| | | <option value="3">客户经理</option> |
| | | <option value="4">客服人员</option> |
| | | <option value="5">财务人员</option> |
| | | </select> |
| | | --> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | |
| | | <div class="modal-dialog"> |
| | | <div class="modal-content animated bounceInRight"> |
| | | <div class="modal-header"> |
| | | <span class="title">设置账户权限</span><a class="close" data-dismiss="modal" aria-hidden="true">×</a></div> |
| | | <span class="title">查看账户权限</span><a class="close" data-dismiss="modal" aria-hidden="true">×</a></div> |
| | | <div class="modal-body"> |
| | | |
| | | <%=RenderFunctionTree() %> |
| | |
| | | <div class="modal-footer"> |
| | | <button class="btn-default btn" data-dismiss="modal" aria-hidden="true"> |
| | | 取消</button> |
| | | <!-- |
| | | <button class="btn btn-primary action-update-permission"> |
| | | 保存</button> |
| | | --> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | public partial class _SysUser : PageBase<SysUser>, IRequiresSessionState |
| | | { |
| | | |
| | | |
| | | |
| | | public List<SysDictData> userRoleList { get; set; } //账号类型或称用户角色。 |
| | | public string IP { get; set; } |
| | | |
| | | protected void Page_Load(object sender, EventArgs e) |
| | | { |
| | | this.IP = this.Request.UserHostAddress; |
| | | this.CheckRight("104", FailedOperation.PromptOnly); |
| | | |
| | | } |
| | | |
| | | private string GenerateTextPadding(SysMenu menu) |
| | |
| | | return stringBuilder.ToString(); |
| | | } |
| | | } |
| | | |
| | | //所有用户角色(字典类型为:USER_ROLE) |
| | | protected string UserRoleList() |
| | | { |
| | | using (SysDictDataDao sysDictDataDao = new SysDictDataDao()) |
| | | { |
| | | SysDictData sysDictData = new SysDictData(); |
| | | sysDictData.DictType = "USER_ROLE"; //字典类型:用户角色 |
| | | sysDictData.Status = 1; //状态:1-启用 |
| | | List<SysDictData> userRoleList = sysDictDataDao.getAllList(sysDictData); |
| | | |
| | | //List<GwProduct> list = gwProductDao.getAllList(gwProduct); |
| | | |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder.Append("<table cellpadding='5'>"); |
| | | if (userRoleList.Count > 0) |
| | | { |
| | | for (int i = 0; i < userRoleList.Count; i++) |
| | | { |
| | | SysDictData bean = (SysDictData)userRoleList[i]; |
| | | |
| | | //行开始符 |
| | | if (i % 5 == 0) |
| | | { |
| | | stringBuilder.Append("<tr>"); |
| | | } |
| | | |
| | | //行单元格 |
| | | stringBuilder.AppendFormat("<td><input type=\"checkbox\" id=\"_UserRole\" name=\"_UserRole\" value=\"{0}\" /><span style='padding:5px;'>{1} </span> \r\n </td>", (object)bean.DictValue, (object)bean.DictLabel); |
| | | |
| | | //行结束符 |
| | | if (i % 5 == 4 || i == (userRoleList.Count - 1)) |
| | | { |
| | | stringBuilder.Append("</tr>"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | stringBuilder.Append("</table>"); |
| | | |
| | | return stringBuilder.ToString(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | protected List<GwProduct> GwProductList; |
| | | |
| | | private int _userId = -1; |
| | | private int _userType = -1; |
| | | private string _userType = ""; |
| | | private string _account = ""; |
| | | |
| | | |