<?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:init-procedure> <a:view> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_car_organization_id" model="prj.PRJ500D.yonda_car_organization" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_special_fields_link_id" model="cont.CON500.con_contract_get_special_fields" modelaction="update"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_calc_id" model="prj.PRJ500D.calc_quotation" modelaction="update"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}check_product_package_bag_link_id" model="prj.PRJ500D.prj_project_before_workflow_start" modelaction="update"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}submit_approval_link" model="prj.PRJ500D.prj_project_workflow_start" modelaction="update"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_id_card_no_info_id" model="prj.PRJ500D.hls_bp_master_np_v" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_organization_code_id" model="prj.PRJ500D.hls_bp_master_org_v" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_id_card_no_info_guar_id" model="prj.PRJ500D.hls_bp_master_np_guar" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_org_code_info_guar_id" model="prj.PRJ500D.hls_bp_master_org_guar" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_id_card_no_tenant_sec_id" model="prj.PRJ500D.hls_bp_master_np_tenant_sec_v" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}user_id_query_link" model="prj.PRJ500D.sys_user_lv" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_calc_validate_sql_link" model="prj.PRJ500D.prj_get_calc_validate_sql" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_car_organization_id_link" model="prj.PRJ500D.get_hls_car_organization" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_company_distrct_link" model="prj.PRJ500D.get_company_info" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_bp_id_invoice_link" model="prj.PRJ500D.get_bp_id_invoice" modelaction="query"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}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="${/parameter/@layout_code}${/parameter/@pre_layout}con_item_frame_number_link" model="cont.CON501N.con_item_frame_number" modelaction="execute"/> <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}prj501n_analyse_detail_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_analyse_detail.lview"/> <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/> <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/> <!-- <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/check_org_code.js" type="text/javascript"/> --> <script type="text/javascript"><![CDATA[ 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: $('${/parameter/@layout_code}${/parameter/@pre_layout}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'); $(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 = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); } else { url = $('${/parameter/@layout_code}${/parameter/@pre_layout}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: '${l:HLS.SUPPORTING_DOCUMENT}', id: 'prj500_cdd_uploadFile_screen_id', width: 850, height: 400 }); win.on('close', function() { record.ds.query(); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); } } function prj501_open_analyse_win(record_id, ds_id, condition_code) { var record = $(ds_id).findById(record_id); var param = {}; param['target_type'] = record.get('target_type'); param['target'] = record.get('target'); param['condition_code'] = condition_code; param['layout_code'] = 'PRJ_ANALYSE_DETAIL'; param['winid'] = 'prj501n_analyse_detail_win'; param['function_usage'] = 'QUERY'; var win = new Leaf.Window({ id: 'prj501n_analyse_detail_win', params: param, url: $('${/parameter/@layout_code}${/parameter/@pre_layout}prj501n_analyse_detail_link').getUrl(), title: '维度明细('+'PRJ_ANALYSE_DETAIL)', fullScreen: true, draggable: true }); } //超链接渲染 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; } else if (name == 'approved_count' || name == 'reject_count' || name == 'cancel_count' || name == 'terminate_count') { var condition_code; if (name === 'approved_count') { condition_code = '11'; } else if (name === 'reject_count') { condition_code = '12'; } else if (name === 'cancel_count') { condition_code = '13'; } else if (name === 'terminate_count') { condition_code = '14'; } if (value > 0) { return '<a href="javascript:prj501_open_analyse_win(\'' + record.id + '\',\'' + record.ds.id + '\',\'' + condition_code + '\')">' + value + '</a>'; } else { 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: $('${/parameter/@layout_code}${/parameter/@pre_layout}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}' }, 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_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.marital_status) { ds.fields.marital_status.pro.validator = marital_status_validate; marital_status_validate(record,name,record.get('marital_status')); } //申请人配偶身份证校验 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.id).indexOf('prj_project_lease_item') != -1) { //产品带出 if (ds.fields.product_plan_id_n) { ds.fields.product_plan_id_n.pro.validator = product_plan_id_validate; } //期数校验 if (ds.fields.lease_times) { ds.fields.lease_times.pro.validator = lease_times_validate; } //首付款比例校验 if (ds.fields.down_payment_ratio) { ds.fields.down_payment_ratio.pro.validator = down_payment_ratio_validate; } //保证金比例校验 if (ds.fields.deposit_ratio) { ds.fields.deposit_ratio.pro.validator = deposit_ratio_validate; } //保证金校验 if (ds.fields.deposit) { ds.fields.deposit.pro.validator = deposit_validate; } //首付款校验 if (ds.fields.down_payment) { ds.fields.down_payment.pro.validator = down_payment_validate; down_payment_validate(record,name,record.get('down_payment')); } //购置价校验 if (ds.fields.invoice_price) { ds.fields.invoice_price.pro.validator = invoice_price_validate; invoice_price_validate(record,name,record.get('invoice_price')); } //融资额校验 if (ds.fields.finance_amount) { ds.fields.finance_amount.pro.validator = finance_amount_validate; } //手续费校验 if (ds.fields.lease_charge) { ds.fields.lease_charge.pro.validator = lease_charge_validate; } //是否包牌校验 if (ds.fields.license_fee_flag) { ds.fields.license_fee_flag.pro.validator = license_fee_flag_validate; license_fee_flag_validate(record,name,record.get('license_fee_flag')); } //是否融保险费 if (ds.fields.insurance_flag) { ds.fields.insurance_flag.pro.validator = insurance_flag_validate; insurance_flag_validate(record,name,record.get('insurance_flag')); } //是否融购置税 if (ds.fields.purchase_tax_flag) { ds.fields.purchase_tax_flag.pro.validator = purchase_tax_flag_validate; purchase_tax_flag_validate(record,name,record.get('purchase_tax_flag')); } //上牌费校验 if (ds.fields.plate_price) { ds.fields.plate_price.pro.validator = plate_price_validate; plate_price_validate(record,name,record.get('plate_price')); } //购置税校验 if (ds.fields.purchase_tax) { ds.fields.purchase_tax.pro.validator = purchase_tax_validate; purchase_tax_validate(record,name,record.get('purchase_tax')); } //保险费校验 if (ds.fields.insurance_amount) { ds.fields.insurance_amount.pro.validator = insurance_amount_validate; insurance_amount_validate(record,name,record.get('insurance_amount')); } // //指导价校验 // if (ds.fields.guide_price) { // ds.fields.guide_price.pro.validator = guide_price_validate; // } } 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; } } }; 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 lease_charge = record.get('lease_charge'); 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); 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 'false'; } record.set('down_payment_ratio', down_payment_ratio); record.set('finance_amount', finance_amount); return true; } function plate_price_validate(record, name, value) { 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 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); return true; } function insurance_amount_validate(record, name, value) { 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 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); return true; } function purchase_tax_validate(record, name, value) { 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 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); return true; } function lease_charge_validate(record, name, value) { var finance_amount = record.get('finance_amount'); var lease_charge_ratio; if (!finance_amount) { lease_charge_ratio = 0; } else { lease_charge_ratio = parseInt(value) / parseInt(finance_amount); } record.set('lease_charge_ratio', lease_charge_ratio); return true; } function finance_amount_validate(record, name, value) { var deposit_ratio = record.get('deposit_ratio') || 0; var deposit = parseFloat(deposit_ratio) * parseInt(value); var lease_charge = record.get('lease_charge') || 0; var finance_amount_from = record.get('finance_amount_from') || 0; var finance_amount_to = record.get('finance_amount_to') || 99999999999; var lease_charge_ratio; if (value < finance_amount_from || value > finance_amount_to) { Leaf.showMessage('提示', '超出范围,请重新选择融资方案!'); return '请填写' + finance_amount_from + '到' + finance_amount_to + '之间的数字'; } if (value != 0) { lease_charge_ratio = parseInt(lease_charge) / parseInt(value); } else { lease_charge_ratio = 0; } record.set('deposit', deposit); record.set('lease_charge_ratio', lease_charge_ratio); return true; } function invoice_price_validate(record, name, value) { var down_payment = record.get('down_payment'); 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 guide_price = record.get('guide_price')|| 9999999999; // if(value > guide_price){ // Leaf.showMessage('提示','购置价不能大于指导价!'); // return '购置价不能大于指导价'; // } 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); } return true; } function guide_price_validate(record, name, value) { record.set('invoice_price',record.get('invoice_price')); 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; // } // } return true; }; //更新时调用 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 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 (lease_item_info_ds_id == ds.id) { if (name == 'model_id_n') { record.getField('product_plan_id_n').setLovPara('model_id', record.get('model_id')); } } if (ds_id == ds.id) { if (name == 'lease_times') { if (!value) { record.getField('lease_times').setReadOnly(false); } } if (name == 'deposit_ratio') { if (!value) { record.getField('deposit_ratio').setReadOnly(false); } } } /*如果是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: $('${/parameter/@layout_code}${/parameter/@pre_layout}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) { 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: $('${/parameter/@layout_code}${/parameter/@pre_layout}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) { 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 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 marital_status_validate(record, name, value) { record.getField('id_no_sp').setRequired(false); record.getField('bp_name_sp').setRequired(false); 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); 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 lease_times_validate(record, name, value) { var min_dp_ratio = record.get('min_dp_ratio'); var times_limit = record.get('times_limit'); var min_dp_ratio_visit = record.get('min_dp_ratio_visit'); var times_limit_visit = record.get('times_limit_visit'); 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 (down_payment_ratio != 'undefined') { if (value == times_limit && down_payment_ratio >= min_dp_ratio) { 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 (value == times_limit_visit && down_payment_ratio >= min_dp_ratio_visit) { record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else { record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } } return true; } function down_payment_ratio_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 min_dp_ratio = record.get('min_dp_ratio'); var times_limit = record.get('times_limit'); var min_dp_ratio_visit = record.get('min_dp_ratio_visit'); var times_limit_visit = record.get('times_limit_visit'); var lease_times = record.get('lease_times') || 0; if (value < down_payment_ratio_from || value > 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 + '之间的数字'; } if (lease_times == times_limit && value >= min_dp_ratio) { 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 (lease_times == times_limit_visit && value >= min_dp_ratio_visit) { record.set('visit_flag', 'N'); record.set('visit_flag_n', '否'); } else { record.set('visit_flag', 'Y'); record.set('visit_flag_n', '是'); } return true; } function deposit_ratio_validate(record, name, value) { var finance_amount = record.get('finance_amount') || 0; var deposit = parseInt(finance_amount) * parseFloat(value); record.set('deposit', deposit); return true; } function deposit_validate(record, name, value) { 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 lease_charge = record.get('lease_charge'); var down_payment = record.get('down_payment'); 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('id_card_no') // var phone_1 = record.get('phone'); // var phone_2 = record.get('phone_2'); // var phone_3 = record.get('phone_3'); // 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; // } 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; } function product_plan_id_validate(record, name, value) { var down_payment_ratio = record.get('down_payment_ratio'); var finance_amount = record.get('finance_amount'); if (down_payment_ratio) { record.set('down_payment_ratio', down_payment_ratio); } if (finance_amount) { record.set('finance_amount', finance_amount); } return true; } function license_fee_flag_validate(record, name, value) { if (value == 'N') { record.getField('plate_price').setReadOnly(true); record.getField('plate_price').setRequired(false); } else { record.getField('plate_price').setReadOnly(false); record.getField('plate_price').setRequired(true); } return true; } function insurance_flag_validate(record, name, value) { if (value == 'N') { record.getField('insurance_amount').setReadOnly(true); record.getField('insurance_purchase').setReadOnly(true); record.getField('insurance_amount').setRequired(false); record.getField('insurance_purchase').setRequired(false); } else { record.getField('insurance_amount').setReadOnly(false); record.getField('insurance_purchase').setReadOnly(false); record.getField('insurance_amount').setRequired(true); record.getField('insurance_purchase').setRequired(true); } return true; } function purchase_tax_flag_validate(record, name, value) { if (value == 'N') { record.getField('purchase_tax').setReadOnly(true); record.getField('purchase_tax').setRequired(false); } else { record.getField('purchase_tax').setReadOnly(false); record.getField('purchase_tax').setRequired(true); } return true; } ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view> </a:screen>