Authored by wangtao

用户资源授权优化,去掉确定按钮。

... ... @@ -1101,7 +1101,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
type: 1,
area: ['90%', '80%'],
resize: false,
btn: ['确定', '取消'],
// btn: ['确定', '取消'],
btn: ['确定'],
content: laytpl($('#userResourceAuthorization').html()).render(JSON.stringify({})),
success: function (index, layero) {
renderResAuthByUser(usernames[0])
... ... @@ -1118,30 +1119,30 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
},
yes: function (index, layero) {
//获取表格中的数据
var $showTypeSelect = $('#res_user_table').next().find('.user_showType');
var resIds = "";
$.each($showTypeSelect, function (i, v) {
var redis = $(this).attr("data-resId");
var showType = $(this).val();
var username = $(this).attr("data-username");
resIds += (username + '##' + redis + '##' + showType + ',');
});
if (resIds.length > 0) {
resIds[resIds.length - 1] = resIds[resIds.length - 1].substring(0, resIds[resIds.length - 1].length - 1);
}
//保存数据到资源用户表中
admin.req({
url: common.domainName + '/api-web/sysUserToResType/resourceSave'
, data: {
ids: resIds
}
}).done(function (res) {
if (res.success) {
layer.msg('保存成功!', {icon: 1, time: 3000});
} else {
layer.msg('保存失败!', {icon: 7, time: 3000});
}
});
// var $showTypeSelect = $('#res_user_table').next().find('.user_showType');
// var resIds = "";
// $.each($showTypeSelect, function (i, v) {
// var redis = $(this).attr("data-resId");
// var showType = $(this).val();
// var username = $(this).attr("data-username");
// resIds += (username + '##' + redis + '##' + showType + ',');
// });
// if (resIds.length > 0) {
// resIds[resIds.length - 1] = resIds[resIds.length - 1].substring(0, resIds[resIds.length - 1].length - 1);
// }
// //保存数据到资源用户表中
// admin.req({
// url: common.domainName + '/api-web/sysUserToResType/resourceSave'
// , data: {
// ids: resIds
// }
// }).done(function (res) {
// if (res.success) {
// layer.msg('保存成功!', {icon: 1, time: 3000});
// } else {
// layer.msg('保存失败!', {icon: 7, time: 3000});
// }
// });
layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
... ...