<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zc
    $Date: 2020年11月17日 17点57分
    $Revision: 1.0  
    $Purpose: 电子合同监控页面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
          trace="true">
    <a:init-procedure>
        <a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
                modelaction="update"/>
        <a:link id="car_modify_link_readonly" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain.lview"/>

        <a:link id="${/parameter/@layout_code}con_contract_query_link"
                url="${/request/@context_path}/modules/cont/CON3200/con_re_incept_modify.lview"/>
        <a:link id="car_modify_link_readonly_c" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain_constru.lview"/>
        <script type="text/javascript"><![CDATA[

        function open_contract_win(ds_id, record_id) {
            var record = $(ds_id).findById(record_id);
            var param = record.data;
            param['function_usage'] = 'QUERY';
            param['function_code'] = 'CON3200Q';
            param['maintain_type'] = 'QUERY';
            param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';

            hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, '${/parameter/@layout_code}con_contract_query_link', ds_id);
        }

        function open_project_Window(record_id, ds_id) {
            var record = $(ds_id).findById(record_id);
            //项目类layout_code
            maintain_type = 'READONLY';
            param = record.data;
            var url;
            param['document_id'] = record.get('project_id');
            param['function_usage'] = 'QUERY';
            param['maintain_type'] = maintain_type;
            param['url_title'] = '${l:HLS.PROJECT_MAITAIN}';
            if(record.get('is_constru_unit') == 'N'){
                //不是虚拟店
                param['function_code'] = 'PRJ501_WFL';
                url = 'car_modify_link_readonly';
            }else{
                //虚拟店
                param['function_code'] = 'PRJ501Q_CONSTRU';
                url = 'car_modify_link_readonly_c';
            }
            hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, url, 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(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
            }
            if (name == 'project_number' && value) {
                return '<a href="javascript:open_project_Window(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
            }
            return value;
        };
        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 grid_id = ds_id.replace('ds', 'layout_grid_id');
            $(grid_id)._export();
        };

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