优化角色和按钮权限
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"text": "导入导出"
|
||||
"text": "编辑"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"text": "启用禁用"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"text": "审核反审核"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"text": "导入导出"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"text": "打印"
|
||||
"text": "启用禁用"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"text": "打印"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"text": "作废"
|
||||
}
|
||||
]
|
||||
@@ -26,9 +26,11 @@
|
||||
var btnEnableList = getBtnStr(); //获取按钮的权限
|
||||
var mPropertyList = ""; //商品属性列表
|
||||
var defaultAccountId = 0; //默认账户id
|
||||
var roleType = ""; //角色类型
|
||||
$(function(){
|
||||
//初始化系统基础信息
|
||||
getType();
|
||||
getRoleType();
|
||||
initSystemData_UB();
|
||||
initSystemData_depot();
|
||||
initSystemData_account();
|
||||
@@ -142,6 +144,21 @@
|
||||
amountNum = "CXD";
|
||||
}
|
||||
}
|
||||
function getRoleType(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/user/getRoleTypeByUserId",
|
||||
async: false,
|
||||
success: function (res) {
|
||||
if (res && res.code === 200) {
|
||||
roleType = res.data.roleType;
|
||||
}
|
||||
else {
|
||||
roleType = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始化系统基础信息
|
||||
function initSystemData_UB(){
|
||||
$.ajax({
|
||||
@@ -360,8 +377,8 @@
|
||||
}
|
||||
}
|
||||
];
|
||||
//如果允许的按钮列表中存在就显示,3-代表审核|反审核的权限
|
||||
if(btnEnableList && btnEnableList.indexOf(3)>-1 && listTitle.indexOf("订单")>-1){
|
||||
//如果允许的按钮列表中存在就显示,2-代表审核|反审核的权限
|
||||
if(btnEnableList && btnEnableList.indexOf(2)>-1 && listTitle.indexOf("订单")>-1){
|
||||
isHiddenStatus = false; //显示
|
||||
tableToolBar.push({
|
||||
id:'okDepotHead',
|
||||
@@ -2214,6 +2231,7 @@
|
||||
search: JSON.stringify({
|
||||
type: listType,
|
||||
subType: listSubType,
|
||||
roleType: roleType,
|
||||
state: $.trim($("#searchState").val()),
|
||||
number: $.trim($("#searchNumber").val()),
|
||||
beginTime: beginTime,
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
url: url,
|
||||
valueField: 'id',
|
||||
textField: 'text',
|
||||
panelHeight: 120,
|
||||
panelHeight: 160,
|
||||
multiple: true,
|
||||
method: 'get'
|
||||
});
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
<a id="btnSetFunctions" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配功能'>分配功能</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
<a id="btnSetFunctions" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配功能'>分配功能</a>
|
||||
<a id="btnSetPushBtn" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配按钮'>分配按钮</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,6 +50,24 @@
|
||||
data-options="required:true,validType:'length[2,30]'" style="width: 230px;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>数据类型 </td>
|
||||
<td style="padding:5px">
|
||||
<select name="type" id="type" class="easyui-combobox"
|
||||
data-options="required:true,panelHeight:'auto'" style="width: 230px;">
|
||||
<option value="全部数据">全部数据</option>
|
||||
<option value="本部门数据">本部门数据</option>
|
||||
<option value="个人数据">个人数据</option>
|
||||
<option value="自定义数据">自定义数据</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>描述 </td>
|
||||
<td style="padding:5px">
|
||||
<input name="description" id="description" class="easyui-textbox" data-options="multiline:true" style="width: 230px;height: 40px;"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -110,7 +128,9 @@
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{title: '角色名称', field: 'name', width: 200}
|
||||
{title: '角色名称', field: 'name', width: 200},
|
||||
{title: '数据类型', field: 'type', width: 200},
|
||||
{title: '描述', field: 'description', width: 200}
|
||||
]],
|
||||
toolbar: [
|
||||
{
|
||||
@@ -147,7 +167,7 @@
|
||||
//兼容 IE,firefox 兼容
|
||||
var obj = e.srcElement ? e.srcElement : e.target;
|
||||
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
|
||||
if (k == "13" && (obj.id == "name" || obj.id == "sort" || obj.id == "remark")) {
|
||||
if (k == "13" && (obj.id == "name" || obj.id == "description")) {
|
||||
$("#saveRole").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
@@ -258,13 +278,9 @@
|
||||
var oldName = "";
|
||||
|
||||
function addRole() {
|
||||
$("#sort").val("");
|
||||
$("#remark").val("");
|
||||
$('#roleFM').form('clear');
|
||||
$('#roleDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/edit_add.png"/> 增加角色信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$("#name").val("").focus();
|
||||
//$('#roleFM').form('clear');
|
||||
|
||||
oldName = "";
|
||||
roleID = 0;
|
||||
url = '/role/add';
|
||||
@@ -305,6 +321,8 @@
|
||||
function editRole(index) {
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#name").textbox("setValue", rowsdata.name);
|
||||
$("#type").combobox("setValue", rowsdata.type);
|
||||
$("#description").textbox("setValue", rowsdata.description);
|
||||
oldName = rowsdata.name;
|
||||
$('#roleDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/pencil.png"/> 编辑角色信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
<div style="padding-bottom: 10px;">
|
||||
<a id="btnAllCheck" class="easyui-linkbutton">全选</a>
|
||||
<a id="btnAllCancel" class="easyui-linkbutton">全取消</a>
|
||||
<a id="btnOK" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
|
||||
</div>
|
||||
<div id="pushList">
|
||||
@@ -83,7 +85,7 @@
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
for (var j = 0; j < pushBtnJSON.length; j++) {
|
||||
if (pushBtnJSON[j].id === arr[i] - 0) {
|
||||
str += "<input type='checkbox' value='" + pushBtnJSON[j].id + "' />" + pushBtnJSON[j].text;
|
||||
str += "<input type='checkbox' value='" + pushBtnJSON[j].id + "' />" + pushBtnJSON[j].text + " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,6 +213,40 @@
|
||||
}
|
||||
$(this).closest(".datagrid-row").find("[field='Id']").attr("data-btn", checkStr);
|
||||
});
|
||||
|
||||
//全选
|
||||
$("#btnAllCheck").off("click").on("click", function () {
|
||||
bindBody.find(".datagrid-row").each(function () {
|
||||
$(this).find("[field='PushBtnList']").find("input").each(function () {
|
||||
$(this).prop("checked", "checked");
|
||||
});
|
||||
$(this).find("[field='PushBtnList']").find("input").each(function () {
|
||||
var checkStr = "";
|
||||
$(this).closest(".datagrid-cell").find("input").each(function () {
|
||||
var thisValue = $(this).val(); //勾选的值
|
||||
var isChecked = $(this).prop("checked");
|
||||
if (isChecked) {
|
||||
checkStr = checkStr + thisValue + ",";
|
||||
}
|
||||
});
|
||||
if (checkStr) {
|
||||
checkStr = checkStr.substring(0, checkStr.length - 1);
|
||||
}
|
||||
$(this).closest(".datagrid-row").find("[field='Id']").attr("data-btn", checkStr);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//全取消
|
||||
$("#btnAllCancel").off("click").on("click", function () {
|
||||
bindBody.find(".datagrid-row").each(function () {
|
||||
$(this).find("[field='Id']").attr("data-btn", "");
|
||||
$(this).find("[field='PushBtnList']").find("input").each(function () {
|
||||
$(this).prop("checked", "");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}, 500);
|
||||
|
||||
$("#btnOK").off("click").on("click", function () {
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="searchBtn">查询</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
<a id="btnSetRole" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配角色'>分配角色</a>
|
||||
<a id="btnSetDepart" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配仓库'>分配仓库</a>
|
||||
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-redo" id="searchResetBtn">重置</a>
|
||||
<a id="btnSetRole" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配角色'>分配角色</a>
|
||||
<a id="btnSetDepart" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配仓库'>分配仓库</a>
|
||||
<a id="btnSetCustomer" class='easyui-linkbutton iframe iframe_LargeForm' href='#' title='分配客户'>分配客户</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user