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
11c172b6
Commit
11c172b6
authored
Dec 11, 2018
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑部门完善
parent
d406c80d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
194 additions
and
37 deletions
+194
-37
src/main/java/cn/stylefeng/guns/modular/system/controller/DeptController.java
+9
-3
src/main/java/cn/stylefeng/guns/modular/system/model/DeptDto.java
+46
-0
src/main/webapp/WEB-INF/system/dept/dept_edit.html
+40
-33
src/main/webapp/assets/modular/system/dept/dept.js
+1
-1
src/main/webapp/assets/modular/system/dept/dept_edit.js
+98
-0
No files found.
src/main/java/cn/stylefeng/guns/modular/system/controller/DeptController.java
View file @
11c172b6
...
...
@@ -15,6 +15,7 @@
*/
package
cn
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.stylefeng.guns.core.common.annotion.BussinessLog
;
import
cn.stylefeng.guns.core.common.annotion.Permission
;
import
cn.stylefeng.guns.core.common.constant.dictmap.DeptDict
;
...
...
@@ -23,6 +24,7 @@ import cn.stylefeng.guns.core.common.exception.BizExceptionEnum;
import
cn.stylefeng.guns.core.common.node.ZTreeNode
;
import
cn.stylefeng.guns.core.log.LogObjectHolder
;
import
cn.stylefeng.guns.modular.system.entity.Dept
;
import
cn.stylefeng.guns.modular.system.model.DeptDto
;
import
cn.stylefeng.guns.modular.system.service.DeptService
;
import
cn.stylefeng.guns.modular.system.warpper.DeptWarpper
;
import
cn.stylefeng.roses.core.base.controller.BaseController
;
...
...
@@ -74,8 +76,8 @@ public class DeptController extends BaseController {
* 跳转到修改部门
*/
@Permission
@RequestMapping
(
"/dept_update
/{deptId}
"
)
public
String
deptUpdate
(
@
PathVariable
Long
deptId
,
Model
model
)
{
@RequestMapping
(
"/dept_update"
)
public
String
deptUpdate
(
@
RequestParam
(
"deptId"
)
Long
deptId
,
Model
model
)
{
Dept
dept
=
deptService
.
selectById
(
deptId
);
model
.
addAttribute
(
dept
);
model
.
addAttribute
(
"pName"
,
ConstantFactory
.
me
().
getDeptName
(
dept
.
getPid
()));
...
...
@@ -129,7 +131,11 @@ public class DeptController extends BaseController {
@Permission
@ResponseBody
public
Object
detail
(
@PathVariable
(
"deptId"
)
Long
deptId
)
{
return
deptService
.
selectById
(
deptId
);
Dept
dept
=
deptService
.
selectById
(
deptId
);
DeptDto
deptDto
=
new
DeptDto
();
BeanUtil
.
copyProperties
(
dept
,
deptDto
);
deptDto
.
setPName
(
ConstantFactory
.
me
().
getDeptName
(
deptDto
.
getPid
()));
return
deptDto
;
}
/**
...
...
src/main/java/cn/stylefeng/guns/modular/system/model/DeptDto.java
0 → 100644
View file @
11c172b6
package
cn
.
stylefeng
.
guns
.
modular
.
system
.
model
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* 字典信息
*
* @author fengshuonan
* @Date 2018/12/8 18:16
*/
@Data
public
class
DeptDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
private
Long
deptId
;
/**
* 父部门id
*/
private
Long
pid
;
/**
* 父部门名称
*/
private
String
pName
;
/**
* 简称
*/
private
String
simpleName
;
/**
* 全称
*/
private
String
fullName
;
/**
* 描述
*/
private
String
description
;
/**
* 排序
*/
private
Integer
sort
;
}
src/main/webapp/WEB-INF/system/dept/dept_edit.html
View file @
11c172b6
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
id=
"deptInfoForm"
>
<input
type=
"hidden"
id=
"id"
value=
"${dept.id}"
>
@layout("/common/_dialog.html",{plugins:["laydate","sweet-alert","layer"],js:["/assets/modular/system/dept/dept_edit.js"]}){
<div
class=
"container-fluid"
>
<form
id=
"deptEditForm"
\@
submit=
"submitForm"
>
<div
class=
"row"
>
<div
class=
"col-sm-6 b-r"
>
<
#
input
id=
"simplename"
name=
"部门名称"
underline=
"true"
value=
"${dept.simplename}"
/>
<
#
input
id=
"fullname"
name=
"部门全称"
underline=
"true"
value=
"${dept.fullname}"
/>
<
#
input
id=
"description"
name=
"备注"
underline=
"true"
value=
"${dept.description}"
/>
<div
class=
"col-6"
>
<div
class=
"form-group"
>
<h5>
部门名称
<span
class=
"text-danger"
>
*
</span></h5>
<div
class=
"controls"
>
<input
v-model=
"simpleName"
type=
"text"
class=
"form-control"
>
</div>
<div
class=
"col-sm-6"
>
<
#
input
id=
"num"
name=
"排序"
underline=
"true"
value=
"${dept.num}"
/>
<
#
input
id=
"pName"
name=
"上级部门"
readonly=
"readonly"
hidden=
"pid"
hiddenValue=
"${dept.pid}"
value=
"${pName}"
clickFun=
"DeptInfoDlg.showDeptSelectTree(); return false;"
style=
"background-color: #ffffff !important;"
/>
</div>
<div
class=
"form-group"
>
<h5>
部门全称
<span
class=
"text-danger"
>
*
</span></h5>
<div
class=
"controls"
>
<input
v-model=
"fullName"
type=
"text"
class=
"form-control"
>
</div>
<!-- 父级部门的选择框 -->
<div
id=
"parentDeptMenu"
class=
"menuContent"
style=
"display: none; position: absolute; z-index: 200;"
>
<ul
id=
"parentDeptMenuTree"
class=
"ztree tree-box"
style=
"width: 245px !important;"
></ul>
</div>
<div
class=
"row btn-group-m-t"
>
<div
class=
"col-sm-10"
>
<
#
button
btnCss=
"info"
name=
"提交"
id=
"ensure"
icon=
"fa-check"
clickFun=
"DeptInfoDlg.editSubmit()"
/>
<
#
button
btnCss=
"danger"
name=
"取消"
id=
"cancel"
icon=
"fa-eraser"
clickFun=
"DeptInfoDlg.close()"
/>
<div
class=
"form-group"
>
<h5>
备注
<span
class=
"text-danger"
>
*
</span></h5>
<div
class=
"controls"
>
<input
v-model=
"description"
type=
"text"
class=
"form-control"
>
</div>
</div>
</div>
<div
class=
"col-6"
>
<div
class=
"form-group"
>
<h5>
排序
</h5>
<div
class=
"controls"
>
<input
v-model=
"sort"
type=
"text"
class=
"form-control"
>
</div>
</div>
<div
class=
"form-group"
>
<h5>
上级部门
<span
class=
"text-danger"
>
*
</span></h5>
<div
class=
"controls"
>
<input
v-model=
"pName"
id=
"detpName"
\@
click=
"showDeptSelectTree"
type=
"text"
class=
"form-control"
autocomplete=
"off"
>
<input
v-model=
"pid"
type=
"hidden"
class=
"form-control"
>
</div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-6"
>
<div
class=
"text-xs-right"
>
<button
class=
"btn btn-info normal-button-width"
\@
click=
"ensure"
>
提交
</button>
<button
class=
"btn btn-inverse normal-button-width m-l-10"
\@
click=
"close"
>
取消
</button>
</div>
</div>
</div>
</form>
</div>
<script
src=
"${ctxPath}/static/modular/system/dept/dept_info.js"
></script>
@}
\ No newline at end of file
src/main/webapp/assets/modular/system/dept/dept.js
View file @
11c172b6
...
...
@@ -63,7 +63,7 @@ Dept.openDeptDetail = function () {
area
:
[
'800px'
,
'420px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/dept/dept_update
/
'
+
Dept
.
seItem
.
deptId
content
:
Feng
.
ctxPath
+
'/dept/dept_update
?deptId=
'
+
Dept
.
seItem
.
deptId
});
}
};
...
...
src/main/webapp/assets/modular/system/dept/dept_edit.js
0 → 100644
View file @
11c172b6
/**
* 部门详情对话框(可用于添加和修改对话框)
*/
var
DeptEditInfoDlg
=
{
data
:
{
deptId
:
""
,
simpleName
:
""
,
fullName
:
""
,
description
:
""
,
sort
:
""
,
pid
:
""
,
pName
:
""
}
};
/**
* 关闭此对话框
*/
DeptEditInfoDlg
.
close
=
function
()
{
parent
.
layer
.
close
(
window
.
parent
.
Dept
.
layerIndex
);
};
/**
* 验证表单
*/
DeptEditInfoDlg
.
validateForm
=
function
()
{
var
data
=
DeptEditInfoDlg
.
data
;
if
(
!
data
.
simpleName
)
{
return
"请输入部门名称"
;
}
if
(
!
data
.
fullName
)
{
return
"请输入上级部门名称"
;
}
if
(
!
data
.
pid
)
{
return
"请选择上级部门"
;
}
return
true
;
};
/**
* 提交编辑部门
*/
DeptEditInfoDlg
.
addSubmit
=
function
()
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/update"
,
function
(
data
)
{
Feng
.
success
(
"修改成功!"
);
window
.
parent
.
Dept
.
table
.
refresh
();
DeptEditInfoDlg
.
close
();
},
function
(
data
)
{
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
DeptEditInfoDlg
.
data
);
ajax
.
start
();
};
$
(
function
()
{
//获取部门信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/dept/detail/"
+
Feng
.
getUrlParam
(
"deptId"
));
var
result
=
ajax
.
start
();
DeptEditInfoDlg
.
data
=
result
;
DeptEditInfoDlg
.
app
=
new
Vue
({
el
:
'#deptEditForm'
,
data
:
DeptEditInfoDlg
.
data
,
methods
:
{
submitForm
:
function
(
e
)
{
e
.
preventDefault
();
},
showDeptSelectTree
:
function
()
{
var
formName
=
encodeURIComponent
(
"parent.DeptEditInfoDlg.app.pName"
);
var
formId
=
encodeURIComponent
(
"parent.DeptEditInfoDlg.app.pid"
);
var
treeUrl
=
encodeURIComponent
(
Feng
.
ctxPath
+
"/dept/tree"
);
layer
.
open
({
type
:
2
,
title
:
'部门选择'
,
area
:
[
'300px'
,
'400px'
],
content
:
Feng
.
ctxPath
+
'/system/commonTree?formName='
+
formName
+
"&formId="
+
formId
+
"&treeUrl="
+
treeUrl
});
},
ensure
:
function
()
{
var
result
=
DeptEditInfoDlg
.
validateForm
();
if
(
result
===
true
)
{
DeptEditInfoDlg
.
addSubmit
();
}
else
{
Feng
.
alert
(
result
);
}
},
close
:
function
()
{
DeptEditInfoDlg
.
close
();
}
}
});
});
\ No newline at end of file
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