<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: wangwei5743 $Date: 2014-10-8 下午3:16:19 $Revision: 1.0 $purpose: 租赁申请创建 创建界面 --> <a:screen 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"/> </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="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="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"/> <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 type="text/javascript"><![CDATA[ //忽略保存校验方法 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() { window['${/parameter/@layout_code}_not_ignore_required_flag'] = true; Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交?', function() { window['${/parameter/@layout_code}_not_ignore_required_flag'] = true; var root_ds_1 = $('${/parameter/@layout_code}_virtual_ds'); if (root_ds_1.validate()) { submit_wfl_flag = 'Y'; //提交先保存 window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](); } }); }; //保存submitsuccess调用 window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res) { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); if (submit_wfl_flag == 'Y') { submit_wfl_flag = 'N'; Leaf.request({ url: $('submit_approval_link').getUrl(), para: { 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 }); } 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); var ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_fin_calculator_ln'); var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); $(quotation_ds_id).setQueryParameter('project_id', $(ds_id).getAt(0).get('project_id')); $(ln_ds_id).query(); $(quotation_ds_id).query(); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }; 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}_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])) { //url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ','; var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase(); if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') { url = url + '<a ref="img" href=' + link + temp[1] + '>' + 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 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) { 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); } */ }; 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')|| 9999999999; if(value > guide_price){ Leaf.showMessage('提示','购置价不能大于指导价!'); return '购置价不能大于指导价'; } return true; } function guide_price_validate(record, name, value) { var invoice_price = record.get('invoice_price')|| 0; if(invoice_price > value){ 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 prj_record = $(prj_project_ds_id).getAt(0); 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=='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); } } } if(lease_item_info_ds_id==ds.id){ if(name=='product_plan_id'){ var down_payment_ratio = record.get('down_payment_ratio'); var finance_amount = record.get('finance_amount'); record.set('down_payment',''); record.set('discount',''); if (down_payment_ratio) { record.set('down_payment_ratio', down_payment_ratio); } if(finance_amount){ record.set('finance_amount', finance_amount); } } 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 == 'lease_times') { var min_dp_ratio = record.get('min_dp_ratio'); var min_dp_ratio_visit = record.get('min_dp_ratio_visit'); var times_limit = record.get('times_limit'); var times_limit_visit = record.get('times_limit_visit'); var finance_amt_max=record.get('finance_amt_max'); var finance_amt_max_visit = record.get('finance_amt_max_visit'); 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'); if (!lease_times_temp) { record.getField('lease_times').setReadOnly(false); } else { record.getField('lease_times').setReadOnly(true); } if(Ext.isEmpty(times_limit) && Ext.isEmpty(min_dp_ratio) && Ext.isEmpty(finance_amt_max)){ record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); }else{ if(Ext.isEmpty(times_limit)){ times_limit=value; } if(Ext.isEmpty(min_dp_ratio)){ min_dp_ratio=0; } if(Ext.isEmpty(finance_amt_max)){ finance_amt_max=999999999999; } if (value == times_limit && down_payment_ratio >= min_dp_ratio && finance_amount <= finance_amt_max) { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); }else{ record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); } } if(Ext.isEmpty(times_limit_visit) && Ext.isEmpty(min_dp_ratio_visit) && Ext.isEmpty(finance_amt_max_visit)){ record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); }else{ if(Ext.isEmpty(times_limit_visit)){ times_limit_visit=value; } if(Ext.isEmpty(min_dp_ratio_visit)){ min_dp_ratio_visit=0; } if(Ext.isEmpty(finance_amt_max_visit)){ finance_amt_max_visit=999999999999; } if (value == times_limit_visit && down_payment_ratio >= min_dp_ratio_visit && finance_amount <= finance_amt_max_visit) { record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else{ record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } } }else if(name =='min_dp_ratio'||name=='min_dp_ratio_visit'||name=='finance_amt_max_visit'||name=='finance_amt_max'|| name=='times_limit'||name=='times_limit_visit'){ var min_dp_ratio = record.get('min_dp_ratio'); var min_dp_ratio_visit = record.get('min_dp_ratio_visit'); var times_limit = record.get('times_limit'); var times_limit_visit = record.get('times_limit_visit'); var finance_amt_max=record.get('finance_amt_max'); var finance_amt_max_visit = record.get('finance_amt_max_visit'); var finance_amount=record.get('finance_amount'); var down_payment_ratio = record.get('down_payment_ratio'); if(Ext.isEmpty(times_limit) && Ext.isEmpty(min_dp_ratio) && Ext.isEmpty(finance_amt_max)){ record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); }else{ if(Ext.isEmpty(times_limit)){ times_limit=value; } if(Ext.isEmpty(min_dp_ratio)){ min_dp_ratio=0; } if(Ext.isEmpty(finance_amt_max)){ finance_amt_max=999999999999; } if (value == times_limit && down_payment_ratio >= min_dp_ratio && finance_amount <= finance_amt_max) { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); }else{ record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); } } if(Ext.isEmpty(times_limit_visit) && Ext.isEmpty(min_dp_ratio_visit) && Ext.isEmpty(finance_amt_max_visit)){ record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); }else{ if(Ext.isEmpty(times_limit_visit)){ times_limit_visit=value; } if(Ext.isEmpty(min_dp_ratio_visit)){ min_dp_ratio_visit=0; } if(Ext.isEmpty(finance_amt_max_visit)){ finance_amt_max_visit=999999999999; } if (value == times_limit_visit && down_payment_ratio >= min_dp_ratio_visit && finance_amount <= finance_amt_max_visit) { record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else{ record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } } } if(name=='down_payment_ratio'){ var min_dp_ratio = record.get('min_dp_ratio'); var min_dp_ratio_visit = record.get('min_dp_ratio_visit'); var times_limit = record.get('times_limit'); var times_limit_visit = record.get('times_limit_visit'); var finance_amt_max=record.get('finance_amt_max'); var finance_amt_max_visit = record.get('finance_amt_max_visit'); var finance_amount=record.get('finance_amount'); var lease_times = record.get('lease_times'); if(Ext.isEmpty(times_limit) && Ext.isEmpty(min_dp_ratio) && Ext.isEmpty(finance_amt_max)){ record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); }else{ if(Ext.isEmpty(times_limit)){ times_limit=lease_times; } if(Ext.isEmpty(min_dp_ratio)){ min_dp_ratio=0; } if(Ext.isEmpty(finance_amt_max)){ finance_amt_max=999999999999; } if (lease_times == times_limit && value >= min_dp_ratio && finance_amount <= finance_amt_max) { record.set('gps_install_flag', 'N'); record.set('gps_install_flag_n', '否'); }else{ record.set('gps_install_flag', 'Y'); record.set('gps_install_flag_n', '是'); } } if(Ext.isEmpty(times_limit_visit) && Ext.isEmpty(min_dp_ratio_visit) && Ext.isEmpty(finance_amt_max_visit)){ record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); }else{ if(Ext.isEmpty(times_limit_visit)){ times_limit_visit=lease_times; } if(Ext.isEmpty(min_dp_ratio_visit)){ min_dp_ratio_visit=0; } if(Ext.isEmpty(finance_amt_max_visit)){ finance_amt_max_visit=999999999999; } if (lease_times == times_limit_visit && value >= min_dp_ratio_visit && finance_amount <= finance_amt_max_visit) { record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else{ record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } } } 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;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 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; } ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view> </a:screen>