EasyUI的使用

表格工具栏按钮点击的对话框(easyui-dialog)

表格工具栏按钮点击的对话框的html代码

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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<div title="账号授权" id="dialog-Setting" class="easyui-dialog" style="padding:15px 25px" data-options="closed:true,buttons:'#footer_set'">
<table cellspacing="8">
<tr>
<td>平台名称:</td>
<td class="needInput">
<!-- <select id="platName_shouquan_select" class="easyui-combobox" name="state" style="width:200px" data-options="textField:'text',panelHeight:'auto'">
<option value="AL">祁县水利局</option>
<option value="AK">武宁供水公司</option>
<option value="AZ">滨江自来水</option>
</select> -->
<input id="platName_shouquan_select" class="easyui-combobox" name="state" style="width:200px" data-options="valueField:'id',textField:'text',panelHeight:'auto'">
</td>
</tr>
<tr style="display: none;">
<td>登录账号:</td>
<td><input readonly="true" id="loginNum" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr style="display: none;">
<td>登录密码:</td>
<td><input readonly="true" id="loginPw" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr>
<td>平台登录账号:</td>
<td><input readonly="true" id="pfNum" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr>
<td>平台登录密码:</td>
<td><input readonly="true" id="pfPw" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr>
<td>营收:</td>
<td class="needInput">
<select id="switchCash" class="easyui-combobox" name="state" style="width:200px" data-options="textField:'text',panelHeight:'auto'">
<option value="false">禁用</option>
<option value="true">启用</option>
</select>
</td>
</tr>
<tr class="goCash" style="display:none">
<td>营收账号:</td>
<td class="needInput"><input id="ysloginName" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr class="goCash" style="display:none">
<td>营收密码:</td>
<td class="needInput"><input id="ysPassword" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr>
<td>账号类型:</td>
<td class="needInput">
<select class="easyui-combobox" id="zhanghaoleixing_select" name="state" style="width:200px" data-options="textField:'text',panelHeight:'auto'">
<option value="3">普通用户</option>
<option value="1">水司用户</option>
<option value="2">代理商</option>
<option value="4">管理员</option>
<option value="0">超级管理员</option>
</select>
</td>
</tr>
<tr>
<td>微信小程序:</td>
<td class="needInput">
<select id="switchWxApp" class="easyui-combobox" name="state" style="width:200px" data-options="textField:'text',panelHeight:'auto'">
<option value='false'>禁用</option>
<option value='true'>启用</option>
</select>
</td>
</tr>
<tr style="display: none;" class="timeLimit">
<td>蓝牙权限:</td>
<td class="needInput"><input id="lanyashouquan" type="text" class="easyui-datetimebox" style="width:200px"></td>
</tr>
</table>
<div id="footer_set" style="text-align: center;">
<a href="javascript:0;" onclick="shouQuanUser()" class="easyui-linkbutton">确认</a>
<a href="javascript:0;" class="easyui-linkbutton btn_close">取消</a>
</div>
</div>
<div title="修改授权" id="dialog_edit" class="easyui-dialog" style="padding:15px 25px" data-options="closed:true,buttons: '#footer_edit'">
<table cellspacing="8">
<tr>
<td>营收账号:</td>
<td class="needInput"><input id="shouquan_name_update" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr>
<td>营收密码:</td>
<td class="needInput"><input id="shouquan_pass_update" type="text" class="easyui-textbox" style="width:200px"></td>
</tr>
<tr>
<td>蓝牙权限:</td>
<td class="needInput"><input id="shouquan_lanyariqi_update" class="easyui-datetimebox" style="width:200px"></td>
</tr>
</table>
</div>
<div id="footer_edit" style="text-align: center;">
<a href="javascript:0;" class="easyui-linkbutton" onclick="xiugaiquanxian()">确认</a>
<a href="javascript:0;" class="easyui-linkbutton btn_close">取消</a>
</div>
<div title="账号注销" id="dialog_zhuxiao" class="easyui-dialog" style="padding:15px 25px" data-options="closed:true,buttons: '#footer_zhuxiao'">
请输入管理员密码!
<input type="text" id="zhuxiaomima" class="easyui-textbox">
</div>
<div id="footer_zhuxiao" style="text-align: center;">
<a href="javascript:0;" onclick="zhuxiaozhanghao()" class="easyui-linkbutton">确认</a>
<a href="javascript:0;" class="easyui-linkbutton btn_close">取消</a>
</div>

按钮点击的对话框内容的显示和隐藏js代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
   //启用营收账号时显示输入框
$('#switchCash').combobox({
onSelect: function(record) {
if (record.value === 'true') {
$('.goCash').show();
} else if (record.value === "false") {
$('.goCash').hide();
}
}
})
//授予微信小程序权限时显示输入框
$('#switchWxApp').combobox({
onSelect: function(record) {
if (record.value === 'true') {
$('.timeLimit').show();
} else if (record.value === "false") {
$('.timeLimit').hide();
}
}
})

授权,修改权限,注销对话框内容的确定js代码

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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
 	function shouQuanUser(){
debugger;
var node = $("#logupMsg").datagrid("getSelected");
var yingshou = 1;
var lanya = 1;
var pingtaiId = $("#platName_shouquan_select").combobox("getValue");
if(pingtaiId == "" || pingtaiId == null){
alert('请选择一个平台!');
return;
}
var login = $("#loginNum").textbox("getText");
var pass = $("#loginPw").textbox("getText");
var ptlogin = $("#pfNum").textbox("getText");
var ptpass = $("#pfPw").textbox("getText");
var shifouqiyongyingshou = $("#switchCash").combobox("getValue");
var yslogin = $("#ysloginName").textbox("getValue");
var yspass = $("#ysPassword").textbox("getValue");
var zhanghaoleixing = $("#zhanghaoleixing_select").combobox("getValue");
var shifouqiyonglanya = $("#switchWxApp").combobox("getValue");
var lanyashouquanriqi = $("#lanyashouquan").datetimebox("getValue");
if(shifouqiyongyingshou == false){
yslogin="";
yspass="";
yingshou = 0;
}
if(shifouqiyonglanya == false){
lanyashouquanriqi ="";
lanya = 0;
}
$.messager.confirm('提示', '您确定让该用户通过审核吗?', function(r){
if (r){
$.messager.prompt('请示','请输入审核密码?',function(r){
debugger;
var myDate = new Date();
var month = (myDate.getMonth()+1);
var day=myDate.getDate();
if(month<10){
month = "0"+(myDate.getMonth()+1);
}
if(day<10){
day="0"+day;
}
var date = myDate.getFullYear()+""+month+""+day;
if(r==date){
$.post(BASE_PATH +"/userPlat/shouQuanUser", {
userId:node.userId,
platformId:pingtaiId,
login:login,
pass:pass,
ptlogin:ptlogin,
ptpass:ptpass,
yingshou:yingshou,
yslogin:yslogin,
yspass:yspass,
zhanghaoleixing:zhanghaoleixing,
lanya:lanya,
lanyashouquanriqi:lanyashouquanriqi,
shouquanren:loginUser.userName
},function(res){
debugger;
$('#dialog-Setting').dialog('close');
selected = false;
selectUserData();
$.messager.alert("提示",res);
},'text');
}else{
$.messager.alert("提示",'密码错误');
}
});
}
});
}

function xiugaiquanxian(){
debugger;
var node = $("#logupMsg").datagrid("getSelected");
var pingtaiId = $("#platName_shouquan_select").combobox("getValue");
var yslogin = $("#shouquan_name_update").textbox("getValue");
var yspass = $("#shouquan_pass_update").textbox("getValue");
var lanyashouquanriqi = $("#shouquan_lanyariqi_update").datetimebox("getValue");

$.messager.confirm('提示', '您确定让该用户通过审核吗?', function(r){
if (r){
$.messager.prompt('请示','请输入审核密码?',function(r){
debugger;
var myDate = new Date();
var month = (myDate.getMonth()+1);
var day=myDate.getDate();
if(month<10){
month = "0"+(myDate.getMonth()+1);
}
if(day<10){
day="0"+day;
}
var date = myDate.getFullYear()+""+month+""+day;
if(r==date){
$.post(BASE_PATH +"/userPlat/updateShouQuanUser", {
userId:node.userId,
platformId:node.platformId,
yslogin:yslogin,
yspass:yspass,
lanyashouquanriqi:lanyashouquanriqi,
shouquanren:loginUser.userName
},function(res){
debugger;
$('#dialog_edit').dialog('close');
selected = false;
selectUserData();
$.messager.alert("提示",res);
},'text');
}else{
$.messager.alert("提示",'密码错误');
}
});
}
});
}

function zhuxiaozhanghao(){
var node = $("#logupMsg").datagrid("getSelected");
if(node == "" || node == null){
alert('请选择一个用户!');
return;
}
var pass=$("#zhuxiaomima").textbox("getValue");
var myDate = new Date();
var month = (myDate.getMonth()+1);
var day=myDate.getDate();
if(month<10){
month = "0"+(myDate.getMonth()+1);
}
if(day<10){
day="0"+day;
}
var date = myDate.getFullYear()+""+month+""+day;
if(pass==date){
$.post(BASE_PATH+"/userPlat/zhuxiaozhanghao.do", {userId:node.userId},function (res) {
$('#dialog_zhuxiao').dialog('close');
selected = false;
selectUserData();
$.messager.alert("提示",res);

}, 'text');
}else{
$.messager.alert("提示",'密码错误');
}

}

授权,修改权限,注销对话框内容的确定java代码

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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
 	//授权User
@RequestMapping("/shouQuanUser")
@ResponseBody
public String shouQuanUser(HttpSession session,int userId,int platformId,String login,
String pass,String ptlogin,String ptpass,String yingshou,String yslogin,
String yspass,int zhanghaoleixing,int lanya,String lanyashouquanriqi,String shouquanren)
throws Exception {
String res = userPlatService.shouQuanUser(session,userId,platformId,login,pass,ptlogin,
ptpass,yingshou,yslogin,yspass,zhanghaoleixing,lanya,lanyashouquanriqi,shouquanren);
return res;
}
@Override
public String shouQuanUser(HttpSession session,int userId,int platformId, String login,
String pass, String ptlogin, String ptpass, String yingshou,
String yslogin, String yspass, int zhanghaoleixing, int lanya,
String lanyashouquanriqi, String shouquanren) {
String res = "";
try {

int count = userPlatMapper.selectUserAndPlatformCount(userId,platformId);
if(count<1) {
if("".equals(lanyashouquanriqi)) {
lanyashouquanriqi =null;
}
int i = userPlatMapper.shouQuanUser(userId,zhanghaoleixing,shouquanren,lanya,lanyashouquanriqi);
if(zhanghaoleixing == 0 || zhanghaoleixing == 4) {
List<UserPlatformModel> platformList = userPlatMapper.selectPlatformAll();
for(UserPlatformModel plat:platformList) {
int count2 = userPlatMapper.selectUserAndPlatformCount(userId,plat.getPlatformId());
if(count2 >0) {
continue;
}
plat.setUserId(userId);
plat.setPlatformId(plat.getPlatformId());
plat.setLoginName(ptlogin);
plat.setLoginPassword(ptpass);
plat.setYingshouName(yslogin);
plat.setYingshouPassword(yspass);
userPlatMapper.saveUserAndPlatform(plat);
}
}else {
UserPlatformModel uap= new UserPlatformModel();
uap.setUserId(userId);
uap.setPlatformId(platformId);
uap.setLoginName(ptlogin);
uap.setLoginPassword(ptpass);
uap.setYingshouName(yslogin);
uap.setYingshouPassword(yspass);
userPlatMapper.saveUserAndPlatform(uap);
}
res="授权成功";
}else {
res="此平台已授权";
}
} catch (Exception e) {
res="授权失败";
}
return res;
}

<select id="selectUserAndPlatformCount" resultType="int">
select count(*) from t_user_platform where userId= #{userId} and platformId =#{platformId}
</select>
<update id="shouQuanUser">
update t_login_user set
userStatus = 1,
userRole = #{userRole},
userCheck=#{userCheck},
userCheckTime = sysdate(),
userBluetooth = #{userBluetooth},
userBluetoothTime=#{userBluetoothTime}
where UserId = #{userId}
</update>
<select id="selectPlatformAll" resultType="UserPlatformModel">
select * from t_platform
</select>


//修改授权User
@RequestMapping("/updateShouQuanUser")
@ResponseBody
public String updateShouQuanUser(HttpSession session,int userId,int platformId,String yslogin,
String yspass,String lanyashouquanriqi,String shouquanren)
throws Exception {
String res = userPlatService.updateShouQuanUser(session,userId,platformId,
yslogin,yspass,lanyashouquanriqi,shouquanren);
return res;
}
@Override
public String updateShouQuanUser(HttpSession session, int userId, int platformId, String yslogin, String yspass,
String lanyashouquanriqi, String shouquanren) {
String res = "";
try {
if("".equals(lanyashouquanriqi)) {
lanyashouquanriqi = null;
}
userPlatMapper.updateUserAndPlatform(userId,platformId,yslogin,yspass);
int i = userPlatMapper.updateShouQuanUser(userId,lanyashouquanriqi);
res="修改成功";
} catch (Exception e) {
res="修改失败";
}
return res;
}
<update id="updateUserAndPlatform">
update t_user_platform set
YingshouName = #{yslogin},
YingshouPassword = #{yspass}
where UserId = #{userId}
</update>
<update id="updateShouQuanUser">
update t_login_user set
userBluetoothTime=#{userBluetoothTime}
where UserId = #{userId}
</update>

@RequestMapping("/zhuxiaozhanghao")
@ResponseBody
public String zhuxiaozhanghao(int userId)
throws Exception {
String res = userPlatService.zhuxiaozhanghao(userId);
return res;
}
@Override
public String zhuxiaozhanghao(int userId) {
String res="";
try {
userPlatMapper.zhuxiaozhanghaoUser(userId);
userPlatMapper.zhuxiaozhanghaoUserAndPlat(userId);
res="注销成功";
} catch (Exception e) {
res="注销失败";
}
return res;
}
<delete id="zhuxiaozhanghaoUser">
DELETE FROM t_login_user WHERE userid=#{userId}
</delete>
<delete id="zhuxiaozhanghaoUserAndPlat">
DELETE FROM t_user_platform WHERE userid=#{userId}
</delete>
对话框属性名称 类型 描述 默认值
toolbar array,selector 对话框的顶部工具栏 null
buttons array,selector 对话框的底部按钮 null

|对话框方法名称|参数|描述|
|–|–|–|–|
|setTitle|title|设置头部的标题文本。|
|open|forceOpen|当 forceOpen 参数设置为 true 时,就绕过 onBeforeOpen 回调函数打开面板(panel)。|
|close|forceClose|当 forceClose 参数设置为 true 时,就绕过 onBeforeClose 回调函数关闭面板(panel)。|