tre_batch_repayment_request.lview 5.9 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: caizhenggan
    $Date: 2017-1-19  上午10:03:40
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="tre317_submit_repayment_link_id" url="${/request/@context_path}/modules/tre/TRE317/tre_loan_contract_repayment_save.lsc"/>
        <a:link id="tre_batch_import_upload_id" url="${/request/@context_path}/modules/tre/TRE317/tre_batch_repay_import_upload.lview"/>
        <script type="text/javascript"><![CDATA[
            function click_back() {
                $('tre_batch_repayment_winid').close();
            }
            
            function tre_batch_repayment_import() {
                var win = new Leaf.Window({
                    id: 'tre_batch_import_upload_winid',
                    url: $('tre_batch_import_upload_id').getUrl(),
                    params: {
                        batch_id: '${/session/@session_id}',
                        win_id: 'tre_batch_import_upload_winid',
                        parent_ds_id: 'tre_batch_query_ds'
                    },
                    title: '导入',
                    width: 420,
                    height: 275
                });
                win.on('close', function() {
                    $('tre_batch_query_ds').query();
                });
            }
            
            //数据导入错误,更改行颜色
            
            function change_background_color(record) {
                var flag = record.get('import_flag');
            
                if (record.get('import_flag') == 'N') {
                    return 'background-color:#F09192;';
                }
            
            
            }
            
            //提交工作流
            
            function tre_repayment_submit() {
                var records = $('tre_batch_query_ds').getSelected();
                if (records.length == 0) {
                    Leaf.showMessage('提示', '请选择要提交的单据!');
                    return;
                }
                var saveData = [];
                for (var i = 0;i < records.length;i++) {
                    var repayment_record;
                    repayment_record = records[i];
                    if (records[i].get('import_flag') == 'N') {
                        Leaf.showMessage('提示', '只有数据完成匹配的单据才能提交审批!');
                        return;
                    }
                    repayment_record.set('_status', 'update');
                    saveData.push(repayment_record.data);
                }
                var param = {};
                param['details'] = saveData;
            
                Leaf.showConfirm('提示', '确认提交吗?', function() {
                    Leaf.Masker.mask(Ext.getBody(), '正在提交......');
                    Leaf.request({
                        url: $('tre317_submit_repayment_link_id').getUrl(),
                        para: param,
                        success: function(args) {
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        failure: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        error: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                });
            
            
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="tre_batch_query_ds" autoQuery="true" model="tre.TRE317.tre_batch_import_query" selectable="true"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="click_back" text="退出"/>
                <a:gridButton click="tre_batch_repayment_import" text="批量还款导入"/>
                <a:gridButton click="tre_repayment_submit" text="提交审批"/>
            </a:screenTopToolbar>
            <a:grid bindTarget="tre_batch_query_ds" marginHeight="200" marginWidth="100" navBar="true" rowRenderer="change_background_color">
                <a:columns>
                    <a:column name="loan_contract_number" align="left" prompt="借款合同号" width="160"/>
                    <a:column name="loan_contract_name" align="left" prompt="借款合同名称" width="160"/>
                    <a:column name="withdrawal_num" align="center" prompt="提款编号"/>
                    <a:column name="ref_v01" align="center" prompt="项目编号"/>
                    <a:column name="times" align="center" prompt="期数"/>
                    <a:column name="attribute_1" align="center" prompt="提款编号"/>
                    <a:column name="attribute_2" align="center" prompt="资金方名称"/>
                    <a:column name="attribute_3" align="center" prompt="客户名称"/>
                    <a:column name="attribute_4" align="center" prompt="还款日期" renderer="Leaf.formatDate"/>
                    <a:column name="attribute_5" align="center" prompt="当期租金" renderer="Leaf.formatMoney"/>
                    <a:column name="attribute_6" align="center" prompt="当期本金" renderer="Leaf.formatMoney"/>
                    <a:column name="attribute_7" align="center" prompt="当前利息" renderer="Leaf.formatMoney"/>
                    <a:column name="attribute_8" align="center" prompt="还款类型"/>
                    <a:column name="logs" align="left" prompt="导入日志" width="180"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>