;width:98%">
;width:98%">
@@ -1149,6 +1149,8 @@
qcUpload(){
let currentData = {
flag: 'template',
+ createBy: this.$store.state.user.name,
+ site: this.$store.state.user.site,
};
//打开组件 去做新增业务
this.$nextTick(() => {
diff --git a/src/views/modules/qc/qc_upload.vue b/src/views/modules/qc/qc_upload.vue
index 593dd16..710f22e 100644
--- a/src/views/modules/qc/qc_upload.vue
+++ b/src/views/modules/qc/qc_upload.vue
@@ -2,6 +2,7 @@
+ 下载文件模板
{
if (data.code === 0) {
@@ -123,8 +130,133 @@ export default {
}
})
}
+ },
+
+ downloadFile(){
+ if(this.pageData.flag == 'item'){
+ let file = {
+ id: 61,
+ fileName: '检验项目格式.xlsx',
+ }
+ axios.get('/proxyApi/pms/eamObject/downLoadObjectFile/' + file.id, {
+ responseType: 'blob',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'token': Vue.cookie.get('token')
+ }
+ }).then(({data}) => {
+ // 不限制文件下载类型
+ const blob = new Blob([data], {type: "application/octet-stream"})
+ // 下载文件名称
+ const fileName = file.fileName
+ // a标签下载
+ const linkNode = document.createElement('a')
+ // a标签的download属性规定下载文件的名称
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ // 生成一个Blob URL
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ // 模拟在按钮上的一次鼠标单击
+ linkNode.click()
+ // 释放URL 对象
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
+ })
+ }else if (this.pageData.flag == 'template'){
+ let file = {
+ id: 62,
+ fileName: '检验模板格式.xlsx',
+ }
+ axios.get('/proxyApi/pms/eamObject/downLoadObjectFile/' + file.id, {
+ responseType: 'blob',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'token': Vue.cookie.get('token')
+ }
+ }).then(({data}) => {
+ // 不限制文件下载类型
+ const blob = new Blob([data], {type: "application/octet-stream"})
+ // 下载文件名称
+ const fileName = file.fileName
+ // a标签下载
+ const linkNode = document.createElement('a')
+ // a标签的download属性规定下载文件的名称
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ // 生成一个Blob URL
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ // 模拟在按钮上的一次鼠标单击
+ linkNode.click()
+ // 释放URL 对象
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
+ })
+ }else if (this.pageData.flag == 'partAttribute'){
+ let file = {
+ id: 63,
+ fileName: '物料属性设置.xlsx',
+ }
+ axios.get('/proxyApi/pms/eamObject/downLoadObjectFile/' + file.id, {
+ responseType: 'blob',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'token': Vue.cookie.get('token')
+ }
+ }).then(({data}) => {
+ // 不限制文件下载类型
+ const blob = new Blob([data], {type: "application/octet-stream"})
+ // 下载文件名称
+ const fileName = file.fileName
+ // a标签下载
+ const linkNode = document.createElement('a')
+ // a标签的download属性规定下载文件的名称
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ // 生成一个Blob URL
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ // 模拟在按钮上的一次鼠标单击
+ linkNode.click()
+ // 释放URL 对象
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
+ })
+ }else if (this.pageData.flag == 'familyAttribute'){
+ let file = {
+ id: 64,
+ fileName: '分类属性设置.xlsx',
+ }
+ axios.get('/proxyApi/pms/eamObject/downLoadObjectFile/' + file.id, {
+ responseType: 'blob',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'token': Vue.cookie.get('token')
+ }
+ }).then(({data}) => {
+ // 不限制文件下载类型
+ const blob = new Blob([data], {type: "application/octet-stream"})
+ // 下载文件名称
+ const fileName = file.fileName
+ // a标签下载
+ const linkNode = document.createElement('a')
+ // a标签的download属性规定下载文件的名称
+ linkNode.download = fileName
+ linkNode.style.display = 'none'
+ // 生成一个Blob URL
+ linkNode.href = URL.createObjectURL(blob)
+ document.body.appendChild(linkNode)
+ // 模拟在按钮上的一次鼠标单击
+ linkNode.click()
+ // 释放URL 对象
+ URL.revokeObjectURL(linkNode.href)
+ document.body.removeChild(linkNode)
+ })
+ }
+
+ },
- }
},
created() {