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: peter soong
$Date: 2014-08-27 16:33:57
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure>
<a:model-query defaultWhereClause="t1.assess_hd_id=${/parameter/@assess_hd_id}" model="rsc.RSC504.rsc_value_assess_hd" rootPath="assess_hd_info"/>
</a:init-procedure>
<a:view>
<a:link id="rsc_value_assessment_save" url="${/request/@context_path}/modules/rsc/RSC504/rsc_value_assessment_save.lsc"/>
<a:link id="rsc_value_assessment_maintain" url="${/request/@context_path}/modules/rsc/RSC505/rsc_value_assessment_maintain.lview"/>
<a:link id="attach_upload_link" url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="rsc_value_assessment_link" url="${/request/@context_path}/modules/rsc/RSC505/rsc_value_assessment_maintain.lview"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function(){
var approval_status='${/model/assess_hd_info/record/@approval_status}';
if(approval_status=='APPROVING' || approval_status=='APPROVED'){
Ext.fly('detailDs_grid_add').setStyle({ display : 'none'});
Ext.fly('detailDs_grid_delete').setStyle({ display : 'none'});
Ext.fly('detailDs_grid_save').setStyle({ display : 'none'});
Ext.fly('detailDs_grid_submit').setStyle({ display : 'none'});
Ext.fly('detailDs_grid_upload').setStyle({ display : 'none'});
}
});
function detailDs_grid_editor(record,name){
var approval_status='${/model/assess_hd_info/record/@approval_status}';
if(name=='contract_number'){
if(approval_status=='APPROVING' || approval_status=='APPROVED'){
return '';
}
else{
return 'grid_lov';
}
}
if(name=='assess_name'||name=='asset_detail'||name=='operator'||name=='comments'){
if(approval_status=='APPROVING' || approval_status=='APPROVED'){
return '';
}
else{
return 'grid_tf';
}
}
if(name=='asset_type_desc'||name=='assess_way_desc'||name=='assess_method_desc'){
if(approval_status=='APPROVING' || approval_status=='APPROVED'){
return '';
}
else{
return 'grid_cb';
}
}
if(name=='assess_date'||name=='last_assess_date'){
if(approval_status=='APPROVING' || approval_status=='APPROVED'){
return '';
}
else{
return 'grid_dp';
}
}
if(name=='orig_value'||name=='assess_value'||name=='last_assess_value'){
if(approval_status=='APPROVING' || approval_status=='APPROVED'){
return '';
}
else{
return 'grid_nf';
}
}
}
function submitScreen_quit() {
window.location.href = $('rsc_value_assessment_maintain').getUrl();
}
var assess_hd_id = '${/parameter/@assess_hd_id}';
var assess_ln_id;
function detailScreen_save(value) {
var bp_id_tenant = '${/parameter/@bp_id_tenant}';
var lns_ds = $('detailDs');
var lns_reords = lns_ds.getAll();
var datas = [];
for (var i = 0;i < lns_reords.length;i++) {
var data = lns_reords[i].data;
datas.push(data);
}
var queryParams = new Object();
queryParams['details'] = datas;
queryParams['bp_id_tenant'] = bp_id_tenant;
queryParams['assess_hd_id'] = assess_hd_id;
if (lns_reords.length == 0) {
Leaf.showWarningMessage('消息', '请先点击新增,再保存。', null, 300, 100);
} else {
if (lns_ds.validate()) {
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
Leaf.request({
url: $('rsc_value_assessment_save').getUrl(),
para: queryParams,
success: function(args) {
assess_hd_id = args.result.assess_hd_id;
assess_ln_id = args.result.assess_ln_id;
$('detailDs').query();
if (value == 'sub') {
submitScreen_submit();
} else {
Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
Leaf.Masker.unmask(Ext.getBody());
}
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}
}
}
function submitScreen_submit() {
Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS.ARE_YOU_SURE_TO_SUBMIT}', function okFun() {
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
Leaf.request({
url: '${/request/@context_path}/autocrud/rsc.RSC504.rsc_value_assess_submit/execute',
para: {
assess_hd_id: assess_hd_id,
_status: 'execute'
},
success: function(res) {
Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
Leaf.Masker.unmask(Ext.getBody());
window.location.href = $('rsc_value_assessment_link').getUrl();
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}, Leaf.Masker.unmask(Ext.getBody()));
}
function detailScreen_save_submit() {
detailScreen_save('sub');
}
function submitScreen_upload() {
if ( !! assess_hd_id) {
var url = $('attach_upload_link').getUrl() + '?table_name=RSC_VALUE_ASSESS_HD&header_id=' + assess_hd_id;
new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'assessment_uploadfile_win',
width: 850,
height: 400
});
} else {
Leaf.showWarningMessage('消息', '请先保存。', null, 300, 100);
}
}
function detailDs_query(){
$('detailDs').query();
}
]]></script>
<a:dataSets>
<a:dataSet id="asset_type_ds" lookupCode="RSC504_ASSET_TYPE"/>
<a:dataSet id="asset_way_ds" lookupCode="RSC504_ASSET_WAY"/>
<a:dataSet id="asset_method_ds" lookupCode="RSC504_ASSET_METHOD"/>
<a:dataSet id="detailDs" autoPageSize="true" autoQuery="true" model="rsc.RSC504.rsc_value_assess_ln" queryUrl="${/request/@context_path}/autocrud/rsc.RSC504.rsc_value_assess_ln/query?assess_hd_id=${/parameter/@assess_hd_id}" selectable="true">
<a:fields>
<a:field name="contract_number" autoComplete="true" lovGridHeight="300" lovHeight="480" lovService="rsc.RSC504.rsc_value_contract_lov?bp_id=${/parameter/@bp_id_tenant}" lovWidth="550" required="true" title="合同信息">
<a:mapping>
<a:map from="contract_id" to="contract_id"/>
<a:map from="contract_name" to="contract_name"/>
<a:map from="contract_number" to="contract_number"/>
<a:map from="contract_num" to="contract_num"/>
</a:mapping>
</a:field>
<a:field name="contract_id"/>
<a:field name="contract_name"/>
<a:field name="asset_type_desc" displayField="code_value_name" options="asset_type_ds" required="true" returnField="asset_type" valueField="code_value"/>
<a:field name="asset_type"/>
<a:field name="assess_way_desc" displayField="code_value_name" options="asset_way_ds" required="true" returnField="assess_way" valueField="code_value"/>
<a:field name="assess_way"/>
<a:field name="assess_method_desc" displayField="code_value_name" options="asset_method_ds" required="true" returnField="assess_method" valueField="code_value"/>
<a:field name="assess_method"/>
<a:field name="assess_value" required="true"/>
<a:field name="assess_date" required="true"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:gridButton id="detailDs_grid_add" bind="detailDs_grid" type="add"/>
<!-- <a:gridButton bind="detailDs_grid" type="clear"/> -->
<a:gridButton id="detailDs_grid_delete" bind="detailDs_grid" type="delete"/>
<a:gridButton id="detailDs_grid_save" click="detailScreen_save" text="HLS.SAVE"/>
<a:gridButton id="detailDs_grid_submit" click="detailScreen_save_submit" text="HLS.SUBMIT"/>
<a:gridButton bind="detailDs_grid" type="excel"/>
<a:gridButton id="detailDs_grid_upload" click="submitScreen_upload" text="附件上传"/>
<a:gridButton click="submitScreen_quit" text="HLS.EXIT"/>
<!-- <a:gridButton click="detailDs_query" text="HLS.QUERY"/> -->
</a:screenTopToolbar>
<a:grid id="detailDs_grid" bindTarget="detailDs" marginHeight="250" marginWidth="30" navBar="true">
<!-- <a:toolBar>
<a:button />
</a:toolBar> -->
<a:columns>
<a:column name="contract_num" prompt="HLS.CONTRACT_NUM"/>
<a:column name="contract_number" editorFunction="detailDs_grid_editor" prompt="HLS.CONTRACT_NUMBER" width="120"/>
<a:column name="assess_name" editorFunction="detailDs_grid_editor" prompt="评估物品名称" width="200"/>
<a:column name="asset_type_desc" editorFunction="detailDs_grid_editor" prompt="资产类型" width="100"/>
<a:column name="asset_detail" editorFunction="detailDs_grid_editor" prompt="资产明细" width="120"/>
<a:column name="orig_value" editorFunction="detailDs_grid_editor" prompt="设备原值" renderer="Leaf.formatMoney" width="100"/>
<a:column name="assess_value" editorFunction="detailDs_grid_editor" prompt="本次评估价值" renderer="Leaf.formatMoney" width="100"/>
<a:column name="assess_date" editorFunction="detailDs_grid_editor" prompt="本次评估日期" renderer="Leaf.formatDate" width="100"/>
<a:column name="last_assess_value" editorFunction="detailDs_grid_editor" prompt="上次评估价值" renderer="Leaf.formatMoney" width="100"/>
<a:column name="last_assess_date" editorFunction="detailDs_grid_editor" prompt="上次评估日期" renderer="Leaf.formatDate" width="100"/>
<a:column name="assess_way_desc" editorFunction="detailDs_grid_editor" prompt="评估方式" width="100"/>
<a:column name="assess_method_desc" editorFunction="detailDs_grid_editor" prompt="评估方法" width="100"/>
<a:column name="operator" editorFunction="detailDs_grid_editor" prompt="评估机构" width="100"/>
<a:column name="comments" editorFunction="detailDs_grid_editor" prompt="备注" width="220"/>
</a:columns>
<a:editors>
<a:lov id="grid_lov"/>
<a:textField id="grid_tf"/>
<a:comboBox id="grid_cb"/>
<a:datePicker id="grid_dp"/>
<a:numberField id="grid_nf"/>
</a:editors>
</a:grid>
</a:screenBody>
</a:view>
</a:screen>