Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
21b25a0d
Commit
21b25a0d
authored
Jun 20, 2019
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善新增常量管理
parent
f3bea0b4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
23 deletions
+58
-23
guns-sys/src/main/java/cn/stylefeng/guns/sys/modular/consts/model/params/SysConfigParam.java
+8
-3
guns-sys/src/main/java/cn/stylefeng/guns/sys/modular/consts/service/impl/SysConfigServiceImpl.java
+14
-7
guns-sys/src/main/webapp/assets/modular/sysConfig/sysConfig_add.js
+29
-6
guns-sys/src/main/webapp/pages/modular/sysConfig/sysConfig_add.html
+7
-7
No files found.
guns-sys/src/main/java/cn/stylefeng/guns/sys/modular/consts/model/params/SysConfigParam.java
View file @
21b25a0d
package
cn
.
stylefeng
.
guns
.
sys
.
modular
.
consts
.
model
.
params
;
import
lombok.Data
;
import
cn.stylefeng.roses.kernel.model.validator.BaseValidatingParam
;
import
java.util.Date
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.
math.BigDecimal
;
import
java.
util.Date
;
/**
* <p>
...
...
@@ -46,6 +46,11 @@ public class SysConfigParam implements Serializable, BaseValidatingParam {
private
String
dictTypeCode
;
/**
* 字典的值
*/
private
String
dictValue
;
/**
* 属性值,如果是字典中的类型,则为dict的code
*/
private
String
value
;
...
...
guns-sys/src/main/java/cn/stylefeng/guns/sys/modular/consts/service/impl/SysConfigServiceImpl.java
View file @
21b25a0d
...
...
@@ -28,18 +28,25 @@ import java.util.List;
public
class
SysConfigServiceImpl
extends
ServiceImpl
<
SysConfigMapper
,
SysConfig
>
implements
SysConfigService
{
@Override
public
void
add
(
SysConfigParam
param
){
public
void
add
(
SysConfigParam
param
)
{
SysConfig
entity
=
getEntity
(
param
);
//如果是字典类型
if
(
ToolUtil
.
isNotEmpty
(
param
.
getDictFlag
())
&&
param
.
getDictFlag
().
equalsIgnoreCase
(
"Y"
))
{
entity
.
setValue
(
param
.
getDictValue
());
}
this
.
save
(
entity
);
}
@Override
public
void
delete
(
SysConfigParam
param
){
public
void
delete
(
SysConfigParam
param
)
{
this
.
removeById
(
getKey
(
param
));
}
@Override
public
void
update
(
SysConfigParam
param
){
public
void
update
(
SysConfigParam
param
)
{
SysConfig
oldEntity
=
getOldEntity
(
param
);
SysConfig
newEntity
=
getEntity
(
param
);
ToolUtil
.
copyProperties
(
newEntity
,
oldEntity
);
...
...
@@ -47,23 +54,23 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
}
@Override
public
SysConfigResult
findBySpec
(
SysConfigParam
param
){
public
SysConfigResult
findBySpec
(
SysConfigParam
param
)
{
return
null
;
}
@Override
public
List
<
SysConfigResult
>
findListBySpec
(
SysConfigParam
param
){
public
List
<
SysConfigResult
>
findListBySpec
(
SysConfigParam
param
)
{
return
null
;
}
@Override
public
LayuiPageInfo
findPageBySpec
(
SysConfigParam
param
){
public
LayuiPageInfo
findPageBySpec
(
SysConfigParam
param
)
{
Page
pageContext
=
getPageContext
();
IPage
page
=
this
.
baseMapper
.
customPageList
(
pageContext
,
param
);
return
LayuiPageFactory
.
createPageInfo
(
page
);
}
private
Serializable
getKey
(
SysConfigParam
param
){
private
Serializable
getKey
(
SysConfigParam
param
)
{
return
param
.
getId
();
}
...
...
guns-sys/src/main/webapp/assets/modular/sysConfig/sysConfig_add.js
View file @
21b25a0d
...
...
@@ -21,10 +21,14 @@ layui.use(['form', 'admin', 'ax'], function () {
var
form
=
layui
.
form
;
var
admin
=
layui
.
admin
;
//默认的激活状态 dict 或者 custom
var
status
=
"dict"
;
//初始化字典选择框
var
init
DictSelect
=
function
()
{
var
active
DictSelect
=
function
()
{
$
(
"#dictCodeDiv"
).
show
();
$
(
"#customCodeDiv"
).
hide
();
status
=
"dict"
;
//初始化所有字典类型
$
(
"#dictTypeCode"
).
html
(
'<option value="">请选择系统字典类型</option>'
);
...
...
@@ -44,13 +48,31 @@ layui.use(['form', 'admin', 'ax'], function () {
};
//初始化非字典选择
var
init
CustomSelect
=
function
()
{
var
active
CustomSelect
=
function
()
{
$
(
"#dictCodeDiv"
).
hide
();
$
(
"#customCodeDiv"
).
show
();
status
=
"custom"
;
};
//表单提交事件
form
.
on
(
'submit(btnSubmit)'
,
function
(
data
)
{
//如果是选择字典
if
(
status
===
"dict"
)
{
var
radio
=
$
(
'input:radio[name="dictValue"]:checked'
).
val
();
if
(
!
$
(
"#dictTypeCode"
).
val
()
||
!
radio
)
{
Feng
.
error
(
"请选择具体字典!"
);
return
false
;
}
}
else
{
if
(
!
$
(
"#value"
).
val
())
{
Feng
.
error
(
"请填写参数值!"
);
return
false
;
}
}
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/sysConfig/addItem"
,
function
(
data
)
{
Feng
.
success
(
"添加成功!"
);
window
.
location
.
href
=
Feng
.
ctxPath
+
'/sysConfig'
...
...
@@ -66,9 +88,9 @@ layui.use(['form', 'admin', 'ax'], function () {
//监听单选切换
form
.
on
(
'radio(dictChecked)'
,
function
(
data
)
{
if
(
data
.
value
===
"Y"
)
{
init
DictSelect
();
active
DictSelect
();
}
else
{
init
CustomSelect
();
active
CustomSelect
();
}
});
...
...
@@ -84,7 +106,7 @@ layui.use(['form', 'admin', 'ax'], function () {
for
(
var
i
=
0
;
i
<
data
.
data
.
length
;
i
++
)
{
var
name
=
data
.
data
[
i
].
name
;
var
code
=
data
.
data
[
i
].
code
;
$
(
"#dictDetails"
).
append
(
'<input type="radio" name="
v
alue" value="'
+
code
+
'" title="'
+
name
+
'">'
);
$
(
"#dictDetails"
).
append
(
'<input type="radio" name="
dictV
alue" value="'
+
code
+
'" title="'
+
name
+
'">'
);
}
form
.
render
();
...
...
@@ -101,6 +123,6 @@ layui.use(['form', 'admin', 'ax'], function () {
});
//显示字典编码选择
init
DictSelect
();
active
DictSelect
();
});
\ No newline at end of file
guns-sys/src/main/webapp/pages/modular/sysConfig/sysConfig_add.html
View file @
21b25a0d
...
...
@@ -25,10 +25,10 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
取值范围
<span
style=
"color: red;"
>
*
</span></label>
<div
class=
"layui-input-block"
>
<input
type=
"radio"
name=
"dictFlag"
value=
"Y"
title=
"
系统
字典"
lay-filter=
"dictChecked"
checked=
"checked"
>
<input
type=
"radio"
name=
"dictFlag"
value=
"N"
title=
"非
系统
字典"
lay-filter=
"dictChecked"
>
<input
type=
"radio"
name=
"dictFlag"
value=
"Y"
title=
"字典"
lay-filter=
"dictChecked"
checked=
"checked"
>
<input
type=
"radio"
name=
"dictFlag"
value=
"N"
title=
"非字典"
lay-filter=
"dictChecked"
>
</div>
<div
class=
"layui-form-mid layui-word-aux"
>
如果选择
系统
字典,则取值来自于 系统管理->字典管理
</div>
<div
class=
"layui-form-mid layui-word-aux"
>
如果选择字典,则取值来自于 系统管理->字典管理
</div>
</div>
<!-- 从字典取值 -->
...
...
@@ -42,18 +42,18 @@
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
字典
值
<span
style=
"color: red;"
>
*
</span></label>
<label
class=
"layui-form-label"
>
参数
值
<span
style=
"color: red;"
>
*
</span></label>
<div
class=
"layui-input-block"
id=
"dictDetails"
>
<input
type=
"radio"
name=
"
v
alue"
value=
""
title=
"无"
disabled=
"disabled"
>
<input
type=
"radio"
name=
"
dictV
alue"
value=
""
title=
"无"
disabled=
"disabled"
>
</div>
</div>
</div>
<!-- 手动输入 -->
<div
class=
"layui-form-item"
id=
"customCodeDiv"
>
<label
class=
"layui-form-label"
>
自定义
值
<span
style=
"color: red;"
>
*
</span></label>
<label
class=
"layui-form-label"
>
参数
值
<span
style=
"color: red;"
>
*
</span></label>
<div
class=
"layui-input-block"
>
<input
id=
"value"
name=
"value"
placeholder=
"属性值"
type=
"text"
class=
"layui-input"
lay-verify=
"required"
required
/>
<input
id=
"value"
name=
"value"
placeholder=
"属性值"
type=
"text"
class=
"layui-input"
/>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
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