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
f62737b4
Commit
f62737b4
authored
Dec 03, 2020
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、审核样例优化
parent
fb3751ef
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
185 additions
and
65 deletions
+185
-65
ucAudit.Designer.cs
Tools/MyCommon/controls/ucAudit.Designer.cs
+27
-10
ucAudit.cs
Tools/MyCommon/controls/ucAudit.cs
+82
-28
ucAuditNode.cs
Tools/MyCommon/controls/ucAuditNode.cs
+60
-11
DrawHelper.cs
Tools/MyUtils/DrawHelper.cs
+3
-3
wAuditDemo.Designer.cs
Tools/UI/wAuditDemo.Designer.cs
+0
-12
wAuditDemo.resx
Tools/UI/wAuditDemo.resx
+13
-1
No files found.
Tools/MyCommon/controls/ucAudit.Designer.cs
View file @
f62737b4
...
...
@@ -28,31 +28,48 @@
/// </summary>
private
void
InitializeComponent
()
{
this
.
panelAuditHome
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
NodeHome
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
NodeHome
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
panelAudit
Home
//
Node
Home
//
this
.
panelAuditHome
.
AutoScroll
=
true
;
this
.
panelAuditHome
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
panelAuditHome
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
panelAuditHome
.
Name
=
"panelAuditHome"
;
this
.
panelAuditHome
.
Size
=
new
System
.
Drawing
.
Size
(
346
,
312
);
this
.
panelAuditHome
.
TabIndex
=
0
;
this
.
NodeHome
.
AutoScroll
=
true
;
this
.
NodeHome
.
Controls
.
Add
(
this
.
label1
);
this
.
NodeHome
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
NodeHome
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
NodeHome
.
Name
=
"NodeHome"
;
this
.
NodeHome
.
Size
=
new
System
.
Drawing
.
Size
(
346
,
312
);
this
.
NodeHome
.
TabIndex
=
0
;
//
// label1
//
this
.
label1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
label1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
36F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label1
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
ControlLight
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
346
,
312
);
this
.
label1
.
TabIndex
=
0
;
this
.
label1
.
Text
=
"审核控件"
;
this
.
label1
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleCenter
;
//
// ucAudit
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
Controls
.
Add
(
this
.
panelAudit
Home
);
this
.
Controls
.
Add
(
this
.
Node
Home
);
this
.
Name
=
"ucAudit"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
346
,
312
);
this
.
NodeHome
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
}
#
endregion
private
System
.
Windows
.
Forms
.
Panel
panelAuditHome
;
private
System
.
Windows
.
Forms
.
Panel
NodeHome
;
private
System
.
Windows
.
Forms
.
Label
label1
;
}
}
Tools/MyCommon/controls/ucAudit.cs
View file @
f62737b4
...
...
@@ -10,14 +10,21 @@ using System.Windows.Forms;
namespace
Tools.MyCommon.controls
{
/// <summary>
/// 审核控件
/// </summary>
public
partial
class
ucAudit
:
UserControl
{
/// <summary>
/// 构造函数:审核控件
/// </summary>
public
ucAudit
()
{
InitializeComponent
();
}
private
DataTable
_dt
=
null
;
/// <summary>
/// 数据源
/// </summary>
...
...
@@ -42,25 +49,50 @@ namespace Tools.MyCommon.controls
/// </summary>
public
void
RefreshNode
()
{
this
.
Set
Audit
Actived
();
this
.
Set
Node
Actived
();
}
List
<
ucAuditNode
>
auditNodeList
=
null
;
int
previous
=
-
1
;
//前一节点
int
current
=
0
;
//当前节点
bool
isIniting
=
false
;
/// <summary>
/// 节点列表
/// </summary>
List
<
ucAuditNode
>
NodeList
=
null
;
/// <summary>
/// 前一节点
/// </summary>
int
previous
=
-
1
;
/// <summary>
/// 当前节点
/// </summary>
int
current
=
0
;
/// <summary>
/// 是否初始化中(并发控制)
/// </summary>
bool
IsIniting
=
false
;
/// <summary>
/// 节点总数
/// </summary>
private
int
NodeCount
=>
this
.
NodeList
==
null
?
0
:
this
.
NodeList
.
Count
;
/// <summary>
/// 是否为空
/// </summary>
private
bool
IsNullOrEmpty
=>
this
.
NodeList
==
null
||
this
.
NodeCount
==
0
;
/// <summary>
/// 初始化审批视图
/// </summary>
private
void
InitAuditView
()
{
if
(
this
.
i
sIniting
)
if
(
this
.
I
sIniting
)
return
;
try
{
this
.
i
sIniting
=
true
;
this
.
I
sIniting
=
true
;
//清除控件
this
.
panelAudit
Home
.
Controls
.
Clear
();
this
.
Node
Home
.
Controls
.
Clear
();
//初始化审批节点列表
audit
NodeList
=
new
List
<
ucAuditNode
>();
this
.
NodeList
=
new
List
<
ucAuditNode
>();
int
index
=
0
;
foreach
(
DataRow
dr
in
this
.
DataSource
.
Rows
)
{
...
...
@@ -69,8 +101,8 @@ namespace Tools.MyCommon.controls
node
.
Index
=
index
;
node
.
AuditStateChanged
+=
Audit_AuditStateChanged
;
node
.
Location
=
new
Point
(
0
,
index
*
155
);
node
.
Parent
=
this
.
panelAudit
Home
;
audit
NodeList
.
Add
(
node
);
node
.
Parent
=
this
.
Node
Home
;
this
.
NodeList
.
Add
(
node
);
index
++;
}
...
...
@@ -81,47 +113,69 @@ namespace Tools.MyCommon.controls
}
finally
{
this
.
i
sIniting
=
false
;
this
.
I
sIniting
=
false
;
}
}
/// <summary>
/// 初始化审批激活状态
/// </summary>
private
void
InitAuditActived
()
{
if
(
this
.
IsNullOrEmpty
)
return
;
//寻找第一个待审节点
int
index
=
0
;
int
total
=
this
.
auditNodeList
.
Count
;
while
(
index
<
total
&&
this
.
auditNodeList
[
index
].
AuditState
!=
0
)
while
(
index
<
this
.
NodeCount
&&
this
.
NodeList
[
index
].
AuditState
!=
0
)
{
index
++;
}
this
.
current
=
index
>=
total
?
total
-
1
:
index
;
//如果不存在待审节点,则指向最后一个节点
this
.
current
=
index
>=
this
.
NodeCount
?
this
.
NodeCount
-
1
:
index
;
this
.
previous
=
this
.
current
-
1
;
this
.
SetAuditActived
();
//激活节点
this
.
SetNodeActived
();
}
private
void
SetAuditActived
()
/// <summary>
/// 激活节点
/// </summary>
private
void
SetNodeActived
()
{
if
(
auditNodeList
==
null
||
auditNodeList
.
Count
==
0
)
if
(
this
.
IsNullOrEmpty
)
return
;
if
(
previous
<
0
)
//到达边界时,分别处理
{
this
.
Set
Audit
Actived
(
current
,
true
);
this
.
Set
Node
Actived
(
current
,
true
);
}
else
{
this
.
Set
AuditActived
(
previous
,
audit
NodeList
[
current
].
AuditState
==
0
);
//下一节点待审核时,当前节点有效,即可以撤销
this
.
Set
AuditActived
(
current
,
audit
NodeList
[
previous
].
AuditState
==
1
);
//上一节点审核通过后,当前节点有效,即可以审批
this
.
Set
NodeActived
(
previous
,
this
.
NodeList
[
current
].
AuditState
==
0
);
//下一节点待审核时,当前节点有效,即可以撤销
this
.
Set
NodeActived
(
current
,
this
.
NodeList
[
previous
].
AuditState
==
1
);
//上一节点审核通过后,当前节点有效,即可以审批
}
}
private
void
SetAuditActived
(
int
index
,
bool
IsActive
)
/// <summary>
/// 激活指定节点
/// </summary>
/// <param name="index"></param>
/// <param name="IsActive"></param>
private
void
SetNodeActived
(
int
index
,
bool
IsActive
)
{
if
(
auditNodeList
==
null
||
auditNodeList
.
Count
==
0
)
if
(
this
.
IsNullOrEmpty
)
return
;
if
(
index
>=
0
&&
index
<
auditNodeList
.
Count
)
if
(
index
>=
0
&&
index
<
this
.
Node
Count
)
{
audit
NodeList
[
index
].
IsActive
=
IsActive
;
this
.
NodeList
[
index
].
IsActive
=
IsActive
;
}
}
/// <summary>
/// 事件:审核状态改变
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
Audit_AuditStateChanged
(
object
sender
,
EventArgs
e
)
{
ucAuditNode
node
=
sender
as
ucAuditNode
;
...
...
@@ -129,13 +183,13 @@ namespace Tools.MyCommon.controls
bool
IsDown
=
node
.
Index
==
current
;
//上下偏移时,修改前序节点状态
int
disposal
=
IsDown
?
previous
:
current
;
this
.
Set
Audit
Actived
(
disposal
,
false
);
this
.
Set
Node
Actived
(
disposal
,
false
);
//移动当前指针位置
current
+=
IsDown
&&
current
<
auditNodeList
.
Count
-
1
?
1
:
0
;
//向下
current
+=
IsDown
&&
current
<
this
.
Node
Count
-
1
?
1
:
0
;
//向下
current
+=
!
IsDown
&&
current
>
0
?
-
1
:
0
;
//向上
previous
=
current
-
1
;
//前序指针永远等于:current-1
//激活当前节点和前序节点
this
.
Set
Audit
Actived
();
this
.
Set
Node
Actived
();
}
}
}
Tools/MyCommon/controls/ucAuditNode.cs
View file @
f62737b4
...
...
@@ -11,24 +11,31 @@ using Tools.MyUtils;
namespace
Tools.MyCommon.controls
{
/// <summary>
/// 审核节点
/// </summary>
public
partial
class
ucAuditNode
:
UserControl
{
/// <summary>
/// 审核状态改变事件
/// </summary>
public
event
EventHandler
AuditStateChanged
;
/// <summary>
/// 构造函数:审核节点
/// </summary>
public
ucAuditNode
()
{
InitializeComponent
();
}
private
bool
_actived
=
false
;
/// <summary>
/// 数据源
/// </summary>
public
DataRow
DataSource
{
get
;
set
;
}
=
null
;
/// <summary>
/// (私有)是否激活
/// </summary>
private
bool
_actived
=
false
;
/// <summary>
/// 是否激活
/// </summary>
public
bool
IsActive
...
...
@@ -61,23 +68,29 @@ namespace Tools.MyCommon.controls
/// </summary>
private
string
WaitAuditUser
=>
this
.
DataSource
==
null
?
""
:
$";
{
this
.
DataSource
[
"WaitAuditUser"
].
ToString
()}
;"
;
/// <summary>
/// 事件:控件加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
ucAudit_Load
(
object
sender
,
EventArgs
e
)
{
if
(!
this
.
DesignMode
&&
this
.
DataSource
!=
null
)
{
this
.
SetEnabled
();
this
.
lbAuditState
.
Text
=
this
.
GetAuditStateText
();
this
.
lbAuditDateTime
.
Text
=
this
.
DataSource
[
"AuditDateTime"
].
ToString
();
this
.
lbWaitAuditUser
.
Text
=
this
.
DataSource
[
"WaitAuditUser"
].
ToString
();
this
.
lbAuditUser
.
Text
=
this
.
DataSource
[
"AuditUser"
].
ToString
();
this
.
tbAuditRemark
.
Text
=
this
.
DataSource
[
"AuditRemark"
].
ToString
();
//
//初始化界面
this
.
InitView
();
//绑定事件
this
.
rbInit
.
CheckedChanged
+=
RadioButton_CheckedChanged
;
this
.
rbPass
.
CheckedChanged
+=
RadioButton_CheckedChanged
;
this
.
rbNoPass
.
CheckedChanged
+=
RadioButton_CheckedChanged
;
this
.
rbRevert
.
CheckedChanged
+=
RadioButton_CheckedChanged
;
}
}
/// <summary>
/// 事件:单选按钮选择
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
RadioButton_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
//只接收选中事件
...
...
@@ -94,6 +107,32 @@ namespace Tools.MyCommon.controls
}
}
/// <summary>
/// 初始化界面
/// </summary>
private
void
InitView
()
{
//设置有效性
this
.
SetEnabled
();
//初始化信息
this
.
lbAuditState
.
Text
=
this
.
GetAuditStateText
();
this
.
lbAuditDateTime
.
Text
=
this
.
DataSource
[
"AuditDateTime"
].
ToString
();
this
.
lbWaitAuditUser
.
Text
=
this
.
DataSource
[
"WaitAuditUser"
].
ToString
();
this
.
lbAuditUser
.
Text
=
this
.
DataSource
[
"AuditUser"
].
ToString
();
this
.
tbAuditRemark
.
Text
=
this
.
DataSource
[
"AuditRemark"
].
ToString
();
}
/// <summary>
/// 刷新界面
/// </summary>
public
void
RefreshView
()
{
this
.
InitView
();
}
/// <summary>
/// 获取审批状态
/// </summary>
/// <returns></returns>
private
int
GetAuditState
()
{
if
(
this
.
rbPass
.
Checked
)
...
...
@@ -105,6 +144,10 @@ namespace Tools.MyCommon.controls
return
0
;
}
/// <summary>
/// 获取审批状态文本
/// </summary>
/// <returns></returns>
private
string
GetAuditStateText
()
{
string
result
=
""
;
...
...
@@ -120,11 +163,17 @@ namespace Tools.MyCommon.controls
return
result
;
}
/// <summary>
/// 设置有效性
/// </summary>
private
void
SetEnabled
()
{
this
.
Enabled
=
this
.
IsActive
&&
this
.
WaitAuditUser
.
IndexOf
(
$";
{
Utils
.
LoginUser
}
;"
)
>=
0
;
this
.
tbAuditRemark
.
Enabled
=
this
.
Enabled
&&
this
.
IsWaitAudit
;
}
/// <summary>
/// 设置审批信息
/// </summary>
private
void
SetAuditInfo
()
{
this
.
lbAuditState
.
Text
=
this
.
GetAuditStateText
();
...
...
Tools/MyUtils/DrawHelper.cs
View file @
f62737b4
...
...
@@ -18,12 +18,12 @@ namespace Tools.MyUtils
private
static
readonly
int
gab_width
=
6
;
//标签间隔
private
static
readonly
int
init_x
=
50
;
//起始坐标x
private
static
readonly
int
init_y
=
50
;
//起始坐标y
//横坐标相对位置
:因为单向绘制,这里只需考虑横坐标
//横坐标相对位置
private
static
readonly
int
arrow_width
=
label_width
+
gab_width
-
bitmap_width
;
//箭头长度
private
static
readonly
int
arrow_relative_x
=
bitmap_width
;
//箭头相对位置x
private
static
readonly
int
label_relative_x
=
label_width
/
2
+
bitmap_width
/
2
+
gab_width
;
//标签相对位置x
private
static
readonly
int
bitmap_relative_x
=
label_width
+
gab_width
;
//图片相对位置x
//纵坐标固定位置
//纵坐标固定位置
(因为单向绘制,所以纵坐标都是固定的)
private
static
readonly
int
arrow_y
=
init_y
+
bitmap_width
/
2
;
//箭头纵坐标绝对位置
private
static
readonly
int
label_y
=
init_y
+
bitmap_width
;
//标签纵坐标绝对位置
...
...
@@ -135,7 +135,7 @@ namespace Tools.MyUtils
FormatFlags
=
StringFormatFlags
.
NoWrap
|
StringFormatFlags
.
LineLimit
,
Trimming
=
StringTrimming
.
EllipsisPath
};
g
.
DrawRectangle
(
new
Pen
(
Brushes
.
Red
),
rectangle
);
//
g.DrawRectangle(new Pen(Brushes.Red), rectangle);
g
.
DrawString
(
text
,
font
,
Brushes
.
Black
,
rectangle
,
format
);
}
...
...
Tools/UI/wAuditDemo.Designer.cs
View file @
f62737b4
...
...
@@ -50,7 +50,6 @@
this
.
tsbExit
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tabPage3
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
panel2
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
lbInfo
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
cmbLoginUser
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
ucAudit1
=
new
Tools
.
MyCommon
.
controls
.
ucAudit
();
...
...
@@ -253,7 +252,6 @@
//
// panel2
//
this
.
panel2
.
Controls
.
Add
(
this
.
lbInfo
);
this
.
panel2
.
Controls
.
Add
(
this
.
cmbLoginUser
);
this
.
panel2
.
Controls
.
Add
(
this
.
label1
);
this
.
panel2
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
...
...
@@ -262,15 +260,6 @@
this
.
panel2
.
Size
=
new
System
.
Drawing
.
Size
(
792
,
35
);
this
.
panel2
.
TabIndex
=
1
;
//
// lbInfo
//
this
.
lbInfo
.
AutoSize
=
true
;
this
.
lbInfo
.
Location
=
new
System
.
Drawing
.
Point
(
313
,
12
);
this
.
lbInfo
.
Name
=
"lbInfo"
;
this
.
lbInfo
.
Size
=
new
System
.
Drawing
.
Size
(
41
,
12
);
this
.
lbInfo
.
TabIndex
=
2
;
this
.
lbInfo
.
Text
=
"label2"
;
//
// cmbLoginUser
//
this
.
cmbLoginUser
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
...
...
@@ -348,7 +337,6 @@
private
System
.
Windows
.
Forms
.
Panel
panel2
;
private
System
.
Windows
.
Forms
.
ComboBox
cmbLoginUser
;
private
System
.
Windows
.
Forms
.
Label
label1
;
private
System
.
Windows
.
Forms
.
Label
lbInfo
;
private
MyCommon
.
controls
.
ucAudit
ucAudit1
;
}
}
\ No newline at end of file
Tools/UI/wAuditDemo.resx
View file @
f62737b4
...
...
@@ -117,6 +117,18 @@
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<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=
"Column1.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=
"Column1.UserAddedColumn"
type=
"System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
>
<value>
True
</value>
</metadata>
...
...
@@ -134,7 +146,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADW
CAAAAk1TRnQBSQFMAgEBAwEAA
UgBAAFI
AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAwEAA
VABAAFQ
AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
...
...
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