<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng
    $Date: 2019-05-27 09:43: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="INSTALLMENT_LIST" user_id="${/session/@user_id}"/>
        <a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;INSTALLMENT_LIST&apos;" model="basic.hls_fnd_attribute_status" rootPath="status"/>
        <a:model-execute model="cont.CON851.ds_record_list_tmp"/>
    </a:init-procedure>
    <a:view>
        <a:link id="import_other_contract_cf_link_id" model="cont.CON851.ds_record_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.CON851.ds_record_list_tmp" queryUrl="${/request/@context_path}/autocrud/cont.CON851.ds_record_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="200"/>
                        <a:column name="attribute_2" prompt="销售方式" width="200"/>
                        <a:column name="attribute_3" prompt="债权基准日期" width="200"/>
                        <a:column name="attribute_4" prompt="贷款合同号" width="200"/>
                        <a:column name="attribute_5" prompt="借款人名称" width="200"/>
                        <a:column name="attribute_6" prompt="借款人电话" width="200"/>
                        <a:column name="attribute_7" prompt="每月还款金额" width="200"/>
                        <a:column name="attribute_8" prompt="还款日" width="200"/>
                        <a:column name="attribute_9" prompt="贷款余额" width="200"/>
                        <a:column name="attribute_10" prompt="逾期天数" width="200"/>
                        <a:column name="attribute_11" prompt="逾期总额" width="200"/>
                        <a:column name="attribute_12" prompt="逾期本金" width="200"/>
                        <a:column name="attribute_13" prompt="逾期利息" width="200"/>
                        <a:column name="attribute_14" prompt="代理商名称" width="200"/>
                        <a:column name="attribute_15" prompt="借款人证件类型" width="200"/>
                        <a:column name="attribute_16" prompt="借款人证件号码" width="200"/>
                        <a:column name="attribute_17" prompt="借款人地址" width="200"/>
                        <a:column name="attribute_18" prompt="贷款利率" width="200"/>
                        <a:column name="attribute_19" prompt="贷款银行" width="200"/>
                        <a:column name="attribute_20" prompt="分行" width="200"/>
                        <a:column name="attribute_21" prompt="支行" width="200"/>
                        <a:column name="attribute_22" prompt="代扣卡号" width="200"/>
                        <a:column name="attribute_23" prompt="机型" width="200"/>
                        <a:column name="attribute_24" prompt="机号" width="200"/>
                        <a:column name="attribute_25" prompt="贷款金额" width="200"/>
                        <a:column name="attribute_26" prompt="首付款" width="200"/>
                        <a:column name="attribute_27" prompt="首付款比例" width="200"/>
                        <a:column name="attribute_28" prompt="发放日" width="200"/>
                        <a:column name="attribute_29" prompt="到期日" width="200"/>
                        <a:column name="attribute_30" prompt="贷款期限（月）" width="200"/>
                    </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>
