<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingefng
    $Date: 2015-04-09 上午10:07:29  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure outputPath="/parameter">
        <a:model-query model="basic.hls_fnd_attribute_sequence" rootPath="header"/>
        <a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="EBANK_LIST" user_id="${/session/@user_id}"/>
        <a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;EBANK_LIST&apos;" model="basic.hls_fnd_attribute_status" rootPath="status"/>
        <a:model-update model="cont.CON591.ebank_list_tmp"/>
    </a:init-procedure>
    <a:view>
        <a:link id="import_other_contract_cf_link_id" model="cont.CON591.ebank_list_tmp" modelaction="insert"/>
        <script type="text/javascript"><![CDATA[
            function backBtn() {
                parent._input_window.close();
            }

            
            var import_flag=0;
            function import_btn() {
                var ds = $('tre_withdraw_subscriber_improt_ds');
                record = ds.getAll();
                if(import_flag==0){
                for (i = 0;i < record.length;i++) {
                    if (record[i].get('status') == 'ERROR') {
                        Leaf.showMessage('${l:PROMPT}', '导入的数据存在错误，请查看错误信息！');
                        return;
                    }
                }
                    Leaf.showConfirm('提示', '确定要导入这些信息吗？', function() {

                        Leaf.request({
                            url: $('import_other_contract_cf_link_id').getUrl(),
                            para: {
                                batch_id: '${/parameter/@batch_id}',
                                header_id: '${/model/header/record/@header_id}'

                            },
                            scope: this,
                            success: function () {
                                import_flag = import_flag + 1;
                                Leaf.SideBar.show({
                                    msg: '操作成功',
                                    duration: 2000
                                });

                                backBtn();
                            }
                        });
                    });
                }else{
                   Leaf.showMessage('${l:PROMPT}', '数据已导入不能重复导入！');
                        return;  
                }
            }
            

        ]]></script>
        <a:dataSets>
            <a:dataSet id="tre_withdraw_subscriber_improt_ds" autoQuery="true" fetchAll="true" model="cont.CON591.ebank_list_tmp" queryUrl="${/request/@context_path}/autocrud/cont.CON591.ebank_list_tmp/query?header_id=${/model/header/record/@header_id}">
                <a:fields>
                    <a:field name="error_message" readOnly="true"/>
                    <a:field name="attribute_4" readOnly="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form id="success_form" height="400" title="THE_IMPORTED_DATA" width="980">
                <a:screenTopToolbar>
                    <a:gridButton click="backBtn" text="退出"/>
                    <a:gridButton click="import_btn" text="导入"/>
                </a:screenTopToolbar>
                <a:grid id="grid_ds_id" bindTarget="tre_withdraw_subscriber_improt_ds" height="340" navBar="true" width="980">
                    <a:columns>
                        <a:column name="error_message" editor="textArea_e" prompt="错误信息" width="180"/>
                        <a:column name="attribute_1" prompt="合同编号" width="80"/>
                        <a:column name="attribute_2" prompt="客户名称" width="80"/>
                        <a:column name="attribute_3" prompt="扣款银行" width="80"/>
                        <a:column name="attribute_4" prompt="扣款账户名称" width="80"/>
                        <a:column name="attribute_5" prompt="绑定银行卡号" width="80"/>
                        <a:column name="attribute_6" prompt="协议/绑定日期" width="80"/>
                    </a:columns>
                    <a:editors>
                        <a:textArea id="textArea_e" height="50" width="240"/>
                    </a:editors>
                </a:grid>
            </a:form>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
	  		
	  	]]></script>
    </a:view>
</a:screen>
