Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zj-manage
Overview
Overview
Details
Activity
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
new-zhengjiang
zj-manage
Commits
3e5eb55b
Commit
3e5eb55b
authored
Jan 04, 2023
by
zhangbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gx:核酸结果模板替换
parent
22cd92fa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
nucleicAcid.js
src/api/nucleicAcid.js
+13
-0
result.vue
src/views/NucleicAcid/result.vue
+46
-2
No files found.
src/api/nucleicAcid.js
View file @
3e5eb55b
...
...
@@ -44,6 +44,19 @@ export function getList(params) {
}))
}
// 模板替换
export
function
TemplateReplace
(
params
)
{
return
axios
({
method
:
'post'
,
data
:
params
,
url
:
`
${
baseUrl
}
/admin-api/nucleicAcidResult/TemplateReplace`
,
responseType
:
'blob'
,
headers
:
{
"Authorization"
:
getToken
()
?
(
'Bearer '
+
getToken
())
:
""
,
}
})
}
// 导入excel
export
function
exportAdd
(
params
)
{
return
axios
({
...
...
src/views/NucleicAcid/result.vue
View file @
3e5eb55b
...
...
@@ -16,13 +16,19 @@
<el-form-item>
<el-button
type=
"primary"
size=
"small"
@
click=
"addNucleicAcid"
>
新增
</el-button>
</el-form-item>
<el-form-item>
<
!--
<
el-form-item>
<el-button
type=
"primary"
size=
"small"
@
click=
"downLoad"
>
下载Excel模板
</el-button>
</el-form-item>
-->
<el-form-item>
<el-upload
class=
"mx-2"
name=
"file"
action=
"string"
:before-upload=
"beforeAvatarUpload"
:limit=
"1"
accept=
".xlsx,.xls"
:show-file-list=
"false"
:file-list=
"fileList"
:http-request=
"uploadFile1"
>
<el-button
type=
"primary"
size=
"small"
>
模板替换
</el-button>
</el-upload>
</el-form-item>
<el-form-item>
<el-upload
class=
"mx-2"
name=
"file"
action=
"string"
:before-upload=
"beforeAvatarUpload"
:limit=
"1"
accept=
".xlsx,.xls"
:show-file-list=
"false"
:file-list=
"fileList"
:http-request=
"uploadFile"
>
<el-button
type=
"primary"
size=
"small"
>
导入Excel文件
</el-button>
<el-button
type=
"primary"
size=
"small"
@
click=
"upload"
>
导入Excel文件
</el-button>
</el-upload>
</el-form-item>
</el-form>
...
...
@@ -93,6 +99,7 @@ import { queryCity } from "@/api/antigen.js";
import
{
getList
,
exportAdd
,
TemplateReplace
,
getResultDetail
,
customAdd
,
update
...
...
@@ -253,8 +260,43 @@ export default {
a
.
setAttribute
(
"download"
,
"核酸采样结果导入模板.xls"
)
a
.
click
()
},
uploadFile1
(
param
)
{
const
File
=
param
.
file
;
let
formData1
=
new
FormData
();
formData1
.
append
(
"file"
,
File
);
const
link
=
document
.
createElement
(
"a"
);
link
.
style
.
display
=
"none"
;
TemplateReplace
(
formData1
).
then
((
res
)
=>
{
console
.
log
(
'res'
,
res
);
this
.
fileList
=
[];
if
(
res
.
status
==
200
)
{
link
.
href
=
window
.
URL
.
createObjectURL
(
new
Blob
([
res
.
data
],
{
type
:
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"
,
})
);
link
.
setAttribute
(
"download"
,
""
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
document
.
body
.
removeChild
(
link
);
this
.
init
();
this
.
$message
.
success
(
"替换成功"
);
}
else
{
this
.
init
();
this
.
$message
.
warning
(
res
.
msg
||
"替换失败"
);
}
}).
catch
(()
=>
{
this
.
fileList
=
[]
this
.
$message
.
warning
(
"替换失败"
);
});
},
upload
()
{
this
.
$message
.
warning
(
"请先进行模板替换"
);
},
// 上传前对文件的大小的判断
beforeAvatarUpload
(
file
)
{
this
.
loading
=
true
;
const
extension
=
file
.
name
.
split
(
"."
)[
file
.
name
.
split
(
'.'
).
length
-
1
]
===
"xls"
;
const
extension2
=
file
.
name
.
split
(
"."
)[
file
.
name
.
split
(
'.'
).
length
-
1
]
===
"xlsx"
;
...
...
@@ -272,6 +314,8 @@ export default {
});
}
return
extension
||
extension2
||
isLt2M
;
},
uploadFile
(
param
)
{
const
File
=
param
.
file
;
...
...
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