Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
data_management_system
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
0
Merge Requests
0
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
张伯涛
data_management_system
Commits
1f87f46d
Commit
1f87f46d
authored
Nov 29, 2022
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
治疗情况导入
parent
68c35213
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
2 deletions
+179
-2
zlqk.js
ruoyi-ui/src/api/system/zlqk.js
+19
-0
index.vue
ruoyi-ui/src/views/index.vue
+1
-1
index.vue
ruoyi-ui/src/views/system/zlqk/index.vue
+159
-1
No files found.
ruoyi-ui/src/api/system/zlqk.js
View file @
1f87f46d
...
...
@@ -9,6 +9,25 @@ export function listZlqk(query) {
})
}
// 下载治疗情况导入模板
export
function
importTemplate
(
params
)
{
return
request
({
url
:
'/system/zlqk/importTemplate'
,
method
:
'post'
,
responseType
:
'blob'
,
params
})
}
// 导入用户信息
export
function
importExcel
(
data
)
{
return
request
({
url
:
'/system/zlqk/importData'
,
method
:
'post'
,
data
})
}
// 查询治疗情况详细
export
function
getZlqk
(
id
)
{
return
request
({
...
...
ruoyi-ui/src/views/index.vue
View file @
1f87f46d
...
...
@@ -58,7 +58,7 @@
</el-table>
</div>
<div
class=
"tableList"
>
<div
class=
"title"
>
累计数据
</div>
<div
class=
"title"
>
累计数据
</div>
0-
<el-table
border
v-loading=
"loading"
...
...
ruoyi-ui/src/views/system/zlqk/index.vue
View file @
1f87f46d
...
...
@@ -90,6 +90,15 @@
v-hasPermi=
"['system:zlqk:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"info"
plain
icon=
"el-icon-upload2"
size=
"mini"
@
click=
"handleImport"
>
导入
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
...
...
@@ -193,11 +202,45 @@
<
el
-
button
@
click
=
"cancel"
>
取
消
<
/el-button
>
<
/div
>
<
/el-dialog
>
<!--
治疗情况导入对话框
-->
<
el
-
dialog
:
before
-
close
=
"closeFileDialog"
:
title
=
"upload.title"
:
close
-
on
-
click
-
modal
=
"false"
:
visible
.
sync
=
"upload.open"
width
=
"400px"
append
-
to
-
body
>
<
el
-
upload
accept
=
".xlsx, .xls"
:
headers
=
"upload.headers"
:
action
=
"upload.url + '?updateSupport=' + upload.updateSupport"
:
disabled
=
"upload.isUploading"
:
on
-
progress
=
"handleFileUploadProgress"
:
on
-
success
=
"handleFileSuccess"
:
auto
-
upload
=
"false"
:
on
-
change
=
"employeeUpload"
:
on
-
remove
=
"handleRemove"
:
before
-
remove
=
"beforeRemove"
:
on
-
preview
=
"handlePreview"
:
file
-
list
=
"fileList"
drag
>
<
i
class
=
"el-icon-upload"
/>
<
div
class
=
"el-upload__text"
>
将文件拖到此处,或
<
em
>
点击上传
<
/em
>
<
/div
>
<
div
slot
=
"tip"
class
=
"el-upload__tip"
>
<!--
<
el
-
checkbox
v
-
model
=
"upload.updateSupport"
/>
是否更新已经存在的用户数据
-->
<
span
type
=
"info"
style
=
"font-size: 14px; color: #0A82D2; cursor: pointer"
@
click
=
"importTemplate"
>
下载模板
<
/span
>
<
/div
>
<
div
slot
=
"tip"
class
=
"el-upload__tip"
style
=
"color:#333; margin-top: 16px;"
>
提示:仅允许导入“
xls
”或“
xlsx
”格式文件!
<
/div
>
<
/el-upload
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"closeFileDialog"
>
取
消
<
/el-button
>
<
el
-
button
:
loading
=
"importLoading"
type
=
"primary"
@
click
=
"submitFileForm"
>
确
定
<
/el-button
>
<
/div
>
<
/el-dialog
>
<
/div
>
<
/template
>
<
script
>
import
{
listZlqk
,
getZlqk
,
delZlqk
,
addZlqk
,
updateZlqk
}
from
"@/api/system/zlqk"
;
import
{
getToken
}
from
'@/utils/auth'
import
{
listZlqk
,
getZlqk
,
delZlqk
,
addZlqk
,
updateZlqk
,
importTemplate
,
importExcel
}
from
"@/api/system/zlqk"
;
export
default
{
name
:
"Zlqk"
,
...
...
@@ -235,6 +278,23 @@ export default {
}
,
// 表单参数
form
:
{
}
,
importLoading
:
false
,
// 导入列表
fileList
:
[],
upload
:
{
// 是否显示弹出层(用户导入)
open
:
false
,
// 弹出层标题(用户导入)
title
:
""
,
// 是否禁用上传
isUploading
:
false
,
// 是否更新已经存在的用户数据
updateSupport
:
0
,
// 设置上传的请求头部
headers
:
{
Authorization
:
"Bearer "
+
getToken
()
}
,
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
"/system/zlqk/importTemplate"
}
,
// 表单校验
rules
:
{
}
...
...
@@ -244,6 +304,83 @@ export default {
this
.
getList
();
}
,
methods
:
{
// 文件上传中处理
handleFileUploadProgress
(
event
,
file
,
fileList
)
{
this
.
upload
.
isUploading
=
true
}
,
// 文件上传成功处理
handleFileSuccess
(
response
,
file
,
fileList
)
{
this
.
upload
.
open
=
false
this
.
upload
.
isUploading
=
false
this
.
$refs
.
upload
.
clearFiles
()
this
.
$alert
(
response
.
msg
,
'导入结果'
,
{
dangerouslyUseHTMLString
:
true
}
)
this
.
getList
()
}
,
closeFileDialog
()
{
this
.
upload
.
open
=
false
this
.
fileList
=
[]
}
,
// 提交上传文件
submitFileForm
()
{
this
.
importLoading
=
true
if
(
this
.
fileList
.
length
===
0
)
{
this
.
$message
.
warning
(
'请上传文件'
)
// 导入成功后关闭弹出框
this
.
importLoading
=
false
this
.
upload
.
open
=
true
}
else
{
// 根据后台需求数据格式
var
formData
=
new
FormData
()
// 当前为空
formData
.
append
(
'file'
,
this
.
fileList
)
importExcel
(
formData
).
then
(
res
=>
{
if
(
res
)
{
const
blob
=
new
Blob
([
res
])
const
downloadElement
=
document
.
createElement
(
'a'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
downloadElement
.
href
=
href
downloadElement
.
download
=
'错误数据'
+
'.xls'
// 下载后文件名
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
// this.download(response.msg);
this
.
$message
.
info
(
'导入数据中有错误数据,已下载请重新填写'
)
this
.
importLoading
=
false
}
else
{
this
.
$message
.
success
(
'导入成功'
)
this
.
fileList
=
[]
// 导入成功后关闭弹出框
this
.
importLoading
=
false
this
.
upload
.
open
=
false
// 导入成功后刷新页面
this
.
getList
()
this
.
importLoading
=
false
}
}
).
catch
(
err
=>
{
this
.
importLoading
=
false
}
)
}
}
,
employeeUpload
(
file
,
fileList
)
{
console
.
log
(
'file'
,
file
)
this
.
$nextTick
(
_
=>
{
const
a
=
document
.
querySelectorAll
(
'.el-upload-list__item-name'
)
a
[
0
].
title
=
file
.
name
console
.
log
(
a
)
}
)
if
(
fileList
.
length
>
1
)
{
fileList
.
splice
(
0
,
1
)
}
this
.
fileList
=
fileList
[
0
].
raw
}
,
handleRemove
(
file
,
fileList
)
{
this
.
fileList
=
[]
}
,
beforeRemove
(
file
,
fileList
)
{
this
.
fileList
=
[]
}
,
/* 上传文件所需求 */
handlePreview
(
file
)
{
}
,
/** 查询治疗情况列表 */
getList
()
{
this
.
loading
=
true
;
...
...
@@ -339,6 +476,27 @@ export default {
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}
).
catch
(()
=>
{
}
);
}
,
/** 导入按钮操作 */
handleImport
()
{
this
.
importLoading
=
false
this
.
upload
.
title
=
"治疗情况导入"
;
this
.
upload
.
open
=
true
;
}
,
/** 下载模板操作 */
importTemplate
()
{
importTemplate
().
then
(
response
=>
{
const
blob
=
new
Blob
([
response
])
const
downloadElement
=
document
.
createElement
(
'a'
)
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
downloadElement
.
href
=
href
downloadElement
.
download
=
'治疗情况导入模板'
+
'.xls'
// 下载后文件名
document
.
body
.
appendChild
(
downloadElement
)
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
// this.download(response.msg);
}
)
}
,
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'system/zlqk/export'
,
{
...
...
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