SelectGridWindow.jsp
4.91 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
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page pageEncoding="UTF-8"%>
<%@include file="/nui/common.jsp"%>
<html>
<!--
- Author(s): JFree
- Date: 2013-03-11 16:40:23
- Description:
-->
<head>
<title></title>
<style type="text/css">
body{
margin:0;padding:0;border:0;width:100%;height:100%;overflow:hidden;
}
</style>
</head>
<body>
<div class="nui-toolbar" style="text-align:center;line-height:30px;" borderStyle="border:0;">
<label>名称:</label>
<input id="key" class="nui-textbox" style="width:150px;" onenter="onKeyEnter"/>
<a class="nui-button" style="width:60px;" onclick="search()">查询</a>
</div>
<div class="nui-fit">
<div id="grid1" class="nui-datagrid" style="width:100%;height:100%;"
idField="id"
borderStyle="border-left:0;border-right:0;" onrowdblclick="onRowDblClick">
<div property="columns">
<div type="indexcolumn"></div>
<div field="id" width="120" headerAlign="center">ID</div>
<div field="code" width="100%" headerAlign="center">编码</div>
<div field="locationCode" width="100" headerAlign="center">位置编码</div>
</div>
</div>
</div>
<div class="nui-toolbar" style="text-align:center;padding-top:8px;padding-bottom:8px;" borderStyle="border:0;">
<a class="nui-button" style="width:60px;" onclick="onOk()">确定</a>
<span style="display:inline-block;width:25px;"></span>
<a class="nui-button" style="width:60px;" onclick="onCancel()">取消</a>
</div>
<script type="text/javascript">
nui.parse();
var grid = nui.get("grid1");
// 动态设置URL
var url = "com.huaheng.wms.wmsinventorydetailbiz.containerQuery.biz.ext";
function loadData(params) {
params = params || {};
nui.ajax({
url: url,
type: 'post',
contentType: 'application/json',
data: JSON.stringify(params),
success: function (data) {
if (data && data.containers) {
grid.setData(data.containers);
}
},
error: function (jqXHR, textStatus, errorThrown) {
console.error("Error occurred: " + textStatus);
}
});
}
function GetData() {
var row = grid.getSelected();
return row;
}
function search() {
var key = nui.get("key").getValue();
loadData({ key: key });
}
function onKeyEnter(e) {
search();
}
function onRowDblClick(e) {
onOk();
}
function CloseWindow(action) {
if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
else window.close();
}
function onOk() {
var rows = grid.getSelecteds();
if (rows.length > 0) {
nui.confirm("确定出库选中空容器?", "系统提示", function(action) {
if (action == "ok") {
var json = nui.encode({ wmsContainers: rows });
grid.loading("正在执行中,请稍等...");
$.ajax({
url: "com.huaheng.wms.wmstaskheaderbiz.createEmptyOut.biz.ext",
type: 'POST',
data: json,
cache: false,
contentType: 'application/json',
success: function(returnJson) {
console.log(returnJson); // 输出返回的 JSON 数据,以便调试
if (returnJson && returnJson.exception && returnJson.exception.code === 200) {
// 执行成功
CloseWindow("ok");
} else {
// 执行失败
grid.unmask();
nui.alert(returnJson.exception.message, "失败");
}
},
error: function(xhr, textStatus, errorThrown) {
// 请求出错的处理
grid.unmask();
nui.alert("请求出错:" + errorThrown, "失败");
}
});
}
});
} else {
nui.alert("请选中一条记录!");
}
}
function onCancel() {
CloseWindow("cancel");
}
// 初始化时加载数据
loadData();
</script>
</body>
</html>