<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhenwei.yin  
    $Date: 2012-12-11 下午4:03:43  
    $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="query_division_detail_link" url="${/request/@context_path}/modules/hls/HLS103/hls_division_detail.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls_103_queryDivision() {
                $('hls_division_result_ds').query();
            }
            
            function hls_103_resetDivision() {
                $('hls_division_query_ds').reset();
            }
            
            function hls_103_grid_submit() {
                var result_ds = $('hls_division_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            function hls_103_grid_add() {
                $('hls_division_grid').showEditorByRecord($('hls_division_result_ds').create());
            }
            
            function hls_103_next() {
                history.go(1);
            }
            
            function hls_103_back() {
                history.go(-1);
            }
            
            function hls_103_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
            }
            
            function hls_103_grid_clear() {
                $('hls_division_grid').clear();
            }
            
            function hls103divisionCodeFunction(record, name) {
                if (record.isNew) {
                    return 'hls103_division_code_tf';
                } else {
                    return '';
                }
            }
         function division_detail_renderer(value, record, name) {
               if(record.get('division')=='70'){
                return '<a href="javascript:open_division_detail_window(\'' + record.get('division')  + '\',\'' + record.get('description') + '\')">' + '明细' + '</a>';
               }
         }

        function open_division_detail_window(division,description) {
                var win = new Leaf.Window({
                id: 'query_division_detail_link_winId',
                url: $('query_division_detail_link').getUrl(),
                params: {
                    division: division,
                    description: description,
                    winid: 'query_division_detail_link_winId'

                },
                title: '产品线细分',
                draggable: true,
                width: 700,
                height: 500
            });
        }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="full_elec_sign_ds" lookupCode="YES_OR_NO"/>
            <a:dataSet id="hls_division_result_ds" autoQuery="true" fetchAll="false" model="hls.HLS103.hls_division" selectable="true">
                <a:fields>
                    <a:field name="division" required="true"/>
                    <a:field name="description" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="full_elec_sign" required="true"/>
                    <a:field name="full_elec_sign_desc" required="true" displayField="code_value_name" options="full_elec_sign_ds" returnField="full_elec_sign" valueField="code_value"/>

                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls_103_back" text="HLS.BACK"/>
                <a:gridButton click="hls_103_next" text="HLS.FORWARD"/>
                <a:gridButton click="hls_103_quit" text="HLS.EXIT"/>
                <a:gridButton click="hls_103_grid_add" text="HLS.NEW"/>
                <a:gridButton click="hls_103_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="hls_103_grid_submit" text="HLS.SAVE"/>
                <a:gridButton click="hls_103_queryDivision" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:grid id="hls_division_grid" bindTarget="hls_division_result_ds" marginHeight="100" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="division" align="left" editorFunction="hls103divisionCodeFunction" sortable="true" width="250"/>
                    <a:column name="description" align="left" editor="hls103_division_description_tf" width="300"/>
                    <a:column name="division_detail" align="center" prompt="产品线明细" renderer="division_detail_renderer" width="100"/>
                    <a:column name="full_elec_sign_desc" prompt="是否为全电子签约" align="center" editor="grid_id_comboBox_id" width="100"/>
                    <a:column name="enabled_flag" align="center" editor="hls103_division_result_grid_cb" width="100"/>
                </a:columns>
                <a:editors>
                    <a:textField id="hls103_division_code_tf" maxLength="2"/>
                    <a:textField id="hls103_division_description_tf"/>
                    <a:checkBox id="hls103_division_result_grid_cb"/>
                    <a:comboBox id="grid_id_comboBox_id"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
