Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NLT-e-cigarette
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
张伯涛
NLT-e-cigarette
Commits
8e68a99b
Commit
8e68a99b
authored
Jul 08, 2022
by
zhangyichen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
97d2fd66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
21 deletions
+50
-21
material.js
src/api/material.js
+18
-0
MaterialFile.vue
src/views/productionInfo/MaterialFile.vue
+32
-21
No files found.
src/api/material.js
View file @
8e68a99b
...
@@ -92,3 +92,21 @@ export function deleteOssInfo(params) {
...
@@ -92,3 +92,21 @@ export function deleteOssInfo(params) {
method
:
'post'
method
:
'post'
})
})
}
}
// 下载文件
export
function
exportMaterVerTemplate
(
params
)
{
return
request
({
url
:
'/nltifsmaterial/exportMaterVerTemplate'
,
method
:
'get'
,
responseType
:
'blob'
})
}
// 导入
export
function
importMaterVer
(
data
)
{
return
request
({
url
:
'/nltifsmaterial/importMaterVer'
,
method
:
'post'
,
data
})
}
src/views/productionInfo/MaterialFile.vue
View file @
8e68a99b
...
@@ -348,7 +348,9 @@ import {
...
@@ -348,7 +348,9 @@ import {
updateMaterial
,
updateMaterial
,
downloadSoftFile
,
downloadSoftFile
,
queryAllFile
,
queryAllFile
,
deleteOssInfo
deleteOssInfo
,
exportMaterVerTemplate
,
importMaterVer
}
from
'@/api/material'
}
from
'@/api/material'
import
{
getToken
}
from
'@/utils/auth'
import
{
getToken
}
from
'@/utils/auth'
import
moment
from
'moment'
import
moment
from
'moment'
...
@@ -949,18 +951,18 @@ export default {
...
@@ -949,18 +951,18 @@ export default {
},
},
/** 下载模板操作 */
/** 下载模板操作 */
importTemplate
()
{
importTemplate
()
{
// exportDisAvd
Template().then(response => {
exportMaterVer
Template
().
then
(
response
=>
{
//
const blob = new Blob([response])
const
blob
=
new
Blob
([
response
])
//
const downloadElement = document.createElement('a')
const
downloadElement
=
document
.
createElement
(
'a'
)
//
const href = window.URL.createObjectURL(blob)// 创建下载的链接
const
href
=
window
.
URL
.
createObjectURL
(
blob
)
// 创建下载的链接
//
downloadElement.href = href
downloadElement
.
href
=
href
// downloadElement.download = '不良定义
模板' + this.dateFor(new Date().getTime()) + '.xls' // 下载后文件名
downloadElement
.
download
=
'物料版本号
模板'
+
this
.
dateFor
(
new
Date
().
getTime
())
+
'.xls'
// 下载后文件名
//
document.body.appendChild(downloadElement)
document
.
body
.
appendChild
(
downloadElement
)
//
downloadElement.click()// 点击下载
downloadElement
.
click
()
// 点击下载
//
document.body.removeChild(downloadElement)// 下载完成移除元素
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
//
window.URL.revokeObjectURL(href)// 释放掉blob对象
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
//
// this.download(response.msg);
// this.download(response.msg);
//
})
})
},
},
cancelUpload
()
{
cancelUpload
()
{
this
.
upload1
.
uploadData
=
false
this
.
upload1
.
uploadData
=
false
...
@@ -975,15 +977,24 @@ export default {
...
@@ -975,15 +977,24 @@ export default {
}
else
{
}
else
{
const
formData
=
new
FormData
()
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
this
.
fileList1
)
formData
.
append
(
'file'
,
this
.
fileList1
)
// importDisAvd
(formData).then(res => {
importMaterVer
(
formData
).
then
(
res
=>
{
//
if (res.code === 200) {
if
(
res
.
code
===
200
)
{
//
this.$message.success(res.message)
this
.
$message
.
success
(
res
.
message
)
//
this.upload1.uploadData = false
this
.
upload1
.
uploadData
=
false
//
this.fileList1 = []
this
.
fileList1
=
[]
//
this.getList()
this
.
getList
()
//
}
}
//
})
})
}
}
},
dateFor
(
value
)
{
var
date
=
new
Date
(
value
)
const
y
=
date
.
getFullYear
()
let
MM
=
date
.
getMonth
()
+
1
MM
=
MM
<
10
?
(
'0'
+
MM
)
:
MM
let
d
=
date
.
getDate
()
d
=
d
<
10
?
(
'0'
+
d
)
:
d
return
y
+
MM
+
d
}
}
}
}
}
}
...
...
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