Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fgqyxxlr
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
yaru
fgqyxxlr
Commits
72a1585e
Commit
72a1585e
authored
Jul 27, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
树表格添加responseHandler(请求获取数据后处理回调函数,校验异常状态提醒)
parent
38c84fbd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
3 deletions
+44
-3
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js
+33
-2
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
+11
-1
No files found.
ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js
View file @
72a1585e
...
...
@@ -165,6 +165,7 @@
data
:
parms
?
parms
:
options
.
ajaxParams
,
dataType
:
"JSON"
,
success
:
function
(
data
,
textStatus
,
jqXHR
)
{
data
=
calculateObjectValue
(
options
,
options
.
responseHandler
,
[
data
],
data
);
renderTable
(
data
);
},
error
:
function
(
xhr
,
textStatus
)
{
...
...
@@ -608,6 +609,33 @@
}
return
value
;
};
// ruoyi 发起对目标(target)函数的调用
var
calculateObjectValue
=
function
(
self
,
name
,
args
,
defaultValue
)
{
var
func
=
name
;
if
(
typeof
name
===
'string'
)
{
var
names
=
name
.
split
(
'.'
);
if
(
names
.
length
>
1
)
{
func
=
window
;
$
.
each
(
names
,
function
(
i
,
f
)
{
func
=
func
[
f
];
});
}
else
{
func
=
window
[
name
];
}
}
if
(
typeof
func
===
'object'
)
{
return
func
;
}
if
(
typeof
func
===
'function'
)
{
return
func
.
apply
(
self
,
args
);
}
if
(
!
func
&&
typeof
name
===
'string'
&&
sprintf
.
apply
(
this
,
[
name
].
concat
(
args
)))
{
return
sprintf
.
apply
(
this
,
[
name
].
concat
(
args
));
}
return
defaultValue
;
};
// 初始化
init
();
return
target
;
...
...
@@ -700,7 +728,9 @@
showColumns
:
true
,
// 是否显示内容列下拉框
showRefresh
:
true
,
// 是否显示刷新按钮
expanderExpandedClass
:
'glyphicon glyphicon-chevron-down'
,
// 展开的按钮的图标
expanderCollapsedClass
:
'glyphicon glyphicon-chevron-right'
// 缩起的按钮的图标
expanderCollapsedClass
:
'glyphicon glyphicon-chevron-right'
,
// 缩起的按钮的图标
responseHandler
:
function
(
res
)
{
return
false
;
}
};
})(
jQuery
);
\ No newline at end of file
ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js
View file @
72a1585e
...
...
@@ -443,7 +443,8 @@
showColumns
:
options
.
showColumns
,
// 是否显示隐藏某列下拉框
expandAll
:
options
.
expandAll
,
// 是否全部展开
expandFirst
:
options
.
expandFirst
,
// 是否默认第一级展开--expandAll为false时生效
columns
:
options
.
columns
columns
:
options
.
columns
,
// 显示列信息(*)
responseHandler
:
$
.
treeTable
.
responseHandler
// 当所有数据被加载时触发处理函数
});
},
// 条件查询
...
...
@@ -463,6 +464,15 @@
});
return
$
.
common
.
uniqueFn
(
rows
);
},
// 请求获取数据后处理回调函数,校验异常状态提醒
responseHandler
:
function
(
data
)
{
if
(
data
.
code
!=
undefined
&&
data
.
code
!=
0
)
{
$
.
modal
.
alertWarning
(
data
.
msg
);
return
[];
}
else
{
return
data
;
}
},
},
// 表单封装处理
form
:
{
...
...
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