<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: WCS  
    $Date: 2014-11-25 上午10:15:07  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <script type="text/javascript"><![CDATA[
           function hls315_query(){
               $('yonda_4s_area_director_hd_ds').query();
           }
           
           function onIndexChange(ds, record, name, value, oldvalue){
                $('yonda_4s_area_director_result_ds').setQueryParameter('employee_id', record.get('employee_id'));
                $('yonda_4s_area_director_result_ds').query();
           }
           
           function hls315_update(ds, record, name, value, oldvalue){
               if(name=='company_id')
               {
                   record.getField('unit_name').setLovPara('company_id', value);
               }
               record.set('employee_id',$('yonda_4s_area_director_hd_ds').getCurrentRecord().get('employee_id'));
           }
		]]></script>
        <a:dataSets>
            <a:dataSet id="yonda_4s_area_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="company_short_name"/>
                    <a:field name="employee_name"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="yonda_4s_area_director_hd_ds" autoQuery="true" model="hls.HLS315.exp_employee_assigns_v" queryDataSet="yonda_4s_area_query_ds" selectable="true" selectionModel="single">
                <a:events>
                    <a:event name="indexChange" handler="onIndexChange"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="yonda_4s_area_director_result_ds" autoCount="true" autoQuery="true" model="hls.HLS315.yonda_4s_area_director" selectable="true" selectionModel="single">
                <a:fields>
                    <a:field name="company_short_name" lovHeight="500" lovService="fnd.fnd_companies" lovWidth="500" required="true" title="公司">
                        <a:mapping>
                            <a:map from="company_id" to="company_id"/>
                            <a:map from="company_short_name" to="company_short_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="unit_name" lovHeight="500" lovService="hls.HLS315.exp_org_unit_for_lov" lovWidth="500" required="true" title="部门">
                        <a:mapping>
                            <a:map from="unit_id" to="unit_id"/>
                            <a:map from="unit_name" to="unit_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="enable_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="hls315_update"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls315_query" text="查询"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="120" marginWidth="200" title="查询条件">
                <a:textField name="company_short_name" bindTarget="yonda_4s_area_query_ds" prompt="公司名称"/>
                <a:textField name="employee_name" bindTarget="yonda_4s_area_query_ds" prompt="员工名称"/>
            </a:form>
            <a:form>
                <a:hBox>
                    <a:grid bindTarget="yonda_4s_area_director_hd_ds" marginHeight="280" marginWidth="600" navBar="true">
                        <a:columns>
                            <a:column name="employee_code" prompt="员工代码"/>
                            <a:column name="employee_name" prompt="员工名称"/>
                            <a:column name="company_short_name" prompt="公司名称" width="200"/>
                            <a:column name="position_name" prompt="岗位名称" width="150"/>
                            <a:column name="unit_name" prompt="部门名称"/>
                        </a:columns>
                    </a:grid>
                    <a:grid bindTarget="yonda_4s_area_director_result_ds" marginHeight="280" marginWidth="800" navBar="true">
                        <a:toolBar>
                            <a:button type="add"/>
                            <a:button type="delete"/>
                            <a:button type="save"/>
                        </a:toolBar>
                        <a:columns>
                            <a:column name="company_short_name" editor="hls315_lov_id" prompt="公司名称" width="200"/>
                            <a:column name="unit_name" editor="hls315_lov_id" prompt="部门名称"/>
                            <a:column name="enable_flag" editor="hls315_checkBox_id" prompt="启用标志"/>
                        </a:columns>
                        <a:editors>
                            <a:lov id="hls315_lov_id"/>
                            <a:checkBox id="hls315_checkBox_id"/>
                        </a:editors>
                    </a:grid>
                </a:hBox>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>
