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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: zhangyi2652 $
$Date: 2010/11/30 06:19:22 $
$Revision: 1.4 $
$Purpose: 角色定义
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
<a:init-procedure/>
<a:view>
<a:link id="sys_role_assign_function_link" url="${/request/@context_path}/modules/sys/SYS8110/sys_role_assign_function.lview"/>
<a:link id="sys_function_group_assign_link" url="${/request/@context_path}/modules/sys/SYS8110/sys_function_group_assign.lview"/>
<a:link id="sys_role_copy_link" url="${/request/@context_path}/modules/sys/SYS8110/sys_role_copy.lview"/>
<a:link id="sys_function_group_copy_link" url="${/request/@context_path}/modules/sys/SYS8110/sys_function_group_copy.lview"/>
<a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
<div/>
<script type="text/javascript"><![CDATA[
function sys_8010_grid_add() {
$('sys_8110_grid').showEditorByRecord($('sys_role_result_ds').create());
}
function sys_8010_grid_clear() {
$('sys_8110_grid').clear();
}
function sys_8010_grid_remove() {
$('sys_8110_grid').remove();
}
function sys_8010_grid_submit() {
var result_ds = $('sys_role_result_ds');
if (result_ds.validate()) {
result_ds.submit();
}
}
function sys_8010_next() {
history.go(1);
}
function sys_8010_back() {
history.go(-1);
}
function sys_8010_quit() {
location.href = $('sys_service_welcome_link').getUrl();
parent.shMenu('show');
}
function queryRole() {
$('sys_role_result_ds').query();
}
function resetRole() {
$('sys_role_query_ds').reset();
}
function actionRenderer(value, record, name) {
var role_id = record.get('role_id');
if (role_id) {
return '<a href="javascript:editRoleInfo(' + role_id + ')">${l:SYS8110.LINK.ASSIGN_FUNCTION}</a>';
} else {
return '';
}
}
function editRoleInfo(id) {
new Leaf.Window({
id: 'assign_function',
url: $('sys_role_assign_function_link').getUrl(),
params: {
role_id: id
},
title: '${l:SYS8110.LINK.ASSIGN_FUNCTION}',
height: 620,
width: 600
});
}
function roleEditorFunction(record) {
var role_id = record.get('role_id');
if (role_id) {
return '';
} else {
return 'sys_role_result_grid_upper_tf';
}
}
function compareDate(start, end) {
if (start > end) {
return false;
}
return true;
}
function dateValidator(record, name, value) {
if (name == 'start_date' || name == 'end_date') {
var start_date = record.get('start_date');
var end_date = record.get('end_date');
if (typeof(end_date) != 'undefined' && !Ext.isEmpty(end_date)) {
if (!compareDate(start_date, end_date)) {
return '${l:START_GREATER_THAN_END}';
}
}
return true;
}
}
function onUpdate(ds, record, name, value) {
if (name == 'start_date' || name == 'end_date') {
record.validate((name == 'start_date') ? 'end_date' : 'start_date');
}
}
function function_group_assign_renderer(value, record, name) {
var role_id = record.get('role_id');
if (role_id) {
return '<a href="javascript:editfunctiongroup_assign(' + role_id + ')">${l:SYS870.ASSIGN_FUNCTION_GROUP}</a>';
} else {
return '';
}
}
function function_copy_renderer(value, record, name) {
var role_id = record.get('role_id');
if (role_id) {
return '<a href="javascript:edit_role_copy(' + record.id + ')">${l:SYS870.ROLE_COPY}</a>';
} else {
return '';
}
}
function function_group_renderer(value, record, name) {
var role_id = record.get('role_id');
if (role_id) {
return '<a href="javascript:edit_function_group_copy(' + record.id + ')">${l:SYS870.FUNCTION_GROUP_COPY}</a>';
} else {
return '';
}
}
function edit_function_group_copy(record_id) {
var current_record = $('sys_role_result_ds').findById(record_id);
new Leaf.Window({
id: 'sys_function_group_copy_link_winid',
url: $('sys_function_group_copy_link').getUrl(),
params: {
orign_role_id: current_record.get('role_id'),
orign_role_code: current_record.get('role_code'),
orign_role_name: current_record.get('role_name'),
winid: 'sys_function_group_copy_link_winid'
},
title: '${l:SYS870.FUNCTION_GROUP_COPY}',
height: 200,
width: 480
});
}
function edit_role_copy(record_id) {
var current_record = $('sys_role_result_ds').findById(record_id);
new Leaf.Window({
id: 'sys_role_copy_link_winid',
url: $('sys_role_copy_link').getUrl(),
params: {
orign_role_id: current_record.get('role_id'),
orign_role_code: current_record.get('role_code'),
orign_role_name: current_record.get('role_name'),
winid: 'sys_role_copy_link_winid'
},
title: '${l:SYS870.ROLE_COPY}',
height: 200,
width: 1100
});
}
function editfunctiongroup_assign(role_id) {
new Leaf.Window({
id: 'sys_function_group_assign_link_winid',
url: $('sys_function_group_assign_link').getUrl(),
params: {
role_id: role_id,
winid: 'sys_function_group_assign_link_winid'
},
title: '${l:SYS870.FUNCTION_GROUP_ASSIGN}',
height: 550,
width: 720
});
}
]]></script>
<a:dataSets>
<a:dataSet id="sys_role_query_ds" autoCreate="true" model="sys.sys_role"/>
<a:dataSet id="sys_role_result_ds" autoPageSize="true" autoQuery="true" fetchAll="false" model="sys.sys_role" queryDataSet="sys_role_query_ds" selectable="true">
<a:fields>
<a:field name="role_code" required="true"/>
<a:field name="start_date" required="true" validator="dateValidator"/>
<a:field name="end_date" validator="dateValidator"/>
<a:field name="role_name" required="true"/>
<a:field name="role_description" required="true"/>
</a:fields>
<a:events>
<a:event name="update" handler="onUpdate"/>
</a:events>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:gridButton click="sys_8010_back" text="HLS.BACK"/>
<a:gridButton click="sys_8010_next" text="HLS.FORWARD"/>
<a:gridButton click="sys_8010_quit" text="HLS.EXIT"/>
<a:gridButton click="queryRole" text="HLS.QUERY"/>
<a:gridButton click="sys_8010_grid_clear" text="HLS.CLEAR"/>
<a:gridButton click="sys_8010_grid_add" text="HLS.NEW"/>
<a:gridButton click="sys_8010_grid_remove" text="HLS.REMOVE"/>
<a:gridButton click="sys_8010_grid_submit" text="HLS.SAVE"/>
<a:gridButton click="sys_8010_role_copy" text="SYS870.ROLE_COPY"/>
</a:screenTopToolbar>
<a:form column="2" title="HAP_QUERY_TITLE">
<a:textField name="role_code" bindTarget="sys_role_query_ds" typeCase="upper" width="200">
<a:events>
<a:event name="enterdown" handler="queryRole"/>
</a:events>
</a:textField>
<a:textField name="role_name" bindTarget="sys_role_query_ds" width="200">
<a:events>
<a:event name="enterdown" handler="queryRole"/>
</a:events>
</a:textField>
</a:form>
<a:grid id="sys_8110_grid" bindTarget="sys_role_result_ds" marginHeight="180" marginWidth="30" navBar="true">
<a:columns>
<a:column name="role_code" editorFunction="roleEditorFunction" width="150"/>
<a:column name="role_name" editor="sys_role_result_grid_tf" width="150"/>
<a:column name="role_description" editor="sys_role_result_grid_tf" width="250"/>
<a:column name="start_date" editor="sys_role_result_grid_dp" renderer="Leaf.formatDate"/>
<a:column name="end_date" editor="sys_role_result_grid_dp" renderer="Leaf.formatDate"/>
<!-- <a:column name="role_id" align="center" prompt="SYS8110.LINK.ASSIGN_FUNCTION" renderer="actionRenderer"/> -->
<a:column name="function_group_assign" align="center" prompt="SYS870.ASSIGN_FUNCTION_GROUP" renderer="function_group_assign_renderer"/>
<a:column name="role_copy" align="center" prompt="SYS870.ROLE_COPY" renderer="function_copy_renderer"/>
<a:column name="function_group_copy" align="center" prompt="SYS870.FUNCTION_GROUP_COPY" renderer="function_group_renderer"/>
</a:columns>
<a:editors>
<a:textField id="sys_role_result_grid_tf"/>
<a:datePicker id="sys_role_result_grid_dp"/>
<a:lov id="sys_role_result_grid_lv"/>
<a:textField id="sys_role_result_grid_upper_tf" typeCase="upper"/>
</a:editors>
</a:grid>
</a:screenBody>
</a:view>
</a:screen>