Commit 9a07874a authored by 18083's avatar 18083

Merge remote-tracking branch 'origin/remote_dev' into remote_dev

# Conflicts:
#	src/main/webapp/modules/cont/CON731/hls_con_contract_change_detail.lview
parents d09d8d39 149de569
var add_datafilters=[
{
name:'contract_id',
expression:"(t1.contract_id=${/parameter/@contract_id})"
}
];
add_datafilter();
\ No newline at end of file
......@@ -11,7 +11,6 @@
</a:init-procedure>
<a:view>
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="csh_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<a:link id="${/parameter/@layout_code}asset_fee_detail_link"
url="${/request/@context_path}/modules/cont/CON1370/con_asset_fee_detail.lview"/>
<script type="text/javascript"><![CDATA[
......@@ -21,36 +20,29 @@
var param = {};
param['function_code'] = 'CON1370N';
param['function_usage'] = 'QUERY';
param['contract_id'] = record.get('contract_id')
param['contract_id'] = record.get('contract_id');
param['maintain_type'] = 'QUERY';
param['url_title'] = '明细';
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, '${/parameter/@layout_code}asset_fee_detail_link',ds_id);
}
//上传附件
function upload_csh_file(id,record_id) {
function open_asset_detail(record_id, ds_id) {
debugger;
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if(record_id == "undefined"){
var url = $('csh_downloadFile_id').getUrl();
}else {
url = $('csh_downloadFile_id').getUrl() + '?table_name=CSH_PAYMENT_REQ_ASSET_HD&header_id=' + record_id;
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'csh_attachment_uploadFile_id',
width: 850,
height: 400
});
win.on('close', function () {
//record.ds.query();
});
var record = $(ds_id).findById(record_id);
var param = {};
param['function_code'] = 'CON1370N';
param['function_usage'] = 'QUERY';
param['contract_id'] = record.get('contract_id');
param['winid'] = 'open_asset_check_id';
param['maintain_type'] = 'QUERY';
param['url_title'] = '明细';
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, '${/parameter/@layout_code}asset_fee_detail_link',ds_id);
}
//超链接渲染
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
debugger;
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if(name == 'have_payment'){
......@@ -58,8 +50,8 @@
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
}
if(name == 'asset_file'){
link_function = 'upload_csh_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.get('payment_req_id') + '\')">' + '附件' + '</a>';
link_function = 'open_asset_detail';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.ds.id + '\')">' + '附件' + '</a>';
}
};
]]></script>
......
......@@ -10,7 +10,78 @@
<a:init-procedure>
</a:init-procedure>
<a:view>
<a:link id="csh_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function() {
debugger;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_write_off');
$(ds_id).setQueryParameter('contract_id','${/parameter/@contract_id}');
$(ds_id).query();
if('${/parameter/@winid}' == 'open_asset_check_id'){
var gridId= 'CON_ASSET_FEE_DETAIL_ASSET_GRID_csh_write_off_layout_grid_id';
$(gridId).hideColumn('write_off_type_desc');
$(gridId).hideColumn('write_off_date');
$(gridId).hideColumn('write_off_amount');
$(gridId).hideColumn('payment_date');
$(gridId).hideColumn('payment_amount');
$(gridId).hideColumn('creade_by');
}
});
//附件
function upload_csh_file(id,record_id) {
debugger;
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if(record_id == "undefined"){
var url = $('csh_downloadFile_id').getUrl();
}else {
url = $('csh_downloadFile_id').getUrl() + '?table_name=CSH_PAYMENT_REQ_ASSET_HD&header_id=' + record_id;
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'csh_attachment_uploadFile_id',
width: 850,
height: 400
});
win.on('close', function () {
//record.ds.query();
});
}
//发票附件
function upload_invoice_file(id,record_id) {
debugger;
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if(record_id == "undefined"){
var url = $('csh_downloadFile_id').getUrl();
}else {
url = $('csh_downloadFile_id').getUrl() + '?table_name=HL_REQ_PAYMENT_ACP&header_id=' + record_id;
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'invoice_attachment_uploadFile_id',
width: 850,
height: 400
});
win.on('close', function () {
//record.ds.query();
});
}
//超链接渲染
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if(name == 'attachment'){
link_function = 'upload_csh_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.get('payment_req_id') + '\')">' + '附件'+ '</a>';
}
if(name == 'invoice_link'){
link_function = 'upload_invoice_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.get('payment_req_id') + '\')">' + '发票附件' + '</a>';
}
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<a:model-update model="hls.HLS811.hls_doc_file_templet_get_atm"/>
<s:server-script import="contract_print_path.js"><![CDATA[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j);
importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.org.apache.commons.io);
//删除文件
function deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
//生成pdf
function wordToPdf(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
wordToPdf.word2pdf(word_file_path, pdf_file_path_new);
//删除word文件
//deleteFile(word_file_path);
return pdf_file_path_new;
}
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 4);
var len = -1;
while ((len = fis.read(b)) != -1) {
fos.write(b, 0, len);
}
fis.close();
fos.close();
}
function transfer(file_path, os) {
println(file_path);
var fis = new FileInputStream(file_path);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
function write_os_to_file(file, os) {
var fis = new FileInputStream(file);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
function download_file(file_name, file_path) {
$ctx["__request_type__"] = 'file'; //to indicate this request is not a JSON_REQUEST
var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
resp.setHeader("Pragma", "No-cache");
resp.setHeader("Cache-Control", "no-cache, must-revalidate");
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'UTF-8'));
var os = resp.getOutputStream();
//transfer(file_path, os);
write_os_to_file(file_path, os);
os.flush();
}
//按日期创建目录
function getDatePath() {
set_parameter_file_path();
var file_path = $ctx.parameter.pdf_path; //file_path = c:/hls_test_files/content_files/
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
var datePath = file_path + y + "/" + m + "/";
return datePath; //datePath = d:/hls_test_files/fileupload/2018/04/
}
function collection_create_content() {
try {
var datePath = getDatePath();
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var attachment_batch_dl = $bm('hls.HLS811.hls_doc_file_templet_get_atm');
var result = attachment_batch_dl.queryAsMap({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table,
batch_flag: $ctx.parameter.batch_flag,
content_id: $ctx.parameter.content_id
});
var from_file_data = result.getChildren();
for (var i = 0;i < from_file_data.length;i++) {
if (!$ctx.parameter.file_path) {
set_parameter_file_path();
}
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
//if (record_data.file_exists_flag != 'Y') {
var to_file_name = record_data.to_file_name;
var from_file_path = record_data.file_path;
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = datePath + guid_file_name_tables[0].guid_file_name + 'doc' + record_data.content_id;
copyFile(from_file_path, to_file_path);
try {
$bm('csh.CSH501.csh_transaction_return_print').update({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table
});
var brwt = new BookmarksReplaceWithText($instance('leaf.database.service.IDatabaseServiceFactory'), $instance('uncertain.ocm.IObjectRegistry'), $ctx.getData());
brwt.replaceBookmarkFromContent(to_file_path.toString(), record_data.content_id.toString(), 'COMMON');
} catch (e) {
raise_app_error(e);
}
// word转pdf
var pdf_file_path=to_file_path;
var outputfilepath = wordToPdf(to_file_path,pdf_file_path);
//var outputfilename= record_data.to_file_name +'.pdf';
var filename_str = record_data.to_file_name;
var outputfilename= filename_str.substr(0, filename_str.length - 5) +'.pdf';
var pdf_file = new File(outputfilepath);
var file_size = 0;
if (pdf_file.exists()) {
file_size = pdf_file.length();
}
$bm('hls.HLS811.hls_file_content_copy_update').update({
table_name: 'HLS_DOC_FILE_CONTENT',
content_id: record_data.content_id,
file_name: outputfilename.toString(),
file_path: outputfilepath.toString(),
source_type: $ctx.parameter.source_type
});
//var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
//HlsFileUtil.downloadFile(encodeURI(to_file_path,'utf-8'),encodeURI(to_file_name,'utf-8'),resp);
//print(outputfilepath.toString());
//print(outputfilename.toString());
download_file(outputfilename.toString(),outputfilepath.toString());
}
$ctx.parameter.return_status = 'S';
$ctx.parameter.return_message = '执行成功';
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = 'E';
$ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
raise_app_error(e);
}
var result = {
result: $ctx.parameter.return_status,
message: $ctx.parameter.return_message
};
$ctx.parameter.json = JSON.stringify(result);
}
if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
collection_create_content();
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
......@@ -19,7 +19,7 @@
</a:init-procedure>
<a:view>
<a:link id="csh_payment_req_word_print_link_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_word_print.lsc"/>
url="${/request/@context_path}/modules/csh/CSH501C/csh_payment_asset_pdf.lsc"/>
<a:link id="csh501d_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="con_rd_wfl_link" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
......@@ -322,7 +322,7 @@
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(hdds_id).getCurrentRecord();
var url_l = $('csh_payment_req_word_print_link_id').getUrl() + '?document_id=' + hd_record.get('payment_req_id') + '&document_table=CSH_PAYMENT_REQ&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
var url_l = $('csh_payment_req_word_print_link_id').getUrl() + '?document_id=' + hd_record.get('payment_req_id') + '&document_table=CSH_PAYMENT_REQ_ASSET_HD&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
window.open(href = url_l, target = "_self");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment