<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author:
    $Date: 2018/8/2
    $Revision: 1.0
    8.CONT INFO信息
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view template="default" package="leaf.ui.std">
        <a:link id="count_info_prj910_project_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="widget_con_info_con301_con_contract_count_info_link" url="${/request/@context_path}/modules/prj/PRJ506/virtual_contract_query.lview"/>
        <style>
            html,body{
            background-color:#eee;
            width:870px;
            height:355px;
            margin: 0;
            padding: 0;
            color:#758697;
            }
            .widget_cont_info{
            width:870px;
            height:355px;
            background-color:#fff;
            position:relative;
            }
            .widget_cont_info .hls-pagging-grid{
            width:870px;
            }
            .widget_cont_info .hls-pagging-grid .grid-title{
            border-bottom:4px solid #F57B69;
            height:45px;
            }
            .widget_cont_info .hls-pagging-grid .grid-title>img{
            width:20px;
            height:20px;
            position:relative;
            top:5px;
            }
            .widget_cont_info .hls-pagging-grid .grid-title>span{
            font-family:"Helvetica Neue", "Luxi Sans", "DejaVu Sans", Tahoma, "Microsoft Yahei", "Hiragino Sans GB", sans-serif;
            font-size:13px;
            line-height:45px;
            color:#000;
            text-size-adjust:100%;
            font-weight:bold;
            }
        </style>
        <script><![CDATA[
        function cont_id_name_renderer(record,index){
            var html='<p style="width:150px;max-height:16px;">'+record.data['contract_number']+'</p>';
            html+='<p style="color:#9f9f9f;width:150px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;">'+record.data['contract_name']+'</p>';
            return html;
        }
        function cont_status_renderer(record,index){
            var statusInfo = {
                "NEW":"#2EC3E8",
                "SIGN":"#14A9CC",
                "INCEPT":"#A0D469",
                "TERMINATE":"#31B995",
                "ET":"#FFCD55",
                "REPUR":"#E75B8D",
                "CANCEL":"#FA6A4D"
            };
            var str='';
            str+='<span style="width:85px;height: 20px;line-height: 20px; border-radius: 2px;max-height:32px;text-align:center;color:#fff;display:inline-block;overflow:hidden;background: '+statusInfo[record.data['contract_status']]+'">';
            str+=record.data['contract_status_desc']+'</span>';
            return str;
        }
        function cont_detail_renderer(record,index){
            return "<img onclick='open_vir_con_modify_win(\"" + record.ds.id + "\",\""+record.id+ "\")' style='cursor:pointer;width:15px;height:15px;display:inline-block;margin:0px;' src='${base.contextPath}/leafresource/images/widget/detail.png' alt='png'/>";
        }
        function open_vir_con_modify_win(ds_id, record_id){
            var record = $(ds_id).findById(record_id);
            var param = record.data;
            param['function_code'] = 'C0N301D_CON';
            param['function_usage'] = 'QUERY';
            param['maintain_type'] = 'READONLY';
            param['cond_para2'] = record.get('hn_industry_classification');
            param['url_title'] = '合同明细';
            param['winid'] = 'con301_virtual_contract_query_detail_link_id';

            Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            Leaf.request({
                url: $('count_info_prj910_project_get_layout_code_link_id').getUrl(),
                para: param,
                success: function(res) {
                    Leaf.Masker.unmask(Ext.getBody());
                    if (!res.result.layout_code) {
                        Leaf.showMessage('${l:PROMPT}', '${l:HLS.LAYOUT_CODE_IS_NULL}');
                        return;
                    }
                    param['layout_code'] = res.result.layout_code;
                    param['usage_type'] = res.result.usage_type;
                    var winid = 'hls_doc_get_layout_code_winid';
                    param['winid'] = winid;
                    param['calc_type'] = res.result.cond_para1;
                    var win;
                    win = new Leaf.Window({
                        id: winid,
                        params: param,
                        url: $('widget_con_info_con301_con_contract_count_info_link').getUrl(),
                        title: param['url_title'] + '(' + res.result.layout_code + ')',
                        fullScreen: true,
                        draggable: true
                    });
                    win.on('close', function() {
                        if (list_ds) {
                            $(list_ds).query();
                        }
                        if (function_name) {
                            window[function_name]();
                        }
                    });
                },
                failure: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                error: function() {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                scope: this
            });
        }
        function cont_search_handler(){
            <!--top.mainJumpCode('PRJ401',true);-->
            location.href='/modules/prj/PRJ401/prj_chance_update_entrance.lview?layout_code=CHANCE_MODIFY&function_code=PRJ401';
        }
            ]]></script>
        <a:dataSets>
            <a:dataSet id="cont_info_ds" autoQuery="true"  pageSize="5" model="cont.CON1003.cont_info">
                <a:fields>
                    <a:field name="contract_id"/>
                    <a:field name="project_id"/>
                    <a:field name="contract_number"/>
                    <a:field name="contract_name"/>
                    <a:field name="bp_name"/>
                    <a:field name="finance_amount"/>
                    <a:field name="division_desc"/>
                    <a:field name="document_type_desc"/>
                    <a:field name="contract_status"/>
                    <a:field name="contract_status_desc"/>
                    <a:field name="hn_industry_classification"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <div class="widget_cont_info">
            <a:hapGrid id="cont_info" title="合同信息" bindTarget="cont_info_ds" titleImg="/leafresource/images/widget/vat-inf-5.png" canWheel="true">
                <a:toolBar>
                    <a:button icon="/leafresource/images/widget/search_flag.png" click="cont_search_handler"/>
                    <!--<a:button type="search" click="click3" width="150px" placeholder="请输入合同编号"/>-->
                </a:toolBar>
                <a:columns>
                    <a:column template="cont_id_name_renderer" prompt="合同编号/合同名称"/>
                    <a:column name="bp_name" prompt="承租人" />
                    <a:column name="finance_amount"  prompt="融资额"/>
                    <a:column name="division_desc"  prompt="产品线"/>
                    <a:column name="document_type_desc"  prompt="合同类型"/>
                    <a:column template="cont_status_renderer" prompt="合同状态"/>
                    <a:column template="cont_detail_renderer"  prompt="明细"/>
                </a:columns>
            </a:hapGrid>
        </div>
        <a:screenBody style="display:none"> </a:screenBody>
    </a:view>
</a:screen>