Commit b4eab980 authored by 李家智's avatar 李家智
Browse files

bug fix

parent 2c334d6c
layui.define([ 'form', 'laydate', 'table','cmsBlogApi'], function(exports) {
var form = layui.form;
var cmsBlogApi = layui.cmsBlogApi;
var index = layui.index;
var view = {
init:function(){
Lib.initGenrealForm($("#addForm"),form);
this.initSubmit();
},
initSubmit:function(){
$("#addButton").click(function(){
cmsBlogApi.addCmsBlog(function(){
parent.window.dataReload();
Common.info("添加成功");
Lib.closeFrame();
});
});
$("#addButton-cancel").click(function(){
Lib.closeFrame();
});
}
}
exports('add',view);
});
\ No newline at end of file
/*访问后台的代码*/
layui.define([], function(exports) {
var api={
updateCmsBlog:function(callback){
Lib.submitForm($('#updateForm'),{},callback)
},
addCmsBlog:function(callback){
Lib.submitForm($('#addForm'),{},callback)
},
del:function(ids,callback){
Common.post("/admin/cmsBlog/delete.json",{"ids":ids},function(){
callback();
})
}
};
exports('cmsBlogApi',api);
});
\ No newline at end of file
layui.define(['table', 'cmsBlogApi'], function(exports) {
var cmsBlogApi = layui.cmsBlogApi;
var table=layui.table;
var view = {
init:function(){
},
delBatch:function(){
var data = Common.getMoreDataFromTable(table,"cmsBlogTable");
if(data==null){
return ;
}
Common.openConfirm("确认要删除这些CmsBlog?",function(){
var ids =Common.concatBatchId(data);
cmsBlogApi.del(ids,function(){
Common.info("删除成功");
dataReload();
})
})
}
}
exports('del',view);
});
\ No newline at end of file
layui.define([ 'form', 'laydate', 'table','cmsBlogApi'], function(exports) {
var form = layui.form;
var cmsBlogApi = layui.cmsBlogApi;
var index = layui.index;
var view = {
init:function(){
Lib.initGenrealForm($("#updateForm"),form);
this.initSubmit();
},
initSubmit:function(){
$("#updateButton").click(function(){
cmsBlogApi.updateCmsBlog(function(){
parent.window.dataReload();
Common.info("更新成功");
Lib.closeFrame();
});
});
$("#updateButton-cancel").click(function(){
Lib.closeFrame();
});
}
}
exports('edit',view);
});
\ No newline at end of file
layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var form = layui.form;
var laydate = layui.laydate;
var table = layui.table;
var cmsBlogTable = null;
var view ={
init:function(){
this.initTable();
this.initSearchForm();
this.initToolBar();
window.dataReload = function(){
Lib.doSearchForm($("#searchForm"),roleTable,form)
}
},
initTable:function(){
cmsBlogTable = table.render({
elem : '#cmsBlogTable',
height : Lib.getTableHeight(1),
method : 'post',
url : Common.CTX + '/admin/cmsBlog/list.json' //数据接口
,page : Lib.tablePage //开启分页
,limit : 10,
cols : [ [ //表头
{
type : 'checkbox',
fixed:'left',
},
{
field : 'id',
title : 'id',
fixed:'left',
width : 100,
},
{
field : 'title',
title : 'title',
width : 100,
},
{
field : 'content',
title : 'content',
width : 100,
},
{
field : 'createTime',
title : 'createTime',
width : 100,
},
{
field : 'createUserId',
title : 'createUserId',
width : 100,
},
{
field : 'type',
title : 'type',
width : 100,
}
] ]
});
},
initSearchForm:function(){
Lib.initSearchForm( $("#searchForm"),cmsBlogTable,form);
},
initToolBar:function(){
toolbar = {
add : function() { //获取选中数据
var url = "/admin/cmsBlog/add.do";
Common.openDlg(url,"CmsBlog管理>新增");
},
edit : function() { //获取选中数目
var data = Common.getOneFromTable(table,"cmsBlogTable");
if(data==null){
return ;
}
var url = "/admin/cmsBlog/edit.do?id="+data.id;
Common.openDlg(url,"CmsBlog管理>"+data.CmsBlog+">编辑");
},
del : function() {
layui.use(['del'], function(){
var delView = layui.del
delView.delBatch();
});
}
};
$('.ext-toolbar').on('click', function() {
var type = $(this).data('type');
toolbar[type] ? toolbar[type].call(this) : '';
});
}
}
exports('index',view);
});
\ No newline at end of file
...@@ -9,7 +9,7 @@ layui.define([ 'form', 'laydate', 'table','orgApi'], function(exports) { ...@@ -9,7 +9,7 @@ layui.define([ 'form', 'laydate', 'table','orgApi'], function(exports) {
}, },
initSubmit:function(){ initSubmit:function(){
$("#saveOrg").click(function(){ $("#saveOrg").click(function(){
orgApi.addOrg(function(){ orgApi.addOrg($('#addForm'),function(){
Common.info("添加成功"); Common.info("添加成功");
Lib.closeFrame(); Lib.closeFrame();
}); });
......
...@@ -9,11 +9,11 @@ layui.define([ 'form', 'laydate', 'table','orgApi'], function(exports) { ...@@ -9,11 +9,11 @@ layui.define([ 'form', 'laydate', 'table','orgApi'], function(exports) {
}, },
initSubmit:function(){ initSubmit:function(){
$("#saveOrg").click(function(){ $("#saveOrg").click(function(){
orgApi.updateOrg(function(){ orgApi.updateOrg($("#updateForm"),function(){
parent.window.dataReload();
Common.info("更新成功"); Common.info("更新成功");
Lib.closeFrame(); Lib.closeFrame();
}); });
parent.window.dataReload();
}); });
......
...@@ -18,7 +18,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { ...@@ -18,7 +18,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
initTable:function(){ initTable:function(){
userTable = table.render({ userTable = table.render({
elem : '#orgTable', elem : '#orgTable',
height : 'full-280', height : Lib.getTableHeight(2),
method : 'post', method : 'post',
url : Common.CTX + '/admin/org/list.json' //数据接口 url : Common.CTX + '/admin/org/list.json' //数据接口
,page : {"layout":['count','prev', 'page', 'next']} //开启分页 ,page : {"layout":['count','prev', 'page', 'next']} //开启分页
......
/*访问后台的代码*/ /*访问后台的代码*/
layui.define([], function(exports) { layui.define([], function(exports) {
var api={ var api={
updateOrg:function(callback){ updateOrg:function(form,callback){
Lib.submitForm($('#updateForm'),{},callback) Lib.submitForm("/admin/org/update.json",form,{},callback)
}, },
addOrg:function(callback){ addOrg:function(form,callback){
Lib.submitForm($('#addForm'),{},callback) Lib.submitForm("/admin/org/save.json",form,{},callback)
}, },
del:function(ids,callback){ del:function(ids,callback){
Common.post("/admin/org/delete.json",{"ids":ids},function(){ Common.post("/admin/org/delete.json",{"ids":ids},function(){
......
...@@ -6,11 +6,12 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { ...@@ -6,11 +6,12 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
var view ={ var view ={
init:function(orgId){ init:function(orgId){
this.initTable(orgId); this.initTable(orgId);
this.initSearchForm();
this.initClose(); this.initClose();
}, },
initClose:function(){ initClose:function(){
$("#close").click(function(){ $("#close").click(function(){
Lib.closeFrame(); Lib.closeFrame();
}); });
...@@ -21,7 +22,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { ...@@ -21,7 +22,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
height : 'full-180', height : 'full-180',
method : 'post', method : 'post',
url : Common.CTX + '/admin/org/user/list.json?orgId='+orgId //数据接口 url : Common.CTX + '/admin/org/user/list.json?orgId='+orgId //数据接口
,page : {"layout":['count','prev', 'page', 'next']} //开启分页 ,page : Lib.tablePage //开启分页
,limit : 10, ,limit : 10,
cols : [ [ //表头 cols : [ [ //表头
{ {
......
...@@ -18,7 +18,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { ...@@ -18,7 +18,7 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) {
initTable:function(){ initTable:function(){
roleTable = table.render({ roleTable = table.render({
elem : '#roleTable', elem : '#roleTable',
height : 'full-280', height : Lib.getTableHeight(2),
method : 'post', method : 'post',
url : Common.CTX + '/admin/role/list.json' //数据接口 url : Common.CTX + '/admin/role/list.json' //数据接口
,page : Lib.tablePage //开启分页 ,page : Lib.tablePage //开启分页
......
...@@ -9,8 +9,8 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) { ...@@ -9,8 +9,8 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) {
init:function(roleId){ init:function(roleId){
this.initFunctionTree(); this.initFunctionTree();
this.initRoles();
this.initSaveFunction(); this.initSaveFunction();
}, },
initFunctionTree:function(){ initFunctionTree:function(){
var that = this; var that = this;
...@@ -18,8 +18,10 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) { ...@@ -18,8 +18,10 @@ layui.define([ 'form', 'laydate', 'table','roleApi'], function(exports) {
var zNodes = response.data; var zNodes = response.data;
var setting = {"check":{"radioType":true,"enable":true}}; var setting = {"check":{"radioType":true,"enable":true}};
zTreeObj = $.fn.zTree.init($("#functionTree"), setting, zNodes); zTreeObj = $.fn.zTree.init($("#functionTree"), setting, zNodes);
//功能树加载完毕后在初始化其他控件
that.initFirstRole(); that.initFirstRole();
that.initRoles();
}) })
}, },
initSaveFunction:function(){ initSaveFunction:function(){
......
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/org/"}){ --> <!--# layout("/common/layout.html",{"jsBase":"/js/admin/org/"}){ -->
<form class="layui-form layui-form-pane" id="addForm" action="/admin/org/save.json"> <form class="layui-form layui-form-pane" id="addForm" >
<div class="layui-row"> <div class="layui-row">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">机构名</label> <label class="layui-form-label">机构名</label>
......
<!--# layout("/common/layout.html",{"jsBase":"/js/admin/org/"}){ --> <!--# layout("/common/layout.html",{"jsBase":"/js/admin/org/"}){ -->
<form class="layui-form layui-form-pane" id="updateForm" action="/admin/org/update.json"> <form class="layui-form layui-form-pane" id="updateForm" >
<div class="layui-row"> <div class="layui-row">
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">机构名</label> <label class="layui-form-label">机构名</label>
......
Supports Markdown
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