agent.js
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* 机构角色管理
*/
var agent = function() {
return {
/** 添加准备 */
beforeAdd : function() {
$("#add-form").form("clear");
$('#add_dialog').dialog("open");
},
/** 修改用户 */
beforeUpdate : function() {
var row = $("#data-grid").datagrid("getSelected");
if (row) {
$("#add-form").form("load", row);
$("#add_dialog").dialog("setTitle", "修改机构角色").dialog("open");
}
}
}
}();
$(function() {
$("#roleId").combobox({
url:'/role/searchAgentRole',
valueField: 'id',
textField: 'roleName',
onLoadSuccess: function (data) {
if (data) {
$('#roleId').combobox('setValue',data[0].id);
}
}
})
$('#add_dialog').dialog({
title : '添加机构角色',
width : 400,
height : 'auto',
closed : true,
top : 100,
buttons : [ {
text : '提交',
iconCls : 'icon-ok',
handler : function() {
$("#add-form").form('submit', {
url : '/admin/agent/addAndUpdateAgentRole',
onSubmit : function() {
return $("#add-form").form("validate");
},
success : function(data) {
if(data == "0"){
$.messager.show({
title : '信息',
msg : '操作成功'
});
$("#add_dialog").dialog("close");
$('#data-grid').datagrid('reload');
}else if(data == "1"){
$.messager.show({
title : '信息',
msg : '操作失败'
});
$("#add_dialog").dialog("close");
}else{
$.messager.show({
title : '信息',
msg : '该会员不是机构会员'
});
}
}
})
}
} ]
});
})