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
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script">
<a:init-procedure>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
$ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
]]>
</s:server-script>
</a:init-procedure>
<a:view>
<a:link id="prj500_cdd_uploadFile_id"
url="${/request/@context_path}/uploadFile.lview"/>
<link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
<script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>
<a:link id="con707_save_atth_note_link" model="cont.CON707.con_contract_atth_note" modelaction="batch_update"/>
<a:link id="con707_con_contract_info_update_link"
model="cont.CON1100.con_contract_excuted" modelaction="execute"/>
<script type="text/javascript"><![CDATA[
Ext.ux.Lightbox.register('a[ref=img]', true);
/****************** 上传文件 *************************/
function open_uploadfile_win_c(record_id) {
new Leaf.Window({
url: $('con_contract_uploadfile_link_id').getUrl(),
title: '${l:HLS.SUPPORTING_DOCUMENT}',
params: {
'table_name': 'CON_CONTENT_FILE_ATTACHMENT',
'header_id': record_id
},
width: 850,
height: 400
});
}
//从app更新信息
function update_con_from_app(){
var url = $('con707_con_contract_info_update_link').getUrl();
var contract_id='${/parameter/@contract_id}';
Leaf.showConfirm('提示', '是否确认执行该操作?', function () {
csh707_lock_current_window();
Leaf.request({
url: url,
para: {
contract_id: contract_id
},
success: function (res) {
Leaf.SideBar.show({
msg: '执行成功!',
duration: 2000
});
$('con_contract_all_file_result_ds').query();
csh707_unlock_current_window();
},
failure: function () {
csh707_unlock_current_window();
},
error: function () {
csh707_unlock_current_window();
},
scope: this
});
});
}
function ds_doc_render_func(value, record, name) {
var check_id = record.get('check_id');
var url;
var text;
var save_table = record.get('save_table');
var save_table_pk = record.get('save_table_pk');
if (name == 'attachment') {
return '<a href="javascript:hls_attachment_window_open(\'' + save_table + '\',\'' + save_table_pk + '\',\'' + record.id + '\',\'' + record.ds.id + '\');">' + '附件上传' + '</a>';
} else if (name == 'attach_file_name') {
if (value != null) {
var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
var str = value.split(';;');
var url = '';
for (var i = 0; i < str.length; i++) {
var temp = str[i].split('--');
if (!Leaf.isEmpty(temp[0])) {
var file_name = temp[0].toUpperCase();
var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
if (file_name.indexOf('.PDF') >= 0) {
url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ',';
} else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
} else {
url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
}
}
}
return url;
}
} else if (name == 'access_record') {
return '<a href="javascript:hls_access_record_window_open(\'' + save_table + '\',\'' + save_table_pk + '\',\'' + record.id + '\',\'' + record.ds.id + '\');">' + '调阅记录' + '</a>';
}
}
function hls_attachment_window_open(save_table, save_table_pk, record_id, ds_id) {
url = $('prj500_cdd_uploadFile_id').getUrl() + '?table_name=' + save_table + '&header_id=' + save_table_pk;
wd = new Leaf.Window({
id: 'open_attachment_window',
url: url,
title: '附件上传',
height: 350,
width: 850
});
wd.on('close', function () {
$('con_contract_all_file_result_ds').query();
});
}
function view_pdf(attachment_id) {
Leaf.request({
url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
para: {
attachment_id: attachment_id
},
success: function (res) {
var path = res.result.record.file_path;
path = path.substr(path.indexOf('hls_attachment'));
var tomcat_source = '${/parameter/@tomcat_source}';
var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path;
var oWin = window.open(source_path);
},
scope: this
});
}
function csh707_exit() {
$('con_archive_atm_link_winId').close();
}
function csh707_save() {
var records = $('con_contract_all_file_result_ds').getSelected();
var post_data = [];
if (records.length == 0) {
Leaf.showMessage('${l:HLS.PROMPT}', '请至少选择一条数据!');
return;
}
for (var i = 0; i < records.length; i++) {
post_data.push({
'contract_id': records[i].get('contract_id'),
'save_table': records[i].get('save_table'),
'save_table_pk': records[i].get('save_table_pk'),
'note': records[i].get('note'),
'_status': 'update'
})
}
csh707_lock_current_window();
Leaf.request({
url: $('con707_save_atth_note_link').getUrl(),
para: post_data,
success: function () {
Leaf.SideBar.show({
msg: '操作成功',
duration: 2000
});
csh707_unlock_current_window();
$('con_contract_all_file_result_ds').query();
},
failure: function () {
csh707_unlock_current_window();
},
error: function () {
csh707_unlock_current_window();
},
scope: this
});
}
function csh707_lock_current_window(msg) {
Leaf.Masker.mask(Ext.getBody(), msg);
}
function csh707_unlock_current_window() {
Leaf.Masker.unmask(Ext.getBody());
}
]]></script>
<a:dataSets>
<a:dataSet id="basic_clause_tmplet_usage_ds" lookupCode="CON_TMPLET_USAGE"/>
<a:dataSet id="con_content_pigeonhole_type_ds" lookupCode="PIGEONHOLE_TYPE"/>
<a:dataSet id="con_contract_all_file_result_ds" autoQuery="true" fetchAll="true" selectable="true"
selectionModel="multiple"
model="cont.CON707.con_contract_file"
queryUrl="${/request/@context_path}/autocrud/cont.CON707.con_contract_file/query?contract_id=${/parameter/@contract_id}">
<a:fields>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:gridButton click="csh707_exit" text="HLS.EXIT"/>
<a:gridButton click="csh707_save" text="HLS.SAVE"/>
<a:gridButton click="update_con_from_app" text="从app更新信息"/>
</a:screenTopToolbar>
<a:grid id="con_contract_all_file_grid_id" bindTarget="con_contract_all_file_result_ds"
marginHeight="250" marginWidth="130" navBar="true" style="margin:20px">
<a:columns>
<a:column name="file_name" prompt="文档名称" width="200"/>
<!-- <a:column name="access_record" prompt="调阅记录" align="center" width="250"/>-->
<a:column name="attachment" renderer="ds_doc_render_func" align="center" prompt="附件上传" width="150"/>
<a:column name="attach_file_name" prompt="附件名称" renderer="ds_doc_render_func"
width="280"/>
<a:column name="atm_count" prompt="附件数量" align="center" width="80"/>
<a:column name="note" prompt="备注" editor="file_result_grid_textArea_id" width="250"/>
<a:column name="save_table" prompt="表名" hidden="true" width="250"/>
<a:column name="save_table_pk" prompt="主键" hidden="true" width="250"/>
</a:columns>
<a:editors>
<a:checkBox id="file_result_grid_checkBox_id"/>
<a:comboBox id="file_result_grid_comboBox_id"/>
<a:lov id="file_result_grid_lov_id"/>
<a:datePicker id="file_result_grid_datePicker_id"/>
<a:textArea id="file_result_grid_textArea_id" height="100" width="300"/>
</a:editors>
</a:grid>
</a:screenBody>
</a:view>
</a:screen>