<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: lpc 9874 $Date: 2017/11/24 13:52:40 $Revision: 1.0 $purpose: 经销商创建 创建界面 --> <a:screen xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true"> <a:init-procedure> <!-- <a:model-query defaultWhereClause="t1.user_id=${/session/@user_id}" model="prj.PRJ500D.sys_user_lv" rootPath="user_name_path"/> --> <a:model-query fetchAll="true" model="prj.PRJ500D.amount_check" rootPath="amount_check"/> <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_car_organization_id" model="prj.PRJ500D.yonda_car_organization" modelaction="query"/> <!-- <a:link id="get_special_fields_link_id" model="cont.CON500.con_contract_get_special_fields" modelaction="update"/> --> <a:link id="get_special_fields_link_id" model="prj.PRJ500.get_new_prj_number" modelaction="update"/> <a:link id="check_gps_visit_link" model="hls.HLS051.check_gps_visit" modelaction="execute"/> <a:link id="get_calc_id" model="prj.PRJ500D.calc_quotation" modelaction="update"/> <a:link id="check_product_package_bag_link_id" model="prj.PRJ500D.prj_project_before_workflow_start" modelaction="update"/> <a:link id="submit_approval_link" model="prj.PRJ500D.prj_project_workflow_start" modelaction="update"/> <a:link id="prj_submit_link" model="prj.PRJ500D.prj_project_workflow_start" modelaction="execute"/> <a:link id="prj500_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <a:link id="prj500_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <a:link id="get_id_card_no_info_id" model="prj.PRJ500D.hls_bp_master_np_v" modelaction="query"/> <a:link id="get_organization_code_id" model="prj.PRJ500D.hls_bp_master_org_v" modelaction="query"/> <a:link id="get_id_card_no_info_guar_id" model="prj.PRJ500D.hls_bp_master_np_guar" modelaction="query"/> <a:link id="get_org_code_info_guar_id" model="prj.PRJ500D.hls_bp_master_org_guar" modelaction="query"/> <a:link id="get_id_card_no_tenant_sec_id" model="prj.PRJ500D.hls_bp_master_np_tenant_sec_v" modelaction="query"/> <a:link id="user_id_query_link" model="prj.PRJ500D.sys_user_lv" modelaction="query"/> <a:link id="get_calc_validate_sql_link" model="prj.PRJ500D.prj_get_calc_validate_sql" modelaction="query"/> <a:link id="get_car_organization_id_link" model="prj.PRJ500D.get_hls_car_organization" modelaction="query"/> <a:link id="get_company_distrct_link" model="prj.PRJ500D.get_company_info" modelaction="query"/> <a:link id="get_bp_id_invoice_link" model="prj.PRJ500D.get_bp_id_invoice" modelaction="query"/> <!-- <a:link id="get_atch_download_link" url="${/request/@context_path}/modules/batch_download/lease_atm_batch_dl.lsc"/> --> <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/> <a:link id="con_item_frame_number_link" model="cont.CON501N.con_item_frame_number" modelaction="execute"/> <a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calc_quotation_header.lview"/> <a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id" url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_update_n.lview"/> <a:link id="${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation.lsc"/> <a:link id="${/parameter/@layout_code}_hls_fin_calc_get_base_rate_link_id" model="hls.HLS500.hls_fin_calc_get_base_rate" modelaction="update"/> <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 src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/check_org_code.js" type="text/javascript"/> --> <script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/> <style type="text/css"><![CDATA[ .redBG{ background-color:#FFC0CB; } .yellowBG{ background-color:#FFFF00; } ]]></style> <script type="text/javascript"><![CDATA[ jQuery.noConflict(); var isLoaded = 'N'; // set单元格颜色 load事件无法实现效果 //hongquan.dai 20180125 var check_isload = setInterval(function() { if (isLoaded == 'N') { var ids = $('${/parameter/@layout_code}_ACY_prj_cdd_item_doc_ref_ds'); var idsRecord = ids.getAll(); for (var i = 0;i < idsRecord.length;i++) { var rowData = idsRecord[i]; var important_flag = rowData.get('important_flag'); //important_flag 是否必须上传 if (important_flag == 'Y') { //普通动态布局 布局代码+组件名+基表名+_layout_grid_id-u- //支撑文件 布局代码+组件名+基表名+_grid_id-u- //tr_id = '#${/parameter/@layout_code}_ACY_prj_cdd_item_doc_ref_layout_grid_id-u-' + rowData.id; tr_id = '#${/parameter/@layout_code}_ACY_con_contract_grid_id-u-' + rowData.id; jQuery(tr_id).addClass('redBG'); } } } else { clearInterval(check_isload); } }, 1000); Ext.ux.Lightbox.register('a[ref=img]', true); //忽略保存校验方法 window['${/parameter/@layout_code}_ignore_required_before_save'] = function() { // param['show_history_flag'] = 'Y'; window['${/parameter/@layout_code}_not_ignore_required_flag'] = false; }; Ext.ux.Lightbox.register('a[ref=img]', true); var submit_wfl_flag = 'N'; //提交审批 window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() { // //提交先保存 var root_ds = $('${/parameter/@layout_code}_virtual_ds'); if (root_ds.validate()) { window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](); var project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item'); var project_record = $(project_ds_id).getCurrentRecord(); var division = project_record.get('division'); if (division == '02') { var lease_item_record = $(lease_item_ds_id).getCurrentRecord(); if (!lease_item_record) { Leaf.showMessage('${l:HLS.PROMPT}', '请先添加租赁物!'); return; } else { Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function() { // var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](); window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('submit_approval_link').getUrl(), para: { layout_code: '${/parameter/@layout_code}', project_id: $(project_ds_id).getAt(0).get('project_id') }, success: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); Leaf.SideBar.show({ msg: '操作成功', duration: 2000 }); }, failure: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, scope: this }); }); } } else if (division == '09') { Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function() { Leaf.request({ url: $('submit_approval_link').getUrl(), para: { layout_code: '${/parameter/@layout_code}', project_id: $(project_ds_id).getAt(0).get('project_id') }, success: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); Leaf.SideBar.show({ msg: '操作成功', duration: 2000 }); }, failure: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, scope: this }); }); } else if (division !== '02' && division !== '09') { var head_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_HEAD_CAR_prj_project_lease_item_ds'; var trailer_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_TRAILER_prj_project_lease_item_ds'; var bus_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_BUS_prj_project_lease_item_ds'; var passenger_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_PASSENGER_CAR_prj_project_lease_item_ds'; var head_car_record = $(head_car_ds_id).getCurrentRecord(); var trailer_record = $(trailer_ds_id).getCurrentRecord(); var bus_record = $(bus_ds_id).getCurrentRecord(); var passenger_car_record = $(passenger_car_ds_id).getCurrentRecord(); if (!head_car_record && !trailer_record && !bus_record && !passenger_car_record) { Leaf.showMessage('${l:HLS.PROMPT}', '请先添加租赁物!'); return; } else { Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function() { // var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](); window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request({ url: $('submit_approval_link').getUrl(), para: { layout_code: '${/parameter/@layout_code}', project_id: $(project_ds_id).getAt(0).get('project_id') }, success: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); Leaf.SideBar.show({ msg: '操作成功', duration: 2000 }); }, failure: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, scope: this }); }); } } } }; //预审 window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() { // var root_ds = $('${/parameter/@layout_code}_virtual_ds'); if (root_ds.validate()) { window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function() { Leaf.request({ url: $('prj_submit_link').getUrl(), para: { layout_code: '${/parameter/@layout_code}', project_id: $(ds_id).getAt(0).get('project_id') }, success: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $('${/parameter/@winid}').close(); Leaf.SideBar.show({ msg: '操作成功', duration: 2000 }); }, failure: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { submit_wfl_flag = 'N'; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, scope: this }); }); } }; //保存submitsuccess调用 window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res) { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); //直接计算报价 modify zhuxianfei window['${/parameter/@layout_code}_quote_layout_dynamic_click'](); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); if (submit_wfl_flag == 'Y') { submit_wfl_flag = 'N'; } else { if (ds_id) { record = $(ds_id).getAt(0); var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref'); $(cdd_item_ds_id).setQueryParameter('cdd_list_id', record.get('cdd_list_id')); $(cdd_item_ds_id).query(); var prj_cdd_item_doc_ref_ds = $(cdd_item_ds_id); function prj_cdd_item_doc_ref_load() { //取消重复监听 prj_cdd_item_doc_ref_ds.un('load', prj_cdd_item_doc_ref_load); $(cdd_item_ds_id).submit(); } prj_cdd_item_doc_ref_ds.on('load', prj_cdd_item_doc_ref_load); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } // // var project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); // var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item'); // var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); // var quotation_record = $(quotation_ds_id).getCurrentRecord(); // var project_record = $(project_ds_id).getCurrentRecord(); // var division = project_record.get('division'); // var sum = 0; // if (division == '02') { // if (lease_item_ds_id) { // var lease_item_record = $(project_ds_id).getAll(); // for (var i = 0;i < lease_item_record.length;i++) { // var finance_amount = lease_item_record[i].get('finance_amount'); // sum += finance_amount; // } // quotation_record.getField('other_fee').setReadOnly(true); // quotation_record.set('other_fee', sum); // } // } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }; 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('check_id')) { var url; if (query_only == 'Y') { url = $('prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else { url = $('prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } var win = new Leaf.Window({ url: url, title: '附件上传', id: 'prj500_cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function() { record.ds.query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } } window['${/parameter/@layout_code}_quote_layout_dynamic_click'] = function() { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var prj_project_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var head_record = $(prj_project_ds).getCurrentRecord(); var prj_quo_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var record = $(prj_quo_ds).getCurrentRecord(); // var record = $(ds_id).findById(record_id); // var head_record = $(record.ds.bindtarget).getAt(0), var url; var calc_tpe = '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR'; if (!head_record.get('project_id')) { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); return; } if (calc_tpe == 'LITE_CALCULATOR') { url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_id').getUrl(); } else if (calc_tpe == 'CLASSIC_CALCULATOR') { url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id').getUrl(); } else { Leaf.showMessage('${l:PROMPT}', '${l:HLS.CALC_TYPE_IS_NULL}'); return; } if ($(record.ds.id).validate()) { // if (!record.get('price_list') || !record.get('currency') || !record.get('lease_times')) { // Leaf.showMessage('${l:PROMPT}', '${l:HLS.QUOTATION_EXECUTE_AFTER_SAVE}'); // return; // } window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var parent_pk_value = head_record.get('project_id'); record.set('function_code', '${/parameter/@function_code}'); record.set('function_usage', '${/parameter/@function_usage}'); record.set('project_id', parent_pk_value); record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD'); record.set('from_doc_table', 'PRJ_QUOTATION'); record.set('from_doc_pk', record.get('quotation_id')); record.set('calculate_flag', 'Y'); // record.set('business_type', business_type); // record.set('business_type_n', business_type_n); var calc_recreate_L_formula; if (record.get('quotation_id') && !record.get('calc_session_id')) { calc_recreate_L_formula = 'Y'; record.set('_status', 'update'); } else if (record.get('quotation_id') && record.get('calc_session_id')) { calc_recreate_L_formula = 'N'; record.set('_status', 'execute'); } else { calc_recreate_L_formula = 'Y'; record.set('_status', 'insert'); } var saveData = []; saveData.push(record.data); /*改成如果是只读的话,就调用只读页面*/ var link_url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(); if ('${/parameter/@maintain_type}' == 'QUERY') { link_url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_readonly_link_id').getUrl(); parent.open_render_window('global_hls_fin_calculator_readonly_id', ({ calc_session_id: record.get('calc_session_id'), winId: 'global_hls_fin_calculator_readonly_id', global_flag: 'Y' }), link_url, '${l:HLS.FIN_CALCULATOR}'); window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); return; } Leaf.request({ url: link_url, para: saveData, success: function(res) { // window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); // $(record.ds.id).query(); // var quotation_id = record.get('quotation_id') || res.result.quotation_id; // quo_win = new Leaf.Window({ // id: '${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_winid', // params: { // document_id: parent_pk_value, // document_category: '${/parameter/@document_category}', // maintain_type: '${/parameter/@maintain_type}', // calc_session_id: res.result.record.calc_session_id, // quotation_id: quotation_id, // dsId: record.ds.id, // winId: '${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_winid', // global_flag: 'Y', // id_num: 0, // calc_type: '${/parameter/@calc_type}', // recreate_L_formula: calc_recreate_L_formula // }, // url: url, // fullScreen: true, // //draggable: true // }); // quo_win.addListener('close', function() { // // $(loan_contract_ds_id).setQueryParameter('project_id', parent_pk_value); // $('${/parameter/@layout_code}_QUOTE_RENT_hls_fin_calculator_ln_ds').query(); // }); // var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); if (quotation_ds_id) { record = $(quotation_ds_id).getCurrentRecord(); var project_id = record.get('project_id'); $(quotation_ds_id).setQueryParameter('project_id', project_id); // $(quotation_ds_id).setQueryParameter('quotation_id', quotation_id); $(quotation_ds_id).query(); } var ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_fin_calculator_ln'); $(ln_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'](); }, scope: this }); } }; //超链接渲染 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_file'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</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 == 'description') { if (record.get('important_flag') == 'Y') { return '<font color="RED">' + value + '</font>'; } return value; } }; /*查询前调用*/ window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) { var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var prj_record = $(prj_project_ds_id).getAt(0); qpara.project_id = prj_record.get('project_id'); }; /*保存前调用,生成项目编号*/ window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function(ds, record) { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var prj_record = $(prj_project_ds_id).getAt(0); var quo_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); //modify by lpc for deron 车款等于车辆的实际融资额之和 // if (ds.id == quo_ds_id) { if (ds.fields.product_id) { if (record.get('product_id') !== '2420') { record.getField('int_rate_display').setReadOnly(true); record.getField('deposit_ratio').setReadOnly(true); record.getField('lease_charge_ratio').setReadOnly(true); record.getField('lease_times').setReadOnly(true); record.getField('price_list').setReadOnly(true); record.getField('down_payment_ratio').setReadOnly(true); record.getField('annual_pay_times').setReadOnly(true); } else { record.getField('int_rate_display').setReadOnly(false); record.getField('deposit_ratio').setReadOnly(false); record.getField('lease_charge_ratio').setReadOnly(false); record.getField('lease_times').setReadOnly(false); record.getField('price_list').setReadOnly(false); record.getField('down_payment_ratio').setReadOnly(false); record.getField('annual_pay_times').setReadOnly(false); } } if (ds.fields.other_fee) { var project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); // var lease_item_ds_id = '${/parameter/@layout_code}' + '_G_CAR_INFO_prj_project_lease_item_ds'; var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item'); var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var quotation_record = $(quotation_ds_id).getCurrentRecord(); var project_record = $(project_ds_id).getCurrentRecord(); var division = '${/parameter/@division}'; var other_fee_sum = 0; //车款 var insurance_price_sum = 0; //保险 var gps_amount_sum = 0; //GPS var purchase_tax_sum = 0; //购置税金额 if (division == '02') { if (lease_item_ds_id) { var lease_item_record = $(lease_item_ds_id).getAll(); for (var i = 0;i < lease_item_record.length;i++) { var finance_amount = lease_item_record[i].get('finance_amount'); other_fee_sum += finance_amount; } // quotation_record.getField('other_fee').setReadOnly(true); quotation_record.set('other_fee', other_fee_sum); } else { // quotation_record.getField('other_fee').setReadOnly(false); quotation_record.set('other_fee', 0); Leaf.showMessage('提示', '请添加车辆!'); return; } } else if (division !== '02' && division != '09') { var head_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_HEAD_CAR_prj_project_lease_item_ds'; var trailer_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_TRAILER_prj_project_lease_item_ds'; var bus_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_BUS_prj_project_lease_item_ds'; var passenger_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_PASSENGER_CAR_prj_project_lease_item_ds'; var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var quotation_record = $(quotation_ds_id).getCurrentRecord(); var head_car_record = $(head_car_ds_id).getAll(); var trailer_car_record = $(trailer_ds_id).getAll(); var bus_car_record = $(bus_ds_id).getAll(); var passenger_car_record = $(passenger_car_ds_id).getAll(); if (head_car_record || trailer_car_record || bus_car_record || passenger_car_record) { for (var i = 0;i < head_car_record.length;i++) { var head_price = head_car_record[i].get('price'); var head_quantity = head_car_record[i].get('quantity'); if (head_price && head_quantity) { var head_total_amount = head_price * head_quantity; other_fee_sum += head_total_amount; } var insurance_price = head_car_record[i].get('insurance_price'); var gps_amount = head_car_record[i].get('gps_amount'); var purchase_tax = head_car_record[i].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * head_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * head_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * head_quantity; } } for (var j = 0;j < trailer_car_record.length;j++) { var trailer_price = trailer_car_record[j].get('price'); var trailer_quantity = trailer_car_record[j].get('quantity'); if (trailer_price && trailer_quantity) { var trailer_total_amount = trailer_price * trailer_quantity; other_fee_sum += trailer_total_amount; } var insurance_price = trailer_car_record[j].get('insurance_price'); var gps_amount = trailer_car_record[j].get('gps_amount'); var purchase_tax = trailer_car_record[j].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * trailer_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * trailer_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * trailer_quantity; } } for (var k = 0;k < bus_car_record.length;k++) { var bus_price = bus_car_record[k].get('price'); var bus_quantity = bus_car_record[k].get('quantity'); if (bus_price && bus_quantity) { var bus_total_amount = bus_price * bus_quantity; other_fee_sum += bus_total_amount; } var insurance_price = bus_car_record[k].get('insurance_price'); var gps_amount = bus_car_record[k].get('gps_amount'); var purchase_tax = bus_car_record[k].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * bus_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * bus_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * bus_quantity; } } for (var m = 0;m < passenger_car_record.length;m++) { var passenger_price = passenger_car_record[m].get('price'); var passenger_quantity = passenger_car_record[m].get('quantity'); if (passenger_price && passenger_quantity) { var passenger_total_amount = passenger_price * passenger_quantity; other_fee_sum += passenger_total_amount; } var insurance_price = passenger_car_record[m].get('insurance_price'); var gps_amount = passenger_car_record[m].get('gps_amount'); var purchase_tax = passenger_car_record[m].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * passenger_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * passenger_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * passenger_quantity; } } quotation_record.set('other_fee', other_fee_sum); quotation_record.set('insurance_fee', insurance_price_sum); quotation_record.set('lease_item_amount', other_fee_sum + quotation_record.get('other_fee3')); quotation_record.set('hd_user_col_n05', gps_amount_sum); quotation_record.set('lease_item_price_agent', purchase_tax_sum); } else { quotation_record.set('other_fee', 0); quotation_record.set('lease_item_amount', quotation_record.get('other_fee3')); Leaf.showMessage('提示', '请添加车辆!'); return; } } else if (division == '09') { var prj_project_factor_info_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_factor_info'); var prj_project_factor_info_record = $(prj_project_factor_info_ds_id).getAll(); if (prj_project_factor_info_record.length > '0') { // if (name == 'accounts_amount' || name == 'policy_amount') { var other_fee_sum_02 = 0; //保理车款 for (var i = 0;i < prj_project_factor_info_record.length;i++) { var accounts_amount = parseFloat(prj_project_factor_info_record[i].get('accounts_amount')); var policy_amount = parseFloat(prj_project_factor_info_record[i].get('policy_amount')); other_fee_sum_02 = accounts_amount + policy_amount + other_fee_sum_02; } quotation_record.set('other_fee', other_fee_sum_02); } } else { quotation_record.set('other_fee', 0); } } } var check_flag = false; if (prj_record.get('project_number')) { return true; } Leaf.request({ url: $('get_special_fields_link_id').getUrl(), para: { document_category: '${/parameter/@document_category}', document_type: record.get('document_type'), function_code: '${/parameter/@function_code}', function_usage: '${/parameter/@function_usage}', lease_channel: prj_record.get('lease_channel'), first_flag: prj_record.get('first_flag'), ka_prj_id: prj_record.get('ka_prj_id') }, success: function(res) { var document_number = res.result.document_number; prj_record.set('project_number', document_number); check_flag = true; window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, 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; }; //新增和加载时调用form window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) { var quo_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); //modify by lpc for deron 车款等于车辆的实际融资额之和 if (ds.id == quo_ds_id) { if (ds.fields.product_id) { if (record.get('product_id') !== '2420') { record.getField('int_rate_display').setReadOnly(true); record.getField('deposit_ratio').setReadOnly(true); record.getField('lease_charge_ratio').setReadOnly(true); record.getField('lease_times').setReadOnly(true); record.getField('price_list').setReadOnly(true); record.getField('down_payment_ratio').setReadOnly(true); record.getField('annual_pay_times').setReadOnly(true); } else { record.getField('int_rate_display').setReadOnly(false); record.getField('deposit_ratio').setReadOnly(false); record.getField('lease_charge_ratio').setReadOnly(false); record.getField('lease_times').setReadOnly(false); record.getField('price_list').setReadOnly(false); record.getField('down_payment_ratio').setReadOnly(false); record.getField('annual_pay_times').setReadOnly(false); } } if (ds.fields.other_fee) { var project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); // var lease_item_ds_id = '${/parameter/@layout_code}' + '_G_CAR_INFO_prj_project_lease_item_ds'; var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item'); var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var quotation_record = $(quotation_ds_id).getCurrentRecord(); var project_record = $(project_ds_id).getCurrentRecord(); var division = '${/parameter/@division}'; var other_fee_sum = 0; //车款 var insurance_price_sum = 0; //保险 var gps_amount_sum = 0; //GPS var purchase_tax_sum = 0; //购置税金额 if (division == '02') { if (lease_item_ds_id) { var lease_item_record = $(lease_item_ds_id).getAll(); for (var i = 0;i < lease_item_record.length;i++) { var finance_amount = lease_item_record[i].get('finance_amount'); other_fee_sum += finance_amount; } // quotation_record.getField('other_fee').setReadOnly(true); quotation_record.set('other_fee', other_fee_sum); } else { // quotation_record.getField('other_fee').setReadOnly(false); quotation_record.set('other_fee', 0); Leaf.showMessage('提示', '请添加车辆!'); return; } } else if (division !== '02' && division != '09') { var head_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_HEAD_CAR_prj_project_lease_item_ds'; var trailer_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_TRAILER_prj_project_lease_item_ds'; var bus_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_BUS_prj_project_lease_item_ds'; var passenger_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_PASSENGER_CAR_prj_project_lease_item_ds'; var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var quotation_record = $(quotation_ds_id).getCurrentRecord(); var head_car_record = $(head_car_ds_id).getAll(); var trailer_car_record = $(trailer_ds_id).getAll(); var bus_car_record = $(bus_ds_id).getAll(); var passenger_car_record = $(passenger_car_ds_id).getAll(); if (head_car_record || trailer_car_record || bus_car_record || passenger_car_record) { for (var i = 0;i < head_car_record.length;i++) { var head_price = head_car_record[i].get('price'); var head_quantity = head_car_record[i].get('quantity'); if (head_price && head_quantity) { var head_total_amount = head_price * head_quantity; other_fee_sum += head_total_amount; } var insurance_price = head_car_record[i].get('insurance_price'); var gps_amount = head_car_record[i].get('gps_amount'); var purchase_tax = head_car_record[i].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * head_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * head_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * head_quantity; } } for (var j = 0;j < trailer_car_record.length;j++) { var trailer_price = trailer_car_record[j].get('price'); var trailer_quantity = trailer_car_record[j].get('quantity'); if (trailer_price && trailer_quantity) { var trailer_total_amount = trailer_price * trailer_quantity; other_fee_sum += trailer_total_amount; } var insurance_price = trailer_car_record[j].get('insurance_price'); var gps_amount = trailer_car_record[j].get('gps_amount'); var purchase_tax = trailer_car_record[j].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * trailer_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * trailer_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * trailer_quantity; } } for (var k = 0;k < bus_car_record.length;k++) { var bus_price = bus_car_record[k].get('price'); var bus_quantity = bus_car_record[k].get('quantity'); if (bus_price && bus_quantity) { var bus_total_amount = bus_price * bus_quantity; other_fee_sum += bus_total_amount; } var insurance_price = bus_car_record[k].get('insurance_price'); var gps_amount = bus_car_record[k].get('gps_amount'); var purchase_tax = bus_car_record[k].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * bus_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * bus_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * bus_quantity; } } for (var m = 0;m < passenger_car_record.length;m++) { var passenger_price = passenger_car_record[m].get('price'); var passenger_quantity = passenger_car_record[m].get('quantity'); if (passenger_price && passenger_quantity) { var passenger_total_amount = passenger_price * passenger_quantity; other_fee_sum += passenger_total_amount; } var insurance_price = passenger_car_record[m].get('insurance_price'); var gps_amount = passenger_car_record[m].get('gps_amount'); var purchase_tax = passenger_car_record[m].get('purchase_tax'); if (insurance_price) { insurance_price_sum += insurance_price * passenger_quantity; } if (gps_amount) { gps_amount_sum += gps_amount * passenger_quantity; } if (purchase_tax) { purchase_tax_sum += purchase_tax * passenger_quantity; } } quotation_record.set('other_fee', other_fee_sum); quotation_record.set('insurance_fee', insurance_price_sum); quotation_record.set('lease_item_amount', other_fee_sum + quotation_record.get('other_fee3')); quotation_record.set('hd_user_col_n05', gps_amount_sum); quotation_record.set('lease_item_price_agent', purchase_tax_sum); } else { quotation_record.set('other_fee', 0); quotation_record.set('lease_item_amount', quotation_record.get('other_fee3')); Leaf.showMessage('提示', '请添加车辆!'); return; } } else if (division == '09') { var prj_project_factor_info_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_factor_info'); var prj_project_factor_info_record = $(prj_project_factor_info_ds_id).getAll(); if (prj_project_factor_info_record.length > '0') { // if (name == 'accounts_amount' || name == 'policy_amount') { var other_fee_sum_02 = 0; //保理车款 for (var i = 0;i < prj_project_factor_info_record.length;i++) { var accounts_amount = parseFloat(prj_project_factor_info_record[i].get('accounts_amount')); var policy_amount = parseFloat(prj_project_factor_info_record[i].get('policy_amount')); other_fee_sum_02 = accounts_amount + policy_amount + other_fee_sum_02; } quotation_record.set('other_fee', other_fee_sum_02); } } else { quotation_record.set('other_fee', 0); } } } } if ((ds.id).indexOf('prj_project') != -1 && (ds.id).indexOf('RECEIPT_INFO') != -1) { if (ds.fields.invoice_agent_id) { // if('${/model/amount_check/record/@x}'){ // var x='${/model/amount_check/record/@x}'; // }else{ // var x=0; // } // if('${/model/amount_check/record/@y}'){ // var y='${/model/amount_check/record/@y}'; // }else{ // var y=1; // } var check_flag = '${/model/amount_check/record/@check_flag}'; if (check_flag == 'N') { Leaf.showMessage('提示', '保证金余额不足!'); } } } //如果存在的话,进行校验逻辑 排除掉联系人校验 if ((ds.id).indexOf('prj_project_bp') != -1 && (ds.id).indexOf('prj_project_bp_contact_info') == -1) { //申请人身份证验证 // if (ds.fields.id_card_no) { // ds.fields.id_card_no.pro.validator = id_card_no_validate; // } //申请人手机验证 // if (ds.fields.cell_phone) { // ds.fields.cell_phone.pro.validator = cell_phone_validate; // } // //申请人配偶身份证校验 // if (ds.fields.id_no_sp) { // ds.fields.id_no_sp.pro.validator = id_no_sp_validate; // } // //申请人配偶手机校验 // if (ds.fields.cell_phone_sp) { // ds.fields.cell_phone_sp.pro.validator = cell_phone_sp_validate; // } //法人代表身份证校验 if (ds.fields.id_card_no_leg) { ds.fields.id_card_no_leg.pro.validator = id_card_no_leg_validate; } //法人代表手机验证 if (ds.fields.cell_phone_leg) { ds.fields.cell_phone_leg.pro.validator = cell_phone_leg_validate; } } if ((ds.id).indexOf('prj_project_lease_item') != -1) { //首付款校验 if (ds.fields.down_payment) { ds.fields.down_payment.pro.validator = down_payment_validate; } //购置价校验 if (ds.fields.invoice_price) { ds.fields.invoice_price.pro.validator = invoice_price_validate; } //融资额校验 if (ds.fields.finance_amount) { ds.fields.finance_amount.pro.validator = finance_amount_validate; } //指导价校验 if (ds.fields.guide_price) { ds.fields.guide_price.pro.validator = guide_price_validate; } // if (ds.fields.deposit_deduction) { // // if ('${/session/@agent_type}'=='AGENT_GRT_DEPOSIT'){ // record.getField('deposit_deduction_n').setReadOnly(false); // record.getField('deposit_deduction_n').setRequired(true); // record.getField('deposit_deduction').setReadOnly(false); // record.getField('deposit_deduction').setRequired(true); // record.set('deposit_deduction_n','最后几期租金'); // record.set('deposit_deduction','K'); // }else{ // record.getField('deposit_deduction_n').setReadOnly(true); // record.getField('deposit_deduction_n').setRequired(false); // record.getField('deposit_deduction').setReadOnly(true); // record.getField('deposit_deduction').setRequired(false); // record.set('deposit_deduction_n','最后几期租金'); // record.set('deposit_deduction','K'); // } // } // '${/session/@agent_type}'=='AGENT_GRT_DEPOSIT'; record.getField('bp_name_sp').setReadOnly(true); } if ((ds.id).indexOf('prj_project_bp_contact_info' != -1)) { //联系人1手机校验 if (ds.fields.phone_1) { ds.fields.phone_1.pro.validator = phone_validate; } //联系人2手机校验 if (ds.fields.phone_2) { ds.fields.phone_2.pro.validator = phone_validate; } //联系人3手机校验 if (ds.fields.phone_3) { ds.fields.phone_3.pro.validator = phone_validate; } } /* var discount_method = record.get('discount_method'); if(discount_method = 'NO_DISCOUNT'||!discount_method){ record.getField('discount_limit_flag_n').setReadOnly(true); }else if(discount_method = 'DISCOUNT'){ record.getField('discount_limit_flag_n').setReadOnly(false); } */ //自动加载基准利率 // if (ds.id == quo_ds_id) { // var quo_record = $(quo_ds_id).getAt(0); // getBaseRate({ // price_list: quo_record.get('price_list'), // base_rate_type: quo_record.get('base_rate_type'), // currency: 'CNY', // annual_pay_times: quo_record.get('annual_pay_times'), // valid_date: quo_record.get('lease_start_date'), // valid_date_to: quo_record.get('lease_end_date'), // month: mul(quo_record.get('lease_times'), 12 / quo_record.get('annual_pay_times')) // }); // } }; function down_payment_validate(record, name, value) { var down_payment_ratio_from = record.get('down_payment_ratio_from') || 0; var down_payment_ratio_to = record.get('down_payment_ratio_to') || 1; var invoice_price = record.get('invoice_price') || 0; var insurance_amount = record.get('insurance_amount') || 0; var purchase_tax = record.get('purchase_tax') || 0; var plate_price = record.get('plate_price') || 0; var down_payment_ratio = parseInt(value) / (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price)); if (down_payment_ratio < down_payment_ratio_from || down_payment_ratio > down_payment_ratio_to) { Leaf.showMessage('提示', '首付比例只能在' + down_payment_ratio_from * 100 + '到' + down_payment_ratio_to * 100 + '之间!'); return '首付比例只能在' + down_payment_ratio_from * 100 + '到' + down_payment_ratio_to * 100 + '之间!'; } return true; } function finance_amount_validate(record, name, value) { var finance_amount_from = record.get('finance_amount_from') || 0; var finance_amount_to = record.get('finance_amount_to') || 99999999999; if (value < finance_amount_from || value > finance_amount_to) { Leaf.showMessage('提示', '融资额超出范围,请重新选择融资方案!'); return '请填写' + finance_amount_from + '到' + finance_amount_to + '之间的数字'; } return true; } function invoice_price_validate(record, name, value) { var guide_price = record.get('guide_price') || 0; if (guide_price == 0) { Leaf.showMessage('提示', '请先选择车型!'); return '请先选择车型'; } if (value > guide_price * 1.02) { Leaf.showMessage('提示', '购置价超过该车辆指导价!'); return '购置价不能大于指导价'; } return true; } function guide_price_validate(record, name, value) { var invoice_price = record.get('invoice_price') || 999999999; if (invoice_price > value * 1.02) { Leaf.showMessage('提示', '购置价超过该车辆指导价!'); return '购置价不能大于指导价'; } return true; } //加载时调用(grid,table,gridBox) window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record, config_records, bp_seq) { //如果存在的话,进行校验逻辑 排除掉联系人校验 // if ((ds.id).indexOf('prj_project_bp') != -1 && (ds.id).indexOf('GUR_NP') != -1 && (ds.id).indexOf('prj_project_bp_contact_info') == -1) { // //担保人身份证校验 // // if (ds.fields.id_card_no) { // // ds.fields.id_card_no.pro.validator = gur_id_card_no_validate; // // } // //担保人手机验证 // // if (ds.fields.cell_phone) { // // ds.fields.cell_phone.pro.validator = gur_cell_phone_validate; // // } // } // // if ((ds.id).indexOf('prj_project_bp') != -1 && (ds.id).indexOf('GUR_ORG') != -1 && (ds.id).indexOf('prj_project_bp_contact_info') == -1) { // // ds.fields.id_card_no.pro.validator = prj500n_card_id_check; // // if (ds.fields.id_no_sp) { // // ds.fields.id_no_sp.pro.validator = prj500n_card_id_check; // // } // // } }; //新增时调用(grid,table,gridBox) window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function(ds, record, config_records, bp_seq) { //如果存在的话,进行校验逻辑 排除掉联系人校验 // if ((ds.id).indexOf('prj_project_bp') != -1 && (ds.id).indexOf('GUR_NP') != -1 && (ds.id).indexOf('prj_project_bp_contact_info') == -1) { // //担保人身份证校验 // if (ds.fields.id_card_no) { // ds.fields.id_card_no.pro.validator = gur_id_card_no_validate; // } // //担保人手机验证 // if (ds.fields.cell_phone) { // ds.fields.cell_phone.pro.validator = gur_cell_phone_validate; // } // } // // if ((ds.id).indexOf('prj_project_bp') != -1 && (ds.id).indexOf('GUR_ORG') != -1 && (ds.id).indexOf('prj_project_bp_contact_info') == -1) { // // ds.fields.id_card_no.pro.validator = prj500n_card_id_check; // // if (ds.fields.id_no_sp) { // // ds.fields.id_no_sp.pro.validator = prj500n_card_id_check; // // } // // } }; //更新时调用 window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) { // var bp_info_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp'); var lease_item_info_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item'); var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var head_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_HEAD_CAR_prj_project_lease_item_ds'; var trailer_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_TRAILER_prj_project_lease_item_ds'; var bus_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_BUS_prj_project_lease_item_ds'; var passenger_car_ds_id = '${/parameter/@layout_code}' + '_G_LEASE_PASSENGER_CAR_prj_project_lease_item_ds'; var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var prj_record = $(prj_project_ds_id).getAt(0); var prj_project_factor_info_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_factor_info'); if (prj_project_factor_info_ds_id == ds.id) { // var quotation_record = $(prj_quotation_ds_id).getCurrentRecord(); var prj_project_factor_info_record = $(prj_project_factor_info_ds_id).getAll(); if (name == 'accounts_amount' || name == 'policy_amount') { if ('${/parameter/@division}' == '09') { var other_fee_sum_02 = 0; //保理车款 for (var i = 0;i < prj_project_factor_info_record.length;i++) { var accounts_amount = parseFloat(prj_project_factor_info_record[i].get('accounts_amount')); var policy_amount = parseFloat(prj_project_factor_info_record[i].get('policy_amount')); other_fee_sum_02 = accounts_amount + policy_amount + other_fee_sum_02; } quotation_record.set('other_fee', other_fee_sum_02); } } } if (prj_quotation_ds_id == ds.id) { if (name == 'product_id') { //非自定义产品不可修改 if (value !== '2420') { record.getField('int_rate_display').setReadOnly(true); record.getField('deposit_ratio').setReadOnly(true); record.getField('lease_charge_ratio').setReadOnly(true); record.getField('lease_times').setReadOnly(true); record.getField('price_list').setReadOnly(true); record.getField('down_payment_ratio').setReadOnly(true); record.getField('annual_pay_times').setReadOnly(true); } else { record.getField('int_rate_display').setReadOnly(false); record.getField('deposit_ratio').setReadOnly(false); record.getField('lease_charge_ratio').setReadOnly(false); record.getField('lease_times').setReadOnly(false); record.getField('price_list').setReadOnly(false); record.getField('down_payment_ratio').setReadOnly(false); record.getField('annual_pay_times').setReadOnly(false); } } // if (name == 'lease_times') { // if (value != old_value) { // getBaseRate({ // price_list: record.get('price_list'), // base_rate_type: record.get('base_rate_type'), // currency: 'CNY', // annual_pay_times: record.get('annual_pay_times'), // valid_date: record.get('lease_start_date'), // valid_date_to: record.get('lease_end_date'), // month: mul(record.get('lease_times'), 12 / record.get('annual_pay_times')) // }); // } // } // if (name == 'annual_pay_times') { // if (value != old_value) { // getBaseRate({ // price_list: record.get('price_list'), // base_rate_type: record.get('base_rate_type'), // currency: 'CNY', // annual_pay_times: record.get('annual_pay_times'), // valid_date: record.get('lease_start_date'), // valid_date_to: record.get('lease_end_date'), // month: mul(record.get('lease_times'), 12 / record.get('annual_pay_times')) // }); // } // } } // if (bp_info_ds_id == ds.id) { // // if (name == 'work_type') { // // $(lease_item_info_ds_id).getAt(0).getField('product_plan_id_n').setLovPara('work_type', record.get('work_type')); // // } // if (name == 'driving_flag') { // if (value == 'Y') { // record.set('driving_provement', ''); // record.getField('driving_provement').setReadOnly(true); // record.getField('driving_provement').setRequired(false); // } else if (value == 'N') { // record.getField('driving_provement').setReadOnly(false); // record.getField('driving_provement').setRequired(true); // } // } // if (name == 'marital_status') { // if (value == 'UM' || value == 'DV') { // record.getField('id_no_sp').setRequired(false); // record.getField('bp_name_sp').setRequired(false); // record.getField('cell_phone_sp').setRequired(false); // record.set('bp_name_sp', ''); // record.set('id_no_sp', ''); // record.set('cell_phone_sp', ''); // record.set('work_unit_name_sp', ''); // record.set('work_type_sp', ''); // record.set('work_type_sp_n', ''); // record.set('age_sp', ''); // record.set('date_of_birth_sp', ''); // record.set('gender_sp_n', ''); // record.getField('bp_name_sp').setReadOnly(true); // record.getField('id_no_sp').setReadOnly(true); // record.getField('cell_phone_sp').setReadOnly(true); // record.getField('work_unit_name_sp').setReadOnly(true); // record.getField('work_type_sp_n').setReadOnly(true); // } else if (value == 'MNC' || value == 'MWC' || value == 'RM' || Ext.isEmpty(value)) { // record.getField('bp_name_sp').setReadOnly(false); // record.getField('id_no_sp').setReadOnly(false); // record.getField('cell_phone_sp').setReadOnly(false); // record.getField('work_unit_name_sp').setReadOnly(false); // record.getField('work_type_sp_n').setReadOnly(false); // record.getField('id_no_sp').setRequired(true); // record.getField('bp_name_sp').setRequired(true); // record.getField('cell_phone_sp').setRequired(true); // } // } // } // var other_fee_sum = 0; //车款 // var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); // var quotation_record = $(quotation_ds_id).getCurrentRecord(); // if (head_car_ds_id == ds.id || trailer_ds_id == ds.id || bus_ds_id == ds.id || passenger_car_ds_id == ds.id) { // if (prj_record.get('division') !== '02' && prj_record.get('division') !== '09') { // var head_car_record = $(head_car_ds_id).getAll(); // var trailer_record = $(trailer_ds_id).getAll(); // var bus_record = $(bus_ds_id).getAll(); // var passenger_car_record = $(passenger_car_ds_id).getAll(); // if (head_car_record) { // if (name == 'price' || name == 'quantity') { // for (var i = 0;i < head_car_record.length;i++) { // var head_car_price = head_car_record[i].get('price'); // var head_car_quantity = head_car_record[i].get('quantity'); // if (head_car_price && head_car_quantity) { // var head_car_total_amount = head_car_price * head_car_quantity; // head_car_record[i].set('total_amount', head_car_total_amount); // other_fee_sum += head_car_total_amount; // } // } // } // } // } // if (trailer_record) { // if (name == 'price' || name == 'quantity') { // for (var j = 0;j < trailer_record.length;j++) { // var trailer_price = trailer_record[j].get('price'); // var trailer_quantity = trailer_record[j].get('quantity'); // if (trailer_price && trailer_quantity) { // var trailer_total_amount = trailer_price * trailer_quantity; // trailer_record[j].set('total_amount', trailer_total_amount); // other_fee_sum += head_car_total_amount; // } // } // } // } // if (bus_record) { // if (name == 'price' || name == 'quantity') { // for (var k = 0;k < bus_record.length;k++) { // var bus_price = bus_record[k].get('price'); // var bus_quantity = bus_record[k].get('quantity'); // if (bus_price && bus_quantity) { // var bus_total_amount = bus_price * bus_quantity; // bus_record[k].set('total_amount', bus_total_amount); // other_fee_sum += bus_total_amount; // } // } // } // } // if (passenger_car_record) { // if (name == 'price' || name == 'quantity') { // for (var p = 0;p < passenger_car_record.length;p++) { // var passenger_car_price = passenger_car_record[p].get('price'); // var passenger_car_quantity = passenger_car_record[p].get('quantity'); // if (passenger_car_price && passenger_car_quantity) { // var passenger_car_total_amount = passenger_car_price * passenger_car_quantity; // passenger_car_record[p].set('total_amount', passenger_car_total_amount); // other_fee_sum += passenger_car_total_amount; // } // } // } // } // quotation_record.set('other_fee', other_fee_sum); // } if (head_car_ds_id == ds.id) { if (name == 'price' || name == 'quantity') { if (prj_record.get('division') !== '02') { head_car_record = $(head_car_ds_id).getAll(); for (var i = 0;i < head_car_record.length;i++) { var head_car_price = head_car_record[i].get('price'); var head_car_quantity = head_car_record[i].get('quantity'); if (head_car_price && head_car_quantity) { var head_car_total_amount = head_car_price * head_car_quantity; head_car_record[i].set('total_amount', head_car_total_amount); } } } } } if (trailer_ds_id == ds.id) { if (name == 'price' || name == 'quantity') { if (prj_record.get('division') !== '02') { trailer_record = $(trailer_ds_id).getAll(); for (var j = 0;j < trailer_record.length;j++) { var trailer_price = trailer_record[j].get('price'); var trailer_quantity = trailer_record[j].get('quantity'); if (trailer_price && trailer_quantity) { var trailer_total_amount = trailer_price * trailer_quantity; trailer_record[j].set('total_amount', trailer_total_amount); } } } } } if (bus_ds_id == ds.id) { if (name == 'price' || name == 'quantity') { if (prj_record.get('division') !== '02') { bus_record = $(bus_ds_id).getAll(); for (var k = 0;k < bus_record.length;k++) { var bus_price = bus_record[k].get('price'); var bus_quantity = bus_record[k].get('quantity'); if (bus_price && bus_quantity) { var bus_total_amount = bus_price * bus_quantity; bus_record[k].set('total_amount', bus_total_amount); } } } } } if (passenger_car_ds_id == ds.id) { if (name == 'price' || name == 'quantity') { if (prj_record.get('division') !== '02') { passenger_car_record = $(passenger_car_ds_id).getAll(); for (var p = 0;p < passenger_car_record.length;p++) { var passenger_car_price = passenger_car_record[p].get('price'); var passenger_car_quantity = passenger_car_record[p].get('quantity'); if (passenger_car_price && passenger_car_quantity) { var passenger_car_total_amount = passenger_car_price * passenger_car_quantity; passenger_car_record[p].set('total_amount', passenger_car_total_amount); } } } } } if (lease_item_info_ds_id == ds.id) { if (name == 'finance_amount') { //modify by lpc for deron 车款等于车辆的实际融资额之和 // var project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); // var lease_item_ds_id = '${/parameter/@layout_code}' + '_G_CAR_INFO_prj_project_lease_item_ds'; var lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item'); var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var quotation_record = $(quotation_ds_id).getCurrentRecord(); var project_record = $(project_ds_id).getCurrentRecord(); var division = project_record.get('division'); var sum = 0; if (division == '02') { if (lease_item_ds_id) { var lease_item_record = $(lease_item_ds_id).getAll(); for (var i = 0;i < lease_item_record.length;i++) { var finance_amount = lease_item_record[i].get('finance_amount'); sum += finance_amount; } // quotation_record.getField('other_fee').setReadOnly(true); quotation_record.set('other_fee', sum); } } var deposit_ratio = record.get('deposit_ratio') || 0; var deposit = parseFloat(deposit_ratio) * parseInt(value); var lease_charge_ratio = record.get('lease_charge_ratio') || 0; var lease_charge = parseFloat(lease_charge_ratio) * parseInt(value); record.set('deposit', deposit); record.set('lease_charge', lease_charge); var down_payment_ratio = parseInt(value) / (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price)); } if (name == 'product_plan_id') { var down_payment_ratio = record.get('down_payment_ratio'); if (down_payment_ratio) { record.set('down_payment_ratio', down_payment_ratio); } var product_plan_id = record.get('product_plan_id'); var finance_amount = record.get('finance_amount'); var lease_times_temp = record.get('lease_times_temp'); var lease_times = record.get('lease_times'); if (!lease_times_temp) { record.getField('lease_times').setReadOnly(false); } else { record.getField('lease_times').setReadOnly(true); } if (!(Ext.isEmpty(product_plan_id) || Ext.isEmpty(finance_amount) || Ext.isEmpty(down_payment_ratio) || Ext.isEmpty(lease_times))) { Leaf.request({ url: $('check_gps_visit_link').getUrl(), para: { product_plan_id: product_plan_id, finance_amount: finance_amount, down_payment_ratio: down_payment_ratio, lease_times: lease_times }, success: function(res) { var result = res.result.result; if (result == 'BOTH') { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else if (result == 'GPS') { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } else if (result == 'VISIT') { record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else if (result == 'NOT') { record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, sync: true, scope: this }); } record.set('down_payment', ''); record.set('discount', ''); record.set('invoice_price', ''); } else if (name == 'discount_method') { /* if(value == 'NO_DISCOUNT'){ record.set('discount_limit_flag',''); record.set('discount_limit_flag_n',''); record.getField('discount_limit_flag_n').setReadOnly(true); }else if(value == 'DISCOUNT'){ record.getField('discount_limit_flag_n').setReadOnly(false); } */ } if (name == 'series_id_n') { record.getField('product_plan_id_n').setLovPara('series_id', record.get('series_id')); } if (name == 'discount_method_n') { record.getField('product_plan_id_n').setLovPara('discount_method', record.get('discount_method')); } if (name == 'discount_method') { record.getField('product_plan_id_n').setLovPara('discount_method', record.get('discount_method')); } if (name == 'times') { record.getField('product_plan_id_n').setLovPara('times', record.get('times')); } if (name == 'lease_times') { var product_plan_id = record.get('product_plan_id'); var finance_amount = record.get('finance_amount'); var down_payment_ratio = record.get('down_payment_ratio'); var lease_times_temp = record.get('lease_times_temp'); var lease_times = record.get('lease_times'); if (!lease_times_temp) { record.getField('lease_times').setReadOnly(false); } else { record.getField('lease_times').setReadOnly(true); } if (!(Ext.isEmpty(product_plan_id) || Ext.isEmpty(finance_amount) || Ext.isEmpty(down_payment_ratio) || Ext.isEmpty(lease_times))) { Leaf.request({ url: $('check_gps_visit_link').getUrl(), para: { product_plan_id: product_plan_id, finance_amount: finance_amount, down_payment_ratio: down_payment_ratio, lease_times: lease_times }, success: function(res) { var result = res.result.result; if (result == 'BOTH') { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else if (result == 'GPS') { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } else if (result == 'VISIT') { record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else if (result == 'NOT') { record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, sync: true, scope: this }); } } if (name == 'down_payment_ratio') { var product_plan_id = record.get('product_plan_id'); var finance_amount = record.get('finance_amount'); var down_payment_ratio = record.get('down_payment_ratio'); var lease_times = record.get('lease_times'); if (!(Ext.isEmpty(product_plan_id) || Ext.isEmpty(finance_amount) || Ext.isEmpty(down_payment_ratio) || Ext.isEmpty(lease_times))) { Leaf.request({ url: $('check_gps_visit_link').getUrl(), para: { product_plan_id: product_plan_id, finance_amount: finance_amount, down_payment_ratio: down_payment_ratio, lease_times: lease_times }, success: function(res) { var result = res.result.result; if (result == 'BOTH') { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else if (result == 'GPS') { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } else if (result == 'VISIT') { record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else if (result == 'NOT') { record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, failure: function() { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, sync: true, scope: this }); } } if (name == 'deposit_ratio') { if (value != 0) { record.getField('deposit_deduction_n').setReadOnly(false); record.set('deposit_deduction_n', '最后几期租金'); record.set('deposit_deduction', 'K'); } else { record.getField('deposit_deduction_n').setReadOnly(true); record.set('deposit_deduction_n', ''); record.set('deposit_deduction', ''); } var finance_amount = record.get('finance_amount') || 0; var deposit = parseInt(finance_amount) * parseFloat(value); record.set('deposit', deposit); } if (name == 'down_payment') { var invoice_price = record.get('invoice_price') || 0; var insurance_amount = record.get('insurance_amount') || 0; var purchase_tax = record.get('purchase_tax') || 0; var plate_price = record.get('plate_price') || 0; var down_payment_ratio = parseInt(value) / (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price)); var finance_amount = parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price) - parseInt(value); record.set('finance_amount', finance_amount); record.set('down_payment_ratio', down_payment_ratio); } if (name == 'invoice_price') { var down_payment = record.get('down_payment') || 0; var insurance_amount = record.get('insurance_amount') || 0; var purchase_tax = record.get('purchase_tax') || 0; var plate_price = record.get('plate_price') || 0; var balloon_ratio = record.get('balloon_ratio') || 0; var balloon = parseFloat(balloon_ratio) * (parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price)); record.set('balloon', balloon); if (down_payment) { var finance_amount = parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price) - parseInt(down_payment); record.set('finance_amount', finance_amount); var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price)); record.set('down_payment_ratio', down_payment_ratio); } } if (name == 'finance_amount') { var deposit_ratio = record.get('deposit_ratio') || 0; var deposit = parseFloat(deposit_ratio) * parseInt(value); var lease_charge_ratio = record.get('lease_charge_ratio') || 0; var lease_charge = parseFloat(lease_charge_ratio) * parseInt(value); record.set('deposit', deposit); record.set('lease_charge', lease_charge); var down_payment_ratio = parseInt(value) / (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price)); } if (name == 'balloon_ratio') { var invoice_price = record.get('invoice_price') || 0; var insurance_amount = record.get('insurance_amount') || 0; var purchase_tax = record.get('purchase_tax') || 0; var plate_price = record.get('plate_price') || 0; var balloon = parseFloat(value) * (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price)); record.set('balloon', balloon); } if (name == 'license_fee_flag') { if (value == 'N') { record.getField('plate_price').setReadOnly(true); record.getField('plate_price').setRequired(false); record.set('plate_price', ''); } else { record.getField('plate_price').setReadOnly(false); record.getField('plate_price').setRequired(true); } } if (name == 'insurance_flag') { if (value == 'N') { record.getField('insurance_amount').setReadOnly(true); record.getField('insurance_purchase_n').setReadOnly(true); record.getField('insurance_amount').setRequired(false); record.getField('insurance_purchase_n').setRequired(false); record.set('insurance_purchase_n', '其他'); record.set('insurance_purchase', 'OTHER'); record.set('insurance_amount', ''); } else { record.getField('insurance_amount').setReadOnly(false); record.getField('insurance_purchase_n').setReadOnly(false); record.getField('insurance_amount').setRequired(true); record.getField('insurance_purchase_n').setRequired(true); } } if (name == 'purchase_tax_flag') { if (value == 'N') { record.getField('purchase_tax').setReadOnly(true); record.getField('purchase_tax').setRequired(false); record.set('purchase_tax', ''); } else { record.getField('purchase_tax').setReadOnly(false); record.getField('purchase_tax').setRequired(true); } } if (name == 'plate_price') { var invoice_price = record.get('invoice_price') || 0; var insurance_amount = record.get('insurance_amount') || 0; var purchase_tax = record.get('purchase_tax') || 0; var down_payment = record.get('down_payment') || 0; var balloon_ratio = record.get('balloon_ratio') || 0; var balloon = parseFloat(balloon_ratio) * (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(value)); record.set('balloon', balloon); var finance_amount = parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(value) - parseInt(down_payment); var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(invoice_price)); record.set('finance_amount', finance_amount); record.set('down_payment_ratio', down_payment_ratio); } if (name == 'purchase_tax') { var invoice_price = record.get('invoice_price') || 0; var insurance_amount = record.get('insurance_amount') || 0; var plate_price = record.get('plate_price') || 0; var down_payment = record.get('down_payment') || 0; var balloon_ratio = record.get('balloon_ratio') || 0; var balloon = parseFloat(balloon_ratio) * (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(value) + parseInt(plate_price)); record.set('balloon', balloon); var finance_amount = parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(plate_price) + parseInt(value) - parseInt(down_payment); var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(insurance_amount) + parseInt(plate_price) + parseInt(invoice_price)); record.set('finance_amount', finance_amount); record.set('down_payment_ratio', down_payment_ratio); } if (name == 'insurance_amount') { var invoice_price = record.get('invoice_price') || 0; var plate_price = record.get('plate_price') || 0; var purchase_tax = record.get('purchase_tax') || 0; var down_payment = record.get('down_payment') || 0; var balloon_ratio = record.get('balloon_ratio') || 0; var balloon = parseFloat(balloon_ratio) * (parseInt(invoice_price) + parseInt(value) + parseInt(purchase_tax) + parseInt(plate_price)); record.set('balloon', balloon); var finance_amount = parseInt(invoice_price) + parseInt(plate_price) + parseInt(purchase_tax) + parseInt(value) - parseInt(down_payment); var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(plate_price) + parseInt(purchase_tax) + parseInt(invoice_price)); record.set('finance_amount', finance_amount); record.set('down_payment_ratio', down_payment_ratio); } else if (name == 'lease_charge_ratio') { var finance_amount = record.get('finance_amount') || 0; var lease_charge = parseFloat(value) * parseInt(finance_amount) record.set('lease_charge', lease_charge); } } /*如果是project_bp相关的,进行身份证校验处理*/ if ((ds.id).indexOf('prj_project_bp') != -1 && (ds.id).indexOf('prj_project_bp_contact_info') == -1) { var id_type = record.get('id_type'); if (name == 'id_card_no') { Leaf.request({ url: $('get_id_card_no_info_id').getUrl(), para: { id_card_no: value, id_type: id_type }, success: function(data) { if (data.result.record && !data.result.record.length) { //申请人信息 for (var name in data.result.record) { if (name != 'bp_type' && name != 'bp_category') { record.set(name, data.result.record[name]); } } //prj_record.set('bp_code', data.result.record['bp_code']); //prj_record.set('bp_id_tenant', data.result.record['bp_id']); } else { //prj_record.set('bp_code', ''); //prj_record.set('bp_id_tenant', ''); } }, failure: function() { }, error: function() { }, scope: this }); } else if (name == 'business_license_num') { Leaf.request({ url: $('get_organization_code_id').getUrl(), para: { business_license_num: value }, success: function(data) { if (data.result.record && !data.result.record.length) { //申请人信息 for (var name in data.result.record) { if (name != 'bp_type' && name != 'bp_category') { record.set(name, data.result.record[name]); } } //prj_record.set('bp_code', data.result.record['bp_code']); //prj_record.set('bp_id_tenant', data.result.record['bp_id']); } else { //prj_record.set('bp_code', ''); //prj_record.set('bp_id_tenant', ''); } }, failure: function() { }, error: function() { }, scope: this }); } } }; function getBaseRate(param) { Leaf.request({ url: $('${/parameter/@layout_code}_hls_fin_calc_get_base_rate_link_id').getUrl(), para: { price_list: param.price_list, base_rate_type: param.base_rate_type, currency: param.currency, annual_pay_times: param.annual_pay_times, valid_date: param.valid_date, valid_date_to: param.valid_date_to, month: param.month }, sync: true, success: setBaseRate, failure: function() {}, error: function() {}, scope: this }); } function setBaseRate(res) { var quo_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var head_record = $(quo_ds_id).getAt(0); if (res.result.base_rate) { head_record.set('base_rate', res.result.base_rate); } else { head_record.set('base_rate', ''); } } function id_card_no_validate(record, name, value) { //获取担保人ds var bp_gur_np_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'BP_GUR_NP', 'prj_project_bp'); if (!value) { return '身份证号不能为空'; } else { if (!checkCard(value)) { Leaf.showMessage('提示', '申请人信息中,请输入正确格式的身份证!'); return '请输入正确格式的身份证'; } } if (value.length == 18) { record.set('date_of_birth', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2))); record.set('age', new Date().getFullYear() - value.substr(6, 4)); if (value.substr(16, 1) % 2 == 1) { record.set('gender', 'MALE'); record.set('gender_n', '男'); } else if (value.substr(16, 1) % 2 == 0) { record.set('gender', 'FEMALE'); record.set('gender_n', '女'); } if (record.get('gender') == record.get('gender_sp')) { Leaf.showMessage('提示', '申请人和申请人配偶的性别不能相同!'); record.set('gender_sp_n', ''); record.set('date_of_birth_sp', ''); record.set('age_sp', ''); record.set('id_no_sp', ''); return '申请人和申请人配偶的性别不能相同'; } } if ($(bp_gur_np_ds_id).getAt(0)) { if (record.get('id_card_no') == $(bp_gur_np_ds_id).getAt(0).get('id_card_no')) { Leaf.showMessage('提示', '申请人和担保人的身份证不能相同!'); record.set('id_no_sp', ''); record.set('id_card_no', ''); record.set('gender_n', ''); record.set('date_of_birth', ''); record.set('age', ''); return '申请人和担保人的身份证不能相同'; } } return true; } function id_card_no_leg_validate(record, name, value) { if (!checkCard(value)) { Leaf.showMessage('提示', '请输入正确格式的身份证!'); return '请输入正确格式的身份证'; } if (value.length == 18) { record.set('date_of_birth_leg', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2))); record.set('age_leg', new Date().getFullYear() - value.substr(6, 4)); if (value.substr(16, 1) % 2 == 1) { record.set('gender_leg', 'MALE'); record.set('gender_leg_n', '男'); } else if (value.substr(16, 1) % 2 == 0) { record.set('gender_leg', 'FEMALE'); record.set('gender_leg_n', '女'); } } return true; } function cell_phone_validate(record, name, value) { //获取担保人ds var bp_gur_np_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'BP_GUR_NP', 'prj_project_bp'); var bp_contact_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp_contact_info'); // if (!checkMobile(value)) { // Leaf.showMessage('提示', '申请人信息中,请输入正确格式的手机号码!'); // return '请输入正确格式的手机号码'; // } // if (record.get('cell_phone') == record.get('cell_phone_sp')) { // Leaf.showMessage('提示', '申请人和申请人配偶的手机号不能相同!'); // return '申请人和申请人配偶的手机号不能相同'; // } // if (!Ext.isEmpty($(bp_gur_np_ds_id).getAt(0))) { // if (record.get('cell_phone') == ($(bp_gur_np_ds_id).getAt(0).get('cell_phone') || 0)) { // Leaf.showMessage('提示', '申请人和担保人的手机号不能相同!'); // return '申请人和担保人的手机号不能相同'; // } // } if (!Ext.isEmpty($(bp_contact_id).getAt(0))) { if (record.get('cell_phone') == $(bp_contact_id).getAt(0).get('phone') || record.get('cell_phone') == $(bp_contact_id).getAt(0).get('phone_2') || record.get('cell_phone') == $(bp_contact_id).getAt(0).get('phone_3')) { Leaf.showMessage('提示', '联系人和申请人的手机号不能一样!'); return '联系人和申请人的手机号不能一样'; } } return true; } function cell_phone_leg_validate(record, name, value) { if (!checkMobile(value)) { Leaf.showMessage('提示', '请输入正确格式的手机号码!'); return '请输入正确格式的手机号码'; } return true; } function id_no_sp_validate(record, name, value) { if (!value) { return true; } else { if (!checkCard(value)) { Leaf.showMessage('提示', '申请人配偶信息中,请输入正确格式的身份证!'); return '请输入正确格式的身份证'; } } if (value.length == 18) { record.set('date_of_birth_sp', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2))); record.set('age_sp', new Date().getFullYear() - value.substr(6, 4)); if (value.substr(16, 1) % 2 == 1) { record.set('gender_sp', 'MALE'); record.set('gender_sp_n', '男'); } else if (value.substr(16, 1) % 2 == 0) { record.set('gender_sp', 'FEMALE'); record.set('gender_sp_n', '女'); } if (record.get('gender') == record.get('gender_sp')) { Leaf.showMessage('提示', '申请人和申请人配偶的性别不能相同!'); record.set('gender_sp_n', ''); record.set('date_of_birth_sp', ''); record.set('age_sp', ''); record.set('id_no_sp', ''); return '申请人和申请人配偶的性别不能相同'; } } return true; } function cell_phone_sp_validate(record, name, value) { if (!value) { return true; } if (!checkMobile(value)) { Leaf.showMessage('提示', '申请人配偶信息中,请输入正确格式的手机号码!'); return '请输入正确格式的手机号码'; } if (record.get('cell_phone') == record.get('cell_phone_sp')) { Leaf.showMessage('提示', '申请人和申请人配偶的手机号不能相同!'); return '申请人和申请人配偶的手机号不能相同'; } return true; } function gur_id_card_no_validate(record, name, value) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp'); if (!value) { return '身份证号不能为空'; } else { if (!checkCard(value)) { Leaf.showMessage('提示', '担保人信息中,请输入正确格式的身份证!'); return '请输入正确格式的身份证'; } } if (value.length == 18) { record.set('date_of_birth', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2))); record.set('age', new Date().getFullYear() - value.substr(6, 4)); if (value.substr(16, 1) % 2 == 1) { record.set('gender', 'MALE'); record.set('gender_n', '男'); } else if (value.substr(16, 1) % 2 == 0) { record.set('gender', 'FEMALE'); record.set('gender_n', '女'); } } if (record.get('id_card_no') == $(ds_id).getAt(0).get('id_card_no')) { Leaf.showMessage('提示', '申请人和担保人的身份证不能相同!'); record.set('gender_n', ''); record.set('date_of_birth', ''); record.set('age', ''); return '申请人和担保人的身份证不能相同'; } return true; } function gur_cell_phone_validate(record, name, value) { //获取申请人ds var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp'); // if (!checkMobile(value)) { // Leaf.showMessage('提示', '担保人信息中,请输入正确格式的手机号码!'); // return '请输入正确格式的手机号码'; // } if (record.get('cell_phone') == $(ds_id).getAt(0).get('cell_phone')) { record.set('cell_phone', ''); Leaf.showMessage('提示', '申请人和担保人的手机号不能相同!'); return '申请人和担保人的手机号不能相同'; } return true; } function phone_validate(record, name, value) { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp'); var phone_0 = $(ds_id).getAt(0).get('cell_phone') var phone_1 = record.get('phone_1') || -1; var phone_2 = record.get('phone_2') || -2; var phone_3 = record.get('phone_3') || -3; if (phone_1 != -1) { if (!checkMobile(phone_1)) { Leaf.showMessage('提示', '联系人1信息中,请输入正确格式的手机号码!'); return '请输入正确格式的手机号码'; } } if (phone_2 != -2) { if (!checkMobile(phone_2)) { Leaf.showMessage('提示', '联系人2信息中,请输入正确格式的手机号码!'); return '请输入正确格式的手机号码'; } } if (phone_3 != -3) { if (!checkMobile(phone_3)) { Leaf.showMessage('提示', '联系人3信息中,请输入正确格式的手机号码!'); return '请输入正确格式的手机号码'; } } if (phone_0 == phone_1 || phone_0 == phone_2 || phone_0 == phone_3) { Leaf.showMessage('提示', '联系人和申请人的手机号不能一样!'); return '联系人和申请人的手机号不能一样'; } if (phone_1 == phone_2 || phone_1 == phone_3 || phone_2 == phone_3) { Leaf.showMessage('提示', '联系人的手机号不能一样!'); return '联系人的手机号不能一样'; } return true; } // Leaf.onReady(function() { // var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); // var record = $(ds_id).getAt(0); // var lease_channel = record.get('lease_channel'); // var bp_class = record.get('bp_class'); // if (lease_channel != '05') { // if (bp_class == 'ORG') { // //$('PROJECT_CREATE_ORG_user_button2').disable(); // var user_button2 = document.getElementById('PROJECT_CREATE_ORG_user_button2'); // user_button2.style.display = 'none'; // } else { // //$('PROJECT_CREATE_NP_user_button2').disable(); // var user_button2 = document.getElementById('PROJECT_CREATE_NP_user_button2'); // user_button2.style.display = 'none'; // } // } // }); ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view> </a:screen>