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
c3c73183
Commit
c3c73183
authored
Dec 05, 2022
by
秦嘉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
危重症人员导入前端修改
parent
d9ebee0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
180 additions
and
1 deletion
+180
-1
wzzry.js
ruoyi-ui/src/api/system/wzzry.js
+20
-0
index.vue
ruoyi-ui/src/views/system/wzzry/index.vue
+160
-1
No files found.
ruoyi-ui/src/api/system/wzzry.js
View file @
c3c73183
...
...
@@ -42,3 +42,23 @@ export function delWzzry(id) {
method
:
'delete'
})
}
// 导入危重症人员
export
function
importExcel
(
data
)
{
return
request
({
url
:
'/system/wzzry/importData'
,
method
:
'post'
,
responseType
:
'blob'
,
data
})
}
// 下载危重症人员导入模板
export
function
importTemplate
(
params
)
{
return
request
({
url
:
'/system/wzzry/importTemplate'
,
method
:
'post'
,
responseType
:
'blob'
,
params
})
}
ruoyi-ui/src/views/system/wzzry/index.vue
View file @
c3c73183
...
...
@@ -125,6 +125,16 @@
v-hasPermi=
"['system:wzzry:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"info"
plain
icon=
"el-icon-upload2"
size=
"mini"
@
click=
"handleImport"
v-hasPermi=
"['system:ycsb:import']"
>
导入
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
...
...
@@ -464,18 +474,69 @@
<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
{
listWzzry
,
getWzzry
,
delWzzry
,
addWzzry
,
updateWzzry
}
from
"@/api/system/wzzry"
;
import
{
listWzzry
,
getWzzry
,
delWzzry
,
addWzzry
,
updateWzzry
,
importExcel
,
importTemplate
}
from
"@/api/system/wzzry"
;
import
{
getDicts
}
from
"@/api/system/dict/data"
import
{
getToken
}
from
'@/utils/auth'
export
default
{
name
:
"Wzzry"
,
dicts
:
[
'street_town'
,
'committee'
,
'basic_disease'
,
'hospital'
,
'user_style'
],
data
()
{
return
{
importLoading
:
false
,
// 导入列表
fileList
:
[],
upload
:
{
// 是否显示弹出层(用户导入)
open
:
false
,
// 弹出层标题(用户导入)
title
:
""
,
// 是否禁用上传
isUploading
:
false
,
// 是否更新已经存在的用户数据
updateSupport
:
0
,
// 设置上传的请求头部
headers
:
{
Authorization
:
"Bearer "
+
getToken
()
},
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
"/system/ycbs/importTemplate"
},
// 遮罩层
loading
:
true
,
// 选中数组
...
...
@@ -922,6 +983,104 @@ export default {
this
.
open
=
false
;
this
.
reset
();
},
// 文件上传中处理
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
()
},
/** 下载模板操作 */
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);
})
},
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
.
size
>
0
)
{
this
.
getList
();
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
)
{
},
/** 导入按钮操作 */
handleImport
()
{
this
.
importLoading
=
false
this
.
upload
.
title
=
"危重症人员导入"
;
this
.
upload
.
open
=
true
;
},
// 表单重置
reset
()
{
this
.
form
=
{
...
...
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