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
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2013-9-10 下午01:51:25
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure/>
<a:view>
<a:link id="leg_print_detail_link" url="${/request/@context_path}/modules/leg/LEG400/leg_content_print_word.lview"/>
<a:link id="leg_print_information_link" model="leg.LEG400.leg_content_print_info" modelaction="execute"/>
<a:link id="leg400_batch_dl_link" url="${/request/@context_path}/modules/leg/LEG400/leg_atm_batch_dl.lsc"/>
<a:link id="leg400_content_create_link" model="leg.LEG400.leg_content_create" modelaction="execute"/>
<script type="text/javascript"><![CDATA[
function lock_current_window() {
Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
}
function unlock_current_window() {
Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
}
function on_result_load(ds) {
var records = ds.getAll();
for (var i = 0;i < records.length;i++) {
var record = records[i];
}
}
function leg400_delete_print(){
$('leg_content_print_detail_grid').remove();
}
function leg400_print_detail_print() {
//
if ($('leg_content_print_detail_ds').validate(true)) {
var records = $('leg_content_print_detail_ds').getSelected();
if (records.length == 0) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
return;
}
lock_current_window();
$('leg400_print_btn').disable();
for(i=0;i<records.length;i++){
var record = records[i];
var templt_name;
var clause_usage = record.get('clause_usage');
var ref_v01 = record.get('ref_v01');
var content_id = record.get('content_id');
var file_path = 'E:\\u01\\lsh_leg\\';
Leaf.request({
url: $('leg_print_information_link').getUrl(),
para: {
content_id: record.get('content_id'),
file_path:file_path,
type:'doc',
file_name:ref_v01
},
success: function() {
if (clause_usage == 'DUNNING') {
templt_name = 'leg_dunning.xml';
} else if (clause_usage == 'SIGN') {
templt_name = 'leg_sign.xml';
} else if (clause_usage == 'KEEP_PAPER') {
templt_name = 'leg_keep_paper.xml';
} else if (clause_usage == 'REPURCHASE_CONFIRM') {
templt_name = 'leg_repurchase_confirm.xml';
} else if (clause_usage == 'REPURCHASE') {
templt_name = 'leg_repurchase.xml';
} else if (clause_usage == 'CANCEL_CONTRACT') {
templt_name = 'leg_cancel_contract.xml';
} else if(clause_usage == 'LAW'){
templt_name = 'leg_law.xml';
} else if(clause_usage == 'DELIVERY_AUTHO'){
templt_name = 'leg_delivery_autho.xml';
} else if (clause_usage == 'DELIVERY_CERTI') {
templt_name = 'leg_delivery_certi.xml';
} else if(clause_usage == 'RETURN_CONFIRM'){
templt_name = 'leg_return_confirm.xml';
} else if(clause_usage == 'ENTRUST'){
templt_name = 'leg_entrust.xml';
} else if(clause_usage == 'AUTHO_LETTER'){
templt_name = 'leg_autho_letter.xml';
} else if(clause_usage == 'DUNNING_NOTICE'){
templt_name = 'leg_dunning_notice.xml';
}
var url = $('leg_print_detail_link').getUrl() + '?templt_name=' + templt_name + '&file_name=' + ref_v01 + '&file_path=' + file_path+'&contract_id=${/parameter/@contract_id}&legal_letter_id=${/parameter/@legal_letter_id}&law_id=${/parameter/@law_id}&clause_usage='+clause_usage+'&content_id='+content_id;
var form = document.createElement("form");
form.target = "word_export_window";
form.method = "post";
form.action = url;
var iframe = Ext.get('word_export_window') || new Ext.Template('<iframe id ="word_export_window" name="word_export_window" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;display:none"></iframe>').insertFirst(document.body, {}, true);
document.body.appendChild(form);
form.submit();
Ext.fly(form).remove();
unlock_current_window();
Leaf.SideBar.show({
msg:'文件已生成',
duration:2000
});
},
failure: function() {
alert('1');
unlock_current_window();
},
error: function() {
alert('2');
unlock_current_window();
},
sync:true,
scope: this
});
}
$('leg_content_print_detail_ds').query();
$('leg400_print_btn').enable();
}
}
function leg400_create_file(){
Leaf.request({
url:$('leg400_content_create_link').getUrl(),
para:{contract_id: '${/parameter/@contract_id}',
clause_usage: '${/parameter/@clause_usage}'},
success:function(){
Leaf.SideBar.show({
msg:'文件已生成',
duration:2000
});
$('leg_content_print_detail_ds').query();
},
scope:this
});
}
function update_attachment_renderer(value, record, name) {
var content_id = record.get('content_id');
return '<a href="javascript:downloadfile_link(' + content_id + ')">下载</a>';
}
function downloadfile_link(content_id) {
var url = $('leg400_batch_dl_link').getUrl() + '?content_id=' + content_id;
window.open(url, '_self');
}
function leg400_download_zip(){
var url = $('leg400_batch_dl_link').getUrl() + '?contract_id=' + '${/parameter/@contract_id}';
window.open(url, '_self');
}
]]></script>
<a:dataSets>
<a:dataSet id="leg_content_print_detail_header_ds" loadData="true" model="leg.LEG400.con_contract_v">
<a:fields>
<a:field name="contract_number" readOnly="true"/>
<a:field name="contract_name" readOnly="true"/>
<a:field name="bp_name" readOnly="true"/>
</a:fields>
</a:dataSet>
<a:dataSet id="leg_content_print_detail_ds" autoQuery="true" model="leg.LEG400.leg_legal_content" queryUrl="${/request/@context_path}/autocrud/leg.LEG400.leg_legal_content/query?contract_id=${/parameter/@contract_id}&function=${/parameter/@function}" selectable="true">
<a:fields>
<a:field name="bp_name"/>
<a:field name="templet_name"/>
<a:field name="content_number"/>
<a:field name="print_date" datatype="java.util.DATE"/>
</a:fields>
<a:events>
<a:event name="load" handler="on_result_load"/>
</a:events>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar style="width:848px">
<a:gridButton click="leg400_create_file" text="生成法务文件"/>
<a:gridButton id="leg400_print_btn" click="leg400_print_detail_print" text="PRJ702.GENERATE_THE_FILE"/>
<a:gridButton click="leg400_download_zip" text="PRJ702.THE_FILE_DOWNLOAD"/>
<a:gridButton click="leg400_delete_print" text="HLS.REMOVE"/>
</a:screenTopToolbar>
<a:form column="2" title="法务文本打印" width="852">
<a:textField name="contract_number" bindTarget="leg_content_print_detail_header_ds" prompt="HLS.CONTRACT_NUMBER"/>
<a:textField name="contract_name" bindTarget="leg_content_print_detail_header_ds" prompt="HLS.CONTRACT_NAME" width="330"/>
</a:form>
<a:grid id="leg_content_print_detail_grid" bindTarget="leg_content_print_detail_ds" height="300" navBar="true" width="850">
<a:columns>
<a:column name="ref_v01" prompt="法务文件名" width="200"/>
<a:column name="print_date" prompt="PRJ702.FILE_GENERATED_DATE" renderer="Leaf.formatDate" width="80"/>
<a:column name="bp_name" prompt="承租人名称"/>
<a:column name="content_print_flag_name" prompt="CON505.CON_CONTENT_STATUS" width="80"/>
<a:column name="attachment" align="center" prompt="HLS.ATTACHMENT" renderer="update_attachment_renderer" width="50"/>
</a:columns>
</a:grid>
</a:screenBody>
</a:view>
</a:screen>