<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: Eugene Song $Date: 2018年11月1日08:30:49 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application"> <a:init-procedure/> <a:view> <a:link id="auto_write_off_id" url="${/request/@context_path}/modules/csh/CSH531N/csh_pos_input.lsc"/> <script type="text/javascript"><![CDATA[ var header = $jq('meta[name=_csrf_header]').attr('content'); var token = $jq('meta[name=_csrf]').attr('content'); $jq(document).ajaxSend(function (e, xhr, options) { xhr.setRequestHeader(header, token); }); function saveClick() { if (document.getElementById('importFile').value) { var fileName = document.getElementById('importFile').value; var fileType = fileName.substr(fileName.lastIndexOf(".") + 1); //校验文件格式是txt if (fileType.toUpperCase() != 'TXT') { Leaf.showErrorMessage('提示', '请上传中行ftp txt 文件'); return; } else { //document.getElementById('importForm').submit(); var formData = new FormData($jq("#importForm")[0]); $jq.ajax({ url: "${/request/@context_path}/pos/txt/upload", type: "POST", dataType: "json", processData: false, data: formData, contentType: false, success: function (res) { var datas = []; if (res.success) { for ( var i = 0;i < res.rows.length;i++) { datas.push(res.rows[i]); } var queryParams = new Object(); queryParams['info'] = datas; Leaf.request({ url: $('auto_write_off_id').getUrl(), para: /*{ trancation_date: datas.rows[0].trancationDate, internal_period_num: datas.rows[0].internalPeriodNum, period_name: datas.rows[0].periodName, transaction_amount: datas.rows[0].transactionAmount, bp_bank_account_num: datas.rows[0].bpBankAccountNum, bp_bank_account_name: datas.rows[0].bpBankAccountName, credit_card_amount: datas.rows[0].creditCardAmount, handling_fee_amount: datas.rows[0].handlingFeeAmount, user_code: datas.rows[0].userCode, contract_number: datas.rows[0].contractNumber }*/ queryParams , success: function (data) { Leaf.SideBar.show({ msg: '上传成功', duration: 2000 }); }, failure: function () { }, error: function () { }, scope: this }); } else { Leaf.showErrorMessage('提示', '上传失败' + res.message); } $('${/parameter/@winid}').close(); }, error: function (datas) { Leaf.showErrorMessage('提示', '上传失败' + datas.message); } }) } } } ]]></script> <a:dataSets> <a:dataSet id="label_ds" autoCreate="true"> <a:fields> <a:field name="label2" defaultValue="1、 严格按照导入模板整理数据,检查必输事项是否缺少数据。"/> <a:field name="label3" defaultValue="2、 关闭txt文件后,方可进行产品主数据导入。"/> <a:field name="label4" defaultValue="3、 本导入程序只支持中行FTP txt文件。"/> <a:field name="label5" defaultValue="仔细阅读上述事项,并检查确认无误。"/> <a:field name="label6" defaultValue="导入完毕后,请在系统内核实数据是否导入成功。"/> </a:fields> </a:dataSet> </a:dataSets> <a:fieldSet style="margin-left:10px;margin-top:10px;" title="导入注意事项" 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"> <form name="upload" id="importForm" action="" enctype="multipart/form-data" method="post"> <label style="margin-left:10px;margin-top:10px;"><![CDATA[请选择文件:]]></label> <input name="CONTENT" id="importFile" style="margin-bottom:4px;width:160px;height:22px;" type="file"/> <input onclick="saveClick()" style="margin-left:50px;margin-top:10px;width:60px;" type="button" value="导入"/> </form> </a:fieldSet> </a:view> </a:screen>