prj_project_maintain.lview 134 KB
Newer Older
1
<?xml version="1.0" encoding="UTF-8"?>
Spencer Chang's avatar
Spencer Chang committed
2
<!--
3 4 5 6
    $Author: wangwei5743
    $Date: 2014-10-8 下午3:16:19
    $Revision: 1.0
    $purpose: 租赁申请创建  创建界面
Spencer Chang's avatar
Spencer Chang committed
7 8 9 10 11 12
-->
<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"/>
13
        <a:model-query
wangwei5743's avatar
wangwei5743 committed
14
                defaultWhereClause="v.role_id = ${/session/@role_id} and v.role_code in (&apos;HAND&apos;,&apos;0017&apos;,&apos;0019&apos;)"
15 16
                model="zjwfl.sys_role_flag" rootPath="role_flag_path"/>
        <a:model-query fetchAll="true" model="prj.PRJ500D.user_agent_description" rootPath="user_agent_description"/>
17
        <a:model-query fetchAll="true" model="prj.PRJ500D.prj_project_get_description" rootPath="description"/>
gzj34291's avatar
gzj34291 committed
18 19
        <a:model-query fetchAll="true"  model="prj.PRJ500D.prj_project_residual_value" rootPath="residual_value"/>
        <!--        <a:model-query fetchAll="true"  model="prj.PRJ500D.prj_project_residual_value_from" rootPath="prj_residual_value"/>-->
21471731's avatar
21471731 committed
20

21
        <a:model-query fetchAll="true" model="prj.PRJ500D.prj_project_get_asset_fee_flag" rootPath="asset_fee_path" ></a:model-query>
22
        <a:model-query fetchAll="true" model="prj.PRJ500D.prj_project_get_division_detail" rootPath="division_detail_path" ></a:model-query>
Spencer Chang's avatar
Spencer Chang committed
23
        <s:server-script import="contract_print_path.js"><![CDATA[
24 25
        $ctx.parameter.file_path = con_print_path['con_print_path'];
        $ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
26 27
		$ctx.parameter.asset_fee_flag = $ctx.get('/model/asset_fee_path/record/@asset_fee_flag');
		$ctx.parameter.division_detail = $ctx.get('/model/division_detail_path/record/@division_detail');
28

29 30
        ]]>
        </s:server-script>
Spencer Chang's avatar
Spencer Chang committed
31 32
    </a:init-procedure>
    <a:view>
21471731's avatar
21471731 committed
33
        <a:link id="prj501N_prj_lease_item_maintain_link" model="prj.PRJ500N.prj_project_lease_item_delete" modelaction="execute"/>
34 35
        <a:link id="hls_bp_master_billing_link" model="prj.PRJ500N.hls_bp_master_billing" modelaction="query"/>
        <a:link id="bp_tenant_detail_query_link" model="prj.PRJ500D.bp_tenant_old_r_query" modelaction="query"/>
36
        <a:link id="${/parameter/@layout_code}${/parameter/@pre_layout}get_special_fields_link_id"
Spencer Chang's avatar
Spencer Chang committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50
                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"/>

51
        <a:link id="${/parameter/@layout_code}_principal_eq_pymt_adj_link_n" model="hls.HLS500N.query_principal_eq_pymt_adj" modelaction="update"/>
Spencer Chang's avatar
Spencer Chang committed
52 53 54
        <a:link id="${/parameter/@layout_code}hls_bp_master_query_link"
                url="${/request/@context_path}/modules/hls/HLS215N/hls_bp_master_query.lview"/>

lijingjing's avatar
lijingjing committed
55 56
        <a:link id="${/parameter/@layout_code}contract_number_query_link"
                url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
57 58
        <a:link id="${/parameter/@layout_code}_tenant_rate_query_link"
                url="${/request/@context_path}/modules/prj/PRJ902/prj_project_score_result.lview"/>
Spencer Chang's avatar
Spencer Chang committed
59 60 61 62 63
        <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"/>

21471731's avatar
21471731 committed
64 65 66
        <a:link id="${/parameter/@layout_code}lease_number_query_link"
                url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_lease_import_details.lview"/>

Spencer Chang's avatar
Spencer Chang committed
67 68 69 70
        <!-- <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"/>
niminmin's avatar
niminmin committed
71 72
        <a:link id="${/parameter/@layout_code}_prj_project_update_status_link_id"
                model="prj.PRJ505.prj_project_create_contract" modelaction="execute"/>
lijingjing's avatar
lijingjing committed
73
        <a:link id="prj_approval_link_id" model="prj.PRJ501N.project_approval" modelaction="update"/>
lijingjing's avatar
lijingjing committed
74
        <a:link id="check_prj_lease_item_link_id" model="prj.PRJ501N.project_approval" modelaction="execute"/>
gzj34291's avatar
gzj34291 committed
75
        <a:link id="check_machine_number_id" model="prj.PRJ501N.project_approval" modelaction="query"/>
76
        <script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/>
Spencer Chang's avatar
Spencer Chang committed
77 78
        <!--<link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
        <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>-->
79
        <a:link id="prj_check_prj_record_link_n" model="hls.HLS500N.check_prj_record" modelaction="execute"/>
80 81
        <a:link id="get_atch_download_link"
                url="${/request/@context_path}/modules/batch_download/lease_atm_batch_dl.lsc"/>
82 83 84
        <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"/>
Spencer Chang's avatar
Spencer Chang committed
85
        <script type="text/javascript"><![CDATA[
86
        jQuery.noConflict();
Spencer Chang's avatar
Spencer Chang committed
87 88 89 90 91 92
        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 quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
                var quo_record = $(quotation_ds_id).getCurrentRecord();

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
                var cal_hd_price_list = quo_record.get('cal_hd_price_list');
                var price_list = quo_record.get('price_list');
                if (cal_hd_price_list == price_list) {
                    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
Spencer Chang's avatar
Spencer Chang committed
122

123 124 125 126
                            }
                        );
                    }
                } else {
Spencer Chang's avatar
Spencer Chang committed
127
                    Leaf.showMessage('${l:PROMPT}', '报价有变动请重新计算!');
niminmin's avatar
niminmin committed
128

Spencer Chang's avatar
Spencer Chang committed
129 130 131 132
                }
            });
        };

133 134 135 136 137 138 139 140
        function check_empty(value){
            if(Ext.isEmpty(value)||typeof(value)=='undefined'||value==''||value==null){
                return true;
            }else{
                return false;
            }
        }

Spencer Chang's avatar
Spencer Chang committed
141 142 143 144 145 146

        //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');
147
            var history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_CASHFLOW_NS', 'prj_quotation');
lijingjing's avatar
lijingjing committed
148

Spencer Chang's avatar
Spencer Chang committed
149 150 151 152 153 154 155 156 157 158 159
            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;
            }
160
            if (head_record.dirty == true) {
lijingjing's avatar
lijingjing committed
161 162 163
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
Spencer Chang's avatar
Spencer Chang committed
164 165 166 167 168
            if (record.dirty == true) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
            if ($(quotation_ds_id).validate()) {
169 170 171 172
                /* if (!record.get('price_list') || !record.get('currency') || !record.get('lease_times')) {
                     Leaf.showMessage('${l:PROMPT}', '${l:HLS.QUOTATION_EXECUTE_AFTER_SAVE}');
                     return;
                 }*/
Spencer Chang's avatar
Spencer Chang committed
173 174

                var parent_pk_value = head_record.get('project_id');
lijingjing's avatar
lijingjing committed
175 176
                var secondary_lease = head_record.get('secondary_lease');
                var payment_deduction = head_record.get('payment_deduction');
Spencer Chang's avatar
Spencer Chang committed
177 178 179 180 181 182 183
                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')) {
184

21471731's avatar
21471731 committed
185 186
                    var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
                    var current_red= $(ds_id).getCurrentRecord();
陆正友's avatar
陆正友 committed
187
                    if(division=='30' || division=='50'|| division=='99'){
188 189
                      var set_number=current_red.get('set_number');
                      var total_number=current_red.get('total_number');
21471731's avatar
21471731 committed
190
                        if(total_number!=0 && set_number!=total_number){
191
						 window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
21471731's avatar
21471731 committed
192 193 194 195
                            Leaf.showMessage('${l:HLS.PROMPT}', '租赁物台数与查看明细中台数不一致,请重新维护!');
                            return;
                        }
                    }
196

Spencer Chang's avatar
Spencer Chang committed
197 198 199 200 201 202 203 204 205 206 207
                    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);
                    }
208
                    var price_list = record.get('price_list');
Spencer Chang's avatar
Spencer Chang committed
209 210 211 212 213 214 215 216
                    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();
lijingjing's avatar
lijingjing committed
217
                            $(history_ds_id).query();
Spencer Chang's avatar
Spencer Chang committed
218 219 220 221
                            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: {
niminmin's avatar
niminmin committed
222
                                    layout_code: '${/parameter/@layout_code}',
Spencer Chang's avatar
Spencer Chang committed
223
                                    document_id: parent_pk_value,
lijingjing's avatar
lijingjing committed
224
                                    price_list: price_list,
225 226
                                    secondary_lease: secondary_lease,
                                    payment_deduction: payment_deduction,
lijingjing's avatar
lijingjing committed
227
                                    document_category: 'PROJECT',
Spencer Chang's avatar
Spencer Chang committed
228
                                    maintain_type: 'MODIFY',
niminmin's avatar
niminmin committed
229
                                    business_type: head_record.get('business_type'),
Spencer Chang's avatar
Spencer Chang committed
230 231 232 233 234 235 236
                                    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: 1,
                                    calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
237 238
                                    recreate_L_formula: calc_recreate_L_formula,
                                    division:'${/parameter/@division}'
Spencer Chang's avatar
Spencer Chang committed
239 240 241 242 243
                                },
                                url: url,
                                fullScreen: true,
                                draggable: true
                            });
244

Spencer Chang's avatar
Spencer Chang committed
245 246
                            win.on('close', function () {
                                $(quotation_ds_id).query();
lijingjing's avatar
lijingjing committed
247
                                $(history_ds_id).query();
Spencer Chang's avatar
Spencer Chang committed
248 249 250 251 252 253 254 255 256 257 258 259 260

                            });
                        },
                        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']();
21471731's avatar
21471731 committed
261 262
                    var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
                    var current_red= $(ds_id).getCurrentRecord();
陆正友's avatar
陆正友 committed
263
                    if(division=='30' || division=='50'|| division=='99'){
264 265
                      var set_number=current_red.get('set_number');
                      var total_number=current_red.get('total_number');
21471731's avatar
21471731 committed
266
                        if(total_number!=0 && set_number!=total_number){
267
					      window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
21471731's avatar
21471731 committed
268 269 270
                            Leaf.showMessage('${l:HLS.PROMPT}', '租赁物台数与查看明细中台数不一致,请重新维护!');
                            return;
                        }
21471731's avatar
21471731 committed
271
                    }
272

273 274
                    var cal_hd_price_list = record.get('cal_hd_price_list');
                    var price_list = record.get('price_list');
275
                                        //追加二手机报价重算条件,选择了适用或者调整了利率组合则需要重算报价
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
                    var cal_hd_user_col_v06 = record.get('cal_hd_user_col_v06');
                    var hd_user_col_v06 = record.get('hd_user_col_v06');
                    var cal_btb_int_rate = record.get('cal_btb_int_rate');
                    var btb_int_rate = record.get('btb_int_rate');
                    var cal_int_rate_display = record.get('cal_int_rate_display');
                    var int_rate_display = record.get('int_rate_display');
                    if(check_empty(cal_hd_user_col_v06)){
                        cal_hd_user_col_v06='N';
                    }
                    if(check_empty(hd_user_col_v06)){
                        hd_user_col_v06='N';
                    }
                    if(check_empty(btb_int_rate)){
                        btb_int_rate=0;
                    }
                    if(check_empty(int_rate_display)){
                        int_rate_display=0;
                    }
18083's avatar
18083 committed
294 295 296 297 298 299
                    if(check_empty(cal_btb_int_rate)){
                         cal_btb_int_rate =0;
                    }
                    if(check_empty(cal_int_rate_display)){
                        cal_int_rate_display=0;
                    }
300 301 302
                    if ((cal_hd_price_list == price_list&&'${/parameter/@asset_fee_flag}'=='N')
                        ||(cal_hd_price_list == price_list&&'${/parameter/@asset_fee_flag}'=='Y'&&cal_hd_user_col_v06==hd_user_col_v06
                            &&cal_btb_int_rate==btb_int_rate&&cal_int_rate_display==int_rate_display)) {
Spencer Chang's avatar
Spencer Chang committed
303 304 305 306 307

                        //直接进入报价页面
                        var win = new Leaf.Window({
                            id: 'hls_fin_calc_quotation_update_link_winid',
                            params: {
niminmin's avatar
niminmin committed
308
                                layout_code: '${/parameter/@layout_code}',
Spencer Chang's avatar
Spencer Chang committed
309
                                document_id: parent_pk_value,
lijingjing's avatar
lijingjing committed
310
                                price_list: price_list,
311 312
                                secondary_lease: secondary_lease,
                                payment_deduction: payment_deduction,
lijingjing's avatar
lijingjing committed
313
                                document_category: 'PROJECT',
Spencer Chang's avatar
Spencer Chang committed
314
                                maintain_type: 'MODIFY',
niminmin's avatar
niminmin committed
315
                                business_type: head_record.get('business_type'),
Spencer Chang's avatar
Spencer Chang committed
316 317 318 319 320 321 322
                                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: 1,
                                calc_type: '${/parameter/@calc_type}',
323 324
                                recreate_L_formula: 'N',
                                division:'${/parameter/@division}'
Spencer Chang's avatar
Spencer Chang committed
325 326 327 328 329 330 331
                            },
                            url: url,
                            fullScreen: true,
                            draggable: true
                        });
                        win.on('close', function () {
                            $(quotation_ds_id).query();
lijingjing's avatar
lijingjing committed
332
                            $(history_ds_id).query();
Spencer Chang's avatar
Spencer Chang committed
333
                        });
334
                    } else {
Spencer Chang's avatar
Spencer Chang committed
335 336 337 338 339 340 341 342 343 344 345
                        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);
                        }
346
                        var price_list = record.get('price_list');
Spencer Chang's avatar
Spencer Chang committed
347 348 349 350 351 352 353 354 355
                        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();
lijingjing's avatar
lijingjing committed
356
                                $(history_ds_id).query();
Spencer Chang's avatar
Spencer Chang committed
357 358 359 360
                                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: {
niminmin's avatar
niminmin committed
361
                                        layout_code: '${/parameter/@layout_code}',
Spencer Chang's avatar
Spencer Chang committed
362
                                        document_id: parent_pk_value,
lijingjing's avatar
lijingjing committed
363
                                        price_list: price_list,
364 365
                                        secondary_lease: secondary_lease,
                                        payment_deduction: payment_deduction,
lijingjing's avatar
lijingjing committed
366
                                        document_category: 'PROJECT',
Spencer Chang's avatar
Spencer Chang committed
367
                                        maintain_type: 'MODIFY',
niminmin's avatar
niminmin committed
368
                                        business_type: head_record.get('business_type'),
Spencer Chang's avatar
Spencer Chang committed
369 370 371 372 373 374 375
                                        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: 1,
                                        calc_type: '${/parameter/@calc_type}' || 'CLASSIC_CALCULATOR',
376 377
                                        recreate_L_formula: calc_recreate_L_formula,
                                        division:'${/parameter/@division}'
Spencer Chang's avatar
Spencer Chang committed
378 379 380 381 382 383 384
                                    },
                                    url: url,
                                    fullScreen: true,
                                    draggable: true
                                });
                                win.on('close', function () {
                                    $(quotation_ds_id).query();
lijingjing's avatar
lijingjing committed
385
                                    $(history_ds_id).query();
Spencer Chang's avatar
Spencer Chang committed
386 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 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427

                                });
                            },
                            failure: function () {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            error: function () {
                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            },
                            scope: this
                        });
                    }
                }
            }
        };


        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}', '请先保存!');
            }
        }

428 429 430 431 432 433 434 435 436 437 438 439 440 441
        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');
                }*/

442
                if ('${/model/role_flag_path/record/@sys_role_flag}' == 'Y') {
443
                    url = $('${/parameter/@layout_code}${/parameter/@pre_layout}prj500_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
444
                } else {
wangwei5743's avatar
wangwei5743 committed
445 446 447 448 449 450
                    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');
                    }

451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
                }
                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}', '请先保存!');
            }
        }

Spencer Chang's avatar
Spencer Chang committed
468 469 470 471 472
        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');
473
            if (record.get('bp_category') == 'AGENT') {
lijingjing's avatar
lijingjing committed
474 475 476
                param['function_code'] = 'HLS303_Q';
                param['function_usage'] = 'QUERY';

477
            } else {
lijingjing's avatar
lijingjing committed
478 479 480
                param['function_code'] = 'HLS215D';
                param['function_usage'] = 'QUERY';
            }
Spencer Chang's avatar
Spencer Chang committed
481 482 483 484 485
            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}');
        }

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
        function prj501n_project_number_renderer(id, name, query_only) {
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            var param = {};
            param['bp_id'] = record.get('project_id');
            param['bp_class'] = record.get('bp_class');
            param['function_code'] = 'PRJ501D';
            param['function_usage'] = 'QUERY';
            param['maintain_type'] = 'READONLY';
            param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
            param['prj_bp_id'] = record.get('prj_bp_id');

            hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}project_number_query_link', record.ds.id, '${/parameter/@layout_code}');
        }

        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}');

        }
Spencer Chang's avatar
Spencer Chang committed
511

21471731's avatar
21471731 committed
512
        function prj501n_lease_number_renderer(record_id, ds_id){
21471731's avatar
21471731 committed
513
            var prj_quotation_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
21471731's avatar
21471731 committed
514 515
            var record = $(ds_id).findById(record_id);
            var param = {};
21471731's avatar
21471731 committed
516
            param['hide_flag'] = '${/parameter/@hide_flag}';
21471731's avatar
21471731 committed
517
            param['project_status'] = '${/parameter/@project_status}';
21471731's avatar
21471731 committed
518
            param['division'] = record.get('division');
21471731's avatar
21471731 committed
519 520 521
            param['project_lease_item_id'] = record.get('project_lease_item_id');
            param['lease_item_id'] = record.get('lease_item_id');
            param['set_number'] = record.get('set_number');
21471731's avatar
21471731 committed
522
            param['document_id'] = record.get('project_id');
21471731's avatar
21471731 committed
523 524 525 526
            param['function_code'] = 'PRJ501INC';
            param['function_usage'] = 'UPDATE';
            param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
            param['url_title'] = '租赁物清单';
21471731's avatar
21471731 committed
527
            hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}lease_number_query_link',prj_quotation_ds, '${/parameter/@layout_code}','${/parameter/@winid}','Y');
21471731's avatar
21471731 committed
528 529
        }

Spencer Chang's avatar
Spencer Chang committed
530 531 532 533 534 535
        //超链接渲染
        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';
wangwei5743's avatar
wangwei5743 committed
536
                if (record.get('cdd_item') == 'ADD_ATTACH'||record.get('cdd_item') == 'TJ_SCORE_SHEET') {
537 538
                    link_function = 'prj501n_upload_file_new';
                }
Spencer Chang's avatar
Spencer Chang committed
539 540 541
                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') {

542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
                /* 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;

                  }*/
564
                if (value != null) {
Spencer Chang's avatar
Spencer Chang committed
565 566 567
                    var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
                    var str = value.split(';;');
                    var url = '';
568
                    for (var i = 0; i < str.length; i++) {
Spencer Chang's avatar
Spencer Chang committed
569 570 571 572 573 574
                        //
                        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();
575

576 577 578 579 580 581 582
                            // if (file_name.indexOf('.BMP') >= 0 || file_name.indexOf('.JPG') >= 0 || file_name.indexOf('.JPEG') >= 0 || file_name.indexOf('.PNG') >= 0 || file_name.indexOf('.GIF') >= 0) {
                            //     url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
                            // }
                            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>' + ',';
                                link_function = 'show_viewer_more';
                                url = url + '<a href="javascript:window[\'' + link_function + '\'](\'' + link + '\',\'' + temp[1] + '\',\'' + temp[0] + '\',\'' + value + '\');">' + temp[0] + '</a>' + ',';
583
                            } else {
Spencer Chang's avatar
Spencer Chang committed
584 585 586 587 588 589 590
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                    }
                    return url;

                }
lijingjing's avatar
lijingjing committed
591
            } else if (name == 'bp_link' && !record.isNew) {
Spencer Chang's avatar
Spencer Chang committed
592
                link_function = 'prj501n_bp_code_renderer';
593
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
Spencer Chang's avatar
Spencer Chang committed
594

595
            } else if (name == 'project_number') {
lijingjing's avatar
lijingjing committed
596
                link_function = 'prj501n_project_number_renderer';
597
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
lijingjing's avatar
lijingjing committed
598

599
            } else if (name == 'contract_number') {
lijingjing's avatar
lijingjing committed
600
                link_function = 'prj501n_contract_number_renderer';
601
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
21471731's avatar
21471731 committed
602
            }else if(name=='machine_number_n' && record.get('project_lease_item_id')!=null){
21471731's avatar
21471731 committed
603 604
                link_function = 'prj501n_lease_number_renderer';
                return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.ds.id + '\')">' + '查看明细' + '</a>';
Spencer Chang's avatar
Spencer Chang committed
605 606 607 608 609 610 611
            }
        };

        //保存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');
612
            var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
613 614 615 616
            var bp_ds_ids = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
            var prj_project_lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
            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'], 'T_HISTORY_INGO', 'hls_bp_master');
Spencer Chang's avatar
Spencer Chang committed
617
            var cdd_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_cdd_item_doc_ref');
618 619 620
            var virtual_ds_id = '${/parameter/@layout_code}_virtual_ds';
            var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
            if (ds_id == ds.id || virtual_ds_id == ds.id) {
Spencer Chang's avatar
Spencer Chang committed
621 622
                $(cdd_item_ds_id).query();
                $(bp_ds_id).query();
lijingjing's avatar
lijingjing committed
623
                $(tenant_ds_id).query();
624
                $(prj_project_lease_item_ds_id).query();
625
                $(prj_quotation_ds_id).query();
626
                $(score_ds_id).query();
Spencer Chang's avatar
Spencer Chang committed
627
            }
18083's avatar
18083 committed
628

629 630 631
			if (prj_project_lease_item_ds_id==ds.id){
			    $(prj_quotation_ds_id).query();
			}
Spencer Chang's avatar
Spencer Chang committed
632 633 634 635 636

            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
        };

        //选择事件(grid,attach,gridbox,table)
637 638
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function (ds, record, bp_seq) {
            var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_BP', 'prj_project_bp');
Spencer Chang's avatar
Spencer Chang committed
639 640 641 642
            if (bp_ds_id == ds.id && bp_ds_id) {
                if (record.get('bp_category') == 'TENANT') {
                    //实际为不选中
                    Leaf.showMessage('${l:HLS.PROMPT}', '无法删除主承租人!');
niminmin's avatar
niminmin committed
643 644 645 646 647
                    //ds.unSelect(record);
                    //ds.select(record);
                    setTimeout(function () {
                        ds.unSelect(record);
                    }, 1);
Spencer Chang's avatar
Spencer Chang committed
648 649 650 651
                }
                if (record.get('bp_category') == 'AGENT') {
                    //实际为不选中
                    Leaf.showMessage('${l:HLS.PROMPT}', '无法删除经销商!');
niminmin's avatar
niminmin committed
652 653 654 655 656
                    // ds.unSelect(record);
                    // ds.select(record);
                    setTimeout(function () {
                        ds.unSelect(record);
                    }, 1);
Spencer Chang's avatar
Spencer Chang committed
657 658 659
                }
            }
        };
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692

        function jsGetAge(strBirthday) {
            var returnAge;
            var strBirthdayArr = strBirthday.split("-");
            var birthYear = strBirthdayArr[0];
            var birthMonth = strBirthdayArr[1];
            var birthDay = strBirthdayArr[2];

            var d = new Date();
            var nowYear = d.getFullYear();
            var nowMonth = d.getMonth() + 1;
            var nowDay = d.getDate();

            if (nowYear == birthYear) {
                returnAge = 0;//同年 则为0岁  
            } else {
                var ageDiff = nowYear - birthYear; //年之差  
                if (ageDiff > 0) {
                    if (nowMonth == birthMonth) {
                        var dayDiff = nowDay - birthDay;//日之差  
                        if (dayDiff < 0) {
                            returnAge = ageDiff - 1;
                        } else {
                            returnAge = ageDiff;
                        }
                    } else {
                        var monthDiff = nowMonth - birthMonth;//月之差  
                        if (monthDiff < 0) {
                            returnAge = ageDiff - 1;
                        } else {
                            returnAge = ageDiff;
                        }
                    }
693
                } else {
694 695 696 697 698 699 700 701 702 703 704
                    returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天  
                }
            }
            return returnAge;//返回周岁年龄  
        }

        //更新时调用
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
            var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
            var prj_project_history_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
            var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
705
            var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
706
            var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
gzj34291's avatar
gzj34291 committed
707
            var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
18083's avatar
18083 committed
708 709 710
             //二手车资管费为否,隐藏组合利率组件及将字段设置为空
            if (prj_quotation_ds_id == ds.id) {
                if (name == 'hd_user_col_v06') {
711 712 713 714 715
                    if('${/parameter/@asset_fee_flag}'=='Y'){
                        if (value== 'N'||Ext.isEmpty(value)||value==''||typeof(value) == 'undefined'||value==null) {
                            record.set('asset_id', null);
                            record.set('asset_id_n', null);
                            record.set('btb_int_rate', '');
716
                            //record.set('int_rate_display', '');
717 718 719 720 721 722
                            record.getField('asset_id').setRequired(false);
                            record.getField('asset_id_n').setRequired(false);
                            //隐藏组件
                            if(document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id')){
                                document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id').style.display = 'none';
                            }
18083's avatar
18083 committed
723 724 725
                            if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
                             $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_interest');
                             $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_fee');
726
                            }
727 728 729
                        } else {
                            record.getField('asset_id').setRequired(true);
                            record.getField('asset_id_n').setRequired(true);
730
                            //隐藏组件
731 732 733
                            if(document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id')){
                                document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id').style.display = 'block';
                            }
18083's avatar
18083 committed
734 735 736
                            if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
                            $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').showColumn('btb_interest');
                            $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').showColumn('btb_fee');
737
                            }
738 739 740
                        }
                    }
                }
18083's avatar
18083 committed
741
            }
gzj34291's avatar
gzj34291 committed
742
            if(tenant_ds_id == ds.id&&tenant_ds_id){
743

gzj34291's avatar
gzj34291 committed
744 745 746 747 748 749 750
                if(name == 'send_message_n'){
                    if(value=='是'){
                        record.getField('cell_phone').setRequired(true);
                    } else if(value=='否'){
                        record.getField('cell_phone').setRequired(false);
                    }
                }
751

gzj34291's avatar
gzj34291 committed
752 753 754
            }


755

756
            if (lease_item_ds_id == ds.id && lease_item_ds_id) {
757
                if(division=='70'){
758 759 760 761 762
                    record.getField('lease_name_n').setRequired(true);
                    record.getField('brand_value').setRequired(true);
                    record.getField('produce_date').setRequired(true);
                    record.getField('using_hour').setRequired(true);
                    record.getField('machine_number_70').setRequired(true);
763 764
                    record.getField('modelcd').setReadOnly(true);
                    record.getField('modelcd').setRequired(false);
765 766 767 768 769 770 771 772 773 774 775 776 777
                    record.getField('full_name').setRequired(false);
                    record.getField('full_name_n').setRequired(false);
                    record.getField('ownership_flag_n').setRequired(true);
                    record.getField('residual_value_amount').setRequired(true);
                    if(name=='lease_name_n'){
                        record.data.type_name=value;
                    }else if(name=='modelcd'){
                        record.data.pattern=value;
                    }
                }else {
                    record.getField('modelcd').setReadOnly(true);
                }
            }
778
            //选择承租人带出开票信息
779
            if (prj_project_ds_id == ds.id && prj_project_ds_id) {
niminmin's avatar
niminmin committed
780 781 782 783 784 785 786 787 788 789 790
                if (name == "payment_deduction" && value == "DOWN_PAYMENT_DEDUCTION") {
                    //业务类型回租时,默认只读“首付款抵扣”选项
                    if ($(prj_project_ds_id).getAt(0).get('business_type') == 'LEASE') {
                        Leaf.showInfoMessage("提示", "直租业务不能选择首付款抵扣");
                        setTimeout(function () {
                            $(prj_project_ds_id).getAt(0).set('payment_deduction', null);
                            $(prj_project_ds_id).getAt(0).set('payment_deduction_n', null);
                        }, 10);

                    }
                }
791
                if (name == "bp_id_tenant_n" && value) {
792 793 794 795 796
                    var bp_id_tenant = record.get('bp_id_tenant');
                    Leaf.Masker.mask(Ext.getBody());
                    Leaf.request({
                        url: $('hls_bp_master_billing_link').getUrl(),
                        para: {
797
                            bp_id: bp_id_tenant
798
                        },
799 800
                        success: function (res) {
                            var billing_into = res.result.record;
801 802
                            var prj_project_bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');

803 804 805 806 807 808 809 810 811
                            $(prj_project_bp_ds_id).getAt(0).set('taxpayer_type_n', billing_into.taxpayer_type_n);
                            $(prj_project_bp_ds_id).getAt(0).set('taxpayer_type', billing_into.taxpayer_type);
                            $(prj_project_bp_ds_id).getAt(0).set('invoice_title', billing_into.invoice_title);
                            $(prj_project_bp_ds_id).getAt(0).set('invoice_bp_address', billing_into.invoice_bp_address);
                            $(prj_project_bp_ds_id).getAt(0).set('invoice_bp_phone_num', billing_into.invoice_bp_phone_num);
                            $(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank', billing_into.invoice_bp_bank);
                            $(prj_project_bp_ds_id).getAt(0).set('invoice_bp_bank_account', billing_into.invoice_bp_bank_account);
                            $(prj_project_bp_ds_id).getAt(0).set('tax_registry_num', billing_into.tax_registry_num);
                            $(prj_project_bp_ds_id).getAt(0).set('ref_v07', billing_into.ref_v07);
812 813 814 815 816 817 818 819 820 821 822 823 824 825

                            //record.set();
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        failure: function () {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        error: function () {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                    //根据承租人查找该承租人的历史合同信息
                    $(prj_project_history_ds_id).setQueryUrl('${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query');
826
                    $(prj_project_history_ds_id).setQueryParameter("bp_id", bp_id_tenant);
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
                    $(prj_project_history_ds_id).query();

                    Leaf.Masker.mask(Ext.getBody());
                    $(score_ds_id).getCurrentRecord().set('score_name', value);
                    Leaf.request({
                        url: $('bp_tenant_detail_query_link').getUrl(),
                        para: {
                            bp_id: bp_id_tenant
                        },
                        success: function (res) {
                            var obj = res.result.record;
                            if (obj) {
                                var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
                                if (bp_tenant_detail_r) {
                                    for (var key in bp_tenant_detail_r.data) {
                                        if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age') {
                                            var vl = obj[key];
                                            if (key == 'bp_birth' && obj[key]) {
                                                vl = new Date(obj[key].toString());
                                            }
                                            if (vl != "null" && vl != "undefined") {
                                                bp_tenant_detail_r.set(key, vl);
                                            }
                                        }
                                    }
                                }
                            }
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        failure: function () {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        error: function () {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                }
865
                if (name == 'legal_person' && value) {
866
                    $(score_ds_id).getCurrentRecord().set('score_name', value);
867
                }
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
                if (name == 'pay_method') {
                    if (record.get('pay_method') == 'WIRE_TRANSFER') {
                        record.set('bank_account_id', null);
                        record.set('bank_account_id_n', null);
                        record.set('bank_branch_num', '');
                        record.set('bank_account_name', '');
                        record.getField('bank_account_id').setReadOnly(true);
                        record.getField('bank_account_id_n').setReadOnly(true);
                        record.getField('bank_account_id').setRequired(false);
                        record.getField('bank_account_id_n').setRequired(false);
                    } else {
                        record.getField('bank_account_id').setReadOnly(false);
                        record.getField('bank_account_id_n').setReadOnly(false);
                        record.getField('bank_account_id').setRequired(false);
                        record.getField('bank_account_id_n').setRequired(false);
                    }
884

niminmin's avatar
niminmin committed
885
                }
886 887 888 889 890 891 892 893 894 895 896 897
                if (name == 'payment_deduction') {
                    var quoation_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
                    var quoation_record = $(quoation_ds_id).getCurrentRecord();
                    var down_payment = quoation_record.get('down_payment') || 0;
                    var calc_session_id = quoation_record.get('calc_session_id');
                    var other_payment2;
                    if (value && calc_session_id && value == 'NO_DEDUCTION') {
                        other_payment2 = 0;
                    } else if (value && calc_session_id && value != 'NO_DEDUCTION') {
                        other_payment2 = down_payment;
                    }
                    window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
niminmin's avatar
niminmin committed
898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915
                    Leaf.request({
                        url: $('${/parameter/@layout_code}_prj_project_update_status_link_id').getUrl(),
                        para: {
                            other_payment2: other_payment2,
                            calc_session_id: calc_session_id
                        },
                        success: function (arg) {
                            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

                    });
916
                }
917 918
                if (name == 'bp_id_tenant') {
                    if (!value) {
919 920 921
                        var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
                        if (bp_tenant_detail_r) {
                            for (var key in bp_tenant_detail_r.data) {
922
                                bp_tenant_detail_r.set(key, '');
923 924 925 926 927
                            }
                        }
                    }
                    record.getField('bank_account_id').setLovPara('bp_id_tenant', record.get('bp_id_tenant'));
                }
niminmin's avatar
niminmin committed
928 929
                //add by niminmin
                //当“二次租赁”字段选择‘是’时,“回购合同编号”字段为必填。当选择‘否’时,“回购合同编号”字段为只读。
930 931
                if (name == 'secondary_lease') {
                    if (value == 'YES') {
932
                        if(document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID')){
933 934
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID_prompt').style.display = 'block';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID').style.display = 'block';
935
                        }
936 937 938 939 940 941 942 943 944 945 946
                        record.getField('repur_contract_id').setRequired(true);
                        record.getField('repur_contract_id_n').setRequired(true);
                        record.getField('repur_contract_id').setReadOnly(false);
                        record.getField('repur_contract_id_n').setReadOnly(false);
                    } else if (value == 'NO') {
                        record.getField('repur_contract_id').setRequired(false);
                        record.getField('repur_contract_id_n').setRequired(false);
                        record.getField('repur_contract_id').setReadOnly(true);
                        record.getField('repur_contract_id_n').setReadOnly(true);
                        record.set('repur_contract_id', null);
                        record.set('repur_contract_id_n', null);
947
                        if(document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID')){
948 949
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID').style.display = 'none';
950
                       }
niminmin's avatar
niminmin committed
951
                    }
952 953 954 955
                }
                //新增 “限制金额”字段;
                //“扣款限额”:“租金支付方式”为“建行扣款(三方)”时展示,必填,大于0,默认20万,可修改;
                if (name=='pay_method') {
gzj34291's avatar
gzj34291 committed
956
                    if(value=='CCB_THREE'||value=='CCB_TWO'){
957
                        if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
958 959
                        document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
                        document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
960
                        }
961 962 963 964 965 966 967
                        record.getField('deduction_limit').setRequired(true);
                        if(Ext.isEmpty(record.get('deduction_limit'))){
                            record.set('deduction_limit',200000);
                        }
                    }else{
                        record.getField('deduction_limit').setRequired(false);
                        record.set('deduction_limit',null);
968
                        if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
969 970
                        document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
971
                       }
972
                    }
niminmin's avatar
niminmin committed
973
                }
974 975 976 977 978 979 980 981 982 983 984 985
            }
            if (score_ds_id == ds.id) {
                if (name == 'bp_birth' && value) {
                    if (jsGetAge(value.format('yyyy-mm-dd').toString()) == -1) {
                        Leaf.showInfoMessage("提示", "出生日期不能大于当前日期");
                        setTimeout(function () {
                            record.set('bp_birth', old_value);
                        }, 0);
                    } else {
                        record.set('bp_age', jsGetAge(value.format('yyyy-mm-dd').toString()));
                    }
                }
王炜's avatar
王炜 committed
986 987 988 989 990 991 992 993 994 995
                if(name=='third_guar_score'&&!Ext.isEmpty(value)){
                    if(value<0||value>10){
                        setTimeout(function () {
                            record.set('third_guar_score', '');
                        }, 0);
                        Leaf.showInfoMessage("提示", "第三方担保附件分数范围为0-10,请重新输入!");

                    }
                }

996 997 998 999 1000 1001 1002 1003 1004 1005 1006
            }
            var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
            if (device_ds_id == ds.id) {
                if (name == 'quantity') {
                    if (value <= 0) {
                        Leaf.showInfoMessage("提示", "数量必须大于0");
                        setTimeout(function () {
                            record.set('quantity', old_value);
                        }, 0);
                    }
                }
1007
            }
1008 1009 1010 1011 1012 1013 1014 1015 1016
            var bp_code='${/model/user_agent_description/record/@bp_code}';
            if (!Ext.isEmpty(bp_code)){
                // if (bp_code == 'C00010168' || bp_code == 'C00010198' || bp_code == 'C00010170'){
                if (bp_code == 'D00000041' || bp_code =='D00010001' || bp_code=='D00000026') {
                    if (prj_quotation_ds_id == ds.id){
                        if (name == 'price_list' && value){
                            var quotation_record =  $(prj_quotation_ds_id).getCurrentRecord();
                            if ($(prj_project_ds_id).getAt(0).get('business_type') == 'LEASE') {
                                if (value == 'HL_PRICR_E' || value == 'HL_PRICR_EN'){
1017
                                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
1018 1019
                                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'block';
                                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'block';
1020
                                    }
1021 1022 1023
                                }else{
                                    quotation_record.set('large_balance','NO');
                                    quotation_record.set('large_balance_n','否');
1024
                                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
1025 1026
                                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'none';
                                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'none';
1027
                                   }
1028 1029 1030 1031 1032 1033
                                }
                            }
                        }
                    }
                }
            }
1034
            if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
王炜's avatar
王炜 committed
1035 1036
            document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'none';
            document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'none';
1037
            }
Spencer Chang's avatar
Spencer Chang committed
1038 1039
        };

1040

Spencer Chang's avatar
Spencer Chang committed
1041
        //加载时调用(grid,table,gridBox)
1042

1043 1044
        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');
1045
            var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
18083's avatar
18083 committed
1046 1047
            //控制资管费现金流隐藏
            var cashflow_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_CASHFLOW_NS', 'prj_quotation');
1048 1049

            /*  var bp_ds_ids = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'F_HISTORY_INFO_1', 'prj_project_bp');
1050
              $(bp_ds_ids).setQueryParameter('bp_id','${/parameter/@bp_id_tenant}');
1051
              $(bp_ds_ids).query();*/
1052 1053
            if(lease_item_ds_id == ds.id &&lease_item_ds_id){
                var gridId= ds.bindname+'_layout_grid_id';
陆正友's avatar
陆正友 committed
1054
                if(division!='30' && division!='50'&& division!='99'){
21471731's avatar
21471731 committed
1055 1056
                    $(gridId).hideColumn('machine_number_n');
                }
1057
                if(division=='70'&&division!=''){
1058 1059 1060
                    if(record!=''){
                        record.getField('lease_name_n').setRequired(true);
                        record.getField('brand_value').setRequired(true);
gzj34291's avatar
gzj34291 committed
1061
                        record.getField('produce_date').setReadOnly(false);
1062 1063
                        record.getField('produce_date').setRequired(true);
                        record.getField('using_hour').setRequired(true);
1064 1065
                        record.getField('modelcd').setReadOnly(true);
                        record.getField('modelcd').setRequired(false);
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091
                        record.getField('ownership_flag_n').setRequired(true);
                        record.getField('residual_value_amount').setRequired(true);
                        record.getField('full_name').setRequired(false);
                        record.getField('full_name_n').setRequired(false);
                    }else {
                        record.getField('modelcd').setReadOnly(true);
                    }
                    $(gridId).hideColumn('full_name_n');
                    $(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');
                }else if(division!=''){
                    $(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');
                }
gzj34291's avatar
gzj34291 committed
1092
                if (lease_item_ds_id == ds.id && lease_item_ds_id) {
陆正友's avatar
陆正友 committed
1093
                    if(division=='30'||division=='50'||division=='80'||division=='99'){
gzj34291's avatar
gzj34291 committed
1094 1095 1096 1097 1098 1099 1100 1101
                        record.getField('set_number').setRequired(true);
                    }else{
                        record.getField('set_number').setReadOnly(true);
                        if(Ext.isEmpty(record.get('set_number'))){
                            record.set('set_number',1);
                        }
                    }
                }
1102
            }
Spencer Chang's avatar
Spencer Chang committed
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112
            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);
                }
            }
18083's avatar
18083 committed
1113 1114
            //现金流列表加载时隐藏资管费  18083
            if(cashflow_ds_id == ds.id &&cashflow_ds_id){
18083's avatar
18083 committed
1115
                //var hd_user_col_v06 = $(cashflow_ds_id).getAt(0).get('hd_user_col_v06');
18083's avatar
18083 committed
1116 1117 1118 1119 1120 1121 1122
              if('${/parameter/@asset_fee_flag}'=='N'||'${/parameter/@asset_fee_flag}'==''){
                if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
               $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_interest');
               $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_fee');
               }

           }else{
18083's avatar
18083 committed
1123 1124 1125 1126 1127 1128 1129
            if(Ext.isEmpty($(cashflow_ds_id).getAt(0))){
                 if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_interest');
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_fee');
                    }
               }else{
               if (Ext.isEmpty($(cashflow_ds_id).getAt(0).get('hd_user_col_v06'))) {
18083's avatar
18083 committed
1130 1131 1132 1133 1134
                   if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_interest');
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_fee');
                    }
               }else{
18083's avatar
18083 committed
1135 1136 1137 1138 1139 1140
                   if($(cashflow_ds_id).getAt(0).get('hd_user_col_v06')=='N'){
                    if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_interest');
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_fee');
                    }
                   }else{
18083's avatar
18083 committed
1141 1142 1143 1144
                   if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').showColumn('btb_interest');
                    $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').showColumn('btb_fee');
                   }
18083's avatar
18083 committed
1145
                   }
18083's avatar
18083 committed
1146 1147

               }
18083's avatar
18083 committed
1148
               }
18083's avatar
18083 committed
1149 1150
           }
        }
lijingjing's avatar
lijingjing committed
1151

1152
        };
lijingjing's avatar
lijingjing committed
1153

1154 1155 1156 1157 1158 1159 1160 1161 1162
        function arrToObject(arr) {
            var strJs = '({';
            for (var i = 0; i < arr.length; i += 1) {
                var as = arr[i].split("=");
                strJs = strJs + as[0] + ':' + '"' + as[1] + '"' + ',';
            }
            strJs = strJs.substr(0, strJs.length - 1) + '})';
            return eval(strJs);
        }
1163
        var division='';
1164
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
18083's avatar
18083 committed
1165
             var tenant_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_BASIC_INFO_1', 'prj_project');
1166

gzj34291's avatar
gzj34291 committed
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182
            if(tenant_ds_id == ds.id){
                if (Leaf.isEmpty(record.get('send_message'))){
                    record.set('send_message', 'YES');
                    record.set('send_message_n', '是');
                    record.getField('cell_phone').setRequired(true);
                } else if( record.get('send_message') == 'YES'){
                    record.getField('cell_phone').setRequired(true);
                }

                if (Leaf.isEmpty(record.get('cell_phone'))){
                    record.set('cell_phone', record.get('phone_number'));
                }


            }

1183
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
1184
            var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
1185
            if (ds_id == ds.id && ds_id) {
1186
                division=record.get('division');
1187
                if (record.get('pay_method') == 'WIRE_TRANSFER') {
25484's avatar
25484 committed
1188 1189 1190 1191
                    record.getField('bank_account_id').setReadOnly(true);
                    record.getField('bank_account_id_n').setReadOnly(true);
                    record.getField('bank_account_id').setRequired(false);
                    record.getField('bank_account_id_n').setRequired(false);
1192
                }
1193 1194
                //新增 “限制金额”字段;
                //“扣款限额”:“租金支付方式”为“建行扣款(三方)”时展示,必填,大于0,默认20万,可修改;
gzj34291's avatar
gzj34291 committed
1195
                if (record.get('pay_method') == 'CCB_THREE'||record.get('pay_method') == 'CCB_TWO') {
1196
                    if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
1197 1198
                    document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'block';
                    document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'block';
1199
                    }
1200 1201
                    record.getField('deduction_limit').setRequired(true);
                } else {
1202
                    if(document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT')){
1203 1204
                    document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_PAY_INFO_PRJ_PROJECT_DEDUCTION_LIMIT').style.display = 'none';
1205
                    }
1206 1207
                    record.getField('deduction_limit').setRequired(false);
                }
1208 1209
                if ('${/parameter/@function_usage}' != 'QUERY') {
                    if (record.get('secondary_lease') == 'YES') {
1210
                        if(document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID')){
1211 1212
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID_prompt').style.display = 'block';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID').style.display = 'block';
1213
                        }
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224
                        record.getField('repur_contract_id').setRequired(true);
                        record.getField('repur_contract_id_n').setRequired(true);
                        record.getField('repur_contract_id').setReadOnly(false);
                        record.getField('repur_contract_id_n').setReadOnly(false);
                    } else if (record.get('secondary_lease') == 'NO') {
                        record.getField('repur_contract_id').setRequired(false);
                        record.getField('repur_contract_id_n').setRequired(false);
                        record.getField('repur_contract_id').setReadOnly(true);
                        record.getField('repur_contract_id_n').setReadOnly(true);
                        record.set('repur_contract_id', null);
                        record.set('repur_contract_id_n', null);
1225
                        if(document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID')){
1226 1227
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID').style.display = 'none';
1228
                      }
niminmin's avatar
niminmin committed
1229 1230
                    }
                } else {
1231
                    if (record.get('secondary_lease') == 'YES') {
1232
                        if(document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID')){
1233 1234
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID_prompt').style.display = 'block';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID').style.display = 'block';
1235
                        }
1236
                    } else if (record.get('secondary_lease') == 'NO') {
1237
                        if(document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID')){
1238 1239
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_REPUR_CONTRACT_ID').style.display = 'none';
1240
                         }
niminmin's avatar
niminmin committed
1241 1242 1243 1244
                    }
                }
                //业务类型回租时,默认只读“首付款抵扣”选项
                if (record.get('business_type') == 'LEASEBACK') {
1245 1246 1247 1248
                    //record.set('payment_deduction', 'DOWN_PAYMENT_DEDUCTION');
                    //record.set('payment_deduction_n', "首付款抵扣");
                    //record.getField('payment_deduction').setReadOnly(true);
                    //record.getField('payment_deduction_n').setReadOnly(true);
niminmin's avatar
niminmin committed
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258
                    record.set('pay_method', 'WIRE_TRANSFER');
                    record.set('pay_method_n', "电汇");
                    record.getField('pay_method').setReadOnly(true);
                    record.getField('pay_method_n').setReadOnly(true);
                    record.getField('bank_account_id').setReadOnly(true);
                    record.getField('bank_account_id_n').setReadOnly(true);
                    record.getField('bank_account_id').setRequired(false);
                    record.getField('bank_account_id_n').setRequired(false);

                }
1259
                if ('${/parameter/@function_usage}' != 'QUERY') {
1260
                       //云南铁拳并入二手机,调整租金支付方式为必填
1261
                    if (division == '70') {
1262
                       if('${/parameter/@division_detail}'=='03'||'${/parameter/@division_detail}'=='02'){
1263 1264
                        record.getField('pay_method').setReadOnly(false);
                        record.getField('pay_method_n').setReadOnly(false);
1265
                        }
1266 1267 1268
                    }
                }

1269 1270 1271 1272 1273 1274
                if (division=='91') { //若为神钢建机
                    var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
                    var current_record = $(ds_id).getCurrentRecord();
                    current_record.getField('payment_deduction').setReadOnly(true);
                    current_record.getField('payment_deduction_n').setReadOnly(true);
                }
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288
                //深圳美鹏和hcs显示分公司,其他隐藏
                var bp_code = '${/model/user_agent_description/record/@bp_code}';
                if (!Ext.isEmpty(bp_code) && bp_code !== 'D00010001' && bp_code !== 'D00000009') {
                    record.getField('branch_code').setRequired(false);
                    record.getField('branch_code_n').setRequired(false);
                    if (document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_BRANCH_CODE')) {
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_BRANCH_CODE_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_BRANCH_CODE').style.display = 'none';
                    }
                }
                if (Ext.isEmpty(bp_code)) {
                    record.getField('branch_code').setRequired(false);
                    record.getField('branch_code_n').setRequired(false);
                }
1289 1290 1291 1292
                //获取员工类型
                var description = '${/model/description/record/@employee_type_code}';
                var bp_code='${/model/user_agent_description/record/@bp_code}';
                var credit_record = $(ds_id).getCurrentRecord();
18083's avatar
18083 committed
1293

1294
			   var invoice_agent_id=record.get('invoice_agent_id');
38823's avatar
38823 committed
1295 1296 1297 1298 1299 1300 1301 1302 1303
                //博雷顿展示 授信额度占用 字段
                if(division !='93') {
                    if (!Ext.isEmpty(description) && description == 'AGENT') {
                        if (!Ext.isEmpty(bp_code)) {
                            if ((division == '80' || division == '30' || division == '50' || division == '99') && bp_code !== 'D00010019') {
                                credit_record.set('credit_line', 'TENANT');
                                credit_record.set('credit_line_n', '承租人');
                            }
                        }
18083's avatar
18083 committed
1304
                    }
38823's avatar
38823 committed
1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317
                    if (!Ext.isEmpty(description) && description == 'AGENT') {
                        if (!Ext.isEmpty(bp_code)) {
                            if (bp_code !== 'D00000026' && bp_code !== 'D00000029' && bp_code !== 'D00000030' && bp_code !== 'D00000031') {
                                if (bp_code == 'X00010005' || bp_code == 'J00010006') {
                                    credit_record.set('credit_line', 'TENANT');
                                    credit_record.set('credit_line_n', '承租人');
                                    credit_record.getField('credit_line').setReadOnly(true);
                                    credit_record.getField('credit_line_n').setReadOnly(true);
                                    credit_record.getField('credit_line').setRequired(false);
                                    credit_record.getField('credit_line_n').setRequired(false);


                                } else {
1318
                                    if(document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_CREDIT_LINE')){
38823's avatar
38823 committed
1319 1320
                                    document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_CREDIT_LINE_prompt').style.display = 'none';
                                    document.getElementById('${/parameter/@layout_code}_F_BASIC_INFO_1_PRJ_PROJECT_CREDIT_LINE').style.display = 'none';
1321
                                    }
38823's avatar
38823 committed
1322
                                }
1323 1324
                            }
                        }
38823's avatar
38823 committed
1325 1326 1327 1328 1329
                    } else {
                        credit_record.getField('credit_line').setReadOnly(true);
                        credit_record.getField('credit_line_n').setReadOnly(true);
                        credit_record.getField('credit_line').setRequired(false);
                        credit_record.getField('credit_line_n').setRequired(false);
1330 1331
                    }
                }
1332
            }
1333 1334 1335 1336 1337 1338
            //只读页面隐藏保存按钮
            if('${/parameter/@function_usage}' == 'QUERY'){
                if(document.getElementById('${/parameter/@layout_code}_save')){
                    document.getElementById('${/parameter/@layout_code}_save').style.display = "none";
                }
            }
1339
            if (prj_quotation_ds_id == ds.id && prj_quotation_ds_id){
1340 1341 1342 1343 1344
                //产品线维护了组合利率的调整加载事件显示
                if('${/parameter/@asset_fee_flag}'=='N'||'${/parameter/@asset_fee_flag}'==''){
                    if(document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id')){
                            document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id').style.display = 'none';
                    }
18083's avatar
18083 committed
1345
                    record.getField('hd_user_col_v06').setRequired(false);
1346
                    record.getField('hd_user_col_v06_n').setRequired(false);
18083's avatar
18083 committed
1347 1348
                    record.getField('asset_id').setRequired(false);
                    record.getField('asset_id_n').setRequired(false);
18083's avatar
18083 committed
1349

1350

1351 1352 1353 1354 1355
                }else{
                    if (check_empty(record.get('hd_user_col_v06'))||record.get('hd_user_col_v06')=='N' ) {
                        record.set('asset_id', null);
                        record.set('asset_id_n', null);
                        record.set('btb_int_rate', '');
1356
                        //record.set('int_rate_display', '');
1357 1358 1359 1360 1361 1362
                        record.getField('asset_id').setRequired(false);
                        record.getField('asset_id_n').setRequired(false);
                        //隐藏组件
                        if(document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id')){
                                document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id').style.display = 'none';
                        }
18083's avatar
18083 committed
1363

1364 1365 1366 1367 1368 1369 1370
                    }else{
                        record.getField('asset_id').setRequired(true);
                        record.getField('asset_id_n').setRequired(true);
                        //隐藏组件
                        if(document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id')){
                            document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id').style.display = 'block';
                        }
1371

1372 1373
                    }
                }
陆正友's avatar
陆正友 committed
1374 1375 1376 1377
                if(division !='93'){
                    record.getField('customer_margin').setReadOnly(true);
                    record.getField('customer_margin_n').setReadOnly(true);
                }
1378
                if(division!='70'&&division!=''){
1379 1380

                    if(division != '93'){
1381
                        if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CUSTOMER_MARGIN')){
1382 1383
                        document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CUSTOMER_MARGIN_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CUSTOMER_MARGIN').style.display = 'none';
1384
                       }
1385
                    }
1386
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_BRAND_VALUE')){
1387 1388
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_BRAND_VALUE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_BRAND_VALUE').style.display = 'none';
1389 1390
                     }
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_MODELCD')){
1391 1392
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_MODELCD_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_MODELCD').style.display = 'none';
1393 1394
                     }
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_USING_HOUR')){
1395 1396
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_USING_HOUR_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_USING_HOUR').style.display = 'none';
1397 1398
                     }
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_RESIDUAL_VALUE_AMOUNT')){
1399 1400
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_RESIDUAL_VALUE_AMOUNT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_RESIDUAL_VALUE_AMOUNT').style.display = 'none';
1401 1402
                     }
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OWNERSHIP_FLAG')){
1403 1404
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OWNERSHIP_FLAG_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OWNERSHIP_FLAG').style.display = 'none';
1405 1406
                     }
                     if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_PRODUCE_DATE')){
1407 1408
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_PRODUCE_DATE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_PRODUCE_DATE').style.display = 'none';
1409 1410
                     }
                     if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CONTRACT_AMOUNT')){
1411 1412
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CONTRACT_AMOUNT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CONTRACT_AMOUNT').style.display = 'none';
1413 1414 1415
                    }
                }else if((division=='70')&&division!=''){
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OTHER_FEE')){
1416 1417
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OTHER_FEE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OTHER_FEE').style.display = 'none';
1418 1419
                     }
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_THIRD_PARTY_DEPOSIT')){
1420 1421
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_THIRD_PARTY_DEPOSIT_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_THIRD_PARTY_DEPOSIT').style.display = 'none';
1422 1423
                    }
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OTHER_FEE2')){
1424 1425
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OTHER_FEE2_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_OTHER_FEE2').style.display = 'none';
1426 1427
                     }
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
1428 1429
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'none';
1430
                    }
1431
                   //北京心诚与云南铁拳隐藏承租人保证金字段  18083 2023/5/24
1432
                  if('${/parameter/@division_detail}'=='03'||'${/parameter/@division_detail}'=='02'){
1433 1434 1435 1436 1437
                   if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CUSTOMER_MARGIN')){
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CUSTOMER_MARGIN_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_CUSTOMER_MARGIN').style.display = 'none'
                      }
                   }
1438
                }
1439
                   var bp_code = '${/model/user_agent_description/record/@bp_code}';
1440 1441 1442 1443 1444
                if (!Ext.isEmpty(bp_code)){
                    // if (bp_code == 'C00010168' || bp_code == 'C00010198' || bp_code == 'C00010170') {
                    if (bp_code == 'D00000041' || bp_code =='D00010001' || bp_code=='D00000026') {
                        //===============================
                        // var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
1445
                        // var prj_quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
1446 1447 1448
                        var quotation_record =  $(prj_quotation_ds_id).getCurrentRecord();
                        if ($(ds_id).getAt(0).get('business_type') == 'LEASE') {
                            if (quotation_record.get('price_list') == 'HL_PRICR_E' || quotation_record.get('price_list') == 'HL_PRICR_EN'){
1449
                                if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
1450 1451
                                document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'block';
                                document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'block';
1452
                                }
1453 1454 1455
                            }else{
                                quotation_record.set('large_balance','NO');
                                quotation_record.set('large_balance_n','否');
1456
                                if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
1457 1458
                                document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'none';
                                document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'none';
1459
                                }
1460 1461 1462
                            }
                        }
                    }else{
1463
                        if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
1464 1465
                        document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'none';
                        document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'none';
1466
                         }
1467 1468
                    }
                }else {
1469
                    if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
1470 1471
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'none';
1472
                    }
1473
                }
1474 1475 1476
            }
            var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
            if (score_ds_id == ds.id) {
wangwei5743's avatar
wangwei5743 committed
1477
                if (division != '70' && division != '') {
1478
                   if(document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE')){
wangwei5743's avatar
wangwei5743 committed
1479 1480 1481
                    document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE_prompt').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE').style.display = 'none';
                }
1482
             //铁甲细分非产品线细分一隐藏铁甲评分
1483
             }else if(division == '70' && division != '' && ('${/parameter/@division_detail}'=='03'||'${/parameter/@division_detail}'=='02')){
1484 1485 1486 1487 1488
              if(document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE')){
               document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE_prompt').style.display = 'none';
               document.getElementById('${/parameter/@layout_code}_F_TENANT_SCORE_INFO_BP_TENANT_RATE_DETAIL_TJ_SCORE').style.display = 'none';
                }
              }
1489 1490 1491 1492 1493
                if (!record.get('score_name')) {
                    if ($(ds_id).getCurrentRecord()) {
                        var score_name = $(ds_id).getCurrentRecord().get('legal_person') || $(ds_id).getCurrentRecord().get('bp_id_tenant_n');
                        record.set('score_name', score_name);
                    }
1494 1495
                }
            }
1496
            if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE')){
王炜's avatar
王炜 committed
1497 1498
            document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE_prompt').style.display = 'none';
            document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_LARGE_BALANCE').style.display = 'none';
1499
            }
Spencer Chang's avatar
Spencer Chang committed
1500 1501 1502 1503 1504 1505 1506 1507 1508
        };

        //pdf预览  add by zhuxianfei
        function view_pdf(attachment_id) {
            Leaf.request({
                url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query',
                para: {
                    attachment_id: attachment_id
                },
1509
                success: function (res) {
Spencer Chang's avatar
Spencer Chang committed
1510 1511 1512 1513 1514 1515 1516 1517 1518 1519
                    var path = res.result.record.file_path;
                    path = path.substr(path.indexOf('hls_attachment'));
                    var tomcat_source = '${/parameter/@tomcat_source}';
                    var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path;
                    var oWin = window.open(source_path);
                },
                scope: this
            });
        }

lijingjing's avatar
lijingjing committed
1520

1521 1522 1523
        Leaf.onReady(function () {
            var bp_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'T_HISTORY_INGO', 'hls_bp_master');
            var url = '${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_history_display/query?project_id=${/parameter/@project_id}&bp_id=${/parameter/@bp_id}';
lijingjing's avatar
lijingjing committed
1524 1525
            $(bp_ds_id).setQueryUrl(url);
            $(bp_ds_id).query();
niminmin's avatar
niminmin committed
1526 1527
            var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
            $(quotation_ds_id).query();
1528 1529 1530 1531 1532
            // var billing_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'F_INVOICE_INFO', 'prj_project_bp');
            var billing_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
            var billing_url = '${/request/@context_path}/autocrud/prj.PRJ501N.prj_project_bp/query?project_id=${/parameter/@project_id}';
            $(billing_ds_id).setQueryUrl(billing_url);
            $(billing_ds_id).query();
1533 1534 1535 1536 1537 1538 1539 1540 1541 1542
            //不为租赁二手机业务时隐藏资管费相关字段及费率 18083 2023/1/15
            if('${/parameter/@asset_fee_flag}'=='N'){
                if(document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_HD_USER_COL_V06')){
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_HD_USER_COL_V06').style.display = 'none';
                    document.getElementById('${/parameter/@layout_code}_F_QUOTATION_N_PRJ_QUOTATION_HD_USER_COL_V06_prompt').style.display = 'none';
                }
                //隐藏组件
                if(document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id')){
                    document.getElementById('${/parameter/@layout_code}_F_RATE_N_component_id').style.display = 'none';
                }
18083's avatar
18083 committed
1543 1544 1545
                if($('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id')){
                 $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_interest');
                 $('${/parameter/@layout_code}_G_CASHFLOW_NS_prj_quotation_layout_grid_id').hideColumn('btb_fee');
1546
                }
1547
            }
niminmin's avatar
niminmin committed
1548
        });
lijingjing's avatar
lijingjing committed
1549
        //序号自增  add by lijingjing
1550
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function (ds, record, config_records, bp_seq) {
lijingjing's avatar
lijingjing committed
1551 1552 1553 1554 1555 1556 1557
            //租赁物序号
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
            if (ds_id == ds.id && ds_id) {
                //设置序号
                var measure_records = ds.getAll(),
                    seq_num = 0;
                if (measure_records.length) {
1558
                    for (var j = 0; j < measure_records.length; j++) {
lijingjing's avatar
lijingjing committed
1559 1560 1561 1562 1563 1564 1565 1566 1567
                        var measure_record = measure_records[j],
                            rk = measure_record.get('lease_item_seq');
                        if (seq_num <= rk) {
                            seq_num = rk;
                        }
                    }
                }
                var rk_value = seq_num + 1;
                record.set('lease_item_seq', rk_value);
1568

lijingjing's avatar
lijingjing committed
1569
            }
1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589
            var device_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_DEVICE', 'bp_tenant_rate_item');
            var traffic_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_SCORE_TRAFFIC', 'bp_tenant_rate_item');
            if ((device_ds_id == ds.id && device_ds_id) || (traffic_ds_id == ds.id && traffic_ds_id)) {
                //设置序号
                var rs = ds.getAll(),
                    seq_num = 0;
                if (rs.length) {
                    for (var j = 0; j < rs.length; j++) {
                        var r = rs[j],
                            rk = r.get('seq_num');
                        if (seq_num <= rk) {
                            seq_num = rk;
                        }
                    }
                }
                var rk_value = seq_num + 1;
                record.set('seq_num', rk_value);

            }

lijingjing's avatar
lijingjing committed
1590
        };
1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602
        //indexchange事件(grid,attach,gridbox,table)
        // window['${/parameter/@layout_code}_on_layout_dynamic_grid_indexchange'] = function(ds, record, bp_seq) {
        //     if(!record.get('pattern')){
        //
        //         var nodes=document.querySelectorAll('td[dataindex="machine_number"]');
        //         // var nodes=document.getElementsByClassName('cell-editor-div');
        //         for (var i=1;i<nodes.length;i++){
        //             nodes[i].children[0].style.backgroundColor= "#FAFACD";
        //         }
        //         //  $('.cell-editor-div').parent().css("background-color","yellow");
        //     }
        // };
lijingjing's avatar
lijingjing committed
1603
        //客户评分
1604
        window['${/parameter/@layout_code}_user_button9_layout_dynamic_click'] = function () {
lijingjing's avatar
lijingjing committed
1605

lijingjing's avatar
lijingjing committed
1606 1607 1608
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');

            var record = $(ds_id).getCurrentRecord();
1609 1610 1611 1612 1613 1614 1615 1616
            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();
Darming's avatar
Darming committed
1617
                    if (r.dirty && '${/parameter/@function_usage}' == 'MODIFY') {
1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629
                        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
                        });
1630
                        win.on('close', function () {
1631 1632 1633 1634 1635
                            $(ds_id).query();
                        });
                    }
                } else {
                    Leaf.showMessage('${l:PROMPT}', '请先保存');
niminmin's avatar
niminmin committed
1636

lijingjing's avatar
lijingjing committed
1637 1638 1639
                }
            }

1640
        };
lijingjing's avatar
lijingjing committed
1641 1642 1643 1644 1645 1646 1647 1648 1649 1650
        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 lease_item_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item');
            var quotation_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_quotation');
            var bp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_bp');
            var record = $(quotation_ds_id).getCurrentRecord();
            var current_record = $(ds_id).getCurrentRecord();
            var lease_item_record = $(lease_item_ds_id).getCurrentRecord();
            var bp_record = $(bp_ds_id).getCurrentRecord();
            var project_id = current_record.get('project_id');
1651 1652 1653 1654
            var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
            var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
            if (bp_tenant_detail_r) {
                for (var key in bp_tenant_detail_r.data) {
wangwei5743's avatar
wangwei5743 committed
1655 1656 1657 1658 1659 1660 1661 1662
                    if(division!='70'){
                        if (key != 'bp_detail_id' && key != 'score_name'&& key != 'contract_id' && key != 'bp_age' && key != 'project_id' && key != 'third_party_credibility' && key != 'third_party_credibility_n'&& key != 'third_guar_score'&& key != 'tj_score' ) {
                            if (typeof bp_tenant_detail_r.get(key) == "null" || typeof bp_tenant_detail_r.get(key) == "undefined" || bp_tenant_detail_r.get(key) === "") {
                                Leaf.showInfoMessage("提示", "承租人评分信息区域的所有字段,除\"第三方担保附件分数\"外,其他都为必输字段,请填写!");
                                return;
                            }
                        }
                    }else{
1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673
					  if('${/parameter/@division_detail}'=='03'||'${/parameter/@division_detail}'=='02'){
                         if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age'&& key != 'contract_id' && key != 'project_id' && key != 'third_party_credibility' && key != 'third_party_credibility_n'&& key != 'third_guar_score'&&key != 'tj_score') {
                           if (typeof bp_tenant_detail_r.get(key) == "null" || typeof bp_tenant_detail_r.get(key) == "undefined" || bp_tenant_detail_r.get(key) === "") {
                               Leaf.showInfoMessage("提示", "承租人评分信息区域的所有字段,除\"第三方担保附件得分\"外,其他都为必输字段,请填写!");
                               bp_rate_flag = false;
                               break;
                           }else{
                               bp_rate_flag = true;
                           }
                       }
                       }else{
wangwei5743's avatar
wangwei5743 committed
1674
                        if (key != 'bp_detail_id' && key != 'score_name'&& key != 'contract_id' && key != 'bp_age' && key != 'project_id' && key != 'third_party_credibility' && key != 'third_party_credibility_n'&& key != 'third_guar_score' ) {
1675
                             if (typeof bp_tenant_detail_r.get(key) == "null" || typeof bp_tenant_detail_r.get(key) == "undefined" || bp_tenant_detail_r.get(key) === "") {
wangwei5743's avatar
wangwei5743 committed
1676 1677 1678
                                Leaf.showInfoMessage("提示", "承租人评分信息区域的所有字段,除\"第三方担保附件分数\"外,其他都为必输字段,请填写!");
                                return;
                            }
1679
                        }
1680
					}
1681
                    }
wangwei5743's avatar
wangwei5743 committed
1682

1683 1684
                }
            }
1685
            if(current_record.get('division')=='70'){
gzj34291's avatar
gzj34291 committed
1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710
                var bp_number;
                $L.request({
                    url: '${/request/@context_path}/autocrud/prj.PRJ500N.get_bp_address/query',
                    para: {
                        bp_id_tenant: current_record.get('bp_id_tenant')
                    },
                    sync: true,
                    success: function (res) {
                        bp_number=res.result.record.bp_number;
                    },
                    error: function () {

                    },
                    failure: function () {

                    },
                    scope: this,
                    sync: true,
                });

                if( bp_number ==0){
                    Leaf.showMessage('提示','承租人的居住地址不能为空');
                    return ;
                }
            }
lijingjing's avatar
lijingjing committed
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726
            if (current_record.dirty == true) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
            if (record.dirty == true) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
            if (lease_item_record.dirty == true) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
            if (bp_record.dirty == true) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.EXECUTE_AFTER_SAVE}');
                return;
            }
1727 1728
            if (record.get('large_balance') == 'YES') {
                var project_number = current_record.get('project_number');
niminmin's avatar
niminmin committed
1729
                Leaf.request({
1730
                    url: $('${/parameter/@layout_code}_principal_eq_pymt_adj_link_n').getUrl(),
1731 1732
                    para: {p_project_number: project_number},
                    scope: this,
niminmin's avatar
niminmin committed
1733
                    success: function (res) {
1734 1735 1736 1737 1738 1739 1740 1741 1742
                        //先查询数量
                        var principal_eq_pymt_adj = res.result.principal_eq_pymt_adj;
                        //根据数量,一个直接查询显示,多个显示空
                        if (principal_eq_pymt_adj == null || principal_eq_pymt_adj == undefined || principal_eq_pymt_adj <= 0) {
                            Leaf.showMessage('${l:PROMPT}', '大额尾款报价需调整且只能调整最后一期租金');
                            return;
                        }else{
                            //验证通过---开始
                            if (current_record.get('business_type') == 'LEASE') {
niminmin's avatar
niminmin committed
1743
                                Leaf.request({
1744
                                    url: $('prj_check_prj_record_link_n').getUrl(),
niminmin's avatar
niminmin committed
1745
                                    para: {
1746
                                        'project_id': project_id
niminmin's avatar
niminmin committed
1747
                                    },
1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760
                                    success: function (res) {
                                        var secondary_lease = res.result.secondary_lease;
                                        var payment_deduction = res.result.payment_deduction;
                                        var price_list = res.result.price_list;
                                        var down_payment_rate_new = res.result.down_payment_rate_new;
                                        var H16 = record.get('down_payment');
                                        var H97 = record.get('third_party_deposit');
                                        var H99 = record.get('other_fee');
                                        var H102 = record.get('other_fee2');

                                        var show = down_payment_rate_new * 100;
                                        if ((price_list == 'HL_PRICR_E' || price_list == 'HL_PRICR_TEST' || price_list == 'HL_PRICR_NTEST' || price_list == 'HL_PRICR_EN') && secondary_lease == 'NO') {
                                            if ((div((H16 + H97), (H99 + H102 - H16)).toFixed(2) * 1) < down_payment_rate_new) {
陆正友's avatar
陆正友 committed
1761
                                                if(current_record.get('division')!='91'&&current_record.get('division')!='93'){
1762 1763 1764
                                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                                Leaf.showMessage('${l:PROMPT}', '首付款比例+首付款保证金比例之和不能低于' + down_payment_rate_new * 100 + '%');
                                                return;
lizhe's avatar
lizhe committed
1765
                                                }
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791
                                            }
                                        }
                                        if ($(ds_id).validate()) {
                                            Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
                                                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                                                Leaf.request({
                                                    url: $('prj_approval_link_id').getUrl(),
                                                    para: {
                                                        project_id: project_id
                                                    },
                                                    scope: this,
                                                    success: function () {
                                                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                                        $('${/parameter/@winid}').close();
                                                    },
                                                    failure: function () {
                                                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                                    },
                                                    error: function () {
                                                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                                    }
                                                });
                                            });

                                        }

niminmin's avatar
niminmin committed
1792 1793
                                    },
                                    failure: function () {
1794
                                        unlock_calc_current_window('${l:HLS.SAVING}');
niminmin's avatar
niminmin committed
1795 1796
                                    },
                                    error: function () {
1797 1798 1799
                                        unlock_calc_current_window('${l:HLS.SAVING}');
                                    },
                                    scope: this
niminmin's avatar
niminmin committed
1800
                                });
1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822
                            } else {
                                if ($(ds_id).validate()) {
                                    Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
                                        window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                                        Leaf.request({
                                            url: $('prj_approval_link_id').getUrl(),
                                            para: {
                                                project_id: project_id
                                            },
                                            scope: this,
                                            success: function () {
                                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                                $('${/parameter/@winid}').close();
                                            },
                                            failure: function () {
                                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                            },
                                            error: function () {
                                                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                            }
                                        });
                                    });
lijingjing's avatar
lijingjing committed
1823

1824 1825 1826 1827
                                }

                            }
                            //验证通过END
1828

1829
                        }
niminmin's avatar
niminmin committed
1830 1831
                    },
                    failure: function () {
1832
                        Leaf.Masker.unmask(Ext.getBody());
niminmin's avatar
niminmin committed
1833 1834
                    },
                    error: function () {
1835 1836
                        Leaf.Masker.unmask(Ext.getBody());
                    }
niminmin's avatar
niminmin committed
1837
                });
1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858
            }else {
                //其他情况正常
                if (current_record.get('business_type') == 'LEASE') {
                    Leaf.request({
                        url: $('prj_check_prj_record_link_n').getUrl(),
                        para: {
                            'project_id': project_id
                        },
                        success: function (res) {
                            var secondary_lease = res.result.secondary_lease;
                            var payment_deduction = res.result.payment_deduction;
                            var price_list = res.result.price_list;
                            var down_payment_rate_new = res.result.down_payment_rate_new;
                            var H16 = record.get('down_payment');
                            var H97 = record.get('third_party_deposit');
                            var H99 = record.get('other_fee');
                            var H102 = record.get('other_fee2');

                            var show = down_payment_rate_new * 100;
                            if ((price_list == 'HL_PRICR_E' || price_list == 'HL_PRICR_TEST' || price_list == 'HL_PRICR_NTEST' || price_list == 'HL_PRICR_EN') && secondary_lease == 'NO') {
                                if ((div((H16 + H97), (H99 + H102 - H16)).toFixed(2) * 1) < down_payment_rate_new) {
陆正友's avatar
陆正友 committed
1859
                                    if(current_record.get('division')!='91'&&current_record.get('division')!='93') {
1860 1861 1862
                                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                    Leaf.showMessage('${l:PROMPT}', '首付款比例+首付款保证金比例之和不能低于' + down_payment_rate_new * 100 + '%');
                                    return;
lizhe's avatar
lizhe committed
1863
                                    }
1864
                                }
niminmin's avatar
niminmin committed
1865
                            }
1866 1867
                            if ($(ds_id).validate()) {
                                Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
21471731's avatar
21471731 committed
1868 1869
                                    var lease_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
                                    var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
陆正友's avatar
陆正友 committed
1870
                                    if(division=='30'||division=='50'|| division=='99'){
21471731's avatar
21471731 committed
1871 1872
                                        var record=$(lease_ds_id).getCurrentRecord();
                                        var records=$(ds_id).getCurrentRecord();
21471731's avatar
21471731 committed
1873
                                        var set_number=records.get('set_number');
21471731's avatar
21471731 committed
1874
                                        var total_number=records.get('total_number');
21471731's avatar
21471731 committed
1875 1876 1877
                                        var total_price=records.get('total_price');
                                        var lease_item_amount=record.get('lease_item_amount');
                                        var  residual_value=record.get('residual_value');
18083's avatar
18083 committed
1878

1879
                                          var  q_value=records.get('q_value');
21471731's avatar
21471731 committed
1880
                                        if(total_price!=lease_item_amount &&total_price!=null){
21471731's avatar
21471731 committed
1881 1882 1883 1884 1885
                                            Leaf.showMessage('${l:PROMPT}', '支付计划页面“设备价格”字段值与租赁物明细“设备单价(总)”合计不相等,无法进行提交!');
                                            return;
                                        }else if(q_value!=residual_value){
                                            Leaf.showMessage('${l:PROMPT}', '支付计划中留购价与报价计算不一致,无法提交审批!');
                                            return;
21471731's avatar
21471731 committed
1886 1887
                                        }else  if(total_number!=0 && set_number!=total_number){
                                            Leaf.showMessage('${l:HLS.PROMPT}', '租赁物台数与查看明细中台数不一致,请重新维护!');
21471731's avatar
21471731 committed
1888
                                            return;
21471731's avatar
21471731 committed
1889 1890
                                        }
                                    }
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909
                                    window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                                    Leaf.request({
                                        url: $('prj_approval_link_id').getUrl(),
                                        para: {
                                            project_id: project_id
                                        },
                                        scope: this,
                                        success: function () {
                                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                            $('${/parameter/@winid}').close();
                                        },
                                        failure: function () {
                                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                        },
                                        error: function () {
                                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                        }
                                    });
                                });
niminmin's avatar
niminmin committed
1910

1911
                            }
niminmin's avatar
niminmin committed
1912

1913 1914 1915
                        },
                        failure: function () {
                            unlock_calc_current_window('${l:HLS.SAVING}');
lijingjing's avatar
lijingjing committed
1916

1917 1918 1919
                        },
                        error: function () {
                            unlock_calc_current_window('${l:HLS.SAVING}');
lijingjing's avatar
lijingjing committed
1920

1921 1922 1923 1924 1925 1926
                        },
                        scope: this
                    });
                } else {
                    if ($(ds_id).validate()) {
                        Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
21471731's avatar
21471731 committed
1927 1928 1929
                            var lease_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_QUOTATION_N', 'prj_quotation');
                            var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');

陆正友's avatar
陆正友 committed
1930
                            if(division=='30'||division=='50'|| division=='99'){
21471731's avatar
21471731 committed
1931 1932
                                var record=$(lease_ds_id).getCurrentRecord();
                                var records=$(ds_id).getCurrentRecord();
21471731's avatar
21471731 committed
1933
                                var set_number=records.get('set_number');
21471731's avatar
21471731 committed
1934
                                var total_number=records.get('total_number');
21471731's avatar
21471731 committed
1935 1936 1937
                                var total_price=records.get('total_price');
                                var lease_item_amount=record.get('lease_item_amount');
                                var  residual_value=record.get('residual_value');
1938
                               var  q_value=records.get('q_value');
18083's avatar
18083 committed
1939

21471731's avatar
21471731 committed
1940
                                if(total_price!=lease_item_amount &&total_price!=null){
21471731's avatar
21471731 committed
1941 1942 1943 1944 1945
                                    Leaf.showMessage('${l:PROMPT}', '支付计划页面“设备价格”字段值与租赁物明细“设备单价(总)”合计不相等,无法进行提交!');
                                    return;
                                }else if(q_value!=residual_value){
                                    Leaf.showMessage('${l:PROMPT}', '支付计划中留购价与报价计算不一致,无法提交审批!');
                                    return;
21471731's avatar
21471731 committed
1946 1947
                                }else  if(total_number!=0 && set_number!=total_number){
                                    Leaf.showMessage('${l:HLS.PROMPT}', '租赁物台数与查看明细中台数不一致,请重新维护!');
21471731's avatar
21471731 committed
1948
                                    return;
21471731's avatar
21471731 committed
1949 1950
                                }
                            }
1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059
                            window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                            Leaf.request({
                                url: $('prj_approval_link_id').getUrl(),
                                para: {
                                    project_id: project_id
                                },
                                scope: this,
                                success: function () {
                                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                    $('${/parameter/@winid}').close();
                                },
                                failure: function () {
                                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                },
                                error: function () {
                                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                                }
                            });
                        });

                    }

                }
            }
            // if (current_record.get('business_type') == 'LEASE') {
            //     Leaf.request({
            //         url: $('prj_check_prj_record_link_n').getUrl(),
            //         para: {
            //             'project_id': project_id
            //         },
            //         success: function (res) {
            //             var secondary_lease = res.result.secondary_lease;
            //             var payment_deduction = res.result.payment_deduction;
            //             var price_list = res.result.price_list;
            //             var down_payment_rate_new = res.result.down_payment_rate_new;
            //             var H16 = record.get('down_payment');
            //             var H97 = record.get('third_party_deposit');
            //             var H99 = record.get('other_fee');
            //             var H102 = record.get('other_fee2');
            //
            //             var show = down_payment_rate_new * 100;
            //             if ((price_list == 'HL_PRICR_E' || price_list == 'HL_PRICR_TEST' || price_list == 'HL_PRICR_NTEST' || price_list == 'HL_PRICR_EN') && secondary_lease == 'NO') {
            //                 if ((div((H16 + H97), (H99 + H102 - H16)).toFixed(2) * 1) < down_payment_rate_new) {
            //                     window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //                     Leaf.showMessage('${l:PROMPT}', '首付款比例+首付款保证金比例之和不能低于' + down_payment_rate_new * 100 + '%');
            //                     return;
            //                 }
            //             }
            //             if ($(ds_id).validate()) {
            //                 Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
            //                     window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
            //                     Leaf.request({
            //                         url: $('prj_approval_link_id').getUrl(),
            //                         para: {
            //                             project_id: project_id
            //                         },
            //                         scope: this,
            //                         success: function () {
            //                             window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //                             $('${/parameter/@winid}').close();
            //                         },
            //                         failure: function () {
            //                             window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //                         },
            //                         error: function () {
            //                             window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //                         }
            //                     });
            //                 });
            //
            //             }
            //
            //         },
            //         failure: function () {
            //             unlock_calc_current_window('${l:HLS.SAVING}');
            //
            //         },
            //         error: function () {
            //             unlock_calc_current_window('${l:HLS.SAVING}');
            //
            //         },
            //         scope: this
            //     });
            // } else {
            //     if ($(ds_id).validate()) {
            //         Leaf.showConfirm('${HLS.PROMPT}', '确认要提交工作流吗?', function () {
            //             window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
            //             Leaf.request({
            //                 url: $('prj_approval_link_id').getUrl(),
            //                 para: {
            //                     project_id: project_id
            //                 },
            //                 scope: this,
            //                 success: function () {
            //                     window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //                     $('${/parameter/@winid}').close();
            //                 },
            //                 failure: function () {
            //                     window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //                 },
            //                 error: function () {
            //                     window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            //                 }
            //             });
            //         });
            //
            //     }
            //
            // }
Darming's avatar
Darming committed
2060 2061 2062 2063
        };

        var bp_rate_flag;
        /*保存前调用,生成项目编号*/
gzj34291's avatar
gzj34291 committed
2064
        var count = 0;
Darming's avatar
Darming committed
2065 2066 2067 2068
        window['${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
            var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
            var score_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'F_TENANT_SCORE_INFO', 'bp_tenant_rate_detail');
            var bp_tenant_detail_r = $(score_ds_id).getCurrentRecord();
2069
            if (prj_project_ds_id == ds.id && prj_project_ds_id) {
gzj34291's avatar
gzj34291 committed
2070
                if ((record.get('pay_method') == 'CCB_THREE'||record.get('pay_method') == 'CCB_TWO') && record.get('deduction_limit') <= 0) {
2071 2072 2073
                    Leaf.showMessage('${l:HLS.PROMPT}', '扣款限额应大于0');
                    return false;
                }
2074
                if (record.get('signing_city')){
2075 2076 2077 2078 2079 2080 2081 2082
                    // var reg = /^([\u2E80-\u9FFF]){4,}$/;
                    // var reg = /^(.){4,}$/;
                    // if (!reg.test(record.get('signing_city'))) {
                    //     $L.showErrorMessage('提示', '合同签订地建议格式:“xx市xx区”(也可填写详细地址)!');
                    //     return false;
                    // }
                    if (record.get('signing_city').indexOf('州') == -1 && record.get('signing_city').indexOf('县') == -1 && record.get('signing_city').indexOf('区') == -1) {
                        Leaf.showConfirm('${HLS.PROMPT}', '合同签订地所填写内容,未细化到区/县/州级别,是否确认?', function () {});
2083 2084
                    }
                }
2085
            }
Darming's avatar
Darming committed
2086 2087
            if (bp_tenant_detail_r && ds.id == prj_project_ds_id) {
                for (var key in bp_tenant_detail_r.data) {
2088
                    if(division != '70'){
wangwei5743's avatar
wangwei5743 committed
2089
                        if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age'&& key != 'contract_id' && key != 'project_id' && key != 'third_party_credibility' && key != 'third_party_credibility_n'&& key != 'third_guar_score'&&key != 'tj_score') {
2090
                             if (typeof bp_tenant_detail_r.get(key) == "null" || typeof bp_tenant_detail_r.get(key) == "undefined" || bp_tenant_detail_r.get(key) === "") {
gzj34291's avatar
gzj34291 committed
2091 2092 2093 2094 2095 2096 2097
                                Leaf.showInfoMessage("提示", "承租人评分信息区域的所有字段,除\"第三方担保附件得分\"外,其他都为必输字段,请填写!");
                                bp_rate_flag = false;
                                break;
                            } else {
                                bp_rate_flag = true;
                            }
                        }
2098
                    }else{
2099
                     if('${/parameter/@division_detail}'=='03'||'${/parameter/@division_detail}'=='02'){
2100 2101 2102 2103 2104 2105 2106 2107 2108 2109
                         if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age'&& key != 'contract_id' && key != 'project_id' && key != 'third_party_credibility' && key != 'third_party_credibility_n'&& key != 'third_guar_score'&&key != 'tj_score') {
                           if (typeof bp_tenant_detail_r.get(key) == "null" || typeof bp_tenant_detail_r.get(key) == "undefined" || bp_tenant_detail_r.get(key) === "") {
                               Leaf.showInfoMessage("提示", "承租人评分信息区域的所有字段,除\"第三方担保附件得分\"外,其他都为必输字段,请填写!");
                               bp_rate_flag = false;
                               break;
                           }else{
                               bp_rate_flag = true;
                           }
                       }
                       }else{
wangwei5743's avatar
wangwei5743 committed
2110 2111 2112 2113 2114 2115 2116 2117 2118
                        if (key != 'bp_detail_id' && key != 'score_name' && key != 'bp_age'&& key != 'contract_id' && key != 'project_id' && key != 'third_party_credibility' && key != 'third_party_credibility_n'&& key != 'third_guar_score') {
                            //if (!bp_tenant_detail_r.get(key)) {
                            if (typeof bp_tenant_detail_r.get(key) == "null" || typeof bp_tenant_detail_r.get(key) == "undefined" || bp_tenant_detail_r.get(key) === "") {
                                Leaf.showInfoMessage("提示", "承租人评分信息区域的所有字段,除\"第三方担保附件得分\"外,其他都为必输字段,请填写!");
                                bp_rate_flag = false;
                                break;
                            } else {
                                bp_rate_flag = true;
                            }
Darming's avatar
Darming committed
2119 2120
                        }
                    }
2121
                 }
wangwei5743's avatar
wangwei5743 committed
2122

Darming's avatar
Darming committed
2123 2124
                }
            }
2125
            if (!bp_rate_flag) {
Darming's avatar
Darming committed
2126 2127
                return false;
            }
gzj34291's avatar
gzj34291 committed
2128 2129 2130 2131 2132 2133
            var lease_item_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_LEASE_HEAD_CAR', 'prj_project_lease_item');
            var lease_item_record = $(lease_item_ds_id).getCurrentRecord();
            var project_record = $(prj_project_ds_id).getCurrentRecord();
            var machine_number = lease_item_record.get('machine_number_70');
            var project_id = project_record.get('project_id');
            var machine_number_num = 0;
2134
            var secondary_lease = project_record.get('secondary_lease');
Darming's avatar
Darming committed
2135

2136

Darming's avatar
Darming committed
2137 2138
            return true;
        };
2139 2140 2141 2142 2143 2144
        //附件打包下载
        window['${/parameter/@layout_code}_ACY_USER_BUTTON1_layout_dynamic_tab_click'] = function () {
            var prj_project_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project');
            var prj_project_record = $(prj_project_ds_id).getAt(0);
            var project_id = prj_project_record.get('project_id');
            var project_number = prj_project_record.get('project_number');
2145
            var url_l = $('get_atch_download_link').getUrl() + '?table_pk_value=' + project_id + '&table_name=PRJ_PROJECT' + '&doc_code=' + project_number;
2146 2147
            window.open(href = url_l, target = "_self");
        };
lijingjing's avatar
lijingjing committed
2148

Spencer Chang's avatar
Spencer Chang committed
2149 2150 2151 2152
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>