Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hel-developer-guide
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hel-guide
hel-developer-guide
Commits
9a48d073
Commit
9a48d073
authored
Aug 02, 2017
by
yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加Excel文件导入
parent
19324914
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
1 deletion
+54
-1
excelImport.png
assets/excelImport.png
+0
-0
jad.md
jad.md
+54
-1
No files found.
assets/excelImport.png
0 → 100644
View file @
9a48d073
175 KB
jad.md
View file @
9a48d073
## Excel文件导入
使用poi解析xml方式进行导入,只支持单表导入。
数据库批量导入默认batch为100.
支持多sheet导入,sheet1从第三行开始读取数据,其他sheet页从第一行导入数据。
使用方法:
1.
Excel文件上传
```
javascript
$
(
"#files"
).
kendoUpload
({
async
:
{
saveUrl
:
"${base.contextPath}/hls/excel/import?${_csrf.parameterName}=${_csrf.token}&templateCode=HLS_FIN_STATEMENT_LN"
,
removeUrl
:
"remove"
},
showFileList
:
false
,
upload
:
onUpload
,
success
:
onSuccess
});
```
| 参数名 | 描述 |
| :--: | :--: |
| _csrf.token | 防跨域token |
| templateCode | 作为模块标识,会出现先在fnd_interface_header中,供后续业务逻辑进行处理 |
2.
处理数据
经过第一步的文件上传,后台会在fnd_interface_header表中生成一条数据,其中包含了传递的templateCode参数作为code,并且,在fnd_interface_lines表中按照顺序,将Excel文件中的每一行数据保存为一条数据,数据的第一列保存在attributes_1上,依次类推。
![
ExcelImport
](
/assets/excelImport.png
)
## Excel文件批量导出
本系统支持Excel文件导出排队处理,支持超大数据量,能实时查询文件生成情况,支持取消导出。
#### 使用方法
#### 前端使用方法
调用js方法
```
javascript
Hel
.
exportExcel
=
function
(
opts
){
var
contextPath
=
opts
.
contextPath
,
id
=
opts
.
id
,
view_model
=
opts
.
viewModel
,
viewModelData
=
opts
.
viewModelData
,
controller_name
=
opts
.
controller
,
fileName
=
opts
.
fileName
,
temp_div_id
=
opts
.
tempDivId
,
dataSourceId
=
opts
.
dataSourceId
,
_csrf_token
=
opts
.
_csrf_token
;
```
| 参数名 | 描述 |
| :--: | :--: |
| contextPath | 项目的url路径 |
| id | 页面上grid的id |
| view_model | grid绑定的model数据模型 |
| viewModelData | model模型中的数据 |
| controller_name | 后端控制器名称 |
| fileName | excel文件名 |
| temp_div_id | 临时div的id |
| dataSourceId | 数据源id |
| _csrf_token | 防跨域的token |
#### 后端使用方法
1.
在代码中注入Excel导出Service
```
java
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment