<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: LPC $Date: 2018-6-26 11:08:57 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true" dynamiccreateenabled="true" trace="true"> <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="get_special_fields_link_id" model="cont.CON500.con_contract_get_special_fields" modelaction="update"/> <a:link id="lon110_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <a:link id="lon110_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="bp_credit_modify_link_id" url="${/request/@context_path}/modules/lon/LON110/bp_credit_modify.lview"/> <a:link id="lon110_sap_eai_create_customer_link" url="${/request/@context_path}/modules/interface/INTERFACE_EAI/hls_sap_eai_CrCustomer.lsc"/> <a:link id="lon110_sap_eai_create_vender_link" url="${/request/@context_path}/modules/interface/INTERFACE_EAI/hls_sap_eai_CrVender.lsc"/> <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/> <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/> <script type="text/javascript"><![CDATA[ Ext.ux.Lightbox.register('a[ref=img]', true); //保存前调用,生成商机编号 window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master'); var address_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_address'); var bank_account_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_bank_account'); var head_record = $(ds_id).getCurrentRecord(); if($(address_ds_id).getAll().length == 0) { Leaf.showMessage('${l:HLS.PROMPT}', '至少录入一条地址信息!'); return true; } if($(bank_account_ds_id).getAll().length == 0) { Leaf.showMessage('${l:HLS.PROMPT}', '至少录入一条银行账户信息!'); return true; } var check_flag = false; if (head_record.get('bp_code')) { return true; } Leaf.request({ url: $('get_special_fields_link_id').getUrl(), para: { document_category: 'BP', // document_type: head_record.get('bp_type'), document_type: 'FUNDS', bp_class: head_record.get('bp_class'), function_code: '${/parameter/@function_code}', function_usage: '${/parameter/@function_usage}' }, success: function(res) { var document_number = res.result.document_number; head_record.set('bp_code', document_number); head_record.set('company_id', '${/session/@company_id}'); check_flag = true; }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, sync: true, scope: this }); return check_flag; }; //保存submitsuccess调用 window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) { var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master'); var bp_record = $(bp_ds_id).getCurrentRecord(); var bp_id = bp_record.get('bp_id'); Leaf.request({ url: $('lon110_sap_eai_create_customer_link').getUrl(), para: { bp_id: bp_id }, scope: this, success: function () { Leaf.request({ url: $('lon110_sap_eai_create_vender_link').getUrl(), para: { bp_id: bp_id }, scope: this, success: function () { $(bp_ds_id).query(); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, sync: true }); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, sync: true }); }; //更新时调用 window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master'); if (ds_id == ds.id) { if (name == 'validity_period_from') { var validity_period_to = record.get('validity_period_to'); if (value > validity_period_to) { Leaf.showMessage('${l:HLS.PROMPT}', '有效期从不能大于有效期到!'); return true; } } if (name == 'validity_period_to') { var validity_period_from = record.get('validity_period_from'); if (value < validity_period_from) { Leaf.showMessage('${l:HLS.PROMPT}', '有效期到不能小于有效期从!!'); return true; } } } }; //授信额度新增按钮 window['${/parameter/@layout_code}_G_CREDIT_LIN_USER_BUTTON1_layout_dynamic_tab_click'] = function () { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master'); var record = $(ds_id).getCurrentRecord(); var bp_id = record.get('bp_id'); if (!Ext.isEmpty(bp_id)) { var param ={}; param['function_code'] = 'LON110'; param['url_title'] = '授信额度明细'; param['bp_id'] = bp_id; param['winid'] = 'lon110_bp_credit_modify_winid'; hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'bp_credit_modify_link_id',ds_id,'${/parameter/@layout_code}'); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } else { Leaf.showMessage('提示', '请先保存!'); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); return; } }; 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 upload_file(id, name, query_only) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; if (record.get('hls_credit_attch_id')) { var url; if (query_only == 'Y') { url = $('lon110_cdd_downloadFile_id').getUrl() + '?table_name=HLS_BP_MASTER_CREDIT_ATTCH&header_id=' + record.get('hls_credit_attch_id'); } else { url = $('lon110_cdd_uploadFile_id').getUrl() + '?table_name=HLS_BP_MASTER_CREDIT_ATTCH&header_id=' + record.get('hls_credit_attch_id'); } var win = new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: 'cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function() { $('${/parameter/@layout_code}_ACY_hls_bp_master_credit_attch_ds').setQueryParameter('bp_id', record.get('bp_id')); $('${/parameter/@layout_code}_ACY_hls_bp_master_credit_attch_ds').query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } }; //超链接渲染 window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) { window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record; if (name == 'attachment') { link_function = 'upload_file'; if (record.get('attach_count') == 0 || !record.get('attach_count')) { return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; } else { return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '(' + record.get('attach_count') + ')' + '</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; } } }; ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view> </a:screen>