Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
Project
Project
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
鲁鑫
topsun-bpm
Commits
bcdca329
Commit
bcdca329
authored
Sep 10, 2024
by
鲁鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义显示列
parent
00b115a1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
UICtrl.js
huigou-xt/src/main/webapp/javaScript/UICtrl.js
+26
-0
jquery.gridExtend.js
huigou-xt/src/main/webapp/lib/jquery/jquery.gridExtend.js
+14
-1
No files found.
huigou-xt/src/main/webapp/javaScript/UICtrl.js
View file @
bcdca329
...
...
@@ -46,6 +46,28 @@ $(document).ready(function () {
}
});
UICtrl
.
getColumnLocal
=
function
(
tableKey
,
allColumns
)
{
// 获取本地配置
try
{
const
localColumns
=
JSON
.
parse
(
localStorage
.
getItem
(
tableKey
))
// 未读取到配置,直接返回默认columns
if
(
!!!
localColumns
)
return
allColumns
// 有本地配置,与默认配置进行匹配,
return
allColumns
.
map
(
column
=>
{
return
{
...
column
,
hide
:
localColumns
.
find
(
v
=>
v
.
name
==
column
.
name
)?.
_hide
}
})
}
catch
(
e
)
{
// 未获取到,或者报错,直接返回默认columns
return
allColumns
}
}
//查询界面回车执行查询
UICtrl
.
initKeyDownQueryGrid
=
function
()
{
var
form
=
$
(
'#queryMainForm'
);
...
...
@@ -806,6 +828,10 @@ UICtrl.grid = function (el, options) {
options
.
parms
=
parms
;
}
var
_windowWidth
=
$
.
windowWidth
();
// 设置了缓存的获取缓存配置
if
(
options
.
_local
)
{
options
.
columns
=
UICtrl
.
getColumnLocal
(
options
.
_tableKey
,
options
.
columns
)
}
$
(
options
.
columns
).
each
(
function
(
i
,
column
)
{
if
(
_windowWidth
<
700
)
{
//xx add 屏幕宽度太小不启用frozen
column
[
'frozen'
]
=
false
;
...
...
huigou-xt/src/main/webapp/lib/jquery/jquery.gridExtend.js
View file @
bcdca329
...
...
@@ -636,6 +636,17 @@ $.ligerDefaults.Grid.formatters['datetime'] = function (value, column){
this
.
dialog
.
find
(
'.column-sort-button-div'
).
removeClass
(
'ui-hide'
);
return
_height
;
},
_setLocalColumns
:
function
()
{
var
g
=
this
.
getGridManager
();
var
cols
=
g
.
columns
.
map
(
v
=>
{
return
{
name
:
v
.
name
,
_hide
:
v
.
_hide
}
})
// 表格显示隐藏设置缓存
localStorage
.
setItem
(
g
.
options
.
_tableKey
,
JSON
.
stringify
(
cols
))
},
_onClickEvent
:
function
(
$el
){
var
_self
=
this
,
g
=
this
.
getGridManager
();
if
(
$el
.
is
(
':checkbox'
)){
//字段显示&隐藏
...
...
@@ -644,9 +655,11 @@ $.ligerDefaults.Grid.formatters['datetime'] = function (value, column){
return
false
;
}
g
.
toggleCol
(
parseInt
(
$el
.
attr
(
"columnindex"
)),
$el
.
is
(
':checked'
),
false
);
g
.
options
.
_local
&&
_self
.
_setLocalColumns
()
},
10
);
return
false
;
}
if
(
$el
.
is
(
'td'
)){
//字段选中
if
(
$el
.
parent
().
hasClass
(
'disable'
)){
return
;
...
...
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