|
|
@@ -0,0 +1,335 @@ |
|
|
|
var selectedRow; |
|
|
|
var refreshGirdData; |
|
|
|
var bootstrap = function ($, learun) { |
|
|
|
"use strict"; |
|
|
|
var companyId = ''; |
|
|
|
var departmentId = ''; |
|
|
|
|
|
|
|
var page = { |
|
|
|
init: function () { |
|
|
|
page.inittree(); |
|
|
|
page.initGrid(); |
|
|
|
page.bind(); |
|
|
|
}, |
|
|
|
bind: function () { |
|
|
|
// 查询 |
|
|
|
$('#btn_Search').on('click', function () { |
|
|
|
var keyword = $('#txt_Keyword').val(); |
|
|
|
page.search({ keyword: keyword }); |
|
|
|
}); |
|
|
|
// 系选择 |
|
|
|
$('#department_select').lrselect({ |
|
|
|
value: "deptno", |
|
|
|
text: "deptname", |
|
|
|
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo', |
|
|
|
placeholder: '请选择系', |
|
|
|
// 是否允许搜索 |
|
|
|
allowSearch: true, |
|
|
|
select: function (item) { |
|
|
|
if (!item || item.value == '-1') { |
|
|
|
departmentId = ''; |
|
|
|
} |
|
|
|
else { |
|
|
|
departmentId = item.deptno; |
|
|
|
} |
|
|
|
page.search(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// 刷新 |
|
|
|
$('#lr_refresh').on('click', function () { |
|
|
|
location.reload(); |
|
|
|
}); |
|
|
|
//// 新增 |
|
|
|
//$('#lr_add').on('click', function () { |
|
|
|
// if (!companyId) { |
|
|
|
// learun.alert.warning('请选择公司!'); |
|
|
|
// return false; |
|
|
|
// } |
|
|
|
// selectedRow = null; |
|
|
|
// learun.layerForm({ |
|
|
|
// id: 'form', |
|
|
|
// title: '添加账号', |
|
|
|
// url: top.$.rootUrl + '/LR_OrganizationModule/User/Form?companyId=' + companyId, |
|
|
|
// width: 750, |
|
|
|
// height: 450, |
|
|
|
// callBack: function (id) { |
|
|
|
// return top[id].acceptClick(refreshGirdData); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
//}); |
|
|
|
//// 编辑 |
|
|
|
//$('#lr_edit').on('click', function () { |
|
|
|
// var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
// selectedRow = $('#gridtable').jfGridGet('rowdata')[0]; |
|
|
|
// if (learun.checkrow(keyValue)) { |
|
|
|
// if (keyValue.indexOf(',') != -1) { |
|
|
|
// learun.alert.warning('只能选择一条数据!'); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// learun.layerForm({ |
|
|
|
// id: 'form', |
|
|
|
// title: '编辑账号', |
|
|
|
// url: top.$.rootUrl + '/LR_OrganizationModule/User/Form?companyId=' + companyId, |
|
|
|
// width: 750, |
|
|
|
// height: 450, |
|
|
|
// callBack: function (id) { |
|
|
|
// return top[id].acceptClick(refreshGirdData); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
//}); |
|
|
|
// 删除 |
|
|
|
$('#lr_delete').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
learun.layerConfirm('是否确认删除该项!', function (res) { |
|
|
|
if (res) { |
|
|
|
learun.deleteForm(top.$.rootUrl + '/LR_OrganizationModule/User/DeleteForm', { keyValue: keyValue }, function () { |
|
|
|
refreshGirdData(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 用户数据导出 |
|
|
|
$('#lr_export').on('click', function () { |
|
|
|
location.href = top.$.rootUrl + "/LR_OrganizationModule/User/ExportUserListOfFamily"; |
|
|
|
}); |
|
|
|
// 启用 |
|
|
|
$('#lr_enabled').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
if (keyValue.indexOf(',') != -1) { |
|
|
|
learun.alert.warning('只能选择一条数据!'); |
|
|
|
return; |
|
|
|
} |
|
|
|
learun.layerConfirm('是否确认要【启用】账号!', function (res) { |
|
|
|
if (res) { |
|
|
|
learun.postForm(top.$.rootUrl + '/LR_OrganizationModule/User/UpdateState', { keyValue: keyValue, state: 1 }, function () { |
|
|
|
refreshGirdData(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 禁用 |
|
|
|
$('#lr_disabled').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
if (keyValue.indexOf(',') != -1) { |
|
|
|
learun.alert.warning('只能选择一条数据!'); |
|
|
|
return; |
|
|
|
} |
|
|
|
learun.layerConfirm('是否确认要【禁用】账号!', function (res) { |
|
|
|
if (res) { |
|
|
|
learun.postForm(top.$.rootUrl + '/LR_OrganizationModule/User/UpdateState', { keyValue: keyValue, state: 0 }, function () { |
|
|
|
refreshGirdData(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 重置账号 |
|
|
|
$('#lr_resetpassword').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
learun.layerConfirm('是否确认要【重置密码】!', function (res) { |
|
|
|
if (res) { |
|
|
|
learun.postForm(top.$.rootUrl + '/LR_OrganizationModule/User/ResetPassword', { keyValue: keyValue }, function () { |
|
|
|
refreshGirdData(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 重置密码(八位) |
|
|
|
$('#lr_resetpasswordeight').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
learun.layerConfirm('是否确认要【重置密码(八位)】!', function (res) { |
|
|
|
if (res) { |
|
|
|
learun.postForm(top.$.rootUrl + '/LR_OrganizationModule/User/ResetPasswordEight', { keyValue: keyValue }, function () { |
|
|
|
refreshGirdData(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 功能授权 |
|
|
|
$('#lr_authorize').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
selectedRow = $('#gridtable').jfGridGet('rowdata')[0]; |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
if (keyValue.indexOf(',') != -1) { |
|
|
|
learun.alert.warning('只能选择一条数据!'); |
|
|
|
return; |
|
|
|
} |
|
|
|
learun.layerForm({ |
|
|
|
id: 'authorizeForm', |
|
|
|
title: '功能授权 - ' + selectedRow.F_RealName, |
|
|
|
url: top.$.rootUrl + '/LR_AuthorizeModule/Authorize/Form?objectId=' + keyValue + '&objectType=2', |
|
|
|
width: 550, |
|
|
|
height: 690, |
|
|
|
btn: null |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 移动功能授权 |
|
|
|
$('#lr_appauthorize').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
selectedRow = $('#gridtable').jfGridGet('rowdata')[0]; |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
if (keyValue.indexOf(',') != -1) { |
|
|
|
learun.alert.warning('只能选择一条数据!'); |
|
|
|
return; |
|
|
|
} |
|
|
|
learun.layerForm({ |
|
|
|
id: 'appAuthorizeForm', |
|
|
|
title: '移动功能授权 - ' + selectedRow.F_RealName, |
|
|
|
url: top.$.rootUrl + '/LR_AuthorizeModule/Authorize/AppForm?objectId=' + keyValue + '&objectType=2', |
|
|
|
width: 550, |
|
|
|
height: 690, |
|
|
|
callBack: function (id) { |
|
|
|
return top[id].acceptClick(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 数据授权 |
|
|
|
$('#lr_dataauthorize').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
selectedRow = $('#gridtable').jfGridGet('rowdata')[0]; |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
if (keyValue.indexOf(',') != -1) { |
|
|
|
learun.alert.warning('只能选择一条数据!'); |
|
|
|
return; |
|
|
|
} |
|
|
|
learun.layerForm({ |
|
|
|
id: 'dataAuthorizeForm', |
|
|
|
title: '数据授权 - ' + selectedRow.F_RealName, |
|
|
|
url: top.$.rootUrl + '/LR_AuthorizeModule/DataAuthorize/Index?objectId=' + keyValue + '&objectType=2', |
|
|
|
width: 1100, |
|
|
|
height: 700, |
|
|
|
maxmin: true, |
|
|
|
btn: null |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
//学生角色批量添加 |
|
|
|
//$("#lr_addRelation").on('click', function () { |
|
|
|
// learun.getForm(top.$.rootUrl + '/LR_OrganizationModule/User/ResetStudentRelation', function () { |
|
|
|
// refreshGirdData(); |
|
|
|
// }); |
|
|
|
|
|
|
|
//}); |
|
|
|
|
|
|
|
// 解绑微信 |
|
|
|
$('#lr_cancelweixinbind').on('click', function () { |
|
|
|
var keyValue = $('#gridtable').jfGridValue('F_UserId'); |
|
|
|
if (learun.checkrow(keyValue)) { |
|
|
|
learun.layerConfirm('是否确认要【解绑微信】!', function (res) { |
|
|
|
if (res) { |
|
|
|
learun.postForm(top.$.rootUrl + '/Home/CancelWeiXinBind', { keyValue: keyValue }, function (data) { |
|
|
|
refreshGirdData(); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$("#lr_closeuser1").on('click', function () { |
|
|
|
learun.alert.success('禁用成功'); |
|
|
|
}) |
|
|
|
$("#lr_closeuser2").on('click', function () { |
|
|
|
learun.alert.success('禁用成功'); |
|
|
|
}) |
|
|
|
$("#lr_closeuser3").on('click', function () { |
|
|
|
learun.alert.success('禁用成功'); |
|
|
|
}) |
|
|
|
}, |
|
|
|
inittree: function () { |
|
|
|
$('#companyTree').lrtree({ |
|
|
|
url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree', |
|
|
|
param: { parentId: '0' }, |
|
|
|
nodeClick: page.treeNodeClick |
|
|
|
}); |
|
|
|
$('#companyTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681'); |
|
|
|
}, |
|
|
|
treeNodeClick: function (item) { |
|
|
|
companyId = item.id; |
|
|
|
$('#titleinfo').text(item.text); |
|
|
|
|
|
|
|
$('#department_select').lrselectRefresh({ |
|
|
|
// 访问数据接口地址 |
|
|
|
url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo' |
|
|
|
}); |
|
|
|
departmentId = ''; |
|
|
|
page.search(); |
|
|
|
}, |
|
|
|
initGrid: function () { |
|
|
|
$('#gridtable').lrAuthorizeJfGrid({ |
|
|
|
url: top.$.rootUrl + '/LR_OrganizationModule/User/GetPageList', |
|
|
|
headData: [ |
|
|
|
{ label: '账户', name: 'F_Account', width: 100, align: 'left' }, |
|
|
|
{ label: '姓名', name: 'F_RealName', width: 160, align: 'left' }, |
|
|
|
{ label: '手机', name: 'F_Mobile', width: 100, align: 'center' }, |
|
|
|
{ |
|
|
|
label: '系部', name: 'F_DepartmentId', width: 100, align: 'left', |
|
|
|
formatterAsync: function (callback, value, row, op, $cell) { |
|
|
|
learun.clientdata.getAsync('custmerData', { |
|
|
|
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', |
|
|
|
key: value, |
|
|
|
keyId: 'deptno', |
|
|
|
callback: function (_data) { |
|
|
|
callback(_data['deptname']); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "状态", name: "F_EnabledMark", index: "F_EnabledMark", width: 50, align: "center", |
|
|
|
formatter: function (cellvalue) { |
|
|
|
if (cellvalue == 1) { |
|
|
|
return '<span class=\"label label-success\" style=\"cursor: pointer;\">正常</span>'; |
|
|
|
} else if (cellvalue == 0) { |
|
|
|
return '<span class=\"label label-default\" style=\"cursor: pointer;\">禁用</span>'; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: "最后登录时间", name: "F_UserId_Log", width: 200, align: "left", formatterAsync: function (callback, value, row) { |
|
|
|
learun.httpAsyncGet(top.$.rootUrl + '/LR_OrganizationModule/User/GetLastLoginTime?userId=' + value, function (res) { |
|
|
|
if (res.code == learun.httpCode.success) { |
|
|
|
callback(res.data); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ label: "备注", name: "F_Description", index: "F_Description", width: 200, align: "left" } |
|
|
|
|
|
|
|
], |
|
|
|
isPage: true, |
|
|
|
reloadSelected: true, |
|
|
|
mainId: 'F_UserId', |
|
|
|
isMultiselect: true |
|
|
|
}); |
|
|
|
}, |
|
|
|
search: function (param) { |
|
|
|
param = param || {}; |
|
|
|
param.companyId = companyId; |
|
|
|
param.departmentId = departmentId; |
|
|
|
param.tp = "1"; |
|
|
|
$('#gridtable').jfGridSet('reload', param); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
refreshGirdData = function () { |
|
|
|
var keyword = $('#txt_Keyword').val(); |
|
|
|
page.search({ keyword: keyword }); |
|
|
|
}; |
|
|
|
|
|
|
|
page.init(); |
|
|
|
} |
|
|
|
|
|
|
|
|