code.jsp
5.36 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
145
146
<%@ page contentType="text/html; charset=utf-8" %>
<script type="text/javascript">
function query(){
var domain = $("#domain").val();
var command = $("#command").val();
var href = "?op=appList&type=code&domain=" + domain + "&id=" + command;
window.location.href = href;
}
var domain2CommandsJson = ${model.domain2CommandsJson};
function changeDomain(domainId, commandId, domainInitVal, commandInitVal){
if(domainInitVal == ""){
domainInitVal = $("#"+domainId).val()
}
var commandSelect = $("#"+commandId);
var commands = domain2CommandsJson[domainInitVal];
$("#"+domainId).val(domainInitVal);
commandSelect.empty();
for(var cou in commands){
var command = commands[cou];
if(command['title'] != undefined && command['title'].trim().length > 0){
commandSelect.append($("<option value='"+command['id']+"'>"+command['title']+"</option>"));
}else{
commandSelect.append($("<option value='"+command['id']+"'>"+command['name']+"</option>"));
}
}
if(commandInitVal != ''){
commandSelect.val(commandInitVal);
}
}
function changeCommandByDomain(){
var domain = $("#domain").val();
var commandSelect = $("#command");
var commands = domain2CommandsJson[domain];
commandSelect.empty();
for(var cou in commands){
var command = commands[cou];
if(command['title'] != undefined && command['title'].trim().length > 0){
commandSelect.append($("<option value='"+command['id']+"'>"+command['title']+"</option>"));
}else{
commandSelect.append($("<option value='"+command['id']+"'>"+command['name']+"</option>"));
}
}
}
function initDomain(domainSelectId, commandSelectId, domainInitVal, commandInitVal){
var domainsSelect = $("#"+domainSelectId);
for(var domain in domain2CommandsJson){
domainsSelect.append($("<option value='"+domain+"'>"+domain+"</option>"))
}
changeDomain(domainSelectId, commandSelectId, domainInitVal, commandInitVal);
domainsSelect.on('change', changeCommandByDomain);
}
$(document).ready(function(){
var domain = '';
var id = '';
if('${payload.type}' == 'code'){
domain = '${payload.domain}';
id = '${payload.id}';
}
initDomain('domain', 'command', domain, id);
})
</script>
项目<select id="domain" style="width: 100px;"></select>
命令字 <select id="command" style="width: 240px;"></select>
<input class="btn btn-primary btn-xs"
value=" 返回码 " onclick="query()"
type="submit" />
<br/>
<br/>
<table class="table table-striped table-condensed table-bordered table-hover" id="contents" width="100%">
<thead>
<tr >
<th width="20%" class="text-info">返回码</th>
<th width="50%" class="text-info">局部设置</th>
<th width="20%" class="text-info">局部状态</th>
<th width="10%" class="text-info">操作 <a href="?op=appCodeAdd&id=${model.id eq '0' ? '1' : model.id}&domain=${payload.domain}&type=code" class="btn btn-primary btn-xs" >
<i class="ace-icon glyphicon glyphicon-plus bigger-120"></i></a></th>
</tr></thead>
<tbody>
<c:forEach var="code" items="${model.updateCommand.codes}">
<tr>
<td>${code.value.id}</td>
<td>${code.value.name}</td>
<td class="center">
<c:choose>
<c:when test="${code.value.status eq 0}">
<button class="btn btn-xs btn-success">
<i class="ace-icon glyphicon glyphicon-ok bigger-120 btn-success"></i>
</button>
</c:when>
<c:otherwise>
<i class="ace-icon glyphicon glyphicon-remove bigger-120"></i>
</c:otherwise>
</c:choose>
</td>
<td><a href="?op=appCodeUpdate&id=${model.id}&domain=${payload.domain}&code=${code.value.id}&type=code" class="btn btn-primary btn-xs">
<i class="ace-icon fa fa-pencil-square-o bigger-120"></i></a>
<a href="?op=appCodeDelete&id=${model.id}&domain=${payload.domain}&code=${code.value.id}&type=code" class="btn btn-danger btn-xs delete" >
<i class="ace-icon fa fa-trash-o bigger-120"></i></a></td>
</tr>
</c:forEach>
<tr><td colspan="4"></td></tr>
<thead>
<tr >
<th width="20%" class="text-info">返回码</th>
<th width="50%" class="text-info">全局设置</th>
<th width="20%" class="text-info">全局状态</th>
<th width="10%" class="text-info">操作 <a href="?op=appCodeAdd&id=${model.id eq '0' ? '1' : model.id}&domain=${payload.domain}&type=code&constant=true" class="btn btn-primary btn-xs" >
<i class="ace-icon glyphicon glyphicon-plus bigger-120"></i></a></th>
</tr></thead>
<c:forEach var="code" items="${model.codes}">
<tr>
<td>${code.value.id}</td>
<td>${code.value.name}</td>
<td class="center">
<c:choose>
<c:when test="${code.value.status eq 0}">
<button class="btn btn-xs btn-success">
<i class="ace-icon glyphicon glyphicon-ok bigger-120 btn-success"></i>
</button>
</c:when>
<c:otherwise>
<i class="ace-icon glyphicon glyphicon-remove bigger-120"></i>
</c:otherwise>
</c:choose>
</td>
<td><a href="?op=appCodeUpdate&id=${model.id}&domain=${payload.domain}&code=${code.value.id}&type=code&constant=true" class="btn btn-primary btn-xs">
<i class="ace-icon fa fa-pencil-square-o bigger-120"></i></a>
<a href="?op=appCodeDelete&id=${model.id}&domain=${payload.domain}&code=${code.value.id}&type=code&constant=true" class="btn btn-danger btn-xs delete" >
<i class="ace-icon fa fa-trash-o bigger-120"></i></a></td>
</tr>
</c:forEach>
</tbody>
</table>