diff --git a/src/api/ftp/oss.js b/src/api/ftp/oss.js index c8f47ca..a10bc4d 100644 --- a/src/api/ftp/oss.js +++ b/src/api/ftp/oss.js @@ -4,3 +4,4 @@ export const ossList = data => createAPI(`sys/oss/ossList`,'post',data) export const downFtpFileNotFtp = data => createAPI(`ftp/file/downFtpFileNotFtp?id=`+data.id,'post','download') +export const ossListForOther= data => createAPI(`sys/oss/ossListForOther`,'post',data) diff --git a/src/api/production/inspect.js b/src/api/production/inspect.js index 710dcf5..53d8681 100644 --- a/src/api/production/inspect.js +++ b/src/api/production/inspect.js @@ -7,3 +7,5 @@ export const inspectPrint = data => createAPI(`inspect/inspectPrint`, 'post', da export const cancelInspect = data => createAPI(`inspect/cancelInspect`, 'post', data); export const cancelInspectResult = data => createAPI(`inspect/cancelInspectResult`, 'post', data); export const getSOScheduleRoutingDataForShiyanshi= data => createAPI(`inspect/getSOScheduleRoutingDataForShiyanshi`, 'post', data); +export const downLoadProjectFile = data => createAPI(`abnormal/downLoadProjectFile?id=`+data.id,'post','download') +export const upLoadAbnormalFiles = data => createAPI(`abnormal/upLoadAbnormalFiles`,'post',data); diff --git a/src/views/modules/Abnormal/AbnormalFeedBack.vue b/src/views/modules/Abnormal/AbnormalFeedBack.vue index bc36470..52e75a7 100644 --- a/src/views/modules/Abnormal/AbnormalFeedBack.vue +++ b/src/views/modules/Abnormal/AbnormalFeedBack.vue @@ -181,6 +181,7 @@ width="300" label="操作"> @@ -329,21 +385,25 @@ saveAbnormalDetail, openFeedBack, closeFeedBack, - } from "@/api/abnormal.js" import { getSOScheduleRoutingDataForShiyanshi, - + downLoadProjectFile, + upLoadAbnormalFiles, } from '@/api/production/inspect.js' import { printABLabel, } from "@/views/modules/print/print_Abnormal_label.js" + import {ossListForOther} from '@/api/ftp/oss.js' export default { name: 'AbnormalFeedBack', data () { return { + upLoadModalFlag:false, + fileModalFlag:false, folder: 'abnormal', fileList: [], + fileData: [], searchData:{ userId:this.$store.state.user.name, startDate:'', @@ -354,6 +414,11 @@ operatorDesc:'', partDesc:'', }, + upLoadData: { + id:0, + site:'', + }, + fileContentList: [], // 导出 start exportData: [], exportDataStandard: { @@ -405,6 +470,11 @@ dataListLoading:false, // 导出 end height:200, + fileSearchData:{ + fileTypeCode:'Abnormal', + orderRef1:'', + orderRef2:'' + }, tableData:[], addData:{ site:'', @@ -429,6 +499,33 @@ abnormalFeedBackData:{ }, + columnFileContentArray: [ + { + columnProp: 'fileName', + headeralign: 'left', + align: 'left', + columnLabel: '文件名称', + columnHidden: false, + columnImage: false, + columnSortable: false, + sortLv: 0, + status: true, + fixed: false + + }, { + columnProp: 'createDate', + headeralign: 'left', + align: 'left', + columnLabel: '上传时间', + columnHidden: false, + columnImage: false, + columnSortable: true, + sortLv: 0, + status: true, + fixed: false + + }, + ], } }, mounted() { @@ -460,6 +557,7 @@ this.addData.abnormalRemark='', this.addData.abnormalCode='', this.getAllAbnormalItem(); + this.fileList = []; this.addModalFlag=true; }, seqNoCheck(){ @@ -689,7 +787,115 @@ data.rows[0].abnormalRemark=row.abnormalRemark printABLabel(data.rows); }) - } + }, + downloadFile(row){ + + downLoadProjectFile(row) + .then(({data}) => { + // 不限制文件下载类型 + const blob = new Blob([data], {type: 'application/octet-stream;charset=utf-8'}) + // 下载文件名称 + const fileName = row.fileName + // a标签下载 + const linkNode = document.createElement('a') + linkNode.download = fileName // a标签的download属性规定下载文件的名称 + linkNode.style.display = 'none' + linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL + console.log(linkNode) + // if(val == 'Y'){ + // this.pdfVisible = true + // this.pdfUrl = linkNode.href + // }else { + document.body.appendChild(linkNode) + linkNode.click() // 模拟在按钮上的一次鼠标单击 + URL.revokeObjectURL(linkNode.href) // 释放URL 对象 + document.body.removeChild(linkNode) + }) + }, + getFileModel(row){ + this.fileSearchData={ + fileTypeCode:'Abnormal', + orderRef1:row.site, + orderRef2:row.id, + } + this.getFileList() + this.fileModalFlag=true; + }, + getFileList(){ + ossListForOther(this.fileSearchData).then(({data}) => { + if (data && data.code == 0) { + this.fileData = data.data + } else { + this.fileData = [] + } + }) + }, + deleteHandle(id) { + let ids = [id] + this.$confirm(`确定进行[删除]操作?`, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.$http({ + url: this.$http.adornUrl('/sys/oss/delete'), + method: 'post', + data: this.$http.adornData(ids, false) + }).then(({data}) => { + if (data && data.code === 0) { + this.$message.success('操作成功') + this.getFileList() + } else { + this.$message.error(data.msg) + } + }) + }).catch(() => { + }) + }, + addUploadFileModal(){ + this.upLoadData.site=this.fileSearchData.orderRef1 + this.upLoadData.id=this.fileSearchData.orderRef2 + this.fileList=[] + this.upLoadModalFlag=true; + }, + upLoadFiles(){ + if(null == this.fileList || 0 === this.fileList.length){ + this.$alert('未选择附件上传!', '错误', { + confirmButtonText: '确定' + }) + return false; + } + + const formData = new FormData(); + //片接文件 + for (let i = 0; i < this.fileList.length; i++) { + formData.append("file",this.fileList[i].raw) + } + + formData.append("site", this.upLoadData.site); + formData.append("folder", this.folder); + formData.append("projectId", this.upLoadData.id); + + upLoadAbnormalFiles(formData).then(({data}) => { + if (data && data.code === 0) { + this.$refs.uploadFile.clearFiles(); + this.fileList = []; + this.upLoadModalFlag=false + this.getFileList() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => { + } + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, }, created() { this.getAllAbnormalItem(); diff --git a/src/views/modules/production/generateReport.vue b/src/views/modules/production/generateReport.vue index f46e231..b4d2b36 100644 --- a/src/views/modules/production/generateReport.vue +++ b/src/views/modules/production/generateReport.vue @@ -1174,6 +1174,7 @@ this.stopData.abnormalRemark='', this.stopData.abnormalCode='', this.stopModalFlag=true; + this.fileList = []; this.$nextTick(() => { this.$refs.stop.focus();}) }, continueScan(){