depreciation_import.lview 5.28 KB
Newer Older
陆正友's avatar
陆正友 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: sf
    $Date: 2015-4-8 上午09:03:15
    $Revision: 1.0
    $Purpose: excel导入收款
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query  fetchAll="true" model="cont.CON3450.depreciation_import" rootPath="depreciation_times"/>
    </a:init-procedure>

    <a:view>
        <a:link id="downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <script type="text/javascript"><![CDATA[

        function downloadFile() {
            new Leaf.Window({
                url: $('downloadFile_id').getUrl(),
                title: '${l:HLS.SUPPORTING_DOCUMENT}',
                params: {
                    'table_name': 'HLS_ATTACHMENT_MODULE',
                    'header_id': '${/model/template_path/record/@attachment_module_id}'
                },
                width: 850,
                height: 400
            });
        }

        function saveClick() {


            if (document.getElementById('importFile').value) {
                var fileName = document.getElementById('importFile').value;
                var fileType = fileName.substr(fileName.lastIndexOf("."));
                if (fileType != '.xls' && fileType != '.xlsx' && fileType != '.xlsm') {
                    alert('${l:SELECT_CORRECT_IMPORT_FILE}');
                } else {
                    doSubmit();
                }
            }
        }

        var _input_window;

        function doSubmit() {
            var form = document.getElementById('importForm');
            var DTS = $('times').getAt(0).get('period_name');
            console.log(DTS);
            if (Ext.isEmpty(DTS)){
                Leaf.showMessage('提示', '导入期间不能为空!');
            }else {
                _input_window = new $L.Window({
                    title: '${l:HLS.IMPORT}',
                    width: 1050,
                    height: 500
                });
                new Ext.Template('<iframe id ="_input_window" name="_input_window" border="0" frameborder="0" height="100%"  width="100%"  style="border:none;padding:0px;margin:0px;"></iframe>').insertFirst(_input_window.body.dom, {}, true);
                var url = '${/request/@context_path}/modules/cont/CON3450/depreciation_excel_import.lview?session_id=${/parameter/@session_id}&winid=${/parameter/@winid}&batch_id=${/parameter/@batch_id}&_csrf=${/session/@_csrf.token}&DTS='+DTS;
                form.action = url;
                form.submit();
            }

        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="label_ds" autoCreate="true">
                <a:fields>
                    <!--<a:field name="label1" defaultValue="注意:"/>-->
                    <a:field name="label2" defaultValue="${l:STRICT_IMPORTED_TEMPLATE_DATA}"/>
                    <a:field name="label3" defaultValue="${l:PRODUCT_MASTER_DATA_IMPORT}"/>
                    <a:field name="label4" defaultValue="${l:IMPORTER_ONLY_SUPPORTS}"/>
                    <a:field name="label5" defaultValue="${l:READ_THE_ABOVE_CAREFULLY}"/>
                    <a:field name="label6" defaultValue="${l:THE_IMPORT_IS_COMPLETE}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="inport_times">
                <a:datas dataSource="/model/depreciation_times"/>
            </a:dataSet>
            <a:dataSet id="times" autoCreate="true"   >
                <a:fields>
                    <a:field name="period_name" displayField="period_name" options="inport_times"
                             returnField="period_name" valueField="period_name" required="true" />

                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:fieldSet style="margin-left:10px;margin-top:10px;" title="IMPORT_CONSIDERATIONS" width="400">
            <a:label name="label2" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
            <a:label name="label3" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
            <a:label name="label4" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
            <a:label name="label5" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;"
                     width="380"/>
            <a:label name="label6" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;"
                     width="380"/>
        </a:fieldSet>
        <a:fieldSet style="margin-left:10px;margin-top:10px;" title="选择导入期间" width="400">
            <a:comboBox name="period_name" bindTarget="times" prompt="导入期间" />
        </a:fieldSet>
        <a:fieldSet style="margin-left:10px;margin-top:10px;" title="TMPLT_IMPORT_FILE" width="400">
            <form name="upload" id="importForm" enctype="multipart/form-data" method="post" target="_input_window">
                <label style="margin-left:10px;margin-top:10px;font-size:13px"><![CDATA[${l:PLEASE_SELECT_A_FILE}]]></label>
                <input name="CONTENT" id="importFile" style="font-size:15px" type="file"/>
                <input onclick="saveClick()" style="margin-left:25px;margin-top:10px;width:60px;height:23px"
                       type="button" value="${l:TMPLT_IMPORT}"/>
            </form>
        </a:fieldSet>
    </a:view>
</a:screen>