Commit 2b41339e authored by xingyue400's avatar xingyue400
Browse files

更新 index.js

parent c74daf33
layui.define([ 'form', 'laydate', 'table' ], function(exports) { layui.define(['form', 'laydate', 'table', 'treeGrid'], function (exports) {
var form = layui.form; var form = layui.form;
var laydate = layui.laydate; var laydate = layui.laydate;
var table = layui.table; // var table = layui.table;
var userTable = null; var treeGrid = layui.treeGrid;
var view ={ var userTable = null;
init:function(){ var view = {
this.initTable();
this.initSearchForm(); init: function () {
this.initToolBar(); this.initTable();
window.dataReload = function(){ this.initSearchForm();
Lib.doSearchForm($("#orgSearchForm"),userTable) this.initToolBar();
} window.dataReload = function () {
Lib.doSearchForm($("#orgSearchForm"), userTable)
}
},
initTable:function(){
userTable = table.render({ },
elem : '#orgTable', initTable: function () {
height : Lib.getTableHeight(2), userTable = treeGrid.render({
method : 'post', elem: '#orgTable',
url : Common.ctxPath + '/admin/org/list.json' //数据接口 height : Lib.getTableHeight(4),
,page : {"layout":['count','prev', 'page', 'next']} //开启分页 url: Common.ctxPath + '/admin/org/list.json',
,limit : 10, method: 'post',
cols : [ [ //表头 cellMinWidth: 100,
{ treeId: 'id',//树形id字段名称
type : 'checkbox', treeUpId: 'parentOrgId',//树形父id字段名称
fixed:'left', treeShowName: 'name',//以树形式显示的字段
}, { cols: [[ //表头
field : 'id', // {type: 'numbers', title: '序号', fixed: 'left'},
title : 'id', {type: 'numbers', title: '序号'},
width : 80,
fixed:'left', {
sort : true type: 'checkbox',
}, { // fixed: 'left'
field : 'code', // fixed: 'left'
title : '机构代码', },
width : 150 {
}, { field: 'name',
field : 'name', title: '机构名称',
title : '机构名称', width: 500
width : 120, },
sort : true {
}, { field: 'typeText',
field : 'parentOrgText', title: '机构类型',
title : '上一级机构', width: 120,
width : 150, align: 'center'
sort : true },
}, {
{ field: 'createTime',
field : 'typeText', title: '创建时间',
title : '机构类型', width: 120,
width : 120, align: 'center',
sort : true templet: function (d) {
}, return Common.getDate(d.createTime);
{ }
field : 'createTime', }, {
title : '创建时间', field: 'id',
width : 120, title: 'id',
templet:function(d){ width: 50,
return Common.getDate(d.createTime); align: 'center'
}, }
sort : true
} ]],
done: function (res, curr, count) {
] ] $("[data-field='id']").css('display', 'none');
},
}); page: false
}, });
initSearchForm:function(){
Lib.initSearchForm( $("#orgSearchForm"),userTable,form);
},
initToolBar:function(){
toolbar = { },
add : function() { //获取选中数据
var url = "/admin/org/add.do"; initSearchForm: function () {
Common.openDlg(url,"用户管理>新增"); Lib.initSearchForm($("#orgSearchForm"), userTable, form);
}, },
edit : function() { //获取选中数目 initToolBar: function () {
var data = Common.getOneFromTable(table,"orgTable"); toolbar = {
if(data==null){ add: function () { //获取选中数据
return ; var url = "/admin/org/add.do";
} Common.openDlg(url, "用户管理>新增");
var url = "/admin/org/edit.do?id="+data.id; },
Common.openDlg(url,"用户管理>编辑"); edit: function () { //获取选中数目
}, var data = Common.getOneFromTable(treeGrid, "orgTable");
del : function() { if (data == null) {
layui.use(['del'], function(){ return;
var delView = layui.del }
delView.delBatch(); var url = "/admin/org/edit.do?id=" + data.id;
}); Common.openDlg(url, "用户管理>编辑");
},
orgUser : function() { },
var data = Common.getOneFromTable(table,"orgTable"); del: function () {
if(data==null){ layui.use(['del'], function () {
return ; var delView = layui.del;
} delView.delBatch();
var url = "/admin/org/user/list.do?orgId="+data.id; });
Common.openDlg(url,"组织管理>用户列表"); },
orgUser: function () {
} var data = Common.getOneFromTable(treeGrid, "orgTable");
if (data == null) {
}; return;
$('.ext-toolbar').on('click', function() { }
var type = $(this).data('type'); var url = "/admin/org/user/list.do?orgId=" + data.id;
toolbar[type] ? toolbar[type].call(this) : ''; Common.openDlg(url, "组织管理>用户列表");
});
} }
}
};
exports('index',view); $('.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
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