con_re_incept_modify.lview 43.2 KB
Newer Older
1 2 3 4 5 6 7
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zlf
    $Date: 2014-11-10 下午5:42:24
    $Revision: 1.0
    $Purpose:
-->
8 9
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true"
          dynamiccreateenabled="true" trace="true">
10 11 12 13 14 15 16 17 18 19 20 21 22
    <a:init-procedure>
        <a:model-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name" rootPath="file_name_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>
        <s:server-script import="con_print_path.js"><![CDATA[
            set_parameter_file_path();
            ]]>
        </s:server-script>
    </a:init-procedure>
    <a:view>
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
        <a:link id="wfl_readonly_pageLink_projectQueryScreen_update_project"
                url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain_readonly.lview"/>
        <a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id"
                model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="${/parameter/@layout_code}_con_contract_content_confirm_link_id"
                url="${/request/@context_path}/modules/cont/CON501N/con_contract_content_confirm.lview"/>
        <a:link id="contract_lease_item_query_link"
                url="${/request/@context_path}/modules/cont/CON505/con_lease_item_query.lview"/>
        <a:link id="contract_history_window_link"
                url="${/request/@context_path}/modules/cont/CON501N/con_document_history_query.lview"/>
        <a:link id="con505_hls_bp_master_query_link"
                url="${/request/@context_path}/modules/cont/CON505/hls_bp_master_query.lview"/>
        <a:link id="${/parameter/@layout_code}_prj500_cdd_uploadFile_id"
                url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="${/parameter/@layout_code}_prj500_cdd_downloadFile_id"
                url="${/request/@context_path}/downloadFile.lview"/>
39
        <!--打印使用-->
40 41 42 43 44 45 46 47 48 49
        <a:link id="${/parameter/@layout_code}_con505_contract_content_id" model="cont.CON505.con505_contract_content"
                modelaction="update"/>
        <a:link id="${/parameter/@layout_code}_creat_con_contract_content_link_id"
                model="cont.CON505.con505_contract_content" modelaction="execute"/>
        <a:link id="${/parameter/@layout_code}_file_copy_from_template_link_id"
                url="${/request/@context_path}/modules/cont/CON505/file_copy_from_template.lsc"/>
        <a:link id="${/parameter/@layout_code}_con_batch_dl_link_id"
                url="${/request/@context_path}/modules/cont/CON505/con_atm_batch_dl.lsc"/>
        <a:link id="${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link"
                url="${/request/@context_path}/modules/cont/CON302N/con_cashflow_wirte_off_detail.lview"/>
50
        <a:link id="con_approval_link_id" model="cont.CON505.contract_approval" modelaction="execute"/>
51 52
        <!--        <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>-->
        <!--        <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>-->
lijingjing's avatar
lijingjing committed
53 54
        <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"/>
55 56
        <a:link id="get_atch_download_link"
                url="${/request/@context_path}/modules/batch_download/lease_atm_batch_dl.lsc"/>
57 58 59
        <link href="${/request/@context_path}/modules/viewerjs/viewer.css" rel="stylesheet"/>
        <script src="${/request/@context_path}/modules/viewerjs/viewer.js"/>
        <script src="${/request/@context_path}/modules/viewerjs/viewer_tool.js"/>
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
        <script type="text/javascript"><![CDATA[
        function lock_current_window() {
            Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
        }

        function unlock_current_window() {
            Leaf.Masker.unmask(Ext.getBody());
        }

        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var contract_id = $(ds_id).getCurrentRecord().get('contract_id');
            new Leaf.Window({
                id: 'contract_history_window',
                url: $('contract_history_window_link').getUrl(),
                params: {
                    contract_id: contract_id
                },
                fullScreen: true
            });
        };

niminmin's avatar
niminmin committed
82 83 84
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            if (ds_id == ds.id && ds_id) {
85 86 87 88 89 90 91 92
                // if (record.get('business_type') == 'LEASEBACK'&&'${/parameter/@function_usage}'=='MODIFY') {
                //     record.set('submit_date',null);
                //     record.set('guarantee_letter_f','N');
                //     record.set('guarantee_letter_f_n','否');
                //     record.getField('submit_date').setReadOnly(true);
                //     record.getField('guarantee_letter_f').setReadOnly(true);
                //     record.getField('guarantee_letter_f_n').setReadOnly(true);
                // }else
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
                if (record.get('division')!='70'){
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_CUSTOMER_MARGIN_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_CUSTOMER_MARGIN').style.display = 'none';
                    if(document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_WRITE_OFF_AMOUNT_prompt')!=null){
                        document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_WRITE_OFF_AMOUNT_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_WRITE_OFF_AMOUNT').style.display = 'none';
                    }
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_BRAND_VALUE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_BRAND_VALUE').style.display = 'none';

                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_MODELCD_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_MODELCD').style.display = 'none';

                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_USING_HOUR_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_USING_HOUR').style.display = 'none';

                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_RESIDUAL_VALUE_AMOUNT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_RESIDUAL_VALUE_AMOUNT').style.display = 'none';

                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_OWNERSHIP_FLAG_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_OWNERSHIP_FLAG').style.display = 'none';

                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_PRODUCE_DATE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_PRODUCE_DATE').style.display = 'none';
                }else if (record.get('division')=='70'){
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_OTHER_FEE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_OTHER_FEE').style.display = 'none';

                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_THIRD_PARTY_DEPOSIT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_THIRD_PARTY_DEPOSIT').style.display = 'none';

                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_OTHER_FEE2_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_LEASE_FIN_INFO_1_CON_CONTRACT_OTHER_FEE2').style.display = 'none';
                }
127
                if (record.get('business_type') == 'LEASE') {
niminmin's avatar
niminmin committed
128 129 130
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_ENTRUSTED_AMOUNT').style.display = 'none';
                }
niminmin's avatar
niminmin committed
131 132 133
                if (record.get('secondary_lease') == 'YES') {
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_REPUR_CONTRACT_ID_prompt').style.display = 'block';
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_REPUR_CONTRACT_ID').style.display = 'block';
134
                } else /*if (record.get('secondary_lease') == 'NO') */{
niminmin's avatar
niminmin committed
135 136 137
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_REPUR_CONTRACT_ID_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_REPUR_CONTRACT_ID').style.display = 'none';
                }
138 139 140 141 142 143 144 145 146 147 148 149 150 151
                if (record.get('contract_status') != 'REPUR' && record.get('contract_status') != 'REPURING') {
                    if (document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_BP_ID_TENANT_BF_REPUR_N')) {
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_BP_ID_TENANT_BF_REPUR_N_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_BP_ID_TENANT_BF_REPUR_N').style.display = 'none';
                    }
                }
                //新增 “限制金额”字段;
                //“扣款限额”:“租金支付方式”为“建行扣款(三方)”时展示;
                if (record.get('pay_method') == 'CCB_THREE') {
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_DEDUCTION_LIMIT_prompt').style.display = 'block';
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_DEDUCTION_LIMIT').style.display = 'block';
                } else {
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_DEDUCTION_LIMIT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_BASIC_1_CON_CONTRACT_DEDUCTION_LIMIT').style.display = 'none';
152
                }
niminmin's avatar
niminmin committed
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

        // window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {

        // if (name == 'car_detail') {
        // return '<a href="javascript:open_contract_window(\'' + record.id + '\',\'' + record.ds.id + '\')">' + config_record.get('prompt') + '</a>';
        // }
        // return value;
        // };

        window['${/parameter/@layout_code}_received_amount_detail'] = function (ds_id, id, name, query_only) {
            var url = $('${/parameter/@layout_code}_con_cashflow_wirte_off_detail_link').getUrl();
            var record = $(ds_id).findById(id);
            if (record) {
                var win = new Leaf.Window({
                    id: 'con_cashflow_wirte_off_detail_window',
                    url: url,
                    params: {
                        cashflow_id: record.get('cashflow_id'),
                        winid: 'con_cashflow_wirte_off_detail_window'
                    },
                    draggable: true,
                    fullScreen: true
                });
            }
        };

        window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
            var link_function = '';
            window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
            if (name == 'project_number') {
                return '<a href="javascript:wfl_prj501_grid_update(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
            } else if (name == 'gps_attch') {
                link_function = '${/parameter/@layout_code}_ast_con_cdd4_attachtment_upload';
                if (record.get('atm_num3') > 0) {
                    return '<a style="color:red" href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                } else {
                    return '<a style="font-weight:bolder;font-size:1.2em" href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                }
            } else if (name == 'description') {
                if (record.get('important_flag') == 'Y') {
                    return '<font color="RED">' + value + '</font>';
                }
                return value;
            } else if (name == 'bp_link' && record.get('bp_id') && record.get('record_id')) {
                link_function = '${/parameter/@layout_code}_open_bp_detail_window';
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
            } else if (name == 'car_detail' && record.get('contract_lease_item_id')) {
                link_function = '${/parameter/@layout_code}_open_lease_item_detail_window';
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\');">' + config_record.get('prompt') + '</a>';
            } else if (name == 'attachment') {
                link_function = '${/parameter/@layout_code}_prj500_cdd_attachtment_upload';
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
209
            } else if (name == 'attach_file_name' || name == 'attach_file_name_print' || name == 'attachment_new') {
210
                var content_type = record.get('content_type');
211
                var content_id = record.get('content_id');
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
                //电子合同
                // if(content_type == '01'){
                //     var link = '${/request/@context_path}/modules/xxx/pdf_download.lsc?type=SIN&content_id=' + content_id;
                //     var url = '';
                //     url = url + '<a href=' + link +  '>' + '下载' + '</a>' + ',';
                //     return url;
                // }else {
                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();
228 229 230
                            // if (file_name.indexOf('.PDF') >= 0) {
                            //     url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ',';
                            // } else
231 232 233
                            // 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>' + ',';
                            // }
234
                            if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
235 236 237
                                // url = url + '<a ref="img" href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                                link_function = 'show_viewer_more';
                                url = url + '<a href="javascript:window[\'' + link_function + '\'](\'' + link + '\',\'' + temp[1] + '\',\'' + temp[0] + '\',\'' + value + '\');">' + temp[0] + '</a>' + ',';
238
                            } else {
239 240 241 242 243 244 245 246 247 248 249
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                    }
                    return url;

                }
                //}
            } else if (name == 'received_amount') {
                link_function = '${/parameter/@layout_code}_received_amount_detail';
                if (value) {
250
                    return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + Leaf.formatMoney(value) + '</a>';
251 252
                }
                return '';
253 254 255
            } else if (name == 'attach_file_name_new') {
                link_function = '${/parameter/@layout_code}_prj500_cdd_attachtment_new_upload';
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.ds.id + '\',\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
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
            }
        };

        function wfl_prj501_grid_update(record_id, ds_id) {
            var record = $(ds_id).findById(record_id);
            var param = {};
            param['bp_class'] = record.get('bp_class');
            param['project_id'] = record.get('project_id');
            param['function_code'] = 'PRJ502D';
            param['function_usage'] = 'QUERY';
            param['url_title'] = '租赁申请查询';
            hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'wfl_readonly_pageLink_projectQueryScreen_update_project', record.ds.id, '${/parameter/@layout_code}');
        }


        window['${/parameter/@layout_code}_ast_con_cdd4_attachtment_upload'] = function (ds_id, id, name, query_only) {
            var record = $(ds_id).findById(id);
            // if (record.get('con_contract_id')) {
            var url;
            if (query_only == 'Y') {
                url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id');
            } else {
                url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('contract_id');
            }
            var win = new Leaf.Window({
                url: url,
                title: 'gps附件上传',
                id: '${/parameter/@layout_code}${/parameter/@tree_code}_ast_con_cdd4_attachtment_upload_id',
                width: 850,
                height: 400
            });
            // win.on('close', function(){
            // $(ds_id).query();
            // });
            // } else {
            // Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
            // }
        };

        window['${/parameter/@layout_code}_open_lease_item_detail_window'] = function (id, name) {
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            var param = record.data;
            var contract_lease_item_id = record.get('contract_lease_item_id');
            new Leaf.Window({
                id: 'contract_lease_item_maintain_window',
                url: $('contract_lease_item_query_link').getUrl(),
                params: {
                    contract_lease_item_id: contract_lease_item_id,
                    winid: 'contract_lease_item_maintain_window'
                },
                draggable: true,
                fullScreen: true
            });
        };

        window['${/parameter/@layout_code}_open_bp_detail_window'] = function (id, name) {
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            var param = {};//record.data;
314
            param['bp_id'] = record.get('bp_id');
315 316 317 318 319 320
            param['cdd_list_id'] = record.get('cdd_list_id');
            param['company_id'] = '${/session/company_id}';
            param['document_id'] = record.get('bp_id');
            param['document_category'] = 'BP';
            param['bp_class'] = record.get('bp_class');
            param['bp_category'] = record.get('bp_category');
321
            if (record.get('bp_category') == 'AGENT') {
322 323
                param['function_code'] = 'HLS303_Q';
                param['function_usage'] = 'QUERY';
324
            } else {
325 326 327
                param['function_code'] = 'CON505H';
                param['function_usage'] = 'QUERY';
            }
328
            param['bp_type'] = record.get('bp_type');
329
            param['download'] = 'Y';
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
            param['url_title'] = '${l:HLS212.BP_MASTER_QUERY}';
            hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'con505_hls_bp_master_query_link', record.ds.id, '${/parameter/@layout_code}');
        };


        // function open_contract_window(record_id, ds_id) {

        // var record = $(ds_id).findById(record_id);

        // var param = record.data;
        // var contract_lease_item_id = record.get('contract_lease_item_id');
        // new Leaf.Window({
        // id: 'contract_lease_item_maintain_window',
        // url: $('contract_lease_item_maintain_link').getUrl(),
        // params: {
        // contract_lease_item_id: contract_lease_item_id
        // },
        // fullScreen: true
        // });
        // // param['function_code'] = 'CON501D';
        // // param['function_usage'] = 'MODIFY';
        // // param['maintain_type'] = 'UPDATE';
        // // param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
        // // hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_modify_link',ds_id);
        // }


        window['${/parameter/@layout_code}_prj500_cdd_attachtment_upload'] = function (ds_id, id, name, query_only) {
            var record = $(ds_id).findById(id);
            if (record.get('check_id')) {
                var url;
363
                if (record.get('attachment_tab_group') == 'SIGN' && '${/parameter/@con_query_only}' == 'N') {
364
                    url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
365
                } else if (record.get('attachment_tab_group') == 'SIGN' && '${/parameter/@con_query_only}' == 'Y') {
366
                    url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
367
                } else if (query_only == 'Y') {
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
                    url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                } else {
                    url = $('${/parameter/@layout_code}_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: '${/parameter/@layout_code}${/parameter/@tree_code}_prj500_cdd_uploadFile_screen_id',
                    width: 850,
                    height: 400
                });

                win.on('close', function () {
                    record.ds.query();
                });
            } else {
                Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
            }
        };
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
        //add by 24976
        window['${/parameter/@layout_code}_prj500_cdd_attachtment_new_upload'] = function (ds_id, id, name, query_only) {
            var record = $(ds_id).findById(id);
            if (record.get('check_id')) {
                var url;
                //add  by  lijingjing  2019-11-15
                if (query_only == 'Y' || '${/parameter/@download}' == 'Y') {
                    url = $('${/parameter/@layout_code}_prj500_cdd_downloadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('check_id');
                } else {
                    url = $('${/parameter/@layout_code}_prj500_cdd_uploadFile_id').getUrl() + '?table_name=CON_CONTRACT&header_id=' + record.get('check_id');
                }
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: '${/parameter/@layout_code}${/parameter/@tree_code}_prj500_cdd_uploadFile_screen_id',
                    width: 850,
                    height: 400
                });

                win.on('close', function () {
                    record.ds.query();
                });
            } else {
                Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
            }
        };
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
        window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () {
            //
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var record = $(ds_id).getCurrentRecord();
            var content_id;
            //alert($('${/parameter/@layout_code}_con505_contract_content_id').getUrl);
            Leaf.request({
                url: $('${/parameter/@layout_code}_con505_contract_content_id').getUrl(),
                para: {
                    content_id: content_id,
                    contract_id: record.get('contract_id'),
                    contract_bp_id: record.get('content_bp_pk'),
                    clause_usage: 'GH_WITHHOLD_AGREE'
                },
                success: function (rsc) {
                    //
                    //alert(rsc.result.content_id);
                    Leaf.request({
                        url: $('${/parameter/@layout_code}_creat_con_contract_content_link_id').getUrl(),
                        para: {
                            content_id: rsc.result.content_id,
                            file_path: '${/parameter/@file_path}'
                        },
                        success: function () {
                            Leaf.request({
                                url: $('${/parameter/@layout_code}_file_copy_from_template_link_id').getUrl(),
                                para: {
                                    contract_id: record.get('contract_id'),
                                    content_id: rsc.result.content_id,
                                    file_path: '${/parameter/@file_path}',
                                    batch_flag: 'Y'
                                },
                                success: function () {
                                    var url = $('${/parameter/@layout_code}_con_batch_dl_link_id').getUrl() + '?contract_id=' + record.get('contract_id') + '&content_id=' + rsc.result.content_id;
                                    window.open(url, '_self');
                                    unlock_current_window();
                                }
                            });
                            unlock_current_window();
                        },
                        error: function () {
                            unlock_current_window();
                        },
                        failure: function () {
                            unlock_current_window();
                        },
                        scope: this
                    });
                },
                error: function () {
                    unlock_current_window();
                },
                failure: function () {
                    unlock_current_window();
                },
                scope: this
            });
        };

        window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');

            var record = $(ds_id).getCurrentRecord();
            var direct_debit_bank_id = record.get('direct_debit_bank_id');
            var dd_bank_account_name = record.get('dd_bank_account_name');
            var dd_bank_account_num = record.get('dd_bank_account_num');
            if (!Ext.isEmpty(record.get('contract_number'))) {
                new Leaf.Window({
                    id: '${/parameter/@layout_code}_con_contract_content_confirm_win_id',
                    params: {
                        action: 'VIEW',
                        contract_id: record.get('contract_id'),
                        company_id: record.get('company_id'),
                        document_category: record.get('document_category'),
                        business_type: record.get('business_type'),
                        winid: '${/parameter/@layout_code}_con_contract_content_confirm_win_id'

                    },
                    url: $('${/parameter/@layout_code}_con_contract_content_confirm_link_id').getUrl(),
                    title: '合同查看',
                    width: 1300,
                    height: 550
                });
            } else {
                Leaf.showErrorMessage('错误', '请先点击保存生成合同编号!');
            }
        };
        var change_flag = 'N';
        //工作流中合同文本生成按钮
        //基本信息tab页 新增必输字段的校验  add by liukang 20160328
        window['${/parameter/@layout_code}_print_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var con_lease_item_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item');
            var record = $(ds_id).getCurrentRecord();
            var con_lease_record = $(con_lease_item_id).getCurrentRecord();
            var direct_debit_bank_id = record.get('direct_debit_bank_id');
            var dd_bank_account_name = record.get('dd_bank_account_name');
            var dd_bank_account_num = record.get('dd_bank_account_num');
            var color_of_apprearance = con_lease_record.get('color_of_apprearance');
            var item_frame_number = con_lease_record.get('item_frame_number');
            var item_engine_number = con_lease_record.get('item_engine_number');
            var license_number = con_lease_record.get('license_number');
            /* if (Ext.isEmpty(direct_debit_bank_id)) {
             Leaf.showMessage('${l:HLS.PROMPT}', '请先填写数据并保存!');
             } else */
            if (!Ext.isEmpty(record.get('contract_number'))) {
                var win = new Leaf.Window({
                    id: '${/parameter/@layout_code}_con_contract_content_confirm_win_id',
                    params: {
                        contract_id: record.get('contract_id'),
                        company_id: record.get('company_id'),
                        document_category: record.get('document_category'),
                        business_type: record.get('business_type'),
                        winid: '${/parameter/@layout_code}_con_contract_content_confirm_win_id',
                        change_flag: change_flag,
                        contract_name: record.get('contract_name'),
                        contract_number: record.get('contract_number')
                    },
                    url: $('${/parameter/@layout_code}_con_contract_content_confirm_link_id').getUrl(),
                    title: '合同文本生成',
                    width: 1300,
                    height: 550
                });
                //在关闭页面之后,刷新一下ds
                win.on('close', function () {
                    if (ds_id) {
                        $(ds_id).query();
                    }
                });
            } else {
                Leaf.showErrorMessage('错误', '请先点击保存生成合同编号!');
            }
        };

        //add by zhuxianfei 20180207

        function view_pdf(attachment_id) {
            Leaf.request({
                url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
                para: {
                    attachment_id: attachment_id
                },
                success: function (res) {

                    var path = res.result.record.file_path;
                    path = path.substr(path.indexOf('hls_attachment'));
                    var tomcat_source = '${/parameter/@tomcat_source}';
560
                    var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path + '?type=pdf';
561 562 563 564 565 566 567
                    var oWin = window.open(source_path);
                },
                scope: this
            });
        }


568
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function (ds, qpara, bp_seq) {
569 570
            //  var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_bs_score');
            // if (ds == $(ds_id)) {
571

572
            // qpara.contract_id = '${/parameter/@contract_id}';
573

574 575
            //$(ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}');
            //  }
576 577 578 579
        };

        window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
580
            var lease_item_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item');
581
            var record = $(ds_id).getCurrentRecord();
582 583 584
            var lease_item_record = $(lease_item_id).getAt(0);
            var contract_id = record.get('contract_id');
            if (lease_item_record.dirty) {
585 586 587
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
588 589 590 591
            if (record.dirty == true) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
592
            if ($(ds_id).validate()) {
593 594 595 596 597
                debugger;
                if(record.get('division')=='70'&&record.get('write_off_amount')<record.get('customer_margin')){
                    Leaf.showMessage('${l:PROMPT}', '铁甲业务需要保证金入账后才能起租');
                    return;
                }
598
                Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
599 600 601 602
                    window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                    Leaf.request({
                        url: $('con_approval_link_id').getUrl(),
                        para: {
603
                            contract_id: contract_id
604 605
                        },
                        scope: this,
606
                        success: function () {
607 608 609
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $('${/parameter/@winid}').close();
                        },
610
                        failure: function () {
611 612
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
613
                        error: function () {
614 615 616 617 618 619 620 621 622 623
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        }
                    });
                });

            }


        }

lijingjing's avatar
lijingjing committed
624 625 626 627 628 629 630 631
        window['${/parameter/@layout_code}_quote_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var cashflow_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_cashflow');
            var record = $(ds_id).getCurrentRecord();
            var price_list = record.get('price_list');
            var calc_session_id = record.get('calc_session_id');
            var parent_pk_value = record.get('contract_id');
            var calc_type = '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR';
632
            var maintain_type = 'QUERY'
lijingjing's avatar
lijingjing committed
633 634 635 636 637
            if (calc_session_id) {
                //直接进入报价页面
                var win = new Leaf.Window({
                    id: 'hls_fin_calc_quotation_update_link_winid',
                    params: {
638
                        layout_code: '${/parameter/@layout_code}',
lijingjing's avatar
lijingjing committed
639 640 641
                        document_id: parent_pk_value,
                        price_list: price_list,
                        document_category: 'CONTRACT',
642
                        contract_status: record.get('contract_status'),
lijingjing's avatar
lijingjing committed
643
                        maintain_type: 'MODIFY',
niminmin's avatar
niminmin committed
644
                        business_type: record.get('business_type'),
lijingjing's avatar
lijingjing committed
645 646 647 648 649 650 651
                        calc_session_id: record.get('calc_session_id'),
                        quotation_id: record.get('quotation_id'),
                        dsId: cashflow_ds_id,
                        winId: 'hls_fin_calc_quotation_update_link_winid',
                        global_flag: 'Y',
                        id_num: 1,
                        calc_type: calc_type,
652
                        recreate_L_formula: 'Y',
653
                        recreate_H_formula: 'Y'
lijingjing's avatar
lijingjing committed
654 655 656 657 658 659 660 661 662 663 664 665 666
                    },
                    url: $('${/parameter/@layout_code}${/parameter/@tree_code}_hls_fin_calculator_update_link_id').getUrl(),
                    fullScreen: true,
                    draggable: true
                });
                win.on('close', function () {
                    $(cashflow_ds_id).query();
                    $(ds_id).query();
                });


            }
        }
667
        Leaf.onReady(function () {
668
            var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_INVOICE_INFO', 'con_contract_bp');
669
            $(ds_id).setQueryUrl('${/request/@context_path}/autocrud/prj.PRJ501N.con_contract_bp/query');
670
            $(ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}');
671 672
            $(ds_id).query();
        })
673 674 675 676 677 678
        //附件打包下载
        window['${/parameter/@layout_code}_C_ATTCH_I_USER_BUTTON1_layout_dynamic_tab_click'] = function () {
            var con_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var contract_record = $(con_ds_id).getAt(0);
            var contract_id = contract_record.get('contract_id');
            var contract_number = contract_record.get('contract_number');
679 680 681
            var cdd_list_id = contract_record.get('cdd_list_id');
            var doc_code = contract_number + '-' + 'SIGN';
            var url_l = $('get_atch_download_link').getUrl() + '?table_pk_value=' + contract_id + '&table_name=CON_CONTRACT' + '&doc_code=' + doc_code + '&group_flag=Y' + '&cdd_list_id=' + cdd_list_id + '&group_code=SIGN' + '&ele_flag=Y';
682 683 684 685 686 687 688 689 690
            window.open(href = url_l, target = "_self");
        };

        //附件打包下载
        window['${/parameter/@layout_code}_C_ATTCH_2_USER_BUTTON1_layout_dynamic_tab_click'] = function () {
            var con_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var contract_record = $(con_ds_id).getAt(0);
            var contract_id = contract_record.get('contract_id');
            var contract_number = contract_record.get('contract_number');
691 692 693
            var cdd_list_id = contract_record.get('cdd_list_id');
            var doc_code = contract_number + '-' + 'SIGN';
            var url_l = $('get_atch_download_link').getUrl() + '?table_pk_value=' + contract_id + '&table_name=CON_CONTRACT' + '&doc_code=' + doc_code + '&group_flag=Y' + '&cdd_list_id=' + cdd_list_id + '&group_code=LEASE_ANNEX';
694 695 696 697 698 699 700 701
            window.open(href = url_l, target = "_self");
        };
        //附件打包下载
        window['${/parameter/@layout_code}_C_ATTCH_1_USER_BUTTON1_layout_dynamic_tab_click'] = function () {
            var con_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var contract_record = $(con_ds_id).getAt(0);
            var contract_id = contract_record.get('contract_id');
            var contract_number = contract_record.get('contract_number');
702 703 704
            var cdd_list_id = contract_record.get('cdd_list_id');
            var doc_code = contract_number + '-' + 'PRJ';
            var url_l = $('get_atch_download_link').getUrl() + '?table_pk_value=' + contract_id + '&table_name=CON_CONTRACT' + '&doc_code=' + doc_code + '&group_flag=Y' + '&cdd_list_id=' + cdd_list_id + '&group_code=CREDIT_CHECK';
705 706
            window.open(href = url_l, target = "_self");
        };
707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
        //加载时调用(grid,table,gridBox)  add by 23459
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
            var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'con_contract_lease_item');
            if(ds.id == lease_item_ds_id&&lease_item_ds_id){
                debugger;
                var gridId= ds.bindname+'_layout_grid_id';
                if(record.data.division=='70'){
                    $(gridId).hideColumn('full_name');
                    $(gridId).hideColumn('division_n');
                    $(gridId).hideColumn('equipments');
                    $(gridId).hideColumn('machine_model_class_n');
                    $(gridId).hideColumn('item_type_n');
                    $(gridId).hideColumn('equipment_type_n');
                    $(gridId).hideColumn('machine_number');
                    record.getField('machine_number').setRequired(false);
                }else {
                    $(gridId).hideColumn('machine_number_70');
                    $(gridId).hideColumn('lease_name_n');
                    $(gridId).hideColumn('brand_value');
                    $(gridId).hideColumn('type_name');
                    $(gridId).hideColumn('produce_date');
                    $(gridId).hideColumn('using_hour');
                    $(gridId).hideColumn('detention_amount');
                    $(gridId).hideColumn('residual_value_amount');
                    $(gridId).hideColumn('ownership_flag_n');
                    $(gridId).hideColumn('created_by_n');
                }
            }
        };
lijingjing's avatar
lijingjing committed
736

737 738 739 740
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>