修改角色管理js效率低下的问题
This commit is contained in:
@@ -123,10 +123,17 @@
|
|||||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||||
{title: '角色名称', field: 'name', width: 200},
|
{title: '角色名称', field: 'name', width: 200},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
||||||
|
/**
|
||||||
|
* create by: qiankunpingtai
|
||||||
|
* create time: 2019/5/5 10:30
|
||||||
|
* website:https://qiankunpingtai.cn
|
||||||
|
* description:
|
||||||
|
* 修改效率低下的js实现
|
||||||
|
*/
|
||||||
var str = '';
|
var str = '';
|
||||||
var rowInfo = rec.id + 'AaBb' + rec.name;
|
// var rowInfo = rec.id + 'AaBb' + rec.name;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editRole(\'' + rowInfo + '\');"/> <a onclick="editRole(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editRole(\'' + index + '\');"/> <a onclick="editRole(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteRole(' + rec.id + ');"/> <a onclick="deleteRole(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteRole(' + rec.id + ');"/> <a onclick="deleteRole(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -318,18 +325,18 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑信息
|
//编辑信息
|
||||||
function editRole(roleTotalInfo) {
|
function editRole(index) {
|
||||||
var roleInfo = roleTotalInfo.split("AaBb");
|
// var roleInfo = roleTotalInfo.split("AaBb");
|
||||||
|
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||||
|
$("#name").focus().val(rowsdata.name);
|
||||||
|
|
||||||
$("#name").focus().val(roleInfo[1]);
|
oldName = rowsdata.name;
|
||||||
|
|
||||||
oldName = roleInfo[1];
|
|
||||||
$('#roleDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑角色信息');
|
$('#roleDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑角色信息');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
roleID = roleInfo[0];
|
roleID = rowsdata.id;
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#name").val("").focus().val(roleInfo[1]);
|
$("#name").val("").focus().val(rowsdata.name);
|
||||||
url = '/role/update?id=' + roleInfo[0];
|
url = '/role/update?id=' + rowsdata.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
|||||||
Reference in New Issue
Block a user