Commit 04f292f4 by fengshuonan

修改部门列表展示

parent b9ff2e18
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
@if(array.contain(plugins,"bootstrap-treetable")){ @if(array.contain(plugins,"bootstrap-treetable")){
<link href="${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.css" rel="stylesheet" type="text/css" /> <link href="${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.css" rel="stylesheet" type="text/css" />
@} @}
@if(array.contain(plugins,"treeview")){
<link href="${ctxPath}/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.css" rel="stylesheet" type="text/css" />
@}
@} @}
<!--其他业务用的css--> <!--其他业务用的css-->
...@@ -166,6 +169,9 @@ ...@@ -166,6 +169,9 @@
<script src="${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.js"></script> <script src="${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable.min.js"></script>
<script src="${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable-object.js"></script> <script src="${ctxPath}/assets/common/plugins/bootstrap-treetable/bootstrap-treetable-object.js"></script>
@} @}
@if(array.contain(plugins,"treeview")){
<script src="${ctxPath}/assets/common/plugins/bootstrap-treeview/bootstrap-treeview.min.js"></script>
@}
@} @}
<!--其他业务用的js--> <!--其他业务用的js-->
......
@layout("/common/_container.html",{plugins:["table","layer","bootstrap-treetable"],js:["/assets/modular/system/dept/dept.js"]}){ @layout("/common/_container.html",{plugins:["table","layer","sweet-alert","treeview"],js:["/assets/modular/system/dept/dept.js"]}){
<div class="row"> <div class="row">
<div class="col-12" id="deptPage"> <div class="col-lg-2 col-sm-3 p-r-0">
<div class="card card-outline-theme">
<div class="card-header">
<h5 class="m-b-0 text-white">部门树列表</h5>
</div>
<div class="card-body">
<ul id="deptTree" class="p-l-0"></ul>
</div>
</div>
</div>
<div class="col-lg-10 col-sm-9" id="deptPage">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="card card-outline-theme m-b-10"> <div class="card card-outline-theme m-b-10">
...@@ -41,7 +51,7 @@ ...@@ -41,7 +51,7 @@
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="card m-b-0 p-b-0"> <div class="card m-b-0 p-b-0">
<div class="hidden-xs" id="managerTableToolbar" role="group"> <div class="hidden-xs" id="DeptTableToolbar" role="group">
@if(shiro.hasPermission("/dept/add")){ @if(shiro.hasPermission("/dept/add")){
<button type="button" class="btn btn-primary waves-effect m-l-5" onclick="Dept.openAddDept()"> <button type="button" class="btn btn-primary waves-effect m-l-5" onclick="Dept.openAddDept()">
<i class="fa fa-check-circle"></i>&nbsp;添加 <i class="fa fa-check-circle"></i>&nbsp;添加
......
.treeview .list-group-item {
cursor: pointer;
padding: .5rem 1.25rem;
}
.treeview span.indent {
margin-left: 10px;
margin-right: 10px
}
.treeview span.icon {
width: 12px;
margin-right: 5px
}
.treeview .node-disabled {
color: silver;
cursor: not-allowed
}
\ No newline at end of file
...@@ -17,10 +17,10 @@ var Dept = { ...@@ -17,10 +17,10 @@ var Dept = {
Dept.initColumn = function () { Dept.initColumn = function () {
return [ return [
{field: 'selectItem', radio: true}, {field: 'selectItem', radio: true},
{title: 'id', field: 'id', align: 'center', valign: 'middle', width: '50px'}, {title: 'id', field: 'deptId', align: 'center', valign: 'middle', width: '50px'},
{title: '部门简称', field: 'simplename', align: 'center', valign: 'middle', sortable: true}, {title: '部门简称', field: 'simpleName', align: 'center', valign: 'middle', sortable: true},
{title: '部门全称', field: 'fullname', align: 'center', valign: 'middle', sortable: true}, {title: '部门全称', field: 'fullName', align: 'center', valign: 'middle', sortable: true},
{title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true}, {title: '排序', field: 'sort', align: 'center', valign: 'middle', sortable: true},
{title: '备注', field: 'description', align: 'center', valign: 'middle', sortable: true}]; {title: '备注', field: 'description', align: 'center', valign: 'middle', sortable: true}];
}; };
...@@ -28,8 +28,8 @@ Dept.initColumn = function () { ...@@ -28,8 +28,8 @@ Dept.initColumn = function () {
* 检查是否选中 * 检查是否选中
*/ */
Dept.check = function () { Dept.check = function () {
var selected = $('#' + this.id).bootstrapTreeTable('getSelections'); var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) { if (selected.length === 0) {
Feng.info("请先选中表格中的某一记录!"); Feng.info("请先选中表格中的某一记录!");
return false; return false;
} else { } else {
...@@ -42,7 +42,7 @@ Dept.check = function () { ...@@ -42,7 +42,7 @@ Dept.check = function () {
* 点击添加部门 * 点击添加部门
*/ */
Dept.openAddDept = function () { Dept.openAddDept = function () {
var index = layer.open({ this.layerIndex = layer.open({
type: 2, type: 2,
title: '添加部门', title: '添加部门',
area: ['800px', '420px'], //宽高 area: ['800px', '420px'], //宽高
...@@ -50,7 +50,6 @@ Dept.openAddDept = function () { ...@@ -50,7 +50,6 @@ Dept.openAddDept = function () {
maxmin: true, maxmin: true,
content: Feng.ctxPath + '/dept/dept_add' content: Feng.ctxPath + '/dept/dept_add'
}); });
this.layerIndex = index;
}; };
/** /**
...@@ -58,15 +57,14 @@ Dept.openAddDept = function () { ...@@ -58,15 +57,14 @@ Dept.openAddDept = function () {
*/ */
Dept.openDeptDetail = function () { Dept.openDeptDetail = function () {
if (this.check()) { if (this.check()) {
var index = layer.open({ this.layerIndex = layer.open({
type: 2, type: 2,
title: '部门详情', title: '部门详情',
area: ['800px', '420px'], //宽高 area: ['800px', '420px'], //宽高
fix: false, //不固定 fix: false, //不固定
maxmin: true, maxmin: true,
content: Feng.ctxPath + '/dept/dept_update/' + Dept.seItem.id content: Feng.ctxPath + '/dept/dept_update/' + Dept.seItem.deptId
}); });
this.layerIndex = index;
} }
}; };
...@@ -83,7 +81,7 @@ Dept.delete = function () { ...@@ -83,7 +81,7 @@ Dept.delete = function () {
}, function (data) { }, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!"); Feng.error("删除失败!" + data.responseJSON.message + "!");
}); });
ajax.set("deptId", Dept.seItem.id); ajax.set("deptId", Dept.seItem.deptId);
ajax.start(); ajax.start();
}; };
...@@ -101,19 +99,64 @@ Dept.search = function () { ...@@ -101,19 +99,64 @@ Dept.search = function () {
}; };
$(function () { $(function () {
var defaultData = [
{
text: 'Parent 1',
href: '#parent1',
tags: ['4'],
nodes: [
{
text: 'Child 1',
href: '#child1',
tags: ['2'],
nodes: [
{
text: 'Grandchild 1',
href: '#grandchild1',
tags: ['0']
},
{
text: 'Grandchild 2',
href: '#grandchild2',
tags: ['0']
}
]
},
{
text: 'Child 2',
href: '#child2',
tags: ['0']
}
]
},
{
text: 'Parent 2'
},
{
text: 'Parent 3'
},
{
text: 'Parent 4'
}
];
$('#deptTree').treeview({
selectedBackColor: "#03a9f3",
onhoverColor: "rgba(0, 0, 0, 0.05)",
expandIcon: 'ti-plus',
collapseIcon: 'ti-minus',
nodeIcon: 'fa fa-home',
data: defaultData
});
Dept.app = new Vue({ Dept.app = new Vue({
el: '#deptPage', el: '#deptPage',
data: Dept.condition data: Dept.condition
}); });
var defaultColunms = Dept.initColumn(); var defaultColunms = Dept.initColumn();
var table = new BSTreeTable('DeptTable', "/dept/list", defaultColunms); var table = new BSTable("DeptTable", "/dept/list", defaultColunms);
table.setExpandColumn(2); table.setPaginationType("client");
table.setIdField("id");
table.setCodeField("id");
table.setParentCodeField("pid");
table.setExpandAll(true);
table.init();
Dept.table = table.init(); Dept.table = table.init();
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment