mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-17 01:46:30 +08:00
修复datagrid高度问题
发布新的初始数据,主要是前端模块化后统一了add()/edit()/del()等函数名称
This commit is contained in:
parent
40ffa5f1e8
commit
2c521e3244
@ -76,7 +76,7 @@ function DialogList() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
@ -67,7 +67,7 @@ function MainGrid() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
@ -117,7 +117,7 @@ var thisDlg = function () {
|
|||||||
paging: false,
|
paging: false,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var getSelectDatas = function () {
|
var getSelectDatas = function () {
|
||||||
|
@ -90,7 +90,7 @@ function MainGrid() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
@ -64,7 +64,7 @@ function MainGrid() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
@ -54,7 +54,7 @@ function MainGrid() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
@ -46,7 +46,7 @@ function MainGrid() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||||
var ids = list.getSelectedProperties('Id');
|
var ids = roleMenuList.getSelectedProperties('Id');
|
||||||
if (ids == null) return;
|
if (ids == null) return;
|
||||||
|
|
||||||
$.post("/ModuleElementManager/AssignForRole",
|
$.post("/ModuleElementManager/AssignForRole",
|
||||||
@ -23,18 +23,18 @@ $(document).ready(function () {
|
|||||||
RoleId: $('#roleId').val(),
|
RoleId: $('#roleId').val(),
|
||||||
menuIds: ids,
|
menuIds: ids,
|
||||||
}, function (json) {
|
}, function (json) {
|
||||||
list.reload();
|
roleMenuList.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
||||||
var ids = list.getSelectedProperties('Id');
|
var ids = roleMenuList.getSelectedProperties('Id');
|
||||||
if (ids == null) return;
|
if (ids == null) return;
|
||||||
|
|
||||||
$.post("/ModuleElementManager/CancelForRole",{
|
$.post("/ModuleElementManager/CancelForRole",{
|
||||||
RoleId: $('#roleId').val(),
|
RoleId: $('#roleId').val(),
|
||||||
menuIds: ids,
|
menuIds: ids,
|
||||||
}, function (json) {
|
}, function (json) {
|
||||||
list.reload();
|
roleMenuList.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -77,8 +77,7 @@ function RoleMEGrid() {
|
|||||||
showCheckboxcol: true,
|
showCheckboxcol: true,
|
||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function(id) {
|
this.reload = function(id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
@ -86,7 +85,7 @@ function RoleMEGrid() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
RoleMEGrid.prototype = new Grid();
|
RoleMEGrid.prototype = new Grid();
|
||||||
var list = new RoleMEGrid();
|
var roleMenuList = new RoleMEGrid();
|
||||||
|
|
||||||
var ztree = function () {
|
var ztree = function () {
|
||||||
var setting = {
|
var setting = {
|
||||||
@ -111,6 +110,6 @@ var ztree = function () {
|
|||||||
});
|
});
|
||||||
}();
|
}();
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
list.reload(treeNode.Id);
|
roleMenuList.reload(treeNode.Id);
|
||||||
}
|
}
|
||||||
//@@ sourceURL=RoleModuleElement.js
|
//@@ sourceURL=RoleModuleElement.js
|
||||||
|
252
OpenAuth.Mvc/BllScripts/stockManager.js
Normal file
252
OpenAuth.Mvc/BllScripts/stockManager.js
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
|
||||||
|
//grid列表模块
|
||||||
|
function MainGrid() {
|
||||||
|
var url = '/StockManager/Load?parentId=';
|
||||||
|
var selectedId = 0; //ztree选中的模块
|
||||||
|
this.maingrid = $('#maingrid').datagrid({
|
||||||
|
showToolbar: false,
|
||||||
|
filterThead: false,
|
||||||
|
target: $(this),
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
name: 'Id',
|
||||||
|
label: '数据ID',
|
||||||
|
width: 100
|
||||||
|
, hide: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Name',
|
||||||
|
label: '产品名称',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Number',
|
||||||
|
label: '产品数量',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Price',
|
||||||
|
label: '产品单价',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Status',
|
||||||
|
label: '出库/入库',
|
||||||
|
width: 100
|
||||||
|
, align: 'center',
|
||||||
|
items: [{ '0': '出库' }, { '1': '入库' }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'User',
|
||||||
|
label: '操作人',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Time',
|
||||||
|
label: '操作时间',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'OrgId',
|
||||||
|
label: '组织ID',
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
],
|
||||||
|
dataUrl: url + selectedId,
|
||||||
|
fullGrid: true,
|
||||||
|
showLinenumber: true,
|
||||||
|
showCheckboxcol: true,
|
||||||
|
paging: true,
|
||||||
|
filterMult: false,
|
||||||
|
showTfoot: false,
|
||||||
|
|
||||||
|
});
|
||||||
|
this.reload = function (id) {
|
||||||
|
if (id != undefined) selectedId = id;
|
||||||
|
this.maingrid.datagrid('reload', { dataUrl: url + selectedId });
|
||||||
|
};
|
||||||
|
};
|
||||||
|
MainGrid.prototype = new Grid();
|
||||||
|
var list = new MainGrid();
|
||||||
|
|
||||||
|
//左边分类导航树
|
||||||
|
var ztree = function () {
|
||||||
|
var url = '/OrgManager/LoadOrg';
|
||||||
|
var setting = {
|
||||||
|
view: { selectedMulti: false },
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: { onClick: zTreeOnClick }
|
||||||
|
};
|
||||||
|
$.getJSON(url, function (json) {
|
||||||
|
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||||
|
});
|
||||||
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
|
list.reload(treeNode.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
reload: function () {
|
||||||
|
$.getJSON(url, function (json) {
|
||||||
|
$.fn.zTree.init($("#tree"), setting, json).expandAll(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
//编辑时,选择上级弹出的树
|
||||||
|
var parentTree = function () {
|
||||||
|
var nameDom = "#ParentName";
|
||||||
|
var idDom = "#OrgId";
|
||||||
|
var zTreeObj;
|
||||||
|
var setting = {
|
||||||
|
view: {
|
||||||
|
selectedMulti: false
|
||||||
|
},
|
||||||
|
check: {
|
||||||
|
enable: true,
|
||||||
|
chkStyle: "radio", //单选
|
||||||
|
radioType: "all"
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
key: {
|
||||||
|
name: 'Name',
|
||||||
|
title: 'Name'
|
||||||
|
},
|
||||||
|
simpleData: {
|
||||||
|
enable: true,
|
||||||
|
idKey: 'Id',
|
||||||
|
pIdKey: 'ParentId',
|
||||||
|
rootPId: 'null'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
callback: {
|
||||||
|
onClick: zTreeOnClick,
|
||||||
|
onCheck: zTreeCheck
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function zTreeCheck(event, treeId, treeNode) {
|
||||||
|
var nodes = zTreeObj.getCheckedNodes(true);
|
||||||
|
var ids = nodes.map(function (e) { return e.Id; }).join(",");
|
||||||
|
var names = nodes.map(function (e) { return e.Name; }).join(",");
|
||||||
|
|
||||||
|
$(nameDom).val(names);
|
||||||
|
$(idDom).val(ids);
|
||||||
|
}
|
||||||
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
|
zTreeObj.checkNode(treeNode, !treeNode.checked, true, true);
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
show: function () {
|
||||||
|
$.getJSON('/OrgManager/LoadForTree', function (json) {
|
||||||
|
zTreeObj = $.fn.zTree.init($('#j_select_tree1'), setting, json);
|
||||||
|
var orgstr = $(idDom).val();
|
||||||
|
var name = '';
|
||||||
|
if (orgstr != '') {
|
||||||
|
var nodeIds = orgstr.split(',');
|
||||||
|
$.each(nodeIds, function () {
|
||||||
|
var node = zTreeObj.getNodeByParam("Id", this, null);
|
||||||
|
name += ',' + node.Name;
|
||||||
|
zTreeObj.checkNode(node, true, true);
|
||||||
|
});
|
||||||
|
$(nameDom).val(name.substr(1)); //显示名称
|
||||||
|
}
|
||||||
|
zTreeObj.expandAll(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
|
||||||
|
//添加(编辑)对话框
|
||||||
|
var editDlg = function () {
|
||||||
|
var update = false;
|
||||||
|
var show = function () {
|
||||||
|
BJUI.dialog({ id: 'editDlg', title: '编辑对话框', target: '#editDlg' });
|
||||||
|
$("#btnSave").on("click", function () {
|
||||||
|
editDlg.save();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
add: function () { //弹出添加
|
||||||
|
update = false;
|
||||||
|
show();
|
||||||
|
$.CurrentDialog.find("form")[0].reset(); //reset方法只能通过dom调用
|
||||||
|
$("#Id").val(0);
|
||||||
|
parentTree.show();
|
||||||
|
},
|
||||||
|
update: function (ret) { //弹出编辑框
|
||||||
|
update = true;
|
||||||
|
show();
|
||||||
|
$('#Id').val(ret.Id);
|
||||||
|
$('#Name').val(ret.Name);
|
||||||
|
$('#Number').selectpicker('val', ret.Number);
|
||||||
|
$('#Price').val(ret.Price);
|
||||||
|
$('#Status').selectpicker('val', ret.Status);
|
||||||
|
$('#User').val(ret.User);
|
||||||
|
$('#Time').val(ret.Time);
|
||||||
|
$('#OrgId').val(ret.OrgId);
|
||||||
|
parentTree.show();
|
||||||
|
},
|
||||||
|
save: function () { //编辑-->保存
|
||||||
|
$('#editForm').isValid(function (v) {
|
||||||
|
if (!v) return; //验证没通过
|
||||||
|
$("#editForm").bjuiajax('ajaxForm', {
|
||||||
|
reload: false,
|
||||||
|
callback: function (json) {
|
||||||
|
list.reload();
|
||||||
|
ztree.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}();
|
||||||
|
|
||||||
|
//删除
|
||||||
|
function del() {
|
||||||
|
var selected = list.getSelectedObj();
|
||||||
|
if (selected == null) return;
|
||||||
|
|
||||||
|
$.getJSON('/StockManager/Delete?Id=' + selected.Id, function (data) {
|
||||||
|
if (data.statusCode == "200") {
|
||||||
|
list.reload();
|
||||||
|
ztree.reload();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(this).alertmsg('warn', data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//自定义的编辑按钮
|
||||||
|
function edit() {
|
||||||
|
var selected = list.getSelectedObj();
|
||||||
|
if (selected == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
editDlg.update(selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
function add() {
|
||||||
|
editDlg.add();
|
||||||
|
}
|
||||||
|
|
||||||
|
function refresh() {
|
||||||
|
list.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
//@@ sourceURL=StockManager.js
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
$.CurrentDialog.find("#btnAccess").on("click", function () {
|
||||||
var ids = list.getSelectedProperties('Id');
|
var ids = userMenuList.getSelectedProperties('Id');
|
||||||
if (ids == null) return;
|
if (ids == null) return;
|
||||||
|
|
||||||
$.post("/ModuleElementManager/AssignForUser",
|
$.post("/ModuleElementManager/AssignForUser",
|
||||||
@ -23,18 +23,18 @@ $(document).ready(function () {
|
|||||||
userId: $('#userId').val(),
|
userId: $('#userId').val(),
|
||||||
menuIds: ids,
|
menuIds: ids,
|
||||||
}, function (json) {
|
}, function (json) {
|
||||||
list.reload();
|
userMenuList.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
$.CurrentDialog.find("#btnDelAccess").on("click", function () {
|
||||||
var ids = list.getSelectedProperties('Id');
|
var ids = userMenuList.getSelectedProperties('Id');
|
||||||
if (ids == null) return;
|
if (ids == null) return;
|
||||||
|
|
||||||
$.post("/ModuleElementManager/CancelForUser",{
|
$.post("/ModuleElementManager/CancelForUser",{
|
||||||
userId: $('#userId').val(),
|
userId: $('#userId').val(),
|
||||||
menuIds: ids,
|
menuIds: ids,
|
||||||
}, function (json) {
|
}, function (json) {
|
||||||
list.reload();
|
userMenuList.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -78,7 +78,7 @@ function UserMEGrid() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function(id) {
|
this.reload = function(id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
@ -86,7 +86,7 @@ function UserMEGrid() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
UserMEGrid.prototype = new Grid();
|
UserMEGrid.prototype = new Grid();
|
||||||
var list = new UserMEGrid();
|
var userMenuList = new UserMEGrid();
|
||||||
|
|
||||||
var ztree = function () {
|
var ztree = function () {
|
||||||
var setting = {
|
var setting = {
|
||||||
@ -111,6 +111,6 @@ var ztree = function () {
|
|||||||
});
|
});
|
||||||
}();
|
}();
|
||||||
function zTreeOnClick(event, treeId, treeNode) {
|
function zTreeOnClick(event, treeId, treeNode) {
|
||||||
list.reload(treeNode.Id);
|
userMenuList.reload(treeNode.Id);
|
||||||
}
|
}
|
||||||
//@@ sourceURL=userModuleElement.js
|
//@@ sourceURL=userModuleElement.js
|
||||||
|
@ -77,7 +77,7 @@ function UserRolesList() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
@ -54,7 +54,7 @@ function MainGrid() {
|
|||||||
paging: true,
|
paging: true,
|
||||||
filterMult: false,
|
filterMult: false,
|
||||||
showTfoot: false,
|
showTfoot: false,
|
||||||
height: '100%'
|
|
||||||
});
|
});
|
||||||
this.reload = function (id) {
|
this.reload = function (id) {
|
||||||
if (id != undefined) selectedId = id;
|
if (id != undefined) selectedId = id;
|
||||||
|
BIN
建表&初始化数据.sql
BIN
建表&初始化数据.sql
Binary file not shown.
Loading…
Reference in New Issue
Block a user