Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Springboot Plus
Commits
149bb772
Commit
149bb772
authored
Mar 15, 2018
by
李家智
Browse files
add data select
parent
59e6416d
Changes
7
Hide whitespace changes
Inline
Side-by-side
admin-console/src/main/resources/static/js/admin/dict/add.js
View file @
149bb772
...
...
@@ -10,9 +10,12 @@ layui.define([ 'form', 'laydate', 'table','dictApi'], function(exports) {
initSubmit
:
function
(){
$
(
"
#addButton
"
).
click
(
function
(){
dictApi
.
addDict
(
$
(
"
#addForm
"
),
function
(){
parent
.
window
.
dataReload
();
Common
.
info
(
"
添加成功
"
);
Lib
.
closeFrame
();
parent
.
window
.
dataReload
();
Common
.
openConfirm
(
"
添加成功,继续添加?
"
,
null
,
function
(){
Lib
.
closeFrame
();
})
});
...
...
admin-console/src/main/resources/static/js/admin/menu/add.js
View file @
149bb772
...
...
@@ -18,9 +18,10 @@ layui.define([ 'form', 'laydate', 'table','menuApi'], function(exports) {
menuApi
.
addMenu
(
function
(){
Common
.
info
(
"
添加成功
"
);
parent
.
window
.
dataReload
();
Lib
.
closeFrame
();
});
parent
.
window
.
dataReload
();
});
...
...
admin-console/src/main/resources/static/js/admin/menu/edit.js
View file @
149bb772
...
...
@@ -17,8 +17,9 @@ layui.define([ 'form', 'laydate', 'table','menuApi'], function(exports) {
menuApi
.
updateMenu
(
function
(){
Common
.
info
(
"
更新成功
"
);
Lib
.
closeFrame
();
parent
.
window
.
dataReload
();
});
parent
.
window
.
dataReload
();
});
...
...
admin-core/src/main/java/com/ibeetl/admin/core/service/BaseService.java
View file @
149bb772
...
...
@@ -167,26 +167,30 @@ public class BaseService<T> {
}
TailBean
ext
=
(
TailBean
)
bean
;
Field
[]
fields
=
ext
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
if
(
field
.
isAnnotationPresent
(
Dict
.
class
))
{
field
.
setAccessible
(
true
);
Dict
dict
=
field
.
getAnnotation
(
Dict
.
class
);
try
{
String
display
=
""
;
Object
fieldValue
=
field
.
get
(
ext
);
if
(
fieldValue
!=
null
)
{
CoreDict
dbDict
=
dictUtil
.
findCoreDict
(
dict
.
type
(),
fieldValue
.
toString
());
display
=
dbDict
!=
null
?
dbDict
.
getName
():
null
;
Class
c
=
ext
.
getClass
();
do
{
Field
[]
fields
=
c
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
if
(
field
.
isAnnotationPresent
(
Dict
.
class
))
{
field
.
setAccessible
(
true
);
Dict
dict
=
field
.
getAnnotation
(
Dict
.
class
);
try
{
String
display
=
""
;
Object
fieldValue
=
field
.
get
(
ext
);
if
(
fieldValue
!=
null
)
{
CoreDict
dbDict
=
dictUtil
.
findCoreDict
(
dict
.
type
(),
fieldValue
.
toString
());
display
=
dbDict
!=
null
?
dbDict
.
getName
():
null
;
}
ext
.
set
(
field
.
getName
()
+
dict
.
suffix
(),
display
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
ext
.
set
(
field
.
getName
()
+
dict
.
suffix
(),
display
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
c
=
c
.
getSuperclass
();
}
while
(
c
!=
TailBean
.
class
);
}
...
...
admin-core/src/main/java/com/ibeetl/admin/core/util/beetl/DictQueryFunction.java
View file @
149bb772
...
...
@@ -23,5 +23,16 @@ public class DictQueryFunction {
return
dictService
.
findAllByGroup
(
group
,
value
);
}
/**
* 根据字典类型和值,找到对应的字典类型定义
* 数据字典在一个type下只有唯一的值
* @param type
* @param value
* @return
*/
public
CoreDict
getDict
(
String
type
,
String
value
)
{
return
dictService
.
findCoreDict
(
type
,
value
);
}
}
admin-core/src/main/resources/templates/common/tag/simpleDataSelect.tag.html
0 → 100644
View file @
149bb772
<!--#
/*通用数据下拉列表控件,输入有data,value,attrId,attrName,name
<layui:simpleDataSelect name="orgId" value="${user.orgId}" data="${orgs}"
attrId="id" attrName="orgName"/>
*/ -->
<div
class=
"${style!'layui-input-inline'}"
>
<!--#
if(has(readonly)){
var selectedData = null;
var expected = value!"";
for(item in data){
if(item[attrId]==expected){
selectedDict = item;
break;
}
}
-->
<input
type=
"text"
class=
"layui-input input-readonly"
value=
"${selectedData[attrName]}"
></input>
<input
type=
"hidden"
name=
"${name}"
value=
"${expected}"
></input>
<!--#}else{ -->
<select
name=
"${name}"
${
has
(
id
)?("
id=
"+id):''}>
<option value="
"
>
请选择
</option>
<!--#
var expected = value!"";
for(item in data){
-->
<option
value=
"${item[attrId]}"
${
item[attrId]=
=expected?'selected'}
>
${item[attrName]}
</option>
<!--#}-->
</select>
<!--#} -->
</div>
admin-core/src/main/resources/templates/common/tag/simpleDictSelect.tag.html
View file @
149bb772
<!--# /*简单一级字典下拉列表控件*/ -->
<!--#
/*简单一级字典下拉列表控件
<layui:simpleDictSelect type="org_type"
name="orgType" value="${user.orgId}" />
*/
-->
<div
class=
"${style!'layui-input-inline'}"
>
<!--#
if(has(readonly)){
...
...
Write
Preview
Supports
Markdown
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