<?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" xmlns:s="leaf.plugin.script" 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 defaultWhereClause="v.role_id = ${/session/@role_id} and v.role_code in ('HAND','0017')" model="zjwfl.sys_role_flag" rootPath="role_flag_path"/> <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="bp_tenant_detail_query_link" model="prj.PRJ500D.bp_tenant_old_r_query" modelaction="query"/> <a:link id="${/parameter/@layout_code}_tenant_rate_query_link" url="${/request/@context_path}/modules/prj/PRJ902/prj_project_score_result.lview"/> <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}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/@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_for_deron_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_doc_quotation_for_deron.lsc"/> <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}contract_number_query_link" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/> <a:link id="${/parameter/@layout_code}hls_bp_master_query_link" url="${/request/@context_path}/modules/hls/HLS215N/hls_bp_master_query.lview"/> <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"/> <a:link id="${/parameter/@layout_code}_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <!-- <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/check_org_code.js" type="text/javascript"/> --> <!-- <a:link id="prj_project_create_con_id" model="prj.PRJ513N.prj_peoject_create_con" modelaction="update"/> --> <a:link id="${/parameter/@layout_code}_prj_project_create_contract_link_id" model="prj.PRJ505.prj_project_create_contract" modelaction="update"/> <script type="text/javascript"><![CDATA[ window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function () { Leaf.showConfirm('提示', '是否确认生成合同?', function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var url = $('${/parameter/@layout_code}_prj_project_create_contract_link_id').getUrl(); var record = $(ds_id).getCurrentRecord(); if ($(ds_id).validate()) { window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); Leaf.request( { url: url, para: { project_id: record.get('project_id'), contract_seq: 1, bp_contract_seq: 1, contract_type: 'CARCON', contract_name: record.get('project_name'), billing_method: record.get('billing_method'), }, success: function (res) { $('${/parameter/@winid}').close(); 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 } ); } }); }; //add by zhuxianfei window['${/parameter/@layout_code}_quote_layout_dynamic_click'] = function () { var url; var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation'); var record = $(quotation_ds_id).getCurrentRecord(); var head_record = $(ds_id).getAt(0); if ('${/parameter/@calc_type}' == 'LITE_CALCULATOR') { url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calc_quotation_header_link_id').getUrl(); } else if ('${/parameter/@calc_type}' == 'CLASSIC_CALCULATOR') { url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id').getUrl(); } else { url = $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id').getUrl(); // Leaf.showMessage('${l:PROMPT}', '${l:HLS.CALC_TYPE_IS_NULL}'); // return; } if (record.dirty == true) { Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}'); return; } if ($(quotation_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; } var parent_pk_value = head_record.get('project_id'); record.set('function_code', 'PRJ505_QUOTATION'); record.set('function_usage', 'UPDATE'); record.set('project_id', parent_pk_value); //拆分合同可维护 window['${/parameter/@layout_code}_lock_layout_dynamic_window'](); //首次插入 if (!record.get('calc_session_id')) { record.set('to_doc_table', 'HLS_FIN_CALCULATOR_HD'); var calc_recreate_L_formula; calc_recreate_L_formula = 'Y'; record.set('_status', 'update'); record.set('from_doc_table', 'PRJ_QUOTATION'); record.set('from_doc_pk', record.get('quotation_id')); record.set('calculate_flag', 'N'); if (!'${/parameter/@document_id}') { record.set('document_id', parent_pk_value); } var saveData = []; saveData.push(record.data); Leaf.request({ url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_doc_quotation_link_id').getUrl(), para: saveData, success: function (res) { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); $(quotation_ds_id).query(); var quotation_id = record.get('quotation_id') || res.result.record.quotation_id; var win = new Leaf.Window({ id: 'hls_fin_calc_quotation_link_winid', params: { document_id: parent_pk_value, document_category: 'PORJECT', maintain_type: 'MODIFY', calc_session_id: res.result.record.calc_session_id, quotation_id: quotation_id, dsId: quotation_ds_id, winId: 'hls_fin_calc_quotation_link_winid', global_flag: 'Y', id_num: 0, calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR', recreate_L_formula: calc_recreate_L_formula }, url: url, fullScreen: true, draggable: true }); win.on('close', function () { $(quotation_ds_id).query(); }); }, failure: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, error: function () { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }, scope: this }); } else { window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); //直接进入报价页面 var win = new Leaf.Window({ id: 'hls_fin_calc_quotation_update_link_winid', params: { document_id: parent_pk_value, document_category: 'PORJECT', maintain_type: 'MODIFY', calc_session_id: record.get('calc_session_id'), quotation_id: record.get('quotation_id'), dsId: quotation_ds_id, winId: 'hls_fin_calc_quotation_update_link_winid', global_flag: 'Y', id_num: 0, calc_type: '${/parameter/@calc_type}', recreate_L_formula: 'N' }, url: url, fullScreen: true, draggable: true }); win.on('close', function () { $(quotation_ds_id).query(); }); } } }; function prj501n_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' || '${/parameter/@function_usage}' == 'QUERY') { 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 prj501n_upload_file_new(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' || '${/parameter/@function_usage}' == 'QUERY') { if('${/model/role_flag_path/record/@sys_role_flag}' == 'Y') { url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); }else{ 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'); }*/ if('${/model/role_flag_path/record/@sys_role_flag}' == 'Y') { url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id'); }else{ url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_downloadFile_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 prj501n_contract_number_renderer(id, name, query_only) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; var param = {}; param['contract_id'] = record.get('contract_id'); param['function_code'] = 'CON301'; param['function_usage'] = 'QUERY'; param['winid'] = '${/parameter/@layout_code}_project_number_win_id'; param['url_title'] = '${l:CON301.CONTRACT_DETAIL}'; hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}contract_number_query_link', record.ds.id, '${/parameter/@layout_code}'); } function prj501n_bp_code_renderer(id, name, query_only) { var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; var param = {}; param['bp_id'] = record.get('bp_id'); param['bp_class'] = record.get('bp_class'); param['function_code'] = 'HLS215D'; param['function_usage'] = 'QUERY'; param['maintain_type'] = 'READONLY'; param['winid'] = '${/parameter/@layout_code}_bp_win_id'; param['url_title'] = '${l:HLS212.BP_MASTER_MAINTAIN}'; hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}hls_bp_master_query_link', record.ds.id, '${/parameter/@layout_code}'); } //超链接渲染 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 = 'prj501n_upload_file'; if(record.get('cdd_item') == 'ADD_ATTACH'){ link_function = 'prj501n_upload_file_new'; } 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 = 'bp_link') { link_function = 'prj501n_bp_code_renderer'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>'; }else if (name == 'contract_number') { link_function = 'prj501n_contract_number_renderer'; return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>'; } }; //保存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'); var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP','prj_project_bp'); var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'F_TENANT_INFO', 'prj_project_bp'); var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref'); var virtual_ds_id = '${/parameter/@layout_code}_virtual_ds'; if (ds_id==ds.id || virtual_ds_id==ds.id) { $(cdd_item_ds_id).query(); $(tenant_ds_id).query(); $(bp_ds_id).query(); } window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); }; //选择事件(grid,attach,gridbox,table) window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function(ds, record, bp_seq) { var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp','G_BP'); if (bp_ds_id == ds.id && bp_ds_id) { if (record.get('bp_category') == 'TENANT') { //实际为不选中 Leaf.showMessage('${l:HLS.PROMPT}', '无法删除主承租人!'); ds.unSelect(record); ds.Select(record); } if (record.get('bp_category') == 'AGENT') { //实际为不选中 Leaf.showMessage('${l:HLS.PROMPT}', '无法删除经销商!'); ds.unSelect(record); ds.Select(record); } } }; //更新时调用 window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) { }; //加载时调用(grid,table,gridBox) window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record, config_records, bp_seq) { var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'G_BP', 'prj_project_bp'); var record = $(bp_ds_id).getCurrentRecord(); if (bp_ds_id == ds.id && bp_ds_id) { if (record.get('bp_category') == 'TENANT') { record.getField('bp_category_n').setReadOnly(true); record.getField('bp_id_n').setReadOnly(true); } if (record.get('bp_category') == 'AGENT') { record.getField('bp_category_n').setReadOnly(true); record.getField('bp_id_n').setReadOnly(true); } } }; //客户评分 window['${/parameter/@layout_code}_user_button9_layout_dynamic_click'] = function () { var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project'); var record = $(ds_id).getCurrentRecord(); if (record) { var param = record.data; if (record.get('project_id')) { param['project_id'] = record.get('project_id'); param['winid'] = 'hl_tenant_score_rate_win_id'; param['url_title'] = '客户评分明细'; var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail'); var r = $(score_ds_id).getCurrentRecord(); // if (r.dirty) { // Leaf.showInfoMessage('提示', '评分数据发生修改,请先保存再进行评分'); // return; // } if ($(ds_id).validate()) { var win = new Leaf.Window({ id: param['winid'], params: param, url: $('${/parameter/@layout_code}_tenant_rate_query_link').getUrl(), title: param['url_title'], fullScreen: true, draggable: true }); win.on('close', function () { $(ds_id).setQueryParameter('project_id',record.get('project_id')); $(ds_id).query(); }); } } else { Leaf.showMessage('${l:PROMPT}', '请先保存'); return; } } }; ]]></script> <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/> </a:view> </a:screen>