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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?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>