136 lines
4.9 KiB
JavaScript
136 lines
4.9 KiB
JavaScript
(function(){
|
|
X.pageLogic['useradmin'] = {
|
|
init : function(){
|
|
var me = this;
|
|
$(document).on("click",".useradmin-top-box .useradmin-tab-box .useradmin-tab",function(){
|
|
$(".useradmin-top-box .useradmin-tab-box .useradmin-tab").removeClass('useradmin-tab-click');
|
|
$(this).addClass("useradmin-tab-click");
|
|
var htmlval = $(this).html();
|
|
if(htmlval.length == 17){
|
|
$(".useradmin-btn").show();
|
|
$(".useradmin-info").show();
|
|
$(".useradmin-group").hide();
|
|
|
|
}else {
|
|
$(".useradmin-btn").hide();
|
|
$(".useradmin-info").hide();
|
|
$(".useradmin-group").show();
|
|
|
|
}
|
|
})
|
|
|
|
$(".useradmin-ss-box input").focus(function(){
|
|
$(".useradmin-ss-box").css("border",'1px solid #4fa1ff');
|
|
$(".useradmin-ss-box").css("box-shadow",'0 0 4px rgba(61,144,255,0.45)');
|
|
});
|
|
|
|
$(".useradmin-ss-box input").blur(function(){
|
|
$(".useradmin-ss-box").css("border",'1px solid #f0f0f0');
|
|
$(".useradmin-ss-box").css("box-shadow",'none');
|
|
});
|
|
|
|
me.useradmin();
|
|
|
|
$(".useradmin-info").click(function(){
|
|
X.open({
|
|
type: 1,
|
|
title: false,
|
|
closeBtn: 0,
|
|
shadeClose: true,
|
|
skin: 'yourclass',
|
|
url: 'adduser'
|
|
})
|
|
})
|
|
|
|
$(".addexistuser").click(function(){
|
|
X.open({
|
|
type: 1,
|
|
title: false,
|
|
closeBtn: 0,
|
|
shadeClose: true,
|
|
skin: 'yourclass',
|
|
url: 'addexistuser'
|
|
})
|
|
})
|
|
|
|
$(".importuser").click(function(){
|
|
X.open({
|
|
type: 1,
|
|
title: false,
|
|
closeBtn: 0,
|
|
shadeClose: true,
|
|
skin: 'yourclass',
|
|
url: 'importuser'
|
|
})
|
|
})
|
|
|
|
$(".useradmin-group").click(function(){
|
|
X.open({
|
|
type: 1,
|
|
title: false,
|
|
closeBtn: 0,
|
|
shadeClose: true,
|
|
skin: 'yourclass',
|
|
url: 'addusergroup'
|
|
})
|
|
})
|
|
|
|
layui.table.on('tool(test)', function(obj){
|
|
var data = obj.data;
|
|
console.log(obj);
|
|
if(obj.event === "edit"){
|
|
// 编辑
|
|
X.open({
|
|
type: 1,
|
|
title: false,
|
|
closeBtn: 0,
|
|
shadeClose: true,
|
|
skin: 'yourclass',
|
|
url: 'useradminedit'
|
|
})
|
|
}else if(obj.event == "password"){
|
|
//重置密码
|
|
X.parametersopen(data,"updatepas",'auto',function(){
|
|
me.useradmin()
|
|
})
|
|
}else if(obj.event == "del"){
|
|
// 删除
|
|
// X.parametersopen(data,"deluserinfo",'auto',function(){
|
|
// me.useradmin()
|
|
// })
|
|
|
|
layer.confirm('确认删除吗?该操作不可恢复', {
|
|
btn: ['取消','删除 '] //按钮
|
|
}, function(){
|
|
//取消
|
|
layer.close(layer.index);
|
|
}, function(){
|
|
//删除
|
|
X.api("authz/del_role_user_domain",'post',{username:data.name,role_id:data.role_id,game:X.DATA['game']},function(d){
|
|
layer.msg('删除成功');
|
|
layer.close(layer.index);
|
|
me.useradmin();
|
|
// X.pageLogic.dashboard.freshMenu(X.DATA.projectid);//刷新侧边栏
|
|
// me.updata(X.DATA.projectid);//刷新数据
|
|
})
|
|
});
|
|
}
|
|
})
|
|
|
|
},
|
|
useradmin : function(id){
|
|
X.tabledata('#userdata','project/members',[[
|
|
{field:'name', width:180, title: '成员账号', sort: true}
|
|
,{field:'nickname', width:180, title: '成员显示名'}
|
|
,{field:'role', width:180, title: '项目角色', sort: true}
|
|
,{field:'data_auth', width:180, title: '数据权限'}
|
|
,{field:'sign', title: '所属成员组', width: 180}
|
|
,{field:'last_login_ts', title: '最后访问时间', sort: true}
|
|
,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:80}
|
|
]]);
|
|
|
|
}
|
|
|
|
};
|
|
})();
|