<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang 
    $Date: 2015年12月9日 下午6:48:14  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="con_contract_before_incept_change_price_list_bm_link" model="cont.CON710.con_contract_before_incept_change_price_list" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            function on_change_price_list_lock() {
                Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
            }
            
            function un_change_price_list_lock() {
                Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
            }
            
            function on_change_price_list_confirm() {
                var ds = $('con_contract_change_req_before_incept_ds');
                if (ds.validate()) {
                    var record = ds.getCurrentRecord();
                    var con_record = $('${/parameter/@ds_id}').getCurrentRecord();
                    on_change_price_list_lock();
                    Leaf.request({
                        url: $('con_contract_before_incept_change_price_list_bm_link').getUrl(),
                        para: {
                            change_req_id: '${/parameter/@change_req_id}',
                            change_price_list: record.get('change_price_list')
                        },
                        success: function(res) {
                            un_change_price_list_lock();
                            get_warning_message(res.result.warning_message);
                            con_record.set('change_price_list_flag', 'Y');
                            $('${/parameter/@winid}').close();
                        },
                        failure: function() {
                            con_record.set('change_price_list_flag', 'N');
                            un_change_price_list_lock();
                        },
                        error: function() {
                            con_record.set('change_price_list_flag', 'N');
                            un_change_price_list_lock();
                        },
                        scope: this
                    });
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con_contract_change_req_before_incept_ds" autoCreate="true">
                <a:fields>
                    <a:field name="pre_price_list" defaultValue="${/parameter/@pre_price_list}" readOnly="true"/>
                    <a:field name="pre_price_list_name" defaultValue="${/parameter/@pre_price_list_name}" readOnly="true"/>
                    <a:field name="change_price_list" autoComplete="true" fetchSingle="true" lovGridHeight="350" lovHeight="500" lovService="hls.HLS050.hls_price_list_for_lov?calc_usage=NORMAL" lovWidth="500" required="true" title="HLS.PRICE_LIST">
                        <a:mapping>
                            <a:map from="price_list" to="change_price_list"/>
                            <a:map from="description" to="change_price_list_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="change_price_list_name" readOnly="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="on_change_price_list_confirm" text="确定变更报价方案"/>
            </a:screenTopToolbar>
            <a:form column="2" labelWidth="120" title=" " width="700">
                <a:textField name="pre_price_list" bindTarget="con_contract_change_req_before_incept_ds" prompt="原价目表代码" width="150"/>
                <a:textField name="pre_price_list_name" bindTarget="con_contract_change_req_before_incept_ds" prompt="描述" width="220"/>
                <a:lov name="change_price_list" bindTarget="con_contract_change_req_before_incept_ds" prompt="变更价目表代码" width="150"/>
                <a:textField name="change_price_list_name" bindTarget="con_contract_change_req_before_incept_ds" prompt="描述" width="220"/>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>
