Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
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
bltdc
DataCenter_Core2.1_20190520
Commits
5ce797a9
Commit
5ce797a9
authored
Dec 09, 2021
by
jianshuqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化:组件功能
parent
c23b2b82
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
16 deletions
+49
-16
TableDTO.cs
Bailun.DC.Models/Component/DTO/TableDTO.cs
+0
-4
TableService.cs
Bailun.DC.Services/Component/TableService.cs
+13
-9
TableController.cs
Bailun.DC.Web/Areas/Component/Controllers/TableController.cs
+32
-3
el-form-control.css
Bailun.DC.Web/wwwroot/css/component/el-form-control.css
+4
-0
No files found.
Bailun.DC.Models/Component/DTO/TableDTO.cs
View file @
5ce797a9
...
...
@@ -74,7 +74,6 @@ namespace Bailun.DC.Models.Component.DTO
/// <summary>
/// 列值
/// </summary>
[
JsonIgnore
]
public
string
ColumnValue
{
get
;
set
;
}
/// <summary>
...
...
@@ -100,19 +99,16 @@ namespace Bailun.DC.Models.Component.DTO
/// <summary>
/// 数据值
/// </summary>
[
JsonIgnore
]
public
string
DataValue
{
get
;
set
;
}
/// <summary>
/// 数据库:1: 数据中心, 2: 交易流水
/// </summary>
[
JsonIgnore
]
public
DBEnum
?
DataDB
{
get
;
set
;
}
/// <summary>
/// 数据默认排序SQL
/// </summary>
[
JsonIgnore
]
public
string
DataSortSql
{
get
;
set
;
}
/// <summary>
...
...
Bailun.DC.Services/Component/TableService.cs
View file @
5ce797a9
...
...
@@ -21,24 +21,27 @@ namespace Bailun.DC.Services.Component
/// 获取查询组件
/// </summary>
/// <param name="code">编码</param>
/// <param name="id">ID</param>
/// <returns></returns>
public
TableDTO
Get
(
string
code
)
public
TableDTO
Get
(
string
code
=
null
,
string
id
=
null
)
{
TableDTO
dto
=
default
(
TableDTO
);
if
(!
string
.
IsNullOrWhiteSpace
(
code
))
if
(!
string
.
IsNullOrWhiteSpace
(
code
)
||
!
string
.
IsNullOrWhiteSpace
(
id
)
)
{
dc_component_table
entity
=
default
(
dc_component_table
);
using
(
var
db
=
DB
)
{
DynamicParameters
sqlparam
=
new
DynamicParameters
();
sqlparam
.
Add
(
"id"
,
id
);
sqlparam
.
Add
(
"code"
,
code
);
entity
=
db
.
QueryFirstOrDefault
<
dc_component_table
>(
"select * from dc_component_table where is_delete = 0 and
code = @code
"
,
sqlparam
);
entity
=
db
.
QueryFirstOrDefault
<
dc_component_table
>(
"select * from dc_component_table where is_delete = 0 and
(id = @id or code = @code)
"
,
sqlparam
);
}
if
(
entity
!=
null
)
{
dto
=
new
TableDTO
{
Id
=
entity
.
id
,
Code
=
entity
.
code
,
Name
=
entity
.
name
,
MenuCode
=
entity
.
menu_code
,
...
...
@@ -69,6 +72,7 @@ namespace Bailun.DC.Services.Component
//列
if
(
dto
.
ColumnType
==
ColumnTypeEnum
.
Config
&&
!
string
.
IsNullOrWhiteSpace
(
entity
.
column_value
))
{
dto
.
ColumnValue
=
null
;
dto
.
ListColumn
=
DeserializeCollection
<
dynamic
>(
entity
.
column_value
);
}
if
(
dto
.
ListOperateControl
?.
Count
()
>
0
)
...
...
@@ -481,7 +485,7 @@ namespace Bailun.DC.Services.Component
if
(
listColumn
!=
null
)
{
//数据类型
DataTypeEnum
?[]
dataTypes
=
{
DataTypeEnum
.
Table
,
DataTypeEnum
.
Sql
};
DataTypeEnum
?[]
dataTypes
=
{
DataTypeEnum
.
Table
,
DataTypeEnum
.
Sql
};
//全部数据导出
queryFilter
.
CurrentPage
=
null
;
queryFilter
.
pageSize
=
null
;
...
...
@@ -537,7 +541,7 @@ namespace Bailun.DC.Services.Component
is_show_sequence_column
=
dto
.
IsShowSequenceColumn
,
is_show_column_search
=
dto
.
IsShowColumnSearch
,
column_type
=
dto
.
ColumnType
,
column_value
=
dto
.
ColumnValue
,
column_value
=
dto
.
Column
Type
==
ColumnTypeEnum
.
Config
&&
dto
.
ListColumn
?.
Count
()
>
0
?
JsonConvert
.
SerializeObject
(
dto
.
ListColumn
)
:
dto
.
Column
Value
,
data_type
=
dto
.
DataType
,
data_value
=
dto
.
DataValue
,
data_db
=
dto
.
DataDB
,
...
...
@@ -733,16 +737,16 @@ namespace Bailun.DC.Services.Component
}
else
{
I
List
<
dynamic
>
listColumn
=
default
(
IList
<
dynamic
>);
I
Enumerable
<
dynamic
>
listColumn
=
default
(
IList
<
dynamic
>);
if
(
entity
.
ColumnType
==
ColumnTypeEnum
.
Config
)
{
listColumn
=
DeserializeCollection
<
dynamic
>(
entity
.
ColumnValue
).
ToList
()
;
listColumn
=
entity
.
ListColumn
;
}
else
{
listColumn
=
this
.
GetListColumn
(
queryFilter
);
listColumn
=
this
.
GetListColumn
(
queryFilter
,
entity
);
}
if
(
listColumn
?.
Count
>
0
&&
listColumn
.
Any
(
l
=>
!
string
.
IsNullOrWhiteSpace
(
l
.
Code
)
&&
l
.
OrderSort
>
0
))
if
(
listColumn
?.
Count
()
>
0
&&
listColumn
.
Any
(
l
=>
!
string
.
IsNullOrWhiteSpace
(
l
.
Code
)
&&
l
.
OrderSort
>
0
))
{
sql
=
string
.
Join
(
","
,
listColumn
.
Where
(
l
=>
!
string
.
IsNullOrWhiteSpace
(
l
.
Code
)
&&
l
.
OrderSort
>
0
).
OrderBy
(
l
=>
l
.
OrderSort
).
Select
(
l
=>
$"`
{
l
.
Code
}
`
{(
l
.
Descending
==
true
?
"desc"
:
"asc"
)}
"
));
}
...
...
Bailun.DC.Web/Areas/Component/Controllers/TableController.cs
View file @
5ce797a9
using
Bailun.DC.Models.Component.DTO
;
using
Bailun.DC.Services.Component
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Serialization
;
using
System
;
using
System.Linq
;
using
System.Collections.Generic
;
namespace
Bailun.DC.Web.Areas.Component.Controllers
{
...
...
@@ -15,12 +19,12 @@ namespace Bailun.DC.Web.Areas.Component.Controllers
[
HttpGet
]
public
JsonResult
Get
(
string
code
=
null
)
public
JsonResult
Get
(
string
id
=
null
,
string
code
=
null
)
{
ResultDTO
result
=
new
ResultDTO
();
try
{
result
.
Data
=
new
TableService
().
Get
(
code
);
result
.
Data
=
new
TableService
().
Get
(
code
,
id
);
result
.
Result
=
true
;
}
catch
(
Exception
ex
)
...
...
@@ -28,7 +32,7 @@ namespace Bailun.DC.Web.Areas.Component.Controllers
result
.
Message
=
ex
.
Message
;
}
return
Json
(
result
);
return
Json
(
result
,
new
JsonSerializerSettings
()
{
ContractResolver
=
new
IgnoreJsonAttributesResolver
(
id
),
DefaultValueHandling
=
DefaultValueHandling
.
Include
}
);
}
[
HttpPost
]
...
...
@@ -143,5 +147,30 @@ namespace Bailun.DC.Web.Areas.Component.Controllers
return
Json
(
result
);
}
private
class
IgnoreJsonAttributesResolver
:
DefaultContractResolver
{
private
string
Id
{
get
;
set
;
}
public
IgnoreJsonAttributesResolver
(
string
id
)
{
this
.
Id
=
id
;
}
protected
override
IList
<
JsonProperty
>
CreateProperties
(
Type
type
,
MemberSerialization
memberSerialization
)
{
this
.
NamingStrategy
=
new
CamelCaseNamingStrategy
();
IList
<
JsonProperty
>
props
=
base
.
CreateProperties
(
type
,
memberSerialization
);
foreach
(
var
prop
in
props
)
{
string
[]
ignorePropertys
=
{
"ColumnValue"
,
"DataValue"
,
"DataDB"
,
"DataSortSql"
};
if
(
string
.
IsNullOrWhiteSpace
(
this
.
Id
)
&&
ignorePropertys
.
Contains
(
prop
.
UnderlyingName
))
{
prop
.
Ignored
=
true
;
}
}
return
props
;
}
}
}
}
Bailun.DC.Web/wwwroot/css/component/el-form-control.css
View file @
5ce797a9
...
...
@@ -77,3 +77,7 @@
.el-form-control
.mt59
{
margin-left
:
59px
;
}
.el-form-control
.el-textarea.el-input--small
span
{
height
:
25px
;
}
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