virtual_contract_query.lview 20.5 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-12-9 上午10:36:28  
    $Revision: 1.0  
    $Purpose: 虚拟合同维护
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
    <a:view>
        <a:link id="prj506_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="prj506_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="hls_fin_calculator_query_link_id" url="${/request/@context_path}/modules/hls/HLS500/hls_fin_calculator_readonly.lview"/>
        <a:link id="hls_fin_calculator_update_link_id" url="${/request/@context_path}/modules/hls/HLS500N/hls_fin_calculator_update_n.lview"/>
        <a:link id="prj_project_update_print_query_link_id" url="${/request/@context_path}/modules/prj/PRJ506/prj_project_print_detail_query.lview"/>
        <a:link id="prj_project_virtual_con_submit_link_id" model="prj.PRJ506.prj_project_create_content" modelaction="execute"/>
        <a:link id="prj_project_sign_check_and_save_link_id" model="prj.PRJ506.con_contract_sign_save_check" modelaction="update"/>
        <a:link id="prj_project_modify_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_create_tree_n.lview"/>
        <a:link id="prj_project_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="prj506_project_side_query_id" url="${/request/@context_path}/modules/prj/PRJ811/hn_project_side_detail.lview"/>
        <a:link id="${/parameter/@layout_code}_prj506_mortgage_detail_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_mortgage_detail_modify.lview"/>
        <a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            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'||'${/parameter/@sign_flag}'!='Y') {
                        url = $('prj506_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    } else {
                        url = $('prj506_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                    }
                    //如果是合同其他附件不为只读则可上传
                   if (query_only != 'Y'&&(record.get('attachment_tab_group')=='CON_OTHER'||typeof(record.get('attachment_tab_group'))=='undefined')){
                       url = $('prj506_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: 'tre610_cdd_uploadFile_screen_id',
                        width: 850,
                        height: 400
                    });
            
                    win.on('close', function() {
                        record.ds.query();
                    });
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
            
                }
            }
            
            function con_content_detail(id, name, query_only){
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                if (record.get('content_id')){
                   var url;
                   url = $('prj506_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT_CONTENT_V&header_id=' + record.get('content_id');
                }
                var win = new Leaf.Window({
                        url: url,
                        title: '文本信息',
                        width: 850,
                        height: 400
                    });
            
                    win.on('close', function() {
                        record.ds.query();
                    });
            }
            
            window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $(ds_id).getAt(0);
                var url = $('prj_project_update_print_query_link_id').getUrl();
                var win = new Leaf.Window({
                    url: url,
                    title: '合同文本',
                    params: {
                        project_id: record.get('project_id'),
                        winid: 'prj_project_create_content_print_win_id'
                    },
                    id: 'prj_project_create_content_print_win_id',
                    width: 1100,
                    height: 500
                });
            };
            
            //提交审批
            window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
            
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $('projectQueryScreen_mainDs').getSelected()[0];
                Leaf.showConfirm('${l:HLS.PROMPT}', '确认已完成合同文本并提交?', function() {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    Leaf.request({
                        url: $('prj_project_virtual_con_submit_link_id').getUrl(),
                        para: {
                            project_id: record.get('project_id')
                        },
                        scope: this,
                        success: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $('${/parameter/winid}').close();
                            $('projectQueryScreen_mainDs').query();
                        },
                        failure: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        error: function() {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        }
                    });
                });
            };
            //报价链接
            
            function prj_project_quote(id, name, query_only) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                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 head_record = $(ds_id).getAt(0);
                url = $('hls_fin_calculator_query_link_id').getUrl();
            
                var parent_pk_value = head_record.get('project_id');
                //var lease_organization = head_record.get('lease_organization');
                record.set('function_code', 'PRJ506D_WFL');
                record.set('function_usage', 'QUERY');
                record.set('project_id', parent_pk_value);
                //record.set('cond_para2', lease_organization);
            
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                //直接进入报价页面
                var win_query = new Leaf.Window({
                    id: 'hls_fin_calc_quotation_link_query_winid',
                    params: {
                        document_id: parent_pk_value,
                        document_category: 'PORJECT',
                        maintain_type: 'QUERY',
                        calc_session_id: record.get('calc_session_id'),
                        quotation_id: record.get('quotation_id'),
                        dsId: quotation_ds_id,
                        winId: 'hls_fin_calc_quotation_link_query_winid',
                        global_flag: 'Y',
                        id_num: 0,
                        calc_type: 'CLASSIC_CALCULATOR'
                        //recreate_L_formula: calc_recreate_L_formula
                    },
                    url: $('hls_fin_calculator_query_link_id').getUrl(),
                    fullScreen: true,
                    draggable: true
                });
                win.on('close', function() {
                    $(quotation_ds_id).query();
                });
            
            }
            
            function side_detail(id, name, query_only) {
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
                var project_id=record.get('ref_project_id');
                var prj_side_id=record.get('prj_side_id');
                
                var url = $('prj506_project_side_query_id').getUrl();
                var win = new Leaf.Window({
                    url: url,
                    params: {
                        project_id: project_id,
                        prj_side_id: prj_side_id,
                        query_flag: 'Y'
                    },
                    title: '项目补充明细',
                    id: 'prj506_project_side_query_win_id',
                    fullScreen: true
                });
            
                win.on('close', function() {
                    record.ds.query();
                });
            }
            
            //超链接渲染
            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';
                    if (record.get('attach_count') == 0 || !record.get('attach_count')) {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                    } else {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '(' + record.get('attach_count') + ')' + '</a>';
                    }
                } else if (name == 'quote' && !record.isNew) {
                    link_function = 'prj_project_quote';
                    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>' + ',';
                            }
                        }
                        return url;
            
                    }
                } else if (name == 'content_detail'){
                        var content_link='con_content_detail';
                        return '<a href="javascript:window[\'' + content_link + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                } else if (name == 'side_detail') {
                    link_function = 'side_detail';
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                }
                //add by zhangyu for huaneng
                else if (name == 'mortgage_detail') {
                    var text;
                    if (record.get('data_exists_flag')!='Y'){
                        text='<font color="red">编辑明细</font>';
                    }else{
                       text='编辑明细'; 
                    }
                    link_function = '${/parameter/@layout_code}_prj506_mortgage_detail';
                    if(record.get('prj_mortgage_id')){
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + text + '</a>';
                    }
                }
            };
            
            window['${/parameter/@layout_code}_prj506_mortgage_detail'] = function(record_id, name, query_only) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_mortgage');
                var record = window['${/parameter/@layout_code}_hls_link_render_record'][record_id + '---' + name];
                if (!record.isNew) {
                    var param = record.data;
                    var maintain_type = '${/parameter/@maintain_type}';
                    if (maintain_type == 'READONLY') {
                        param['function_code'] = 'PRJ501M_WFL';
                    } else {
                        param['function_code'] = 'PRJ501M';
                    }
                    param['cond_para2'] = record.get('mortgage_asset_detail');
                    param['maintain_type'] = '${/parameter/@maintain_type}';
                    param['function_usage'] = '${/parameter/@function_usage}';
                    param['url_title'] = '抵质押物明细';
                    hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, '${/parameter/@layout_code}_prj506_mortgage_detail_link', ds_id);
                }
            };
            
            //查询时调用(grid,table,gridBox)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
                $(ds_id).setQueryParameter('bp_seq', 1);
            };
            
            //加载时调用(grid,table,gridBox)
            var count_flag = 0;
            //项目类匹配上bp_seq
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record) {
            
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
                $(ds_id).setQueryParameter('bp_seq', 1);
                if (ds.id == ds_id && count_flag < 1) {
                    count_flag = count_flag + 1;
                    $(ds_id).query();
                }
            
            
            };
            
            window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
                
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                var record = $(ds_id).getAt(0);
                 var maintain_type = 'READONLY';
                var param = {};
                param['project_id'] = record.get('project_id');
                param['winid'] = 'prj_project_query_winid';
                param['document_id'] = record.get('project_id');
                param['company_id'] = record.get('company_id');
                param['function_code'] = 'PRJ505';
            	param['function_usage'] = 'QUERY';
            	param['cond_para2']=record.get('hn_industry_classification');
                param['maintain_type'] = maintain_type;
                param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
                param['prj_report_read_flag'] = 'Y';
                hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'prj_project_modify_link');
            };
            
            //新增和加载时调用(form)
            window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) {
                
                var prj_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                if (ds.id == prj_ds_id) {
                    //签约节点控制必输
                    if ('${/parameter/@sign_flag}' != 'Y') {
                        var head_record = $(prj_ds_id).getAt(0);
                        head_record.getField('signing_person_id').setRequired(false);
                        head_record.getField('signing_person_id_n').setRequired(false);
                        head_record.getField('signing_date').setRequired(false);
                        head_record.getField('signing_place').setRequired(false);
                        head_record.getField('ebs_project_code').setRequired(false);
                        head_record.getField('signing_person_id').setReadOnly(true);
                        head_record.getField('signing_person_id_n').setReadOnly(true);
                        head_record.getField('signing_date').setReadOnly(true);
                        head_record.getField('signing_description').setReadOnly(true);
                        head_record.getField('signing_place').setReadOnly(true);
                        head_record.getField('ebs_project_code').setReadOnly(true);
                        
                    }
                }
            };
            
            
        ]]></script>
        <a:switch test="/parameter/@sign_flag">
            <a:case value="Y">
                <script type="text/javascript"><![CDATA[
                    //工作流中同意按钮调用保存
                    zjwfl5110_ApproveChecker_add('agree', function() {
                        var bool = save_before_agree();
                        return bool;
                    });
                    
                    function save_before_agree() {
                        var prj_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                    
                        if ($(prj_ds_id).validate()) {
                            var head_head = $(prj_ds_id).getAt(0);
                            var execute_bool = false;
                            Leaf.request({
                                url: $('prj_project_sign_check_and_save_link_id').getUrl(),
                                para: {
                                    project_id: head_head.get('project_id'),
                                    signing_person_id: head_head.get('signing_person_id'),
                                    signing_date: head_head.get('signing_date'),
                                    signing_description: head_head.get('signing_description'),
                                    signing_place: head_head.get('signing_place')
                                },
                                success: function(res) {
                                    execute_bool = true;
                    
                                    Leaf.SideBar.show({
                                        msg: '操作成功',
                                        duration: 2000
                                    });
                                },
                                failure: function() {
                                    execute_bool = false;
                                },
                                error: function() {
                                    execute_bool = false;
                                },
                                sync: true,
                                scope: this
                            });
                            return execute_bool;
                        } else {
                            return false;
                        }
                    }
                ]]></script>
            </a:case>
        </a:switch>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>