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
b8a6fba3
Commit
b8a6fba3
authored
May 26, 2022
by
jianshuqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化:组件功能
parent
bc6e0cd2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
13 deletions
+72
-13
ColumnDTO.cs
Bailun.DC.Models/Component/DTO/ColumnDTO.cs
+6
-0
BaseService.cs
Bailun.DC.Services/Component/BaseService.cs
+35
-10
Control.cshtml
Bailun.DC.Web/Areas/Component/Views/Form/Control.cshtml
+19
-1
Control.cshtml
Bailun.DC.Web/Areas/Component/Views/Table/Control.cshtml
+1
-1
el-table-query.css
Bailun.DC.Web/wwwroot/css/component/el-table-query.css
+9
-0
el-table-control.js
Bailun.DC.Web/wwwroot/js/component/el-table-control.js
+2
-1
No files found.
Bailun.DC.Models/Component/DTO/ColumnDTO.cs
View file @
b8a6fba3
...
@@ -39,5 +39,10 @@
...
@@ -39,5 +39,10 @@
/// 行合并属性
/// 行合并属性
/// </summary>
/// </summary>
public
string
RowSpanProp
{
get
;
set
;
}
public
string
RowSpanProp
{
get
;
set
;
}
/// <summary>
/// 宽度
/// </summary>
public
dynamic
Width
{
get
;
set
;
}
}
}
}
}
\ No newline at end of file
Bailun.DC.Services/Component/BaseService.cs
View file @
b8a6fba3
...
@@ -11,6 +11,7 @@ using System.Collections.Generic;
...
@@ -11,6 +11,7 @@ using System.Collections.Generic;
using
System.Data
;
using
System.Data
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
namespace
Bailun.DC.Services.Component
namespace
Bailun.DC.Services.Component
{
{
...
@@ -260,6 +261,8 @@ namespace Bailun.DC.Services.Component
...
@@ -260,6 +261,8 @@ namespace Bailun.DC.Services.Component
{
{
IWorkbook
workbook
=
null
;
IWorkbook
workbook
=
null
;
MemoryStream
ms
=
null
;
MemoryStream
ms
=
null
;
//日期格式化正则
Regex
regex
=
new
Regex
(
"[y|Y|m|M|d|h|H|s|S]+"
);
try
try
{
{
workbook
=
dataCount
<=
65535
?
(
IWorkbook
)
new
HSSFWorkbook
()
:
new
SXSSFWorkbook
();
workbook
=
dataCount
<=
65535
?
(
IWorkbook
)
new
HSSFWorkbook
()
:
new
SXSSFWorkbook
();
...
@@ -276,12 +279,15 @@ namespace Bailun.DC.Services.Component
...
@@ -276,12 +279,15 @@ namespace Bailun.DC.Services.Component
//设置字体大小
//设置字体大小
fontTitle
.
FontHeightInPoints
=
12
;
fontTitle
.
FontHeightInPoints
=
12
;
//单元格样式
//单元格样式
ICellStyle
styleTitle
=
workbook
.
CreateCellStyle
();
ICellStyle
alignmentstyle
=
workbook
.
CreateCellStyle
();
alignmentstyle
.
VerticalAlignment
=
VerticalAlignment
.
Center
;
alignmentstyle
.
Alignment
=
HorizontalAlignment
.
Center
;
ICellStyle
verticAlalignmentstyle
=
workbook
.
CreateCellStyle
();
ICellStyle
verticAlalignmentstyle
=
workbook
.
CreateCellStyle
();
verticAlalignmentstyle
.
VerticalAlignment
=
VerticalAlignment
.
Center
;
verticAlalignmentstyle
.
VerticalAlignment
=
VerticalAlignment
.
Center
;
verticAlalignmentstyle
.
BorderLeft
=
BorderStyle
.
Thin
;
verticAlalignmentstyle
.
BorderTop
=
BorderStyle
.
Thin
;
verticAlalignmentstyle
.
BorderBottom
=
BorderStyle
.
Thin
;
verticAlalignmentstyle
.
BorderRight
=
BorderStyle
.
Thin
;
ICellStyle
alignmentstyle
=
workbook
.
CreateCellStyle
();
alignmentstyle
.
CloneStyleFrom
(
verticAlalignmentstyle
);
alignmentstyle
.
Alignment
=
HorizontalAlignment
.
Center
;
//合并行属性值
//合并行属性值
IDictionary
<
string
,
(
int
,
string
)>
rowSpanProp
=
new
Dictionary
<
string
,
(
int
,
string
)>();
IDictionary
<
string
,
(
int
,
string
)>
rowSpanProp
=
new
Dictionary
<
string
,
(
int
,
string
)>();
//组头
//组头
...
@@ -321,8 +327,19 @@ namespace Bailun.DC.Services.Component
...
@@ -321,8 +327,19 @@ namespace Bailun.DC.Services.Component
listColumn
.
ForEach
((
l
,
col
)
=>
listColumn
.
ForEach
((
l
,
col
)
=>
{
{
var
cell
=
headerRow
.
CreateCell
(
col
);
var
cell
=
headerRow
.
CreateCell
(
col
);
cell
.
CellStyle
=
styleTit
le
;
cell
.
CellStyle
=
verticAlalignmentsty
le
;
cell
.
SetCellValue
(
l
.
Name
);
cell
.
SetCellValue
(
l
.
Name
);
if
(
l
.
Width
!=
null
)
{
if
(
l
.
Width
.
ToString
().
ToLower
()
==
"auto"
)
{
sheet
.
AutoSizeColumn
(
col
);
}
else
if
(
l
.
Width
>
0
)
{
sheet
.
SetColumnWidth
(
col
,
(
int
)((
int
)
l
.
Width
*
12
*
2.44
));
}
}
});
});
for
(
int
row
=
0
;
row
<
excelMaxRowCount
&&
reader
.
Read
();
row
++)
for
(
int
row
=
0
;
row
<
excelMaxRowCount
&&
reader
.
Read
();
row
++)
{
{
...
@@ -338,22 +355,30 @@ namespace Bailun.DC.Services.Component
...
@@ -338,22 +355,30 @@ namespace Bailun.DC.Services.Component
{
{
if
(
value
.
Equals
(
"true"
,
StringComparison
.
OrdinalIgnoreCase
)
||
value
==
"1"
)
if
(
value
.
Equals
(
"true"
,
StringComparison
.
OrdinalIgnoreCase
)
||
value
==
"1"
)
{
{
value
=
"是"
;
cell
.
SetCellValue
(
"是"
)
;
}
}
else
if
(
value
.
Equals
(
"false"
,
StringComparison
.
OrdinalIgnoreCase
)
||
value
==
"0"
)
else
if
(
value
.
Equals
(
"false"
,
StringComparison
.
OrdinalIgnoreCase
)
||
value
==
"0"
)
{
{
value
=
"否"
;
cell
.
SetCellValue
(
"否"
)
;
}
}
}
}
else
if
(
header
.
Format
is
string
)
else
if
(
header
.
Format
is
string
)
{
{
DateTime
parseTime
=
DateTime
.
Now
;
DateTime
parseTime
=
DateTime
.
Now
;
if
(
DateTime
.
TryParse
(
value
,
out
parseTime
))
double
parseDouble
=
default
(
double
);
if
((
new
string
[]
{
"money"
,
"number"
}).
Contains
(
header
.
Format
as
string
)
&&
double
.
TryParse
(
value
,
out
parseDouble
))
{
{
value
=
parseTime
.
ToString
(
header
.
Format
.
Replace
(
"hh"
,
"HH"
)
);
cell
.
SetCellValue
(
parseDouble
);
}
}
else
if
(
regex
.
IsMatch
(
header
.
Format
as
string
)
&&
DateTime
.
TryParse
(
value
,
out
parseTime
))
{
cell
.
SetCellValue
(
parseTime
.
ToString
(
header
.
Format
.
Replace
(
"hh"
,
"HH"
)));
}
}
else
{
cell
.
SetCellValue
(
value
);
}
}
cell
.
SetCellValue
(
value
.
ToString
());
}
}
else
if
(
dataCount
>
65535
)
else
if
(
dataCount
>
65535
)
{
{
...
...
Bailun.DC.Web/Areas/Component/Views/Form/Control.cshtml
View file @
b8a6fba3
...
@@ -188,7 +188,25 @@
...
@@ -188,7 +188,25 @@
<span class="text" v-bind:style="'color:' + item.color">{{item_value}}</span>
<span class="text" v-bind:style="'color:' + item.color">{{item_value}}</span>
</template>
</template>
<template v-else-if="item_value != null">
<template v-else-if="item_value != null">
{{ item.format ? (item_value.constructor === Boolean || item_value == 1 || item_value == 0 ? (item_value ? '是' : '否') :(new Date(item_value).format(item.format))) : item_value}}
<template v-if="item.format">
<template v-if="item.format.constructor === Boolean && (item_value.constructor === Boolean || item_value == 1 || item_value == 0)">
{{ item_value ? '是' : '否' }}
</template>
<template v-else-if="item.format.constructor === String">
<template v-if="item.format == 'money'">
{{ item_value.toLocaleString() }}
</template>
<template v-else-if="item.format == 'number'">
{{ item_value }}
</template>
<template v-else-if="/[y|Y|m|M|d|h|H|s|S]+/.test(item.format)">
{{ new Date(item_value).format(item.format) }}
</template>
</template>
</template>
<template v-else>
{{ item_value }}
</template>
</template>
</template>
</span>
</span>
</script>
</script>
...
...
Bailun.DC.Web/Areas/Component/Views/Table/Control.cshtml
View file @
b8a6fba3
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
v-on:select-all="(selection)=> onRowClick()"
v-on:select-all="(selection)=> onRowClick()"
v-on:row-click="onRowClick"
v-on:row-click="onRowClick"
v-on:current-change="setting.selectRowMethod == 1 && onCurrentChange"
v-on:current-change="setting.selectRowMethod == 1 && onCurrentChange"
v-bind:class="{search:setting.isShowColumnSearch}">
v-bind:class="{search:setting.isShowColumnSearch
,group:setting.isGroupColumn
}">
<el-table-column v-if="setting.selectRowMethod == 2"
<el-table-column v-if="setting.selectRowMethod == 2"
header-align="center"
header-align="center"
type="selection"
type="selection"
...
...
Bailun.DC.Web/wwwroot/css/component/el-table-query.css
View file @
b8a6fba3
...
@@ -7,6 +7,10 @@
...
@@ -7,6 +7,10 @@
height
:
calc
(
100%
-
65px
);
height
:
calc
(
100%
-
65px
);
}
}
.el-table-query
.el-main
.el-table.group
.el-table__body-wrapper
{
height
:
calc
(
100%
-
67px
);
}
#app
,
#app
.el-container.is-vertical
{
#app
,
#app
.el-container.is-vertical
{
height
:
100%
;
height
:
100%
;
}
}
...
@@ -78,3 +82,7 @@
...
@@ -78,3 +82,7 @@
border
:
1px
solid
#ebeef5
;
border
:
1px
solid
#ebeef5
;
padding-right
:
10px
;
padding-right
:
10px
;
}
}
.el-table-query
.el-main
.el-table__header-wrapper
.is-group
tr
:first-child
{
height
:
38px
;
}
\ No newline at end of file
Bailun.DC.Web/wwwroot/js/component/el-table-control.js
View file @
b8a6fba3
...
@@ -106,7 +106,8 @@
...
@@ -106,7 +106,8 @@
//组表头
//组表头
if
(
that
.
setting
.
listColumn
&&
that
.
setting
.
listColumn
.
length
&&
that
.
setting
.
listColumn
.
findIndex
(
function
(
l
)
{
return
l
.
groupname
})
>
0
)
{
if
(
that
.
setting
.
listColumn
&&
that
.
setting
.
listColumn
.
length
&&
that
.
setting
.
listColumn
.
findIndex
(
function
(
l
)
{
return
l
.
groupname
})
>
0
)
{
//保存原生列
//保存原生列
Vue
.
set
(
this
,
"olistColumn"
,
that
.
setting
.
listColumn
);
Vue
.
set
(
that
,
"olistColumn"
,
that
.
setting
.
listColumn
);
Vue
.
set
(
that
.
setting
,
"isGroupColumn"
,
true
);
var
listColumn
=
[];
var
listColumn
=
[];
that
.
setting
.
listColumn
.
forEach
((
l
,
i
)
=>
{
that
.
setting
.
listColumn
.
forEach
((
l
,
i
)
=>
{
if
(
l
.
groupname
)
{
if
(
l
.
groupname
)
{
...
...
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