<?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_CUS_LIST" user_id="${/session/@user_id}"/>
        <a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;INSTALLMENT_CUS_LIST&apos;" model="basic.hls_fnd_attribute_status" rootPath="status"/>
        <a:model-update model="cont.CON852.ds_record_list_tmp"/>
    </a:init-procedure>
    <a:view>
        <a:link id="import_other_contract_cf_link_id" model="cont.CON852.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.CON852.ds_record_list_tmp" queryUrl="${/request/@context_path}/autocrud/cont.CON852.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="DCS销售方式" 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="DCS销售订单号" width="200"/>
                        <a:column name="attribute_25" prompt="DCS销售日期" 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:column name="attribute_31" prompt="首付款" width="200"/>
                        <a:column name="attribute_32" prompt="首付比率" width="200"/>
                        <a:column name="attribute_33" prompt="客户联系电话" width="200"/>
                        <a:column name="attribute_34" 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>
