Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Ftt_Common
Commits
8855d40a
Commit
8855d40a
authored
May 28, 2021
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、导航栏名称及提示优化
2、添加通用树形控件,优化模块管理界面 3、Excel导出设置功能(通用版) 4、UI层弹出窗口统一到Popups文件夹
parent
eba2b93d
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1385 additions
and
200 deletions
+1385
-200
excelsetting_help.txt
AppHome/config/help/excelsetting_help.txt
+6
-0
MyTreeView.Designer.cs
Tools/MyCommon/controls/MyTreeView.Designer.cs
+36
-0
MyTreeView.cs
Tools/MyCommon/controls/MyTreeView.cs
+188
-0
Tools.csproj
Tools/Tools.csproj
+27
-3
wAppModelEdit.Designer.cs
Tools/UI/Popups/wAppModelEdit.Designer.cs
+1
-1
wAppModelEdit.cs
Tools/UI/Popups/wAppModelEdit.cs
+1
-1
wAppModelEdit.resx
Tools/UI/Popups/wAppModelEdit.resx
+0
-0
wSelectTemplates.Designer.cs
Tools/UI/Popups/wSelectTemplates.Designer.cs
+108
-0
wSelectTemplates.cs
Tools/UI/Popups/wSelectTemplates.cs
+65
-0
wSelectTemplates.resx
Tools/UI/Popups/wSelectTemplates.resx
+120
-0
wAppModel.cs
Tools/UI/wAppModel.cs
+1
-1
wExcelExportSetting.Designer.cs
Tools/UI/wExcelExportSetting.Designer.cs
+411
-0
wExcelExportSetting.cs
Tools/UI/wExcelExportSetting.cs
+200
-0
wExcelExportSetting.resx
Tools/UI/wExcelExportSetting.resx
+165
-0
wModuleManager.Designer.cs
Tools/UI/wModuleManager.Designer.cs
+11
-14
wModuleManager.cs
Tools/UI/wModuleManager.cs
+17
-147
wModuleManager.resx
Tools/UI/wModuleManager.resx
+10
-16
wExtend.cs
Tools/wExtend.cs
+18
-17
No files found.
AppHome/config/help/excelsetting_help.txt
0 → 100644
View file @
8855d40a
1、先设置数据库链接
2、选择左侧的模块节点(叶子节点)
3、右侧通过右键菜单増行和删行
4、右侧-上表:前缀自动生成,只需填写模板名称
5、右侧-下表:模板通过单击选择,表名必填
6、通过右上角“保存设置”按钮,保存所有配置
\ No newline at end of file
Tools/MyCommon/controls/MyTreeView.Designer.cs
0 → 100644
View file @
8855d40a
namespace
Tools.MyCommon.controls
{
partial
class
MyTreeView
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private
void
InitializeComponent
()
{
components
=
new
System
.
ComponentModel
.
Container
();
}
#
endregion
}
}
Tools/MyCommon/controls/MyTreeView.cs
0 → 100644
View file @
8855d40a
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
Tools.MyUtils
;
namespace
Tools.MyCommon.controls
{
[
ToolboxBitmap
(
typeof
(
TreeView
)),
Description
(
"树形图"
)]
public
partial
class
MyTreeView
:
TreeView
{
/// <summary>
/// 树形图-父键列
/// </summary>
[
Browsable
(
false
),
DefaultValue
(
"PrevID"
)]
[
DesignerSerializationVisibility
(
DesignerSerializationVisibility
.
Hidden
)]
public
string
ParentColumn
{
get
;
set
;
}
=
"PrevID"
;
/// <summary>
/// 树形图-主键列
/// </summary>
[
Browsable
(
false
),
DefaultValue
(
"ID"
)]
[
DesignerSerializationVisibility
(
DesignerSerializationVisibility
.
Hidden
)]
public
string
NodeKeyColumn
{
get
;
set
;
}
=
"ID"
;
/// <summary>
/// 树形图-名称列
/// </summary>
[
Browsable
(
false
),
DefaultValue
(
"Name"
)]
[
DesignerSerializationVisibility
(
DesignerSerializationVisibility
.
Hidden
)]
public
string
NodeTextColumn
{
get
;
set
;
}
=
"Name"
;
/// <summary>
/// 父级初始化值
/// </summary>
[
Browsable
(
false
),
DefaultValue
(
"0"
)]
[
DesignerSerializationVisibility
(
DesignerSerializationVisibility
.
Hidden
)]
public
string
ParentInitValue
{
get
;
set
;
}
=
"0"
;
private
DataTable
_dt
=
null
;
/// <summary>
/// 数据源
/// </summary>
[
Browsable
(
false
),
DefaultValue
(
null
)]
[
DesignerSerializationVisibility
(
DesignerSerializationVisibility
.
Hidden
)]
public
DataTable
DataSource
{
get
{
return
this
.
_dt
;
}
set
{
this
.
_dt
=
value
;
if
(
this
.
_dt
!=
null
)
{
if
(!
this
.
_dt
.
Columns
.
Contains
(
this
.
ParentColumn
)
||
!
this
.
_dt
.
Columns
.
Contains
(
this
.
NodeKeyColumn
)
||
!
this
.
_dt
.
Columns
.
Contains
(
this
.
NodeTextColumn
))
{
Utils
.
Tip
(
$"数据源必须包含列:
{
this
.
ParentColumn
}
,
{
this
.
NodeKeyColumn
}
,
{
this
.
NodeTextColumn
}
"
);
return
;
}
this
.
InitTreeNode
(
this
.
Nodes
,
this
.
ParentInitValue
);
}
}
}
public
MyTreeView
()
{
InitializeComponent
();
}
/// <summary>
/// 添加树节点
/// </summary>
/// <param name="IsCopy"></param>
/// <returns></returns>
public
string
AddNode
(
bool
IsCopy
=
false
)
{
//获取当前节点行
var
drCurrent
=
this
.
GetCurrentNodeRow
();
var
ParentKey
=
drCurrent
[
this
.
ParentColumn
].
ToString
();
//创建数据源
int
index
=
this
.
_dt
.
Select
(
$"
{
NodeTextColumn
}
like '新节点%'"
).
Length
;
string
text
=
$"新节点
{
index
}
"
;
var
drNew
=
this
.
_dt
.
NewRow
();
drNew
[
this
.
ParentColumn
]
=
ParentKey
;
drNew
[
NodeTextColumn
]
=
text
;
if
(
IsCopy
)
{
Utils
.
CopyRow
(
drCurrent
,
drNew
,
new
List
<
string
>
{
this
.
ParentColumn
,
this
.
NodeKeyColumn
,
this
.
NodeTextColumn
});
}
this
.
_dt
.
Rows
.
Add
(
drNew
);
//创建树节点
string
key
=
drNew
[
this
.
NodeKeyColumn
].
ToString
();
var
ParentNode
=
this
.
SearchNode
(
ParentKey
);
var
node
=
new
TreeNode
(
text
,
0
,
1
)
{
Name
=
key
,
};
ParentNode
.
Nodes
.
Add
(
node
);
//选中新增节点
this
.
SelectedNode
=
node
;
//返回值
return
IsCopy
?
drCurrent
[
this
.
NodeKeyColumn
].
ToString
()
:
""
;
}
/// <summary>
/// 删除树节点
/// </summary>
public
void
DeleteNode
()
{
var
CurrentNode
=
this
.
SelectedNode
;
var
ParentNode
=
CurrentNode
.
Parent
;
if
(
CurrentNode
.
Nodes
.
Count
>
0
)
{
Utils
.
Tip
(
$"当前节点[
{
CurrentNode
.
Text
}
]有多个子节点,请先删除子节点!"
);
return
;
}
//删除数据源
var
drCurrent
=
this
.
GetCurrentNodeRow
();
drCurrent
?.
Delete
();
//移除树节点
var
nodes
=
ParentNode
==
null
?
this
.
Nodes
:
ParentNode
.
Nodes
;
nodes
.
Remove
(
CurrentNode
);
}
/// <summary>
/// 查找树节点
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public
TreeNode
SearchNode
(
string
key
)
{
return
this
.
SearchTreeNode
(
key
,
this
.
Nodes
);
}
/// <summary>
/// 获取当前节点行
/// </summary>
/// <returns></returns>
public
DataRow
GetCurrentNodeRow
()
{
var
key
=
this
.
SelectedNode
.
Name
;
return
this
.
_dt
.
Select
(
$"
{
this
.
NodeKeyColumn
}
=
{
key
}
"
).
FirstOrDefault
();
}
/// <summary>
/// 递归:添加树节点
/// </summary>
/// <param name="nodes"></param>
/// <param name="ParentValue"></param>
private
void
InitTreeNode
(
TreeNodeCollection
nodes
,
string
ParentValue
)
{
DataRow
[]
rows
=
this
.
_dt
.
Select
(
$"ISNULL(
{
this
.
ParentColumn
}
, '
{
this
.
ParentInitValue
}
') = '
{
ParentValue
}
'"
);
if
(
rows
.
Length
==
0
)
return
;
for
(
int
i
=
0
;
i
<
rows
.
Length
;
i
++)
{
if
(
rows
[
i
].
RowState
==
DataRowState
.
Deleted
)
continue
;
var
key
=
rows
[
i
][
this
.
NodeKeyColumn
].
ToString
();
var
text
=
rows
[
i
][
this
.
NodeTextColumn
].
ToString
();
nodes
.
Add
(
key
,
text
,
0
,
1
);
this
.
InitTreeNode
(
nodes
[
i
].
Nodes
,
key
);
}
}
/// <summary>
/// 递归:查找树节点
/// </summary>
/// <param name="key"></param>
/// <param name="nodes"></param>
/// <returns></returns>
private
TreeNode
SearchTreeNode
(
string
key
,
TreeNodeCollection
nodes
)
{
TreeNode
result
=
null
;
foreach
(
TreeNode
n
in
nodes
)
{
result
=
n
.
Name
.
Equals
(
key
)
?
n
:
this
.
SearchTreeNode
(
key
,
n
.
Nodes
);
if
(
result
!=
null
)
break
;
}
return
result
;
}
}
}
Tools/Tools.csproj
View file @
8855d40a
...
...
@@ -67,6 +67,12 @@
<Reference
Include=
"System.Xml"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"MyCommon\controls\MyTreeView.cs"
>
<SubType>
Component
</SubType>
</Compile>
<Compile
Include=
"MyCommon\controls\MyTreeView.Designer.cs"
>
<DependentUpon>
MyTreeView.cs
</DependentUpon>
</Compile>
<Compile
Include=
"MyCommon\controls\ucAudit.cs"
>
<SubType>
UserControl
</SubType>
</Compile>
...
...
@@ -90,6 +96,18 @@
<Compile
Include=
"MyData\DBHelper.cs"
/>
<Compile
Include=
"MyData\SqlHelper.cs"
/>
<Compile
Include=
"MyUtils\DrawHelper.cs"
/>
<Compile
Include=
"UI\Popups\wSelectTemplates.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"UI\Popups\wSelectTemplates.Designer.cs"
>
<DependentUpon>
wSelectTemplates.cs
</DependentUpon>
</Compile>
<Compile
Include=
"UI\wExcelExportSetting.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"UI\wExcelExportSetting.Designer.cs"
>
<DependentUpon>
wExcelExportSetting.cs
</DependentUpon>
</Compile>
<Compile
Include=
"UI\wEmptyTable.cs"
>
<SubType>
Form
</SubType>
</Compile>
...
...
@@ -162,10 +180,10 @@
<Compile
Include=
"UI\wAppModel.Designer.cs"
>
<DependentUpon>
wAppModel.cs
</DependentUpon>
</Compile>
<Compile
Include=
"UI\wAppModelEdit.cs"
>
<Compile
Include=
"UI\
Popups\
wAppModelEdit.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"UI\wAppModelEdit.Designer.cs"
>
<Compile
Include=
"UI\
Popups\
wAppModelEdit.Designer.cs"
>
<DependentUpon>
wAppModelEdit.cs
</DependentUpon>
</Compile>
<Compile
Include=
"UI\wDbAnlysis.cs"
>
...
...
@@ -256,6 +274,12 @@
<DependentUpon>
Resources.resx
</DependentUpon>
<DesignTime>
True
</DesignTime>
</Compile>
<EmbeddedResource
Include=
"UI\Popups\wSelectTemplates.resx"
>
<DependentUpon>
wSelectTemplates.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"UI\wExcelExportSetting.resx"
>
<DependentUpon>
wExcelExportSetting.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"UI\wEmptyTable.resx"
>
<DependentUpon>
wEmptyTable.cs
</DependentUpon>
</EmbeddedResource>
...
...
@@ -271,7 +295,7 @@
<EmbeddedResource
Include=
"UI\wAppModel.resx"
>
<DependentUpon>
wAppModel.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"UI\wAppModelEdit.resx"
>
<EmbeddedResource
Include=
"UI\
Popups\
wAppModelEdit.resx"
>
<DependentUpon>
wAppModelEdit.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"UI\wAuditDemo.resx"
>
...
...
Tools/UI/wAppModelEdit.Designer.cs
→
Tools/UI/
Popups/
wAppModelEdit.Designer.cs
View file @
8855d40a
namespace
Tools.UI
namespace
Tools.UI
.Popups
{
partial
class
wAppModelEdit
{
...
...
Tools/UI/wAppModelEdit.cs
→
Tools/UI/
Popups/
wAppModelEdit.cs
View file @
8855d40a
...
...
@@ -14,7 +14,7 @@ using Tools.MyData;
using
Tools.MyUtils
;
using
Tools.UI.Models
;
namespace
Tools.UI
namespace
Tools.UI
.Popups
{
public
partial
class
wAppModelEdit
:
Form
{
...
...
Tools/UI/wAppModelEdit.resx
→
Tools/UI/
Popups/
wAppModelEdit.resx
View file @
8855d40a
File moved
Tools/UI/Popups/wSelectTemplates.Designer.cs
0 → 100644
View file @
8855d40a
namespace
Tools.UI.Popups
{
partial
class
wSelectTemplates
{
/// <summary>
/// Required designer variable.
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
Windows
Form
Designer
generated
code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private
void
InitializeComponent
()
{
this
.
btnShotAll
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnShotAdded
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnShotCover
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
checkedListBox1
=
new
System
.
Windows
.
Forms
.
CheckedListBox
();
this
.
SuspendLayout
();
//
// btnShotAll
//
this
.
btnShotAll
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnShotAll
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnShotAll
.
Location
=
new
System
.
Drawing
.
Point
(
5
,
214
);
this
.
btnShotAll
.
Name
=
"btnShotAll"
;
this
.
btnShotAll
.
Size
=
new
System
.
Drawing
.
Size
(
123
,
32
);
this
.
btnShotAll
.
TabIndex
=
1
;
this
.
btnShotAll
.
Text
=
"选择所有"
;
this
.
btnShotAll
.
UseVisualStyleBackColor
=
true
;
this
.
btnShotAll
.
Click
+=
new
System
.
EventHandler
(
this
.
btnShotAll_Click
);
//
// btnShotAdded
//
this
.
btnShotAdded
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnShotAdded
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnShotAdded
.
Location
=
new
System
.
Drawing
.
Point
(
133
,
214
);
this
.
btnShotAdded
.
Name
=
"btnShotAdded"
;
this
.
btnShotAdded
.
Size
=
new
System
.
Drawing
.
Size
(
123
,
32
);
this
.
btnShotAdded
.
TabIndex
=
2
;
this
.
btnShotAdded
.
Text
=
"增量添加"
;
this
.
btnShotAdded
.
UseVisualStyleBackColor
=
true
;
this
.
btnShotAdded
.
Click
+=
new
System
.
EventHandler
(
this
.
btnShotAdded_Click
);
//
// btnShotCover
//
this
.
btnShotCover
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnShotCover
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnShotCover
.
Location
=
new
System
.
Drawing
.
Point
(
261
,
214
);
this
.
btnShotCover
.
Name
=
"btnShotCover"
;
this
.
btnShotCover
.
Size
=
new
System
.
Drawing
.
Size
(
124
,
32
);
this
.
btnShotCover
.
TabIndex
=
3
;
this
.
btnShotCover
.
Text
=
"覆盖添加"
;
this
.
btnShotCover
.
UseVisualStyleBackColor
=
true
;
this
.
btnShotCover
.
Click
+=
new
System
.
EventHandler
(
this
.
btnShotCover_Click
);
//
// checkedListBox1
//
this
.
checkedListBox1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
this
.
checkedListBox1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
14.25F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
checkedListBox1
.
FormattingEnabled
=
true
;
this
.
checkedListBox1
.
Location
=
new
System
.
Drawing
.
Point
(
5
,
5
);
this
.
checkedListBox1
.
MultiColumn
=
true
;
this
.
checkedListBox1
.
Name
=
"checkedListBox1"
;
this
.
checkedListBox1
.
Size
=
new
System
.
Drawing
.
Size
(
380
,
200
);
this
.
checkedListBox1
.
TabIndex
=
4
;
//
// wSelectTemplates
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Window
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
390
,
253
);
this
.
Controls
.
Add
(
this
.
btnShotCover
);
this
.
Controls
.
Add
(
this
.
btnShotAll
);
this
.
Controls
.
Add
(
this
.
checkedListBox1
);
this
.
Controls
.
Add
(
this
.
btnShotAdded
);
this
.
FormBorderStyle
=
System
.
Windows
.
Forms
.
FormBorderStyle
.
FixedToolWindow
;
this
.
Name
=
"wSelectTemplates"
;
this
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
5
);
this
.
Text
=
"选择模板信息"
;
this
.
ResumeLayout
(
false
);
}
#
endregion
private
System
.
Windows
.
Forms
.
Button
btnShotAll
;
private
System
.
Windows
.
Forms
.
Button
btnShotAdded
;
private
System
.
Windows
.
Forms
.
Button
btnShotCover
;
private
System
.
Windows
.
Forms
.
CheckedListBox
checkedListBox1
;
}
}
\ No newline at end of file
Tools/UI/Popups/wSelectTemplates.cs
0 → 100644
View file @
8855d40a
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
//
using
Tools.MyCommon
;
namespace
Tools.UI.Popups
{
public
partial
class
wSelectTemplates
:
wBasic
{
/// <summary>
/// 是否覆盖
/// </summary>
public
bool
IsCover
=
false
;
/// <summary>
/// 选中项
/// </summary>
public
List
<
string
>
CheckedItems
=>
this
.
checkedListBox1
.
CheckedItems
.
Cast
<
string
>().
ToList
();
public
wSelectTemplates
(
IEnumerable
<
string
>
items
)
{
InitializeComponent
();
//状态初始化
this
.
DialogResult
=
DialogResult
.
None
;
//初始化数据源
this
.
checkedListBox1
.
Items
.
AddRange
(
items
.
ToArray
());
}
private
void
btnShotAll_Click
(
object
sender
,
EventArgs
e
)
{
//全选
for
(
int
i
=
0
;
i
<
this
.
checkedListBox1
.
Items
.
Count
;
i
++)
{
this
.
checkedListBox1
.
SetItemChecked
(
i
,
true
);
}
//关闭窗口
this
.
CloseWin
(
true
);
}
private
void
btnShotAdded_Click
(
object
sender
,
EventArgs
e
)
{
this
.
CloseWin
();
}
private
void
btnShotCover_Click
(
object
sender
,
EventArgs
e
)
{
this
.
CloseWin
(
true
);
}
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="isCover"></param>
private
void
CloseWin
(
bool
isCover
=
false
)
{
this
.
IsCover
=
isCover
;
this
.
DialogResult
=
DialogResult
.
OK
;
this
.
Close
();
}
}
}
Tools/UI/Popups/wSelectTemplates.resx
0 → 100644
View file @
8855d40a
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema
id=
"root"
xmlns=
""
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:msdata=
"urn:schemas-microsoft-com:xml-msdata"
>
<xsd:import
namespace=
"http://www.w3.org/XML/1998/namespace"
/>
<xsd:element
name=
"root"
msdata:IsDataSet=
"true"
>
<xsd:complexType>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
name=
"metadata"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
use=
"required"
type=
"xsd:string"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"assembly"
>
<xsd:complexType>
<xsd:attribute
name=
"alias"
type=
"xsd:string"
/>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"data"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
<xsd:element
name=
"comment"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"2"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
msdata:Ordinal=
"1"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
msdata:Ordinal=
"3"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
msdata:Ordinal=
"4"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"resheader"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader
name=
"resmimetype"
>
<value>
text/microsoft-resx
</value>
</resheader>
<resheader
name=
"version"
>
<value>
2.0
</value>
</resheader>
<resheader
name=
"reader"
>
<value>
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
</root>
\ No newline at end of file
Tools/UI/wAppModel.cs
View file @
8855d40a
...
...
@@ -10,9 +10,9 @@ using System.Threading.Tasks;
using
System.Windows.Forms
;
//
using
Tools.MyCommon
;
using
Tools.MyData
;
using
Tools.MyUtils
;
using
Tools.UI.Models
;
using
Tools.UI.Popups
;
namespace
Tools.UI
{
...
...
Tools/UI/wExcelExportSetting.Designer.cs
0 → 100644
View file @
8855d40a
This diff is collapsed.
Click to expand it.
Tools/UI/wExcelExportSetting.cs
0 → 100644
View file @
8855d40a
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Windows.Forms
;
//
using
Tools.MyCommon
;
using
Tools.MyData
;
using
Tools.MyUtils
;
using
Tools.UI.Popups
;
namespace
Tools.UI
{
public
partial
class
wExcelExportSetting
:
wEditBasic
{
public
wExcelExportSetting
()
{
InitializeComponent
();
}
public
override
void
InitData
()
{
base
.
InitData
();
#
region
初始化基础表结构
var
sql
=
$@"
IF NOT EXISTS(SELECT 1 FROM sys.tables WHERE name = 'ModuleTemplate')
BEGIN
CREATE TABLE ModuleTemplate
(
ID INT IDENTITY(1,1) PRIMARY KEY,
ModuleID INT NULL,
Prefix VARCHAR(50) NULL,
TpName VARCHAR(50) NULL
)
CREATE TABLE ModuleTemplateTable
(
ID INT IDENTITY(1,1) PRIMARY KEY,
ModuleID INT NULL,
TpNames VARCHAR(MAX) NULL,
TpTableName VARCHAR(50) NULL,
IsRtf BIT NULL,
IsConvert BIT NULL,
CrtNameCol VARCHAR(50) NULL,
CrtValueCol VARCHAR(50) NULL,
CrtSumCol VARCHAR(50) NULL,
SelectSQL VARCHAR(MAX) NULL
)
END"
;
this
.
_db
.
ExecNonSql
(
sql
);
#
endregion
this
.
ModuleTableList
=
new
List
<
TQuery
>()
{
new
TQuery
(
"ModuleTemplate"
),
new
TQuery
(
"ModuleTemplateTable"
),
};
this
.
_ds
=
this
.
_db
.
GetData
(
this
.
ModuleTableList
,
true
);
}
public
override
void
InitUI
()
{
base
.
InitUI
();
//数据表格初始化
this
.
dgvTemplates
.
AllowUserToAddRows
=
false
;
this
.
dgvTemplates
.
AutoGenerateColumns
=
false
;
this
.
dgvTables
.
AllowUserToAddRows
=
false
;
this
.
dgvTables
.
AutoGenerateColumns
=
false
;
this
.
dgvTemplates
.
DataSource
=
this
.
_ds
.
Tables
[
"ModuleTemplate"
].
DefaultView
;
this
.
dgvTables
.
DataSource
=
this
.
_ds
.
Tables
[
"ModuleTemplateTable"
].
DefaultView
;
this
.
dgvTables
.
CellClick
+=
DgvTables_CellClick
;
//初始化树结构
var
sql
=
$"SELECT * FROM dbo.SysBusinessModel"
;
this
.
myTreeView1
.
DataSource
=
this
.
_db
.
GetDataTable
(
sql
,
"SysModels"
);
//添加选择后事件
this
.
myTreeView1
.
AfterSelect
+=
MyTreeView1_AfterSelect
;
//首次初始化,触发一下事件
if
(
this
.
myTreeView1
.
Nodes
.
Count
>
0
)
{
this
.
myTreeView1
.
Nodes
[
0
].
Expand
();
this
.
myTreeView1
.
SelectedNode
=
this
.
myTreeView1
.
Nodes
[
0
];
//选中首节点
}
}
//树节点选择,更新表格状态
private
void
MyTreeView1_AfterSelect
(
object
sender
,
TreeViewEventArgs
e
)
{
//设置化过滤条件
var
drNow
=
this
.
myTreeView1
.
GetCurrentNodeRow
();
var
id
=
Convert
.
ToInt32
(
drNow
[
"ID"
]);
this
.
_ds
.
Tables
[
"ModuleTemplate"
].
DefaultView
.
RowFilter
=
$"ModuleID=
{
id
}
"
;
this
.
_ds
.
Tables
[
"ModuleTemplateTable"
].
DefaultView
.
RowFilter
=
$"ModuleID=
{
id
}
"
;
//仅当叶子节点(即模块节点)操作时表格有效
bool
isEnabled
=
e
.
Node
.
Nodes
.
Count
==
0
;
this
.
dgvTemplates
.
Enabled
=
isEnabled
;
this
.
dgvTables
.
Enabled
=
isEnabled
;
this
.
tslTemplates
.
ForeColor
=
isEnabled
?
Color
.
Black
:
Color
.
Gray
;
this
.
tslTables
.
ForeColor
=
isEnabled
?
Color
.
Black
:
Color
.
Gray
;
var
tag
=
isEnabled
?
""
:
"(已禁用)"
;
this
.
tslTemplates
.
Text
=
$"模板维护
{
tag
}
"
;
this
.
tslTables
.
Text
=
$"数据源绑定
{
tag
}
"
;
}
//单元格单击:选择模板
private
void
DgvTables_CellClick
(
object
sender
,
DataGridViewCellEventArgs
e
)
{
if
(
e
.
RowIndex
<
0
||
e
.
ColumnIndex
<
0
)
return
;
if
(
this
.
dgvTables
.
Columns
[
e
.
ColumnIndex
].
DataPropertyName
.
Equals
(
"TpNames"
))
{
var
items
=
this
.
_ds
.
Tables
[
"ModuleTemplate"
].
DefaultView
.
Cast
<
DataRowView
>().
Select
(
r
=>
r
[
"TpName"
].
ToString
());
wSelectTemplates
frm
=
new
wSelectTemplates
(
items
);
if
(
frm
.
ShowDialog
()
==
DialogResult
.
OK
)
{
var
drNow
=
this
.
_ds
.
Tables
[
"ModuleTemplateTable"
].
DefaultView
[
e
.
RowIndex
];
var
result
=
""
;
if
(
frm
.
IsCover
)
{
result
=
$"[
{
string
.
Join
(
"]["
,
frm
.
CheckedItems
)}
]"
;
}
else
{
result
=
drNow
[
"TpNames"
].
ToString
();
foreach
(
var
item
in
frm
.
CheckedItems
)
{
var
tpName
=
$"[
{
item
}
]"
;
if
(!
result
.
Contains
(
tpName
))
result
+=
tpName
;
}
}
drNow
[
"TpNames"
]
=
result
;
drNow
.
EndEdit
();
}
}
}
//上下文菜单
DataTable
dtFocused
=
null
;
private
void
contextMenuStrip1_Opening
(
object
sender
,
CancelEventArgs
e
)
{
var
name
=
(
sender
as
ContextMenuStrip
).
SourceControl
.
Name
;
var
tableName
=
name
.
Equals
(
dgvTemplates
.
Name
)
?
"ModuleTemplate"
:
"ModuleTemplateTable"
;
dtFocused
=
this
.
_ds
.
Tables
[
tableName
];
}
private
void
tsmiAddRow_Click
(
object
sender
,
EventArgs
e
)
{
var
drNode
=
this
.
myTreeView1
.
GetCurrentNodeRow
();
var
drNew
=
dtFocused
.
NewRow
();
drNew
[
"ModuleID"
]
=
drNode
[
"ID"
];
if
(
dtFocused
.
Columns
.
Contains
(
"Prefix"
))
drNew
[
"Prefix"
]
=
$"Excel模板-
{
drNode
[
"Name"
]}
-"
;
drNew
.
EndEdit
();
dtFocused
.
Rows
.
Add
(
drNew
);
}
private
void
tsmiDelRow_Click
(
object
sender
,
EventArgs
e
)
{
var
isTemplate
=
dtFocused
.
TableName
.
Equals
(
"ModuleTemplate"
);
var
dgv
=
isTemplate
?
dgvTemplates
:
dgvTables
;
var
drDel
=
dtFocused
.
DefaultView
[
dgv
.
CurrentRow
.
Index
];
//清除所有对该模板的引用
if
(
isTemplate
)
{
string
mName
=
$"[
{
drDel
[
"TpName"
].
ToString
()}
]"
;
foreach
(
DataRowView
drv
in
this
.
_ds
.
Tables
[
"ModuleTemplateTable"
].
DefaultView
)
{
drv
[
"TpNames"
]
=
drv
[
"TpNames"
].
ToString
().
Replace
(
mName
,
""
);
drv
.
EndEdit
();
}
}
drDel
.
Delete
();
}
//工具栏菜单
private
void
tsbSave_Click
(
object
sender
,
EventArgs
e
)
{
this
.
Save
();
}
private
void
tsbDb_Click
(
object
sender
,
EventArgs
e
)
{
wDbSetting
frm
=
new
wDbSetting
(
this
.
tslDbLink
);
if
(
frm
.
ShowDialog
()
==
DialogResult
.
OK
)
{
this
.
InitDBHelper
(
frm
.
LinkModel
);
this
.
InitData
();
this
.
InitUI
();
}
}
private
void
tsbHelp_Click
(
object
sender
,
EventArgs
e
)
{
Utils
.
ShowHelp
(
"excelsetting_help"
);
}
}
}
Tools/UI/wExcelExportSetting.resx
0 → 100644
View file @
8855d40a
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema
id=
"root"
xmlns=
""
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:msdata=
"urn:schemas-microsoft-com:xml-msdata"
>
<xsd:import
namespace=
"http://www.w3.org/XML/1998/namespace"
/>
<xsd:element
name=
"root"
msdata:IsDataSet=
"true"
>
<xsd:complexType>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
name=
"metadata"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
use=
"required"
type=
"xsd:string"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"assembly"
>
<xsd:complexType>
<xsd:attribute
name=
"alias"
type=
"xsd:string"
/>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"data"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
<xsd:element
name=
"comment"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"2"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
msdata:Ordinal=
"1"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
msdata:Ordinal=
"3"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
msdata:Ordinal=
"4"
/>
<xsd:attribute
ref=
"xml:space"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"resheader"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader
name=
"resmimetype"
>
<value>
text/microsoft-resx
</value>
</resheader>
<resheader
name=
"version"
>
<value>
2.0
</value>
</resheader>
<resheader
name=
"reader"
>
<value>
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<metadata
name=
"Column10.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column1.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column6.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column2.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column3.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column4.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column5.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column9.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"contextMenuStrip1.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
347, 17
</value>
</metadata>
<metadata
name=
"toolStrip3.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
237, 17
</value>
</metadata>
<metadata
name=
"Column11.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"Column7.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
<metadata
name=
"toolStrip2.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
127, 17
</value>
</metadata>
<metadata
name=
"toolStrip1.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
512, 17
</value>
</metadata>
<metadata
name=
"$this.TrayHeight"
type=
"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
46
</value>
</metadata>
</root>
\ No newline at end of file
Tools/UI/wModuleManager.Designer.cs
View file @
8855d40a
...
...
@@ -39,7 +39,6 @@
this
.
tsbDbSetting
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tslDbLinkString
=
new
System
.
Windows
.
Forms
.
ToolStripLabel
();
this
.
splitContainer1
=
new
System
.
Windows
.
Forms
.
SplitContainer
();
this
.
tvModules
=
new
System
.
Windows
.
Forms
.
TreeView
();
this
.
imgList5
=
new
System
.
Windows
.
Forms
.
ImageList
(
this
.
components
);
this
.
panelMHeader
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
tbSearch
=
new
System
.
Windows
.
Forms
.
TextBox
();
...
...
@@ -78,6 +77,7 @@
this
.
ckCanPassLevelReport
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
tbSysCode
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbPrevID
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
myTreeView1
=
new
Tools
.
MyCommon
.
controls
.
MyTreeView
();
this
.
toolStrip1
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
splitContainer1
)).
BeginInit
();
this
.
splitContainer1
.
Panel1
.
SuspendLayout
();
...
...
@@ -175,7 +175,7 @@
// splitContainer1.Panel1
//
this
.
splitContainer1
.
Panel1
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
splitContainer1
.
Panel1
.
Controls
.
Add
(
this
.
tvModules
);
this
.
splitContainer1
.
Panel1
.
Controls
.
Add
(
this
.
myTreeView1
);
this
.
splitContainer1
.
Panel1
.
Controls
.
Add
(
this
.
panelMHeader
);
//
// splitContainer1.Panel2
...
...
@@ -187,17 +187,6 @@
this
.
splitContainer1
.
SplitterWidth
=
6
;
this
.
splitContainer1
.
TabIndex
=
1
;
//
// tvModules
//
this
.
tvModules
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
tvModules
.
ImageIndex
=
0
;
this
.
tvModules
.
ImageList
=
this
.
imgList5
;
this
.
tvModules
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
39
);
this
.
tvModules
.
Name
=
"tvModules"
;
this
.
tvModules
.
SelectedImageIndex
=
0
;
this
.
tvModules
.
Size
=
new
System
.
Drawing
.
Size
(
220
,
502
);
this
.
tvModules
.
TabIndex
=
1
;
//
// imgList5
//
this
.
imgList5
.
ImageStream
=
((
System
.
Windows
.
Forms
.
ImageListStreamer
)(
resources
.
GetObject
(
"imgList5.ImageStream"
)));
...
...
@@ -602,6 +591,14 @@
this
.
tbPrevID
.
Size
=
new
System
.
Drawing
.
Size
(
104
,
21
);
this
.
tbPrevID
.
TabIndex
=
28
;
//
// myTreeView1
//
this
.
myTreeView1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
myTreeView1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
39
);
this
.
myTreeView1
.
Name
=
"myTreeView1"
;
this
.
myTreeView1
.
Size
=
new
System
.
Drawing
.
Size
(
220
,
502
);
this
.
myTreeView1
.
TabIndex
=
1
;
//
// wModuleManager
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
...
...
@@ -637,7 +634,6 @@
private
System
.
Windows
.
Forms
.
ToolStrip
toolStrip1
;
private
System
.
Windows
.
Forms
.
SplitContainer
splitContainer1
;
private
System
.
Windows
.
Forms
.
TreeView
tvModules
;
private
System
.
Windows
.
Forms
.
Panel
panelMHeader
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbAdd
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbCopy
;
...
...
@@ -683,5 +679,6 @@
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
tsmiDel
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
tsmiCopy
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbGenSQL
;
private
MyCommon
.
controls
.
MyTreeView
myTreeView1
;
}
}
\ No newline at end of file
Tools/UI/wModuleManager.cs
View file @
8855d40a
...
...
@@ -83,7 +83,16 @@ namespace Tools.UI
this
.
dgvDetail
.
AllowUserToAddRows
=
false
;
this
.
dgvDetail
.
DataSource
=
this
.
_dtDetail
.
DefaultView
;
//初始化树形图
this
.
InitTreeView
();
//初始化树节点
this
.
myTreeView1
.
DataSource
=
this
.
_dtModel
;
//添加选择后事件
this
.
myTreeView1
.
AfterSelect
+=
Tv_AfterSelect
;
//首次初始化,触发一下事件
if
(
this
.
myTreeView1
.
Nodes
.
Count
>
0
)
{
this
.
myTreeView1
.
Nodes
[
0
].
Expand
();
this
.
myTreeView1
.
SelectedNode
=
this
.
myTreeView1
.
Nodes
[
0
];
//选中首节点
}
//模块查询
this
.
tbSearch
.
TextChanged
+=
TbSearch_TextChanged
;
//输入模块名称,自动生成字符串ID
...
...
@@ -104,12 +113,12 @@ namespace Tools.UI
}
private
void
TsbAdd_Click
(
object
sender
,
EventArgs
e
)
{
this
.
AddNode
();
this
.
myTreeView1
.
AddNode
();
}
private
void
TsbCopy_Click
(
object
sender
,
EventArgs
e
)
{
//复制节点
var
key
=
this
.
AddNode
(
IsCopy
:
true
);
var
key
=
this
.
myTreeView1
.
AddNode
(
IsCopy
:
true
);
//复制功能表
var
dt
=
this
.
_dtDetail
;
var
rows
=
dt
.
Select
(
$"ModelID =
{
key
}
"
);
...
...
@@ -122,7 +131,7 @@ namespace Tools.UI
}
private
void
TsbDel_Click
(
object
sender
,
EventArgs
e
)
{
this
.
DeleteNode
();
this
.
myTreeView1
.
DeleteNode
();
}
private
void
TsbSave_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -131,7 +140,7 @@ namespace Tools.UI
private
void
TsbGenSQL_Click
(
object
sender
,
EventArgs
e
)
{
//模块表
DataRow
drMaster
=
this
.
GetCurrentNodeRow
();
DataRow
drMaster
=
this
.
myTreeView1
.
GetCurrentNodeRow
();
var
model
=
Utils
.
GenInsertSQL
(
drMaster
);
//功能表
var
rows
=
this
.
_dtDetail
.
DefaultView
.
Cast
<
DataRowView
>().
Select
(
r
=>
r
.
Row
);
...
...
@@ -169,34 +178,8 @@ namespace Tools.UI
}
#
endregion
#
region
树
结构处理:此处处理具有通用性,可为后续树控件提取做参考
#
region
树
形图事件
/// <summary>
/// 树形图-初始化
/// </summary>
/// <param name="tv"></param>
/// <param name="dt"></param>
private
void
InitTreeView
()
{
//初始化树节点
this
.
InitTreeNode
(
this
.
tvModules
.
Nodes
,
"0"
);
//添加选择后事件
this
.
tvModules
.
AfterSelect
+=
Tv_AfterSelect
;
//默认展开设置
if
(
this
.
tvModules
.
Nodes
.
Count
>
0
)
{
this
.
tvModules
.
Nodes
[
0
].
Expand
();
if
(
this
.
tvModules
.
Nodes
[
0
].
Nodes
.
Count
>
0
)
{
this
.
tvModules
.
Nodes
[
0
].
Nodes
[
0
].
ExpandAll
();
}
}
//首次初始化,触发一下事件
if
(
this
.
tvModules
.
Nodes
.
Count
>
0
)
{
this
.
tvModules
.
SelectedNode
=
this
.
tvModules
.
Nodes
[
0
];
//选中首节点
}
}
/// <summary>
/// 事件-树节点选择后
/// </summary>
...
...
@@ -205,8 +188,7 @@ namespace Tools.UI
private
void
Tv_AfterSelect
(
object
sender
,
TreeViewEventArgs
e
)
{
var
ModelID
=
e
.
Node
.
Name
;
var
drv
=
this
.
_dtModel
.
DefaultView
.
Cast
<
DataRowView
>()
var
drv
=
this
.
_dtModel
.
DefaultView
.
Cast
<
DataRowView
>()
.
FirstOrDefault
(
r
=>
r
[
"ID"
].
ToString
().
Equals
(
ModelID
));
if
(
drv
!=
null
)
{
...
...
@@ -217,118 +199,6 @@ namespace Tools.UI
}
}
/// <summary>
/// 添加树节点
/// </summary>
/// <param name="IsCopy"></param>
/// <returns></returns>
private
string
AddNode
(
bool
IsCopy
=
false
)
{
//获取当前节点行
var
drCurrent
=
this
.
GetCurrentNodeRow
();
var
ParentKey
=
drCurrent
[
this
.
ParentColumn
].
ToString
();
//创建数据源
int
index
=
this
.
_dtModel
.
Select
(
$"
{
NodeTextColumn
}
like '新模块%'"
).
Length
;
string
text
=
$"新模块
{
index
}
"
;
var
drNew
=
this
.
_dtModel
.
NewRow
();
drNew
[
this
.
ParentColumn
]
=
ParentKey
;
drNew
[
NodeTextColumn
]
=
text
;
if
(
IsCopy
)
{
Utils
.
CopyRow
(
drCurrent
,
drNew
,
new
List
<
string
>
{
this
.
ParentColumn
,
this
.
NodeKeyColumn
,
this
.
NodeTextColumn
});
}
this
.
_dtModel
.
Rows
.
Add
(
drNew
);
//创建树节点
string
key
=
drNew
[
this
.
NodeKeyColumn
].
ToString
();
var
ParentNode
=
this
.
SearchNode
(
ParentKey
);
var
node
=
new
TreeNode
(
text
,
0
,
1
)
{
Name
=
key
,
};
ParentNode
.
Nodes
.
Add
(
node
);
//选中新增节点
this
.
tvModules
.
SelectedNode
=
node
;
//返回值
return
IsCopy
?
drCurrent
[
this
.
NodeKeyColumn
].
ToString
()
:
""
;
}
/// <summary>
/// 删除树节点
/// </summary>
public
void
DeleteNode
()
{
var
CurrentNode
=
this
.
tvModules
.
SelectedNode
;
var
ParentNode
=
CurrentNode
.
Parent
;
if
(
CurrentNode
.
Nodes
.
Count
>
0
)
{
Utils
.
Tip
(
$"当前节点[
{
CurrentNode
.
Text
}
]有多个子节点,请先删除子节点!"
);
return
;
}
//删除数据源
var
drCurrent
=
this
.
GetCurrentNodeRow
();
drCurrent
?.
Delete
();
//移除树节点
var
nodes
=
ParentNode
==
null
?
this
.
tvModules
.
Nodes
:
ParentNode
.
Nodes
;
nodes
.
Remove
(
CurrentNode
);
}
/// <summary>
/// 查找树节点
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
private
TreeNode
SearchNode
(
string
key
)
{
return
this
.
SearchTreeNode
(
key
,
this
.
tvModules
.
Nodes
);
}
/// <summary>
/// 获取当前节点行
/// </summary>
/// <returns></returns>
private
DataRow
GetCurrentNodeRow
()
{
var
key
=
this
.
tvModules
.
SelectedNode
.
Name
;
return
this
.
_dtModel
.
Select
(
$"
{
this
.
NodeKeyColumn
}
=
{
key
}
"
).
FirstOrDefault
();
}
/// <summary>
/// 递归:添加树节点
/// </summary>
/// <param name="nodes"></param>
/// <param name="ParentValue"></param>
private
void
InitTreeNode
(
TreeNodeCollection
nodes
,
string
ParentValue
)
{
DataRow
[]
rows
=
this
.
_dtModel
.
Select
(
$"ISNULL(
{
this
.
ParentColumn
}
, '0') = '
{
ParentValue
}
'"
);
if
(
rows
.
Length
==
0
)
return
;
for
(
int
i
=
0
;
i
<
rows
.
Length
;
i
++)
{
if
(
rows
[
i
].
RowState
==
DataRowState
.
Deleted
)
continue
;
var
key
=
rows
[
i
][
this
.
NodeKeyColumn
].
ToString
();
var
text
=
rows
[
i
][
this
.
NodeTextColumn
].
ToString
();
nodes
.
Add
(
key
,
text
,
0
,
1
);
this
.
InitTreeNode
(
nodes
[
i
].
Nodes
,
key
);
}
}
/// <summary>
/// 递归:查找树节点
/// </summary>
/// <param name="key"></param>
/// <param name="nodes"></param>
/// <returns></returns>
private
TreeNode
SearchTreeNode
(
string
key
,
TreeNodeCollection
nodes
)
{
TreeNode
result
=
null
;
foreach
(
TreeNode
n
in
nodes
)
{
result
=
n
.
Name
.
Equals
(
key
)
?
n
:
this
.
SearchTreeNode
(
key
,
n
.
Nodes
);
if
(
result
!=
null
)
break
;
}
return
result
;
}
#
endregion
#
region
查询功能相关
...
...
@@ -339,7 +209,7 @@ namespace Tools.UI
/// <param name="e"></param>
private
void
TbSearch_TextChanged
(
object
sender
,
EventArgs
e
)
{
this
.
SetTreeNodeBackColor
(
this
.
tvModules
.
Nodes
,
this
.
tbSearch
.
Text
.
Trim
());
this
.
SetTreeNodeBackColor
(
this
.
myTreeView1
.
Nodes
,
this
.
tbSearch
.
Text
.
Trim
());
}
/// <summary>
/// (查询)设置树节点背景色
...
...
Tools/UI/wModuleManager.resx
View file @
8855d40a
...
...
@@ -120,6 +120,15 @@
<metadata
name=
"toolStrip1.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
17, 17
</value>
</metadata>
<metadata
name=
"cmsDetail.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
735, 18
</value>
</metadata>
<metadata
name=
"tsFuncInfo.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
408, 18
</value>
</metadata>
<metadata
name=
"tsBaseInfo.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
521, 18
</value>
</metadata>
<metadata
name=
"imgList5.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
634, 18
</value>
</metadata>
...
...
@@ -128,7 +137,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo
CAAAAk1TRnQBSQFMAgEBAgEAA
XgBAAF4
AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAA
YABAAGA
AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
...
...
@@ -169,21 +178,6 @@
BP8EAAs=
</value>
</data>
<metadata
name=
"tsFuncInfo.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
408, 18
</value>
</metadata>
<metadata
name=
"tsBaseInfo.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
521, 18
</value>
</metadata>
<metadata
name=
"cmsDetail.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
735, 18
</value>
</metadata>
<metadata
name=
"tsFuncInfo.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
408, 18
</value>
</metadata>
<metadata
name=
"tsBaseInfo.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
521, 18
</value>
</metadata>
<metadata
name=
"$this.TrayHeight"
type=
"System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
104
</value>
</metadata>
...
...
Tools/wExtend.cs
View file @
8855d40a
...
...
@@ -20,23 +20,24 @@ namespace Tools
//为保证显示效果:名称长度尽量少于9个汉字
return
new
List
<
ModuleInfo
>
{
this
.
CreateModule
(
typeof
(
UpdateExecuter
.
frmMain
),
"更新执行工具"
),
this
.
CreateModule
(
typeof
(
Ftt
.
PatchPack
.
FrmMain
),
"自动打包工具"
),
this
.
CreateModule
(
typeof
(
UI
.
wDBTableDevelopTools
),
"数据库表开发工具"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wDbAnlysis
),
"简易SQL效率分析"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wSysChecker
),
"系统检查配置工具"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wMonitorVisit
),
"APP模块访问监控"
),
this
.
CreateModule
(
typeof
(
UI
.
wAppModel
),
"APP模块管理"
),
this
.
CreateModule
(
typeof
(
UI
.
wSysModule
),
"功能模块管理"
),
this
.
CreateModule
(
typeof
(
UI
.
wAutoClass
),
"类生成工具"
),
this
.
CreateModule
(
typeof
(
UI
.
wAuditDemo
),
"审批示例"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wImageSearch
),
"图片搜索"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wXmlGenerator
),
"XML生成器"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wModuleManager
),
"模块管理"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wLoginPwd
),
"登录密码"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wEvaluationOfEmployee
),
"员工考核"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wEmptyTable
),
"清空表"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UI
.
wDbLinkMngr
),
"数据库链接管理"
,
"tr"
),
this
.
CreateModule
(
typeof
(
UpdateExecuter
.
frmMain
),
"更新执行工具"
,
"xj:用于客户更新和执行SQL脚本"
),
this
.
CreateModule
(
typeof
(
Ftt
.
PatchPack
.
FrmMain
),
"自动打包工具"
,
"xj:用于CS后端程序自动打包成压缩包"
),
this
.
CreateModule
(
typeof
(
UI
.
wDBTableDevelopTools
),
"表开发工具"
,
"tr:用于创建表,添加描述及生成模型类等"
),
this
.
CreateModule
(
typeof
(
UI
.
wDbAnlysis
),
"SQL效率分析"
,
"tr:用于分析SQL查询效率(执行计划和IO计数)"
),
this
.
CreateModule
(
typeof
(
UI
.
wSysChecker
),
"检查配置工具"
,
"tr:系统通用检查配置服务(通过存储过程检查)"
),
this
.
CreateModule
(
typeof
(
UI
.
wMonitorVisit
),
"APP访问监控"
,
"tb:APP模块的访问统计查看界面"
),
this
.
CreateModule
(
typeof
(
UI
.
wAppModel
),
"APP模块管理"
,
"tb:APP添加模块的图形化界面"
),
this
.
CreateModule
(
typeof
(
UI
.
wSysModule
),
"功能模块管理"
,
"xj:管理功能模块和代码窗体的映射"
),
this
.
CreateModule
(
typeof
(
UI
.
wAutoClass
),
"类生成工具"
,
"tb:将任意数据库表,生成为模型类"
),
this
.
CreateModule
(
typeof
(
UI
.
wAuditDemo
),
"审批示例"
,
"tr:一个审批程序的示例"
),
this
.
CreateModule
(
typeof
(
UI
.
wImageSearch
),
"图片搜索"
,
"tr:一个图片搜索的示例程序"
),
this
.
CreateModule
(
typeof
(
UI
.
wXmlGenerator
),
"XML生成器"
,
"tr:将表生成为XML配置文件"
),
this
.
CreateModule
(
typeof
(
UI
.
wModuleManager
),
"模块管理"
,
"tr:系统模块管理工具(支持生成SQL)"
),
this
.
CreateModule
(
typeof
(
UI
.
wLoginPwd
),
"登录密码"
,
"tr:用于登陆密码的解密加密"
),
this
.
CreateModule
(
typeof
(
UI
.
wEvaluationOfEmployee
),
"员工考核"
,
"tr:员工考核的记录工具"
),
this
.
CreateModule
(
typeof
(
UI
.
wEmptyTable
),
"清空表"
,
"tr:输入主表、自动清空关联表的工具"
),
this
.
CreateModule
(
typeof
(
UI
.
wDbLinkMngr
),
"数据库链接管理"
,
"tr:现有数据库链接的管理和查看"
),
this
.
CreateModule
(
typeof
(
UI
.
wExcelExportSetting
),
"Excel导出设置"
,
"tr:Excel导出配置图形化版本"
),
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment