Commit 121a941d authored by tr's avatar tr

1、登录界面:增加提示;权限优化

2、原【流程共享】更名为【共享文件】
3、原【客户信息】更名为【共享信息】
parent d9dcd05c
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="UpdateTime" value="2021-10-11 18:11:12.770" />
<add key="LoginInfo" value="wwF/xpBzWek=" /> <add key="LoginInfo" value="wwF/xpBzWek=" />
<add key="LoginVerify" value="v86f5Q3Xa7U=" /> <add key="LoginVerify" value="v86f5Q3Xa7U=" />
<add key="UpdateTime" value="2021-10-11 18:11:12.770" />
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral"/> <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10"/> <bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CefSharp.Core.Runtime" processorArchitecture="x86" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
<codeBase version="92.0.251.0" href="x86/CefSharp.Core.Runtime.dll"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CefSharp.Core.Runtime" processorArchitecture="amd64" publicKeyToken="40c4b6fc221f4138" culture="neutral"/>
<codeBase version="92.0.251.0" href="x64/CefSharp.Core.Runtime.dll"/>
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/> <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
......
...@@ -51,6 +51,10 @@ namespace Tools.MyCommon ...@@ -51,6 +51,10 @@ namespace Tools.MyCommon
/// 是否部门负责人 /// 是否部门负责人
/// </summary> /// </summary>
public static bool IsPrincipal { get; set; } = false; public static bool IsPrincipal { get; set; } = false;
/// <summary>
/// 是否公司员工
/// </summary>
public static bool IsStaff { get; set; } = false;
} }
/// <summary> /// <summary>
......
using Newtonsoft.Json; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Data; using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Web;
// //
using System.Windows.Forms; using System.Windows.Forms;
...@@ -535,29 +530,6 @@ namespace Tools.MyUtils ...@@ -535,29 +530,6 @@ namespace Tools.MyUtils
return a <= high && a >= low; return a <= high && a >= low;
} }
#endregion
#region (扩展)JSON序列化
/// <summary>
/// JSON序列化
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string ToJson(this object obj)
{
return JsonConvert.SerializeObject(obj);
}
/// <summary>
/// JSON反序列化
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="json">JSON字符串</param>
/// <returns></returns>
public static T ToEntity<T>(this string json)
{
return JsonConvert.DeserializeObject<T>(json);
}
#endregion #endregion
#region 图片分离 #region 图片分离
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL"> <Reference Include="ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath> <HintPath>..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="NPOI, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL"> <Reference Include="NPOI, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\FunnyPick\packages\NPOI.2.5.1\lib\net45\NPOI.dll</HintPath> <HintPath>..\FunnyPick\packages\NPOI.2.5.1\lib\net45\NPOI.dll</HintPath>
</Reference> </Reference>
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
this.tbPassword = new System.Windows.Forms.TextBox(); this.tbPassword = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.btnLogin = new System.Windows.Forms.Button(); this.btnLogin = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
...@@ -120,6 +121,7 @@ ...@@ -120,6 +121,7 @@
// panel1 // panel1
// //
this.tableLayoutPanel1.SetColumnSpan(this.panel1, 2); this.tableLayoutPanel1.SetColumnSpan(this.panel1, 2);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.btnLogin); this.panel1.Controls.Add(this.btnLogin);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(60, 135); this.panel1.Location = new System.Drawing.Point(60, 135);
...@@ -138,6 +140,18 @@ ...@@ -138,6 +140,18 @@
this.btnLogin.UseVisualStyleBackColor = true; this.btnLogin.UseVisualStyleBackColor = true;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
// //
// label4
//
this.label4.Dock = System.Windows.Forms.DockStyle.Bottom;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.ForeColor = System.Drawing.Color.IndianRed;
this.label4.Location = new System.Drawing.Point(0, 55);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(219, 22);
this.label4.TabIndex = 1;
this.label4.Text = "提示:姓名+任务系统密码登录";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// wLogin // wLogin
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -165,5 +179,6 @@ ...@@ -165,5 +179,6 @@
private System.Windows.Forms.TextBox tbPassword; private System.Windows.Forms.TextBox tbPassword;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnLogin; private System.Windows.Forms.Button btnLogin;
private System.Windows.Forms.Label label4;
} }
} }
\ No newline at end of file
...@@ -44,7 +44,9 @@ namespace Tools.UI.sys ...@@ -44,7 +44,9 @@ namespace Tools.UI.sys
var userName = this.tbUserName.Text.Trim(); var userName = this.tbUserName.Text.Trim();
var password = Utils.Encryptor(this.tbPassword.Text); var password = Utils.Encryptor(this.tbPassword.Text);
var sql = $@" var sql = $@"
SELECT ID, ISNULL(IsPrincipal, 0) AS IsPrincipal SELECT ID,
ISNULL(IsPrincipal, 0) AS IsPrincipal,
CAST(CASE WHEN UserType = 5311 THEN 1 ELSE 0 END AS BIT) AS IsStaff
FROM dbo.AC_User FROM dbo.AC_User
WHERE ISNULL(IsStop, 0) = 0 WHERE ISNULL(IsStop, 0) = 0
And Name='{userName}' And LoginPassword = '{password}'"; And Name='{userName}' And LoginPassword = '{password}'";
...@@ -60,6 +62,7 @@ namespace Tools.UI.sys ...@@ -60,6 +62,7 @@ namespace Tools.UI.sys
LoginInfo.UserName = userName; LoginInfo.UserName = userName;
LoginInfo.Password = password; LoginInfo.Password = password;
LoginInfo.IsPrincipal = Convert.ToBoolean(dt.DefaultView[0]["IsPrincipal"].ToString()); LoginInfo.IsPrincipal = Convert.ToBoolean(dt.DefaultView[0]["IsPrincipal"].ToString());
LoginInfo.IsStaff = Convert.ToBoolean(dt.DefaultView[0]["IsStaff"].ToString());
//保存登录信息 //保存登录信息
Utils.AppSettings(APP.LOGIN_INFO, Utils.Encryptor(dt.DefaultView[0]["ID"].ToString())); Utils.AppSettings(APP.LOGIN_INFO, Utils.Encryptor(dt.DefaultView[0]["ID"].ToString()));
Utils.AppSettings(APP.LOGIN_VERIFY, password); Utils.AppSettings(APP.LOGIN_VERIFY, password);
......
...@@ -9,11 +9,26 @@ namespace Tools ...@@ -9,11 +9,26 @@ namespace Tools
{ {
//预定义分类:统一采用四字说明 //预定义分类:统一采用四字说明
string Tools_uni = "通用工具"; /// <summary>
string Tools_imp = "实施工具"; /// 通用工具
string Tools_dev = "开发工具"; /// </summary>
string Tools_human = "行政工具"; public readonly string Tools_uni = "通用工具";
string Tools_demos = "示例程序"; /// <summary>
/// 实施工具
/// </summary>
public readonly string Tools_imp = "实施工具";
/// <summary>
/// 开发工具
/// </summary>
public readonly string Tools_dev = "开发工具";
/// <summary>
/// 行政工具
/// </summary>
public readonly string Tools_human = "行政工具";
/// <summary>
/// 示例程序
/// </summary>
public readonly string Tools_demos = "示例程序";
/// <summary> /// <summary>
/// 获取模块列表 /// 获取模块列表
...@@ -25,10 +40,10 @@ namespace Tools ...@@ -25,10 +40,10 @@ namespace Tools
return new List<ModuleInfo> return new List<ModuleInfo>
{ {
//------------------------------- //-------------------------------
this.CreateModule(Tools_uni, typeof(UI.wFlowShare), "流程共享", "tr:助力业务沉淀与流程共享"), this.CreateModule(Tools_uni, typeof(UI.wFlowShare), "共享文件", "tr:助力业务沉淀与流程共享"),
this.CreateModule(Tools_uni, typeof(UI.wDbLinkMngr), "共享信息", "tr:客户数据库及远程桌面信息"),
this.CreateModule(Tools_uni, typeof(UI.wTaskBoard), "任务看板", "tr:任务看板的简易化工具,免除翻页困扰"), this.CreateModule(Tools_uni, typeof(UI.wTaskBoard), "任务看板", "tr:任务看板的简易化工具,免除翻页困扰"),
this.CreateModule(Tools_uni, typeof(UI.wLoginPwd), "密码解析", "tr:用于登陆密码的解密加密"), this.CreateModule(Tools_uni, typeof(UI.wLoginPwd), "密码解析", "tr:用于登陆密码的解密加密"),
this.CreateModule(Tools_uni, typeof(UI.wDbLinkMngr), "客户信息", "tr:客户数据库及远程桌面信息"),
//------------------------------- //-------------------------------
this.CreateModule(Tools_imp, typeof(UpdateExecuter.frmMain), "更新执行工具", "xj:用于客户更新和执行SQL脚本"), this.CreateModule(Tools_imp, typeof(UpdateExecuter.frmMain), "更新执行工具", "xj:用于客户更新和执行SQL脚本"),
this.CreateModule(Tools_imp, typeof(UI.wEmptyTable), "清空表", "tr:输入主表、自动清空关联表的工具"), this.CreateModule(Tools_imp, typeof(UI.wEmptyTable), "清空表", "tr:输入主表、自动清空关联表的工具"),
......
...@@ -393,13 +393,11 @@ namespace Tools ...@@ -393,13 +393,11 @@ namespace Tools
page.Refresh(); page.Refresh();
} }
/// <summary> /// <summary>
/// 事件:Tab双击(双击移除Page,即关闭窗口) /// 关闭模块
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="page"></param>
/// <param name="e"></param> private void CloseModule(TabPage page)
private void TabControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{ {
var page = this.tabControl1.SelectedTab;
if (page.Name != nameof(HomePage)) if (page.Name != nameof(HomePage))
{ {
this.OpenedList.Remove(page.Text); //移除列表 this.OpenedList.Remove(page.Text); //移除列表
...@@ -408,6 +406,15 @@ namespace Tools ...@@ -408,6 +406,15 @@ namespace Tools
} }
} }
/// <summary> /// <summary>
/// 事件:Tab双击(双击移除Page,即关闭窗口)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TabControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.CloseModule(this.tabControl1.SelectedTab);
}
/// <summary>
/// 事件:Tab切换(刷新Tab,防止Tab尺寸和窗体尺寸不一致) /// 事件:Tab切换(刷新Tab,防止Tab尺寸和窗体尺寸不一致)
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
...@@ -437,7 +444,16 @@ namespace Tools ...@@ -437,7 +444,16 @@ namespace Tools
//登录人员点击 //登录人员点击
private void LbSysLoginUser_Click(object sender, EventArgs e) private void LbSysLoginUser_Click(object sender, EventArgs e)
{ {
this.ShowLoginWindow(); if (this.ShowLoginWindow())
{
//关闭已打开窗口
while (this.tabControl1.TabPages.Count > 1)
{
this.CloseModule(this.tabControl1.TabPages[1]);
}
//新渲染菜单栏
this.RenderMenu();
}
} }
#endregion #endregion
...@@ -450,13 +466,20 @@ namespace Tools ...@@ -450,13 +466,20 @@ namespace Tools
private void RenderMenu() private void RenderMenu()
{ {
//listView初始化 //listView初始化
this.listView1.Items.Clear(); //清空原有项
this.listView1.MultiSelect = false; this.listView1.MultiSelect = false;
this.listView1.ShowItemToolTips = true; this.listView1.ShowItemToolTips = true;
this.listView1.View = View.SmallIcon; this.listView1.View = View.SmallIcon;
this.listView1.DoubleClick += ListView1_DoubleClick; this.listView1.DoubleClick += ListView1_DoubleClick;
//装载目录 //装载目录
var limitGroupName = LoginInfo.IsPrincipal ? "" : "行政工具"; //行政工具,只有部门负责人可以使用 var limitGroups = new List<string>();
var mList = this.Extend.GetModuleList().Where(m => m.GroupName != limitGroupName); //通用工具,只有公司内部人员可以使用
if (!LoginInfo.IsStaff)
limitGroups.Add(this.Extend.Tools_uni);
//行政工具,只有部门负责人可以使用
if (!LoginInfo.IsPrincipal)
limitGroups.Add(this.Extend.Tools_human);
var mList = this.Extend.GetModuleList().Where(m => limitGroups.IndexOf(m.GroupName) < 0);
foreach (ModuleInfo m in mList) foreach (ModuleInfo m in mList)
{ {
//获取分组 //获取分组
...@@ -539,7 +562,10 @@ namespace Tools ...@@ -539,7 +562,10 @@ namespace Tools
if (!string.IsNullOrEmpty(loginInfo)) if (!string.IsNullOrEmpty(loginInfo))
{ {
var sql = $@" var sql = $@"
SELECT Name as UserName, LoginPassword as Password, ISNULL(IsPrincipal, 0) AS IsPrincipal SELECT Name as UserName,
LoginPassword as Password,
ISNULL(IsPrincipal, 0) AS IsPrincipal,
CAST(CASE WHEN UserType = 5311 THEN 1 ELSE 0 END AS BIT) AS IsStaff
FROM dbo.AC_User FROM dbo.AC_User
WHERE ISNULL(IsStop, 0) = 0 and ID = {Utils.Decryptor(loginInfo)}"; WHERE ISNULL(IsStop, 0) = 0 and ID = {Utils.Decryptor(loginInfo)}";
var dt = this._db.GetDataTable(sql, "user", false); var dt = this._db.GetDataTable(sql, "user", false);
...@@ -565,6 +591,7 @@ namespace Tools ...@@ -565,6 +591,7 @@ namespace Tools
LoginInfo.UserName = userName; LoginInfo.UserName = userName;
LoginInfo.Password = password; LoginInfo.Password = password;
LoginInfo.IsPrincipal = Convert.ToBoolean(dt.DefaultView[0]["IsPrincipal"].ToString()); LoginInfo.IsPrincipal = Convert.ToBoolean(dt.DefaultView[0]["IsPrincipal"].ToString());
LoginInfo.IsStaff = Convert.ToBoolean(dt.DefaultView[0]["IsStaff"].ToString());
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment