<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: duzhihong  
    $Date: 2014-8-19 下午4:22:48  
    $Revision: 1.0  
    $Purpose: 合同审批工作流页面-合同文本
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:view>
        <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON500/con_contract_update.lview"/>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con_contract_approve_wfl_text_detail_link_id" url="${/request/@context_path}/modules/cont/CON505/con_contract_approve_wfl_text_detail.lview"/>
        <a:link id="con_contract_approve_wfl_atm_upload_link_id" url="${/request/@context_path}/atm_upload.lview"/>
        <script type="text/javascript"><![CDATA[
            function con505_render_contrac_text(value, record, name) {
                if (name == 'contract_text'){
                    return '<a href="javascript:con505_con_contract_content_text();">' + '合同文本' + '</a>';
                }else if(name == 'contract_id'){
                    return '<a href="javascript:con505_con_contract_atm_upload();">' + '<font size="4">附件上传</font>' + '</a>';
                    
                }
            }
            
            
            function con505_con_contract_content_text() {
                var record = $('con_contract_for_wfl_ds').getAt(0);
                new Leaf.Window({
                    id: 'contract_approve_wfl_text_detail_winid',
                    url: $('con_contract_approve_wfl_text_detail_link_id').getUrl(),
                    params: {
                        contract_id: record.get('contract_id')
                    },
                    title: '合同文本清单',
                    width:1000,
                    height:500
                });
            }
            
            function con505_con_contract_atm_upload() {
                var record = $('con_contract_for_wfl_ds').getAt(0);
                new Leaf.Window({
                    id: 'contract_approve_wfl_atm_upload_winid',
                    url: $('con_contract_approve_wfl_atm_upload_link_id').getUrl(),
                    params: {
                        document_id: record.get('contract_id'),
                        document_table:'CON_CONTRACT',
                        showflag : 'N'
                    },
                    title: '附件上传',
                    width:850,
                    height:450
                });
            }
            
            
            function con505_render_contractMaintainDs_grid(value, record, name) {
                    return '<a href="javascript:con505_contractMaintainDs_grid_update(' + record.id + ');">' + '合同明细' + '</a>';
            }
            
            function con505_param_set_value(param) {
                param['function_code'] = 'CON301';
                param['function_usage'] = 'QUERY';
                param['maintain_type'] = 'READONLY';
                param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_update_link_id');
            }
            
            function con505_contractMaintainDs_grid_update(id) {
                var current_record = $('con_contract_for_wfl_ds').findById(id);
                var param = current_record.data;
                param['document_id'] = current_record.get('contract_id');
                con505_param_set_value(param);
            }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <a:dataSets>
            <a:dataSet id="con_contract_for_wfl_ds" loadData="true" model="cont.CON500.con_contract_v" queryUrl="${/request/@context_path}/autocrud/cont.CON500.con_contract_v/query?contract_id=${/parameter/@contract_id}">
                <a:fields>
                    <a:field name="contract_number" readOnly="true"/>
                    <a:field name="bp_name" readOnly="true"/>
                    <a:field name="contract_name" readOnly="true"/>
                    <a:field name="contract_id"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form marginWidth="30" title="合同审批">
                <a:box column="3" labelWidth="120" width="1000">
                    <a:textField name="contract_number" bindTarget="con_contract_for_wfl_ds" prompt="HLS.CONTRACT_NUMBER"/>
                    <a:textField name="contract_name" bindTarget="con_contract_for_wfl_ds" prompt="合同名称"/>
                    <a:textField name="bp_name" bindTarget="con_contract_for_wfl_ds" prompt="承租人" width="200"/>
                    <a:label name="contract_detail" bindTarget="con_contract_for_wfl_ds" renderer="con505_render_contractMaintainDs_grid" style="margin-left:30px;"/>
                    <a:label name="contract_text" bindTarget="con_contract_for_wfl_ds" renderer="con505_render_contrac_text" style="margin-left:30px;"/>
                </a:box>
            </a:form>
            <!-- <a:label name="contract_id" bindTarget="con_contract_for_wfl_ds" prompt="" renderer="con505_render_contrac_text" style="margin-left:30px;"/> -->
            <!-- <a href="javascript:con505_con_contract_atm_upload();" style="margin-left:19px;text-decoration:underline">
                <font size="3"><![CDATA[附件上传]]></font>
            </a> -->
        </a:screenBody>
        <a:switch test="/parameter/@upload_flag">
            <a:case value="Y">
                <!-- <a href="javascript:approve_wfl_atm_upload();" style="margin-left:19px;text-decoration:underline">
                    <font size="3"><![CDATA[附件上传]]></font>
                </a> -->
                <a:screen-include screen="atm_upload.lview?document_id=${/parameter/@contract_id}&amp;document_table=HY_CON_PROCESS&amp;showflag=N"/>
            </a:case>
            <a:case value="N">
                <!-- <a href="javascript:approve_wfl_atm_query();" style="margin-left:19px;text-decoration:underline">
                    <font size="3"><![CDATA[附件上传]]></font>
                </a> -->
                <a:screen-include screen="atm_query.lview?document_id=${/parameter/@contract_id}&amp;document_table=HY_CON_PROCESS&amp;showflag=N"/>
            </a:case>
        </a:switch>
    </a:view>
</a:screen>
