<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2016-5-10 上午9:29:19  
    $Revision: 1.0  
    $Purpose: 维护取消原因，提交审批
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="con542_con_contract_cancel_wfl_link_id" model="cont.CON542.con_contract_cancel" modelaction="insert"/>
        <script type="text/javascript"><![CDATA[
       function con542_con_contract_return(){
           $('${/parameter/@winid}').close();
       }
       
       function con542_con_contract_cancel_submit(){
           if($('cancel_reason_ds').validate()){
               var record=$('cancel_reason_ds').getAt(0);
              
                Leaf.showConfirm('${l:HLS.PROMPT}', '确认提交审批吗？', function() {
                    Leaf.Masker.mask($('${/parameter/@winid}').wrap, '正在执行');
                    Leaf.request({
                        url: $('con542_con_contract_cancel_wfl_link_id').getUrl(),
                        para: {
                            contract_id: '${/parameter/@contract_id}',
                            cancel_reason:record.get('cancel_reason')
                        },
                        scope: this,
                        success: function() {
                             Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
                             $('${/parameter/@winid}').close();
                        },
                        failure: function() {
                            Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
                        },
                        error: function() {
                           Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
                        }
                    });
                });
           }
           
       }
       
       ]]></script>
        <a:dataSets>
            <a:dataSet id="cancel_reason_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
                    <a:field name="contract_name" defaultValue="${/parameter/@contract_name}" readOnly="true"/>
                    <a:field name="cancel_reason" defaultValue="${/parameter/@cancel_reason}" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="con542_con_contract_return" text="退出"/>
                <a:gridButton click="con542_con_contract_cancel_submit" text="提交审批"/>
            </a:screenTopToolbar>
            <a:form labelSeparator="" title="关闭原因说明">
                <a:hBox>
                    <a:textField name="contract_number" bindTarget="cancel_reason_ds" prompt="合同序号"/>
                    <a:textField name="contract_name" bindTarget="cancel_reason_ds" prompt="合同名称" width="250"/>
                </a:hBox>
                <a:textArea name="cancel_reason" bindTarget="cancel_reason_ds" height="200" prompt="关闭原因说明" width="600"/>
            </a:form>
        </a:screenBody>
    </a:view>
</a:screen>
