提交 1b10d3ea 编写于 作者: doc_wei's avatar doc_wei

团队模板管理完成

上级 07f2c312
......@@ -13,6 +13,8 @@ layui.config({
form = layui.form;
textool.init({eleId: 'remark', maxlength: 200});
var treeTableData = [];
// 已经选中的权限对应关系
var checkTrueList = [];
skyeyeClassEnumUtil.showEnumDataListByClassName("teamObjectType", 'select', "objectType", '', form);
skyeyeClassEnumUtil.showEnumDataListByClassName("commonEnable", 'radio', "enabled", '', form);
......@@ -88,26 +90,35 @@ layui.config({
function reloadTreeTable() {
var data = $.extend(true, [], treeTableData);
tableTree.reload("messageTable", {data: data});
restCheckbox();
loadAuthList();
}
loadAuthList();
form.on('select(objectType)', function(data) {
checkTrueList = [];
loadAuthList();
});
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
console.log(treeTableData)
if (winui.verifyForm(data.elem)) {
var teamRoleList = getTeamRoleList();
if (teamRoleList.length == 0) {
winui.window.msg('团队成员不能为空', {icon: 2, time: 2000});
return false;
}
var teamObjectPermissionList = getTeamObjectPermissionList();
var params = {
dictName: $("#dictName").val(),
dictCode: $("#dictCode").val(),
name: $("#name").val(),
objectType: $("#objectType").val(),
enabled: $("#enabled input:radio:checked").val(),
remark: $("#remark").val(),
teamRoleList: JSON.stringify(teamRoleList),
teamObjectPermissionList: JSON.stringify(teamObjectPermissionList)
};
AjaxPostUtil.request({url: reqBasePath + "writeDictTypeMation", params: params, type: 'json', method: "POST", callback: function (json) {
AjaxPostUtil.request({url: reqBasePath + "writeTeamTemplate", params: params, type: 'json', method: "POST", callback: function (json) {
parent.layer.close(index);
parent.refreshCode = '0';
}});
......@@ -115,6 +126,50 @@ layui.config({
return false;
});
function getTeamRoleList() {
var teamRoleList = [];
$.each(treeTableData, function (i, item) {
var teamRole = {};
if (item.pId == '0') {
// 角色
teamRole['roleId'] = item.id;
// 查询这个角色下的用户
var roleUserList = [];
$.each(treeTableData, function (j, bean) {
if (bean.pId == item.id) {
roleUserList.push({
userId: bean.id
});
}
});
teamRole['teamRoleUserList'] = roleUserList;
teamRoleList.push(teamRole);
}
});
return teamRoleList;
}
function getTeamObjectPermissionList() {
var checkRow = $("#authList input[type='checkbox']:checked");
var teamObjectPermissionList = [];
$.each(checkRow, function (i, item) {
var id = $(item).attr('id');
var str = id.split('_');
var authGroupKey = str[0];
var authKey = str[1];
var roleId = str[2];
var userId = str[3];
teamObjectPermissionList.push({
permissionKey: authGroupKey,
permissionValue: authKey,
ownerId: isNull(userId) ? roleId : userId,
ownerKey: isNull(userId) ? sysServiceMation["dictData"]["key"] : sysServiceMation["userInfo"]["key"],
fromType: 1
});
});
return teamObjectPermissionList;
}
function loadAuthList() {
var data = $.extend(true, [], treeTableData);
var objectType = $('#objectType').val();
......@@ -130,14 +185,12 @@ layui.config({
});
form.on('checkbox(checkClick)', function(obj) {
// var checkRow = $("#useTable input[type='checkbox'][name='tableCheckRow']:checked");
var id = $(this).attr('id');
var str = id.split('_');
var authGroupKey = str[0];
var authKey = str[1];
var roleId = str[2];
var userId = str[3];
var checkBoxId = authGroupKey + '_' + authKey + '_' + roleId + '_' + userId;
var name = authGroupKey + '_' + authKey + '_' + roleId;
var _table = $(`div[lay-id='${authGroupKey}']`);
if (isNull(userId)) {
......@@ -157,10 +210,21 @@ layui.config({
$(`input[id='${name}_']`).prop("checked", false);
}
}
restCheckbox();
form.render('checkbox');
});
}
function restCheckbox() {
// 将所有选中的重新放入 checkTrueList 中,防止出现操作成员信息时无法回显
var checkRow = $("#authList input[type='checkbox']:checked");
checkTrueList = [];
$.each(checkRow, function (i, item) {
checkTrueList.push($(item).attr('id'));
});
}
function loadAuthTreeTable(id, cols, data) {
tableTree.render({
id: id,
......
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'tableTreeDj', 'form'], function (exports) {
winui.renderColor();
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$,
tableTree = layui.tableTreeDj,
form = layui.form;
var treeTableData = [];
// 已经选中的权限对应关系
var checkTrueList = [];
showGrid({
id: "showForm",
url: reqBasePath + "queryTeamTemplateById",
params: {id: parent.rowId},
pagination: false,
method: "GET",
template: $("#showTemplate").html(),
ajaxSendLoadBefore: function(hdb, json) {
json.bean.enabled = skyeyeClassEnumUtil.getEnumDataNameByClassName('commonEnable', 'id', json.bean.enabled, 'name');
json.bean.objectTypeName = skyeyeClassEnumUtil.getEnumDataNameByClassName('teamObjectType', 'id', json.bean.objectType, 'name');
json.bean.remark = stringManipulation.textAreaShow(json.bean.remark);
},
ajaxSendAfter: function (json) {
loadTreeTable();
// 解析成员信息
$.each(json.bean.teamRoleList, function (i, item) {
treeTableData.push({
id: item.roleId,
pId: '0',
name: item.name
});
$.each(item.teamRoleUserList, function (j, bean) {
treeTableData.push({
id: bean.userId,
pId: item.roleId,
name: bean.userMation.name,
departmentName: bean.userMation.departmentName,
phone: bean.userMation.phone,
email: bean.userMation.email
});
});
});
// 解析权限信息
$.each(json.bean.teamObjectPermissionList, function (i, item) {
var authGroupKey = item.permissionKey;
var authKey = item.permissionValue;
var checkParams = getInPoingArr(treeTableData, "id", item.ownerId);
if (checkParams != null) {
var roleId = checkParams.pId == '0' ? checkParams.id : checkParams.pId;
var userId = checkParams.pId == '0' ? '' : checkParams.id;
var id = authGroupKey + '_' + authKey + '_' + roleId + '_' + userId;
checkTrueList.push(id);
}
});
reloadTreeTable(json.bean.objectType);
matchingLanguage();
form.render();
}
});
function loadTreeTable() {
tableTree.render({
id: 'messageTable',
elem: '#messageTable',
data: [],
// 该参数不能删除,分页参数无效,目前只能通过设置10000来保证当前页最大的数据量
limit: 10000,
cols: [[
{ field: 'name', title: '名称', width: 160 },
{ field: 'departmentName', title: '部门', width: 120 },
{ field: 'phone', title: '联系方式', width: 140 },
{ field: 'email', title: '邮箱', width: 200 }
]],
done: function(json) {
matchingLanguage();
}
}, {
keyId: 'id',
keyPid: 'pId',
title: 'name',
defaultShow: true,
});
}
// 刷新成员树表格
function reloadTreeTable(objectType) {
var data = $.extend(true, [], treeTableData);
tableTree.reload("messageTable", {data: data});
loadAuthList(objectType);
}
function loadAuthList(objectType) {
var data = $.extend(true, [], treeTableData);
// 加载该受用类型的团队可以设置哪些权限
var colsList = teamObjectPermissionUtil.getAuthColsDetails(objectType);
$('#authList').html(getDataUseHandlebars($('#authTableTemplate').html(), {list: colsList}));
$.each(colsList, function (i, item) {
// 给数据设置权限组的key,
$.each(data, function (j, bean) {
bean.authGroupKey = item.id;
});
loadAuthTreeTable(item.id, item.cols, data);
});
$.each(checkTrueList, function (i, id) {
$(`div[id='${id}']`).html(`<i class="fa fa-check" style="color: green"></i>`);
});
}
function loadAuthTreeTable(id, cols, data) {
tableTree.render({
id: id,
elem: '#' + id,
data: data,
// 该参数不能删除,分页参数无效,目前只能通过设置10000来保证当前页最大的数据量
limit: 10000,
cols: [cols],
}, {
keyId: 'id',
keyPid: 'pId',
title: 'name',
defaultShow: true,
});
}
$("body").on("click", "#cancle", function() {
parent.layer.close(index);
});
});
\ No newline at end of file
......@@ -4,83 +4,318 @@ layui.config({
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'textool'], function (exports) {
}).define(['window', 'jquery', 'winui', 'textool', 'tableTreeDj', 'form'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$,
textool = layui.textool;
showGrid({
id: "showForm",
url: reqBasePath + "queryDictTypeMationById",
params: {id: parent.rowId},
pagination: false,
method: "GET",
template: $("#showTemplate").html(),
ajaxSendLoadBefore: function(hdb, json){
json.bean.remark = stringManipulation.textAreaShow(json.bean.remark);
},
ajaxSendAfter: function (json) {
skyeyeClassEnumUtil.showEnumDataListByClassName("commonEnable", 'radio', "enabled", json.bean.enabled, form);
form.on('radio(dictType)', function (data) {
var val = data.value;
if (val == 1) {
$("#chooseLevel").parent().parent().remove();
} else if (val == 2) {
$("#dictTypeBox").after(
`<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">可选层级<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="chooseLevel" name="chooseLevel" win-verify="required|number" placeholder="请输入可选层级" class="layui-input"/>
<div class="layui-form-mid layui-word-aux">例如:多级字典为三级,这里设置为2,那么只有二级和二级的所有子层级可以选择</div>
</div>
</div>`);
}
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$,
textool = layui.textool,
tableTree = layui.tableTreeDj,
form = layui.form;
var treeTableData = [];
// 已经选中的权限对应关系
var checkTrueList = [];
showGrid({
id: "showForm",
url: reqBasePath + "queryTeamTemplateById",
params: {id: parent.rowId},
pagination: false,
method: "GET",
template: $("#showTemplate").html(),
ajaxSendLoadBefore: function(hdb, json) {
json.bean.remark = stringManipulation.textAreaShow(json.bean.remark);
},
ajaxSendAfter: function (json) {
skyeyeClassEnumUtil.showEnumDataListByClassName("teamObjectType", 'select', "objectType", json.bean.objectType, form);
skyeyeClassEnumUtil.showEnumDataListByClassName("commonEnable", 'radio', "enabled", json.bean.enabled, form);
loadTreeTable();
// 解析成员信息
$.each(json.bean.teamRoleList, function (i, item) {
treeTableData.push({
id: item.roleId,
pId: '0',
name: item.name
});
$.each(item.teamRoleUserList, function (j, bean) {
treeTableData.push({
id: bean.userId,
pId: item.roleId,
name: bean.userMation.name,
departmentName: bean.userMation.departmentName,
phone: bean.userMation.phone,
email: bean.userMation.email
});
});
});
if (json.bean.dictType == 2) {
$("#dictTypeBox").after(
`<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">可选层级<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="chooseLevel" name="chooseLevel" win-verify="required|number" placeholder="请输入可选层级" class="layui-input" value="${json.bean.chooseLevel}"/>
<div class="layui-form-mid layui-word-aux">例如:多级字典为三级,这里设置为2,那么只有二级和二级的所有子层级可以选择</div>
</div>
</div>`);
// 解析权限信息
$.each(json.bean.teamObjectPermissionList, function (i, item) {
var authGroupKey = item.permissionKey;
var authKey = item.permissionValue;
var checkParams = getInPoingArr(treeTableData, "id", item.ownerId);
if (checkParams != null) {
var roleId = checkParams.pId == '0' ? checkParams.id : checkParams.pId;
var userId = checkParams.pId == '0' ? '' : checkParams.id;
var id = authGroupKey + '_' + authKey + '_' + roleId + '_' + userId;
checkTrueList.push(id);
}
$("input:radio[name=dictType][value=" + json.bean.dictType + "]").attr("checked", true);
});
textool.init({eleId: 'remark', maxlength: 200});
reloadTreeTable();
textool.init({eleId: 'remark', maxlength: 200});
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var teamRoleList = getTeamRoleList();
if (teamRoleList.length == 0) {
winui.window.msg('团队成员不能为空', {icon: 2, time: 2000});
return false;
}
var teamObjectPermissionList = getTeamObjectPermissionList();
var params = {
id: parent.rowId,
name: $("#name").val(),
objectType: $("#objectType").val(),
enabled: $("#enabled input:radio:checked").val(),
remark: $("#remark").val(),
teamRoleList: JSON.stringify(teamRoleList),
teamObjectPermissionList: JSON.stringify(teamObjectPermissionList)
};
AjaxPostUtil.request({url: reqBasePath + "writeTeamTemplate", params: params, type: 'json', method: "POST", callback: function (json) {
parent.layer.close(index);
parent.refreshCode = '0';
}});
}
return false;
});
}
});
function loadTreeTable() {
tableTree.render({
id: 'messageTable',
elem: '#messageTable',
data: [],
// 该参数不能删除,分页参数无效,目前只能通过设置10000来保证当前页最大的数据量
limit: 10000,
cols: [[
{ field: 'name', title: '名称', width: 160 },
{ field: 'departmentName', title: '部门', width: 120 },
{ field: 'phone', title: '联系方式', width: 140 },
{ field: 'email', title: '邮箱', width: 200 },
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 150, toolbar: '#tableBar' }
]],
done: function(json) {
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var dictType = $("input[name='dictType']:checked").val();
var params = {
id: parent.rowId,
dictName: $("#dictName").val(),
dictCode: $("#dictCode").val(),
enabled: $("#enabled input:radio:checked").val(),
dictType: dictType,
chooseLevel: dictType == 1 ? 1 : $('#chooseLevel').val(),
remark: $("#remark").val(),
};
AjaxPostUtil.request({url: reqBasePath + "writeDictTypeMation", params: params, type: 'json', method: "POST", callback: function (json) {
parent.layer.close(index);
parent.refreshCode = '0';
}});
}
return false;
});
}
}
}, {
keyId: 'id',
keyPid: 'pId',
title: 'name',
defaultShow: true,
});
tableTree.getTable().on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'removeRole') {
// 移除角色和该角色下的用户
$.each(treeTableData, function(index, item) {
if (item.id == data.id || item.pId == data.id) {
treeTableData.splice(index, 1);
}
});
restCheckbox();
reloadTreeTable();
} else if (layEvent === 'addUser') { // 添加成员
var roleId = data.id;
systemCommonUtil.userReturnList = [];
systemCommonUtil.chooseOrNotMy = "1"; // 人员列表中是否包含自己--1.包含;其他参数不包含
systemCommonUtil.chooseOrNotEmail = "2"; // 人员列表中是否必须绑定邮箱--1.必须;其他参数没必要
systemCommonUtil.checkType = "1"; // 人员选择类型,1.多选;其他。单选
systemCommonUtil.openSysUserStaffChoosePage(function (userReturnList) {
var userList = [].concat(userReturnList);
$.each(userList, function (i, item) {
// 一个用户在一个团队中只能属于一个角色
var checkParams = getInPoingArr(treeTableData, "id", item.id);
if (checkParams == null) {
item['pId'] = roleId;
treeTableData.push(item);
}
});
restCheckbox();
reloadTreeTable();
});
} else if (layEvent === 'removeUser') { // 移除成员
var roleId = data.pId;
var userId = data.id;
$.each(treeTableData, function(index, item) {
if (!isNull(item) && item.pId == roleId && item.id == userId) {
treeTableData.splice(index, 1);
}
});
restCheckbox();
reloadTreeTable();
}
});
}
// 刷新成员树表格
function reloadTreeTable() {
var data = $.extend(true, [], treeTableData);
tableTree.reload("messageTable", {data: data});
loadAuthList();
}
loadAuthList();
form.on('select(objectType)', function(data) {
checkTrueList = [];
loadAuthList();
});
function getTeamRoleList() {
var teamRoleList = [];
$.each(treeTableData, function (i, item) {
var teamRole = {};
if (item.pId == '0') {
// 角色
teamRole['roleId'] = item.id;
// 查询这个角色下的用户
var roleUserList = [];
$.each(treeTableData, function (j, bean) {
if (bean.pId == item.id) {
roleUserList.push({
userId: bean.id
});
}
});
teamRole['teamRoleUserList'] = roleUserList;
teamRoleList.push(teamRole);
}
});
return teamRoleList;
}
function getTeamObjectPermissionList() {
var checkRow = $("#authList input[type='checkbox']:checked");
var teamObjectPermissionList = [];
$.each(checkRow, function (i, item) {
var id = $(item).attr('id');
var str = id.split('_');
var authGroupKey = str[0];
var authKey = str[1];
var roleId = str[2];
var userId = str[3];
teamObjectPermissionList.push({
permissionKey: authGroupKey,
permissionValue: authKey,
ownerId: isNull(userId) ? roleId : userId,
ownerKey: isNull(userId) ? sysServiceMation["dictData"]["key"] : sysServiceMation["userInfo"]["key"],
fromType: 1
});
});
$("body").on("click", "#cancle", function() {
parent.layer.close(index);
});
return teamObjectPermissionList;
}
function loadAuthList() {
var data = $.extend(true, [], treeTableData);
var objectType = $('#objectType').val();
// 加载该受用类型的团队可以设置哪些权限
var colsList = teamObjectPermissionUtil.getAuthCols(objectType);
$('#authList').html(getDataUseHandlebars($('#authTableTemplate').html(), {list: colsList}));
$.each(colsList, function (i, item) {
// 给数据设置权限组的key,
$.each(data, function (j, bean) {
bean.authGroupKey = item.id;
});
loadAuthTreeTable(item.id, item.cols, data);
});
$.each(checkTrueList, function (i, id) {
$(`input[id='${id}']`).prop("checked", true);
});
form.render('checkbox');
form.on('checkbox(checkClick)', function(obj) {
var id = $(this).attr('id');
var str = id.split('_');
var authGroupKey = str[0];
var authKey = str[1];
var roleId = str[2];
var userId = str[3];
var name = authGroupKey + '_' + authKey + '_' + roleId;
var _table = $(`div[lay-id='${authGroupKey}']`);
if (isNull(userId)) {
// 如果用户id为空,代表点击的是角色的选择box,需要把name是这个的都选中
if (obj.elem.checked) {
_table.find(`input[name='${name}']`).prop("checked", true);
} else {
_table.find(`input[name='${name}']`).prop("checked", false);
}
} else {
if (obj.elem.checked) {
if (_table.find(`input[name='${name}']:checked`).length
== _table.find(`input[name='${name}']`).length - 1) {
$(`input[id='${name}_']`).prop("checked", true);
}
} else {
$(`input[id='${name}_']`).prop("checked", false);
}
}
restCheckbox();
form.render('checkbox');
});
}
function restCheckbox() {
// 将所有选中的重新放入 checkTrueList 中,防止出现操作成员信息时无法回显
var checkRow = $("#authList input[type='checkbox']:checked");
checkTrueList = [];
$.each(checkRow, function (i, item) {
checkTrueList.push($(item).attr('id'));
});
}
function loadAuthTreeTable(id, cols, data) {
tableTree.render({
id: id,
elem: '#' + id,
data: data,
// 该参数不能删除,分页参数无效,目前只能通过设置10000来保证当前页最大的数据量
limit: 10000,
cols: [cols],
}, {
keyId: 'id',
keyPid: 'pId',
title: 'name',
defaultShow: true,
});
}
$("body").on("click", "#addRole", function() {
_openNewWindows({
url: "../../tpl/sysDictData/sysDictDataSelectChoose.html?sysDictType=teamRole",
title: '选择角色',
pageId: "sysDictDataSelectChoose",
area: ['50vw', '50vh'],
callBack: function (refreshCode, turnData) {
var checkParams = getInPoingArr(treeTableData, "id", turnData.id);
if (checkParams == null) {
turnData["pId"] = '0';
turnData["lay_is_open"] = true;
treeTableData.push(turnData);
reloadTreeTable();
} else {
winui.window.msg("角色重复", {icon: 2, time: 2000});
}
}});
});
$("body").on("click", "#cancle", function() {
parent.layer.close(index);
});
});
\ No newline at end of file
......@@ -26,7 +26,9 @@ layui.config({
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' },
{ field: 'name', title: '名称', width: 200 },
{ field: 'name', title: '名称', align: 'left', width: 200, templet: function (d) {
return '<a lay-event="select" class="notice-title-click">' + d.name + '</a>';
}},
{ field: 'objectType', title: '适用类型', width: 150, templet: function (d) {
return skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("teamObjectType", 'id', d.objectType, 'name');
}},
......@@ -58,6 +60,8 @@ layui.config({
del(data, obj);
} else if (layEvent === 'edit') { // 编辑
edit(data);
} else if (layEvent === 'select') { // 详情
select(data);
}
});
......@@ -86,6 +90,18 @@ layui.config({
}});
}
// 详情
function select(data) {
rowId = data.id;
_openNewWindows({
url: "../../tpl/teamTemplate/teamTemplateDetails.html",
title: systemLanguage["com.skyeye.detailsPageTitle"][languageType],
pageId: "teamTemplateDetails",
area: ['90vw', '90vh'],
callBack: function (refreshCode) {
}});
}
// 新增
$("body").on("click", "#addBean", function() {
_openNewWindows({
......
......@@ -19,7 +19,7 @@
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header"><b>{{@key}}</b></div>
<div class="layui-card-body" style="display: inline-block;">
<div class="layui-card-body layui-col-md12" style="display: inline-block;">
{{#each @this}}
<div class="layui-col-md12">
<div class="layui-card">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="padding:20px; margin:0 auto;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
</form>
</div>
<script type="text/x-handlebars-template" id="showTemplate">
{{#bean}}
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">基本信息</span><hr>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">团队名称</label>
<div class="layui-input-block ver-center">
{{name}}
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">适用对象</label>
<div class="layui-input-block ver-center">
{{objectTypeName}}
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">状态</label>
<div class="layui-input-block ver-center">
{{enabled}}
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">备注</label>
<div class="layui-input-block ver-center">
{{remark}}
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">成员信息</span><hr>
</div>
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">成员信息</label>
<div class="layui-input-block">
<div class="winui-tip alert-info" id="showInfo">一个用户在一个团队中只能属于一个角色</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
</div>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">权限信息</span><hr>
</div>
<div class="layui-form-item layui-col-xs12" id="authList">
</div>
{{/bean}}
</script>
<script type="text/x-handlebars-template" id="authTableTemplate">
{{#list}}
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">{{title}}</label>
<div class="layui-input-block">
<table id="{{id}}" lay-filter="{{id}}"></table>
</div>
</div>
{{/list}}
</script>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/teamTemplate/'}).use('teamTemplateDetails');
</script>
</body>
</html>
\ No newline at end of file
......@@ -15,18 +15,22 @@
<script type="text/x-handlebars-template" id="showTemplate">
{{#bean}}
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">基本信息</span><hr>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">名称<i class="red">*</i></label>
<label class="layui-form-label">团队名称<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="dictName" name="dictName" win-verify="required" placeholder="请输入名称" class="layui-input" value="{{dictName}}"/>
<div class="layui-form-mid layui-word-aux">名称不能重复</div>
<input type="text" id="name" name="name" win-verify="required" placeholder="请输入团队名称" class="layui-input" value="{{name}}"/>
<div class="layui-form-mid layui-word-aux">团队名称不能重复</div>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">编码<i class="red">*</i></label>
<label class="layui-form-label">适用对象<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="dictCode" name="dictCode" win-verify="required" placeholder="请输入编码" class="layui-input" value="{{dictCode}}"/>
<div class="layui-form-mid layui-word-aux">编码不能重复</div>
<select lay-filter="objectType" lay-search="" id="objectType" win-verify="required">
</select>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
......@@ -34,18 +38,35 @@
<div class="layui-input-block winui-radio" id="enabled">
</div>
</div>
<div class="layui-form-item layui-col-xs6" id="dictTypeBox">
<label class="layui-form-label">字典类型<i class="red">*</i></label>
<div class="layui-input-block winui-radio">
<input type="radio" name="dictType" value="1" title="一级字典" lay-filter="dictType" />
<input type="radio" name="dictType" value="2" title="多级字典" lay-filter="dictType" />
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea id="remark" name="remark" placeholder="请输入备注" class="layui-textarea" style="height: 100px;" maxlength="200">{{remark}}</textarea>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">成员信息</span><hr>
</div>
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">成员信息</label>
<div class="layui-input-block">
<div class="winui-tip alert-info" id="showInfo">一个用户在一个团队中只能属于一个角色</div>
<div class="winui-toolbar">
<div class="winui-tool" style="text-align: left;">
<button id="addRole" class="winui-toolbtn" type="button"><i class="fa fa-plus" aria-hidden="true"></i>添加角色</button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
</div>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">权限信息</span><hr>
</div>
<div class="layui-form-item layui-col-xs12" id="authList">
</div>
<div class="layui-form-item layui-col-xs12">
<div class="layui-input-block">
......@@ -56,10 +77,30 @@
{{/bean}}
</script>
<script type="text/html" id="tableBar">
{{# if(d.pId == '0'){ }}
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="addUser">添加成员</a>
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="removeRole">移除</a>
{{# } else { }}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="removeUser">移除</a>
{{# } }}
</script>
<script type="text/x-handlebars-template" id="authTableTemplate">
{{#list}}
<div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">{{title}}<i class="red">*</i></label>
<div class="layui-input-block">
<table id="{{id}}" lay-filter="{{id}}"></table>
</div>
</div>
{{/list}}
</script>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/sysDictType/'}).use('sysDictTypeEdit');
layui.config({base: '../../js/teamTemplate/'}).use('teamTemplateEdit');
</script>
</body>
</html>
\ No newline at end of file
......@@ -47,6 +47,52 @@ var teamObjectPermissionUtil = {
});
return result;
}
},
getAuthColsDetails: function (objectType) {
if (isNull(objectType)) {
return [];
} else {
var teamObjectType = skyeyeClassEnumUtil.getEnumDataListByClassName("teamObjectType").rows;
var pageAuthList = getInPoingArr(teamObjectType, "id", objectType, "pageAuth");
if (pageAuthList == null) {
return [];
}
var result = [];
$.each(pageAuthList, function(i, enumKey) {
var map = {
id: enumKey,
title: skyeyeClassEnum[enumKey].name
};
// 获取枚举中需要鉴权的内容
var authBtnJson = skyeyeClassEnumUtil.getEnumDataListByClassName(enumKey).rows;
var cols = [];
cols.push({
field: 'name',
title: '名称',
width: 160
});
$.each(authBtnJson, function(j, item) {
cols.push({
field: item.id,
title: item.name,
align: 'center',
width: 140,
templet: function(row) {
var roleId = row.pId == '0' ? row.id : row.pId;
var authGroupKey = row.authGroupKey;
var authKey = $(this)[0].field;
var userId = row.pId == '0' ? '' : row.id;
var checkBoxId = authGroupKey + '_' + authKey + '_' + roleId + '_' + userId;
return `<div style="width: 30px; height: 30px" id="${checkBoxId}"><i class="fa fa-close" style="color: orangered"></i></div>`;
}
});
});
map['cols'] = cols;
result.push(map);
});
return result;
}
}
}
......@@ -23,6 +23,8 @@
"skyeyeView": {"name": "视图枚举", "className": "skyeye-pro#com.skyeye.common.SkyeyeViewEnum"},
"contactsAuthEnum": {"name": "联系人", "className": "skyeye-pro#com.skyeye.contacts.classenum.ContactsAuthEnum"}
"teamObjectType": {"name": "团队适用对象枚举", "className": "skyeye-pro#com.skyeye.team.classenum.TeamObjectTypeEnum"},
"contactsAuthEnum": {"name": "联系人", "className": "skyeye-pro#com.skyeye.contacts.classenum.ContactsAuthEnum"},
"documentAuthEnum": {"name": "文档", "className": "skyeye-pro#com.skyeye.document.classenum.DocumentAuthEnum"}
}
\ No newline at end of file
......@@ -63,5 +63,9 @@
"bossInterviewQuit": {"name": "离职申请", "key": "com.skyeye.service.impl.BossInterviewQuitServiceImpl"},
"bossInterviewJobTransfer": {"name": "岗位调动申请", "key": "com.skyeye.service.impl.BossInterviewJobTransferServiceImpl"},
"userInfo": {"name": "用户信息", "key": "com.skyeye.personnel.service.impl.SysEveUserServiceImpl"},
"dictData": {"name": "数据字典", "key": "com.skyeye.eve.service.impl.SysDictDataServiceImpl"},
"contacts": {"name": "联系人", "key": "com.skyeye.contacts.service.impl.ContactsServiceImpl"}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册