<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangguangfan  
    $Date: 2012-12-6 下午02:09:44  
    $Revision: 1.0  
    $Purpose: 事业部定义
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="pageLink_orgAssign" url="${/request/@context_path}/modules/hls/HLS101/hls_lease_org_assign.lview"/>
        <a:screen-include screen="modules/hls/hls_common_javascript.lview"/>
        <script type="text/javascript"><![CDATA[
            function queryFunction() {
                $('orgDs').query();
            }
            
            function hls_101_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
            }
            
            function hls_101_grid_add() {
                $('orgDs_grid').showEditorByRecord($('orgDs').create());
            }
            
            function hls_101_grid_clear() {
                $('orgDs_grid').clear();
            }
            
            function hls_101_grid_remove() {
                $('orgDs_grid').remove();
            }
            
            function hls_101_grid_submit() {
                $('orgDs').submit();
            }
            
            function editorFun_orgDs_grid(record, name) {
                if (record.isNew) {
                    if (name == 'lease_organization') {
                        return 'orgDs_grid_tf_upper';
                    } else {
                        return 'orgDs_grid_tf';
                    }
                } else {
                    return '';
                }
            }
            
            function do_hls101_company_name(record, name) {
                if (record.isNew) {
                    return 'orgDs_grid_comb';
                } else {
                    return '';
                }
            }
            
            function companyAssign(value, record, name) {
                if (record.isNew) {
                    return '';
                }
                return '<a href="javascript:companyAssignInfo(\'' + record.get('lease_organization') + '\')">${l:HLS101.LINK.ASSIGN_COMPANY}</a>';
            
            }
            
            function companyAssignInfo(lease_organization) {
                
                new Leaf.Window({
                    id: 'hls_lease_org_assign',
                    url: $('pageLink_orgAssign').getUrl(),
                    params: {
                        lease_organization: lease_organization
                    },
                    title: '${l:HLS101.LINK.ASSIGN_COMPANY}',
                    fullScreen: true
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="orgDs" autoQuery="true" model="hls.HLS101.hls_lease_organization" pageSize="20" selectable="true">
                <a:fields>
                    <a:field name="lease_organization" required="true" validator="hlsCommon_validateCode"/>
                    <a:field name="description" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="ref_n01_desc" lovGridHeight="300" lovHeight="520" lovService="basic.exp_emp_assign_e_v_primary_lov" lovWidth="820" required="true" title="HLS.EMPLOYEE_NAME">
                        <a:mapping>
                            <a:map from="employee_id" to="ref_n01"/>
                            <a:map from="employee_name" to="ref_n01_desc"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls_101_quit" text="HLS.EXIT"/>
                <a:gridButton click="queryFunction" text="HLS.QUERY"/>
                <a:gridButton click="hls_101_grid_add" text="HLS.NEW"/>
                <a:gridButton click="hls_101_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="hls_101_grid_submit" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:grid id="orgDs_grid" bindTarget="orgDs" marginHeight="100" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="lease_organization" editorFunction="editorFun_orgDs_grid" width="200"/>
                    <a:column name="description" editor="orgDs_grid_tf" width="300"/>
                    <a:column name="asignCm" align="center" prompt="HLS101.LINK.ASSIGN_COMPANY" renderer="companyAssign" width="100"/>
                    <a:column name="ref_n01_desc" editor="orgDs_grid_lov" prompt="风控专员"/>
                    <a:column name="enabled_flag" editor="orgDs_grid_check" width="100"/>
                </a:columns>
                <a:editors>
                    <a:textField id="orgDs_grid_tf_upper"/>
                    <a:textField id="orgDs_grid_tf"/>
                    <a:comboBox id="orgDs_grid_comb"/>
                    <a:checkBox id="orgDs_grid_check"/>
                    <a:lov id="orgDs_grid_lov"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
