-
Notifications
You must be signed in to change notification settings - Fork 1
/
accountinfo.html
130 lines (111 loc) · 4.35 KB
/
accountinfo.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!DOCTYPE html />
<html>
<head>
<meta http-equiv="content-type" charset="utf8"/>
<title>Hello MiniUI!</title>
<!--jQuery js-->
<script src="jquery.min.js" type="text/javascript"></script>
<!--MiniUI-->
<link href="themes/default/miniui.css" rel="stylesheet" type="text/css" />
<script src="miniui.js" type="text/javascript"></script>
</head>
<body>
<input id="key" class="mini-buttonedit" onbuttonclick=""/>
<a class="mini-button" plain="true" onclick="search" >查询</a>
<a class="mini-button" plain="true" onclick="addRow()" >新增</a>
<a class="mini-button" plain="true" onclick="removeRow()" >删除</a>
<a class="mini-button" plain="true" onclick="saveData()" >保存</a>
新增需要先新增然后保存
<div id="datagrid1" class="mini-datagrid" style="width:800px;height:280px;"
pageIndexField="page" pageSizeField="size"
url="http://acc-my-project2.193b.starter-ca-central-1.openshiftapps.com/digitalAccount" idField="id"
allowResize="true"
allowCellEdit="true" allowCellSelect="true" multiSelect="true" ajaxOptions="{type:'get',contentType:'application/json'}"
>
<div property="columns">
<div type="checkcolumn"></div>
<div field="name" width="120" headerAlign="center" allowSort="true">网站名称
<input property="editor" class="mini-textbox" style="width:100%;"/>
</div>
<div field="url" width="100" renderer="onGenderRenderer" align="center" headerAlign="center">网站地址
<input property="editor" class="mini-textbox" style="width:100%;" data="Genders"/>
</div>
<div field="username" width="100" allowSort="true" >用户名
<input property="editor" class="mini-textbox" minValue="0" maxValue="200" value="25" style="width:100%;"/>
</div>
<div field="password" width="100" allowSort="true" dateFormat="yyyy-MM-dd">密码
<input property="editor" class="mini-textbox" style="width:100%;"/>
</div>
<div field="mark" width="120" headerAlign="center" allowSort="true">备注
<input property="editor" class="mini-textarea" style="width:100%;" minHeight="80"/>
</div>
<!--<div field="createtime" width="100" headerAlign="center" dateFormat="yyyy-MM-dd" allowSort="true">创建日期</div>-->
</div>
</div>
<script>
// //隐藏的增加 , 修改的窗口
//
// var editWindow = mini.Panel();
// editWindow.show();
var serverUrl = "http://acc-my-project2.193b.starter-ca-central-1.openshiftapps.com/";
mini.parse();
var grid = mini.get("datagrid1");
grid.load();
function search() {
console.log("search ...");
var key = document.getElementById("key").value;
grid.load({ key: key });
}
function addRow() {
var newRow = { name: "New Row" };
grid.addRow(newRow, 0);
}
function removeRow() {
var rows = grid.getSelecteds();
if (rows.length > 0) {
grid.removeRows(rows, true);
var idArrs = new Array();
for(var count = 0 ; count < rows.length ; count++ ){
var row = rows[count];
if(row._state === "removed"){
idArrs[count] = row.id;
}
}
//删除请求
$.ajax({
contentType: 'application/json',
url: serverUrl + "/digitalAccount/batchDelete",
data:
JSON.stringify(idArrs)
,
type: "delete",
success: function (text) {
grid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
console.log("safd");
}
}
function saveData() {
var data = grid.getChanges();
var json = mini.encode(data);
grid.loading("保存中,请稍后......");
$.ajax({
contentType: 'application/json',
url: serverUrl +"digitalAccount/batchInsertOrUpdate",
data: json,
type: "post",
success: function (text) {
grid.reload();
},
error: function (jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});
}
</script>
</body>
</html>