<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lpc
    $Date: 2018-10-8 上午10:30:25
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
          trace="true">
    <a:view>
        <a:link id="contract_cost_scene_link" url="${/request/@context_path}/modules/cont/CON316/contract_cost_scene.lview"/>
        <a:link id="con316_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
                modelaction="update"/>
        <a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con_contract_modify_link" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
        <a:link id="car_modify_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain_readonly.lview"/>
        <script type="text/javascript"><![CDATA[
        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var record = $(ds_id).getCurrentRecord();
            if ($(ds_id).validate()) {
                record.set('function_code', 'CON316B');
                record.set('function_usage', 'UPDATE');
                record.set('default_value_dsid', ds_id);
                record.data['url_title'] = '诉讼费用支援';
                var case_type = 'CFL-7680C3C0-CFF3-49A1-A17C-F0690505F7A5';
                var param = record.data;
                param['case_type'] = case_type;
                hls_doc_get_layout_code('con316_get_layout_code_link_id', param, 'contract_cost_scene_link', ds_id);
            }
        };

        window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var record = $(ds_id).getCurrentRecord();
            if ($(ds_id).validate()) {
                record.set('function_code', 'CON316A');
                record.set('function_usage', 'UPDATE');
                record.set('default_value_dsid', ds_id);
                record.data['url_title'] = '现场债权费用支援';
                var case_type = 'CFL-6914943F-7768-45CF-AA82-653F897D246A';
                var param = record.data;
                param['case_type'] = case_type;
                hls_doc_get_layout_code('con316_get_layout_code_link_id', param, 'contract_cost_scene_link', ds_id);
            }
        };

        window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
            var record = $(ds_id).getCurrentRecord();
            if ($(ds_id).validate()) {
                record.set('function_code', 'CON316C');
                record.set('function_usage', 'UPDATE');
                record.set('default_value_dsid', ds_id);
                record.data['url_title'] = '拖车费用支援';
                var case_type = 'CFL-E21E48B0-5FE5-4A12-9D6C-AED6BA001E05';
                var param = record.data;
                param['case_type'] = case_type;
                hls_doc_get_layout_code('con316_get_layout_code_link_id', param, 'contract_cost_scene_link', ds_id);
            }
        };

        function open_contract_win_detail(ds_id, record_id) {
            var record = $(ds_id).findById(record_id);
            var param = record.data;
            param['function_code'] = 'CON301';
            param['function_usage'] = 'QUERY';
            param['maintain_type'] = 'QUERY';
            param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
            hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'con_contract_modify_link', null);
        }

        function open_project_modify_win(record_id, ds_id) {

            var record = $(ds_id).findById(record_id);
            //项目类layout_code

            var maintain_type = 'QUERY';
            var param = record.data;
            param['document_id'] = record.get('project_id');
            param['function_code'] = 'PRJ501Q';
            param['function_usage'] = 'MODIFY';
            param['bp_class'] = 'NP';
            param['maintain_type'] = maintain_type;
            param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
            hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'car_modify_link', ds_id);

        }

        window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
            if (name == 'contract_number' && value) {
                return '<a href="javascript:open_contract_win_detail(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
            }
            else if (name == 'project_id_c' && value) {
                return '<a href="javascript:open_project_modify_win(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
            }
            return value;
        };
        window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');

            if (ds == $(ds_id)) {
                aut_authority_list_validate_query(ds, qpara);

            }
        };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&amp;function_code=CON316"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
