<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhuxianfei
    $Date: 2018年7月16日 下午2:18:45  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <script type="text/javascript"><![CDATA[

        //锁屏
        function lock_window() {
            Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
        }

        //解屏
        function unlock_window() {
            Leaf.Masker.unmask(Ext.getBody());
        }


        //确定
        function con_confirm() {
            //
            var record = $('con_change_other_result_ds').getCurrentRecord();
            lock_window();
            Leaf.request({
                url: '${/request/@context_path}/autocrud/cont.CON350.con350_insurance_result/execute',
                para: {
                    contract_id: '${/parameter/@contract_id}',
                    insurance_method: record.get('insurance_method')
                },
                success: function (res) {
                    Leaf.SideBar.show({
                        msg: '操作成功',
                        duration: 2000
                    });
                    unlock_window();
                    con_cancel();
                },
                error: function () {
                    unlock_window();
                },
                failure: function () {
                    unlock_window();
                },
                sync: true,
                scope: this
            })
            ;
        }
        //取消
        function con_cancel() {
            $('change_other_ins_link_winId').close();
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="insurance_method_ds" lookupCode="INSURANCE_METHOD"/>

            <a:dataSet id="con_change_other_result_ds" autoQuery="true" fetchAll="true"
                       model="cont.CON350.con350_insurance_result"
                       queryUrl="${/request/@context_path}/autocrud/cont.CON350.con350_insurance_result/query?contract_id=${/parameter/@contract_id}"
                       selectable="false">
                <a:fields>
                    <a:field name="contract_number" readOnly="true"/>
                    <a:field name="bp_id_tenant_n" readOnly="true"/>
                    <a:field name="insurance_method" required="true"/>
                    <a:field name="insurance_method_n" required="true" displayField="code_value_name"
                             options="insurance_method_ds"
                             returnField="insurance_method" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <!--<a:screenTitle/>-->
                <a:gridButton click="con_confirm" text="确定"/>
                <a:gridButton click="con_cancel" text="取消"/>
            </a:screenTopToolbar>
            <a:grid id="con_change_other_result_ds_id" bindTarget="con_change_other_result_ds" width="850" height="200"
                    navBar="true">
                <a:columns>
                    <a:column name="contract_number" prompt="合同编号" width="200"/>
                    <a:column name="bp_id_tenant_n" prompt="客户名" width="200"/>
                    <a:column name="insurance_method_n" prompt="投保方式" editor="cb_id" width="200"/>
                </a:columns>
                <a:editors>
                    <a:numberField id="nf_id" allowDecimals="true" allowNegative="false"/>

                    <a:comboBox id="cb_id"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
