<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Administrator  
    $Date: 2014-8-5 下午1:43:46  
    $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"/>
        <script type="text/javascript"><![CDATA[
            function con505_render_contractMaintainDs_grid(value, record, name) {
                // if (name == 'contract_number') {
                    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);
            }
            
            function save_wfl_contract_legal(ds,record,name,value,oldValud){
                if(name=='employee_id'){
                    
                   $('wfl_contract_legal_ds').submit();
                }
            }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <a:dataSets>
            <a:dataSet id="wfl_contract_legal_ds" autoQuery="true" model="cont.CON505.wfl_contract_legal_specialist" queryUrl="${/request/@context_path}/autocrud/cont.CON505.wfl_contract_legal_specialist/query?instance_id=${/parameter/@instance_id}">
                <a:fields>
                    <a:field name="instance_id" defaultValue="${/parameter/@instance_id}"/>
                    <a:field name="employee_id" required="true"/>
                    <a:field name="position_id"/>
                    <a:field name="legal_person" lovGridHeight="400" lovHeight="600" lovLabelWidth="100" lovService="cont.CON505.con_contract_legal_person?company_id=${/seesion/@company_id}" lovWidth="500" readOnly="${/parameter/@readOnly}" required="true" title="指派法务岗">
                        <a:mapping>
                            <a:map from="employee_id" to="employee_id"/>
                            <a:map from="name" to="legal_person"/>
                            <a:map from="position_id" to="position_id"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="save_wfl_contract_legal"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="con_contract_for_wfl_ds" autoQuery="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="instance_id" defaultValue="${/parameter/@instance_id}" /> -->
                    <a:field name="contract_number" readOnly="true"/>
                    <a:field name="contract_name" readOnly="true"/>
                    <a:field name="bp_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:lov name="legal_person" bindTarget="wfl_contract_legal_ds" prompt="指派法务岗"/>
                    <!--  <a:button click="save_wfl_contract_legal" text="HLS.SAVE"/> -->
                    <a:label name="contract_detail" bindTarget="con_contract_for_wfl_ds" renderer="con505_render_contractMaintainDs_grid" style="margin-left:30px;"/>
                </a:box>
            </a:form>
        </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>
