<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-10-9 下午2:37:49  
    $Revision: 1.0  
    $Purpose: priceListAssignScreen
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="business_type in (&apos;LEASE&apos;,&apos;LEASEBACK&apos;)" fetchAll="true" model="basic.hls_business_type_for_lov" rootPath="business_type_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="company_assign_link" url="${/request/@context_path}/modules/hls/HLS052/hls_price_list_company_assign.lview"/>
        <a:link id="requirement_def_link" url="${/request/@context_path}/modules/hls/HLS052/hls_price_list_requirement_def.lview"/>
        <a:link id="financing_scale_link" url="${/request/@context_path}/modules/hls/HLS052/hls_price_list_financing_scale_def.lview"/>
        <a:screen-include screen="modules/hls/hls_common_javascript.lview"/>
        <script type="text/javascript"><![CDATA[
            var calc_type_flag = 'N';
            var record_id = '';
            
            function priceListAssignScreen_forward() {
                history.go(1);
            }
            
            function priceListAssignScreen_back() {
                history.go(-1);
            }
            
            function priceListAssignScreen_add() {
                $('priceListAssignScreen_mainDs_grid').showEditorByRecord($('priceListAssignScreen_mainDs').create());
            }
            
            function priceListAssignScreen_clear() {
                $('priceListAssignScreen_mainDs_grid').clear();
            }
            
            function priceListAssignScreen_query() {
                $('priceListAssignScreen_mainDs').query();
            }
            
            function priceListAssignScreen_save() {
                var ds = $('priceListAssignScreen_mainDs');
                if (ds.validate()) {
                    ds.submit();
                }
            }
            
            function priceListAssignScreen_reset() {
                $('query_ds').reset();
            }
            
            
           function editFunction_priceListAssignScreen_price_list(record, name) {
                if (record.isNew) {
                    return 'priceListAssignScreen_mainDs_grid_lov';
                } else {
                    return '';
                }
            }
            function editFunction_priceListAssignScreen_company(record, name) {
                if (record.isNew) {
                    return 'priceListAssignScreen_mainDs_grid_lov';
                } else {
                    return '';
                }
            }
            function editFunction_priceListAssignScreen_lease_organization(record, name) {
                if (record.isNew) {
                    return 'priceListAssignScreen_mainDs_grid_lov';
                } else {
                    return '';
                }
            }
            function onSubmitSuccess_priceListAssignScreen_mainDs(ds, res) {
                ds.query(ds.currentPage);
            }
            
            function render_mainDs_grid(value, record, name) {
                var price_list=record.get('price_list');
                if (!record.isNew) {
                    if (name == 'company_assign') {
                        return '<a href="javascript:winOpen_company_assign(\'' + price_list + '\');">' + '分配公司' + '</a>';
                    } else if (name == 'requirement_value_def') {
                        return '<a href="javascript:winOpen_requirement_value_def(\'' + price_list +  '\');">' + '编辑' + '</a>';
                    } else if (name == 'financing_scale_def') {
                        return '<a href="javascript:winOpen_financing_scale_def(\'' + price_list + '\');">' + '编辑' + '</a>';
                    }
                    return '';
                }
                return '';
            }
            
             function winOpen_company_assign(price_list) {
                new Leaf.Window({
                    id: 'hls_price_list_company_assign',
                    url: $('company_assign_link').getUrl(),
                    params: {
                        price_list: price_list
                    },
                    title: '分配公司',
                    width:820,
                    height:530
                });
            }
            
            function winOpen_requirement_value_def(price_list) {
                new Leaf.Window({
                    id: 'hls_price_list_req_value_def',
                    url: $('requirement_def_link').getUrl(),
                    params: {
                        price_list: price_list
                    },
                    title: '条件值定义',
                    draggable: true
                });
            }
            
            function winOpen_financing_scale_def(price_list) {
                new Leaf.Window({
                    id: 'hls_price_list_fin_scale_def',
                    url: $('financing_scale_link').getUrl(),
                    params: {
                        price_list: price_list
                    },
                    title: '融资范围',
                    draggable: true
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="query_ds">
                <a:fields>
                    <a:field name="description"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="priceListAssignScreen_mainDs" autoPageSize="true" autoQuery="true" model="hls.HLS052.hls_price_list" pageSize="17" queryDataSet="query_ds">
                <a:fields>
                    <a:field name="price_list"/>
                    <a:field name="description"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="onSubmitSuccess_priceListAssignScreen_mainDs"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="priceListAssignScreen_reset" text="重置"/>
                <a:gridButton click="priceListAssignScreen_query" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form>
                <a:hBox>
                    <a:textField name="description" bindTarget="query_ds" prompt="价目表名称" width="150">
                        <a:events>
                            <a:event name="enterdown" handler="priceListAssignScreen_query"/>
                        </a:events>
                    </a:textField>
                </a:hBox>
            </a:form>
            <a:grid id="priceListAssignScreen_mainDs_grid" bindTarget="priceListAssignScreen_mainDs" marginHeight="120" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="price_list" editorFunction="editFunction_priceListAssignScreen_price_list" prompt="价目表代码" width="255"/>
                    <a:column name="description" editorFunction="editFunction_priceListAssignScreen_price_list" prompt="价目表名称" width="255"/>
                    <a:column name="company_assign" align="center" prompt="分配公司" renderer="render_mainDs_grid" width="150"/>
                    <a:column name="requirement_value_def" align="center" prompt="条件值定义" renderer="render_mainDs_grid" width="150"/>
                    <a:column name="financing_scale_def" align="center" prompt="融资范围" renderer="render_mainDs_grid" width="150"/>
                </a:columns>
                <a:editors>
                    <a:numberField id="priceListAssignScreen_mainDs_grid_nf_integer" allowDecimals="false" allowNegative="false"/>
                    <a:textField id="priceListAssignScreen_mainDs_grid_tf"/>
                    <a:lov id="priceListAssignScreen_mainDs_grid_lov"/>
                    <a:checkBox id="priceListAssignScreen_mainDs_grid_check"/>
                    <a:comboBox id="priceListAssignScreen_mainDs_grid_comboBox"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
