| | |
| | | <view class="info-block"> |
| | | <view class="info-label">物料编码:</view> |
| | | <view class="info-value">{{formData.itemNo}}</view> |
| | | <!-- 造梦者特殊功能 --> |
| | | <view class="doc-links"> |
| | | <a class="doc-link" @click="toFileUrlByU9List(1,formData.itemNo)">图纸规格书</a> |
| | | <a class="doc-link" @click="toFileUrlByU9List(2,formData.itemNo)">进料检验文件</a> |
| | | </view> |
| | | |
| | | </view> |
| | | <view class="info-block"> |
| | |
| | | |
| | | <view class="info-label" v-if="formData.extendNo1!=null">技改状态:</view> |
| | | <view class="info-value" v-if="formData.extendNo1!=null">{{formData.extendNo1}}</view> |
| | | <view class="info-label">项目:</view> |
| | | <view class="info-value">{{formData.projectCodes}}</view> |
| | | |
| | | |
| | | <view class="info-label">数量:</view> |
| | | <view class="info-value highlight">{{formData.fcovertQty}}</view> |
| | | |
| | | </view> |
| | | <view class="info-block" v-if="formData.fngDesc!=null"> |
| | | <view class="info-label">不良描述:</view> |
| | |
| | | WORKSHOP: '', |
| | | REMARK: '', |
| | | checkState: false, |
| | | writeStatu: true |
| | | writeStatu: true, |
| | | fileName:'' |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | |
| | | }).then(res => { |
| | | if (res.status == 0) { |
| | | |
| | | this.QcIssueResultDetailes = { |
| | | fbatchQty: this.formData.fbatchQty, |
| | | itemName: this.formData.itemName, |
| | | itemNo: this.formData.itemNo, |
| | | suppName: this.formData.suppName, |
| | | appicationReason: this.formData.fngDesc, |
| | | badReason: this.badreason, |
| | | remark: this.REMARK, |
| | | releaseNo: this.formData.releaseNo, |
| | | staffNo: 'HMCS', |
| | | // staffNo: this.formData.userNo, |
| | | iqcStatus: this.PSTYPE, |
| | | department: this.DEPARTMENT |
| | | }; |
| | | if(this.$loginInfo.account == 'PL017'){ |
| | | this.QcIssueResultDetailes = { |
| | | fbatchQty: this.formData.fbatchQty, |
| | | itemName: this.formData.itemName, |
| | | itemNo: this.formData.itemNo, |
| | | suppName: this.formData.suppName, |
| | | appicationReason: this.formData.fngDesc, |
| | | badReason: this.badreason, |
| | | remark: this.REMARK, |
| | | workShop: this.WORKSHOP, |
| | | releaseNo: this.formData.releaseNo, |
| | | staffNo: 'HMCS', |
| | | // staffNo: this.$loginInfo.account, |
| | | iqcStatus: this.PSTYPE, |
| | | department: this.DEPARTMENT |
| | | }; |
| | | } |
| | | else{ |
| | | this.QcIssueResultDetailes = { |
| | | fbatchQty: this.formData.fbatchQty, |
| | | itemName: this.formData.itemName, |
| | | itemNo: this.formData.itemNo, |
| | | suppName: this.formData.suppName, |
| | | appicationReason: this.formData.fngDesc, |
| | | badReason: this.badreason, |
| | | remark: this.REMARK, |
| | | workShop: this.WORKSHOP, |
| | | releaseNo: this.formData.releaseNo, |
| | | // staffNo: 'HMCS', |
| | | staffNo: this.$loginInfo.account, |
| | | iqcStatus: this.PSTYPE, |
| | | department: this.DEPARTMENT |
| | | }; |
| | | } |
| | | |
| | | console.log(this.QcIssueResultDetailes) |
| | | |
| | |
| | | }, |
| | | |
| | | fetchDrawingNumber() { |
| | | const item = '83070100066' |
| | | // const item = this.formData.itemNo; |
| | | // console.log(this.formData.itemNo) |
| | | // const item = '83040700101' |
| | | const item = this.formData.itemNo; |
| | | console.log(this.formData.itemNo) |
| | | // console.log(item) |
| | | const url = "http://192.168.1.22:10054/api/PLM/RetrieveDrawings?ItemNo=" + item |
| | | |
| | |
| | | openDrawings(item) { |
| | | console.log("jkjoi", item) |
| | | if (item.fRelevantObject.length > 2) { |
| | | const url = "http://192.168.1.22:10054/api/PLM/OpenDrawings?fileId=" + item.fRelevantObject + |
| | | '&fName=' + encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20') |
| | | .replace( |
| | | /\#/g, '%23').replace(/\?/g, '%3F').replace(/\+/g, '%2B').replace(/\//g, '%2F') |
| | | .replace( |
| | | /\&/g, '%26')) |
| | | console.log('jpgurl: ' + url); |
| | | // 生成请求URL(简化编码逻辑) |
| | | const encodedName = encodeURIComponent(item.fName); |
| | | const url = `http://192.168.1.22:10054/api/PLM/OpenDrawingsGet?fileId=${item.fRelevantObject}&fName=${encodedName}`; |
| | | console.log('请求URL:', url); |
| | | |
| | | const now = new Date(); |
| | | const timestamp = [ |
| | | now.getFullYear(), |
| | | String(now.getMonth() + 1).padStart(2, '0'), |
| | | String(now.getDate()).padStart(2, '0'), |
| | | String(now.getHours()).padStart(2, '0'), |
| | | String(now.getMinutes()).padStart(2, '0'), |
| | | String(now.getSeconds()).padStart(2, '0') |
| | | ].join(''); |
| | | |
| | | // 生成新文件名(基础名_时间戳.后缀) |
| | | this.fileName = `${item.fName}_${timestamp}.pdf`; |
| | | console.log('新文件名:', this.fileName); |
| | | |
| | | uni.downloadFile({ |
| | | url: url, |
| | | success: (res) => { |
| | | console.log(res); |
| | | let fileName = this.fileName; |
| | | let fileExt = fileName.split('.').pop(); |
| | | // let newFilePath = "_doc/uniapp_temp_1742877118745/download" + "/" + fileName; |
| | | // console.log('newFilePath', newFilePath) |
| | | if (fileExt === 'xls' || fileExt === 'xlsx' || fileExt === 'pdf'|| fileExt === 'jpg'|| fileExt === 'png') { |
| | | plus.io.resolveLocalFileSystemURL(res.tempFilePath, (entry) => { |
| | | // 获取文件所在的目录 |
| | | entry.getParent((parentEntry) => { |
| | | let newFileName = this.fileName; // 新的文件名 |
| | | |
| | | // 移动并重命名文件 |
| | | entry.moveTo( |
| | | parentEntry, |
| | | newFileName, |
| | | (newEntry) => { |
| | | console.log('重命名成功:', newEntry.fullPath); |
| | | |
| | | // 打开 Excel 文件 |
| | | plus.runtime.openFile(newEntry.fullPath, {}, (e) => { |
| | | console.error('无法打开 Excel 文件:', e); |
| | | }); |
| | | |
| | | // let pages = getCurrentPages(); |
| | | // let beforePage = pages[pages.length - 2]; |
| | | // uni.navigateBack({ |
| | | // delta: 1, //返回的页面数,如果为1表示返回上一页 |
| | | // success: (event) => { |
| | | // beforePage.$vm.reload() |
| | | // } |
| | | // }); |
| | | |
| | | }, |
| | | (err) => { |
| | | console.error('重命名失败:', err); |
| | | } |
| | | ); |
| | | }, (err) => { |
| | | console.error('获取父目录失败:', err); |
| | | }); |
| | | }, (err) => { |
| | | console.error('获取文件失败:', err); |
| | | }); |
| | | } else { |
| | | console.error('文件格式不匹配:', fileExt); |
| | | uni.showToast({ |
| | | title: '文件格式不支持', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | |
| | | |
| | | // uni.downloadFile({ |
| | | // url: url, |
| | | // responseType: 'arraybuffer', // 关键:指定响应数据类型为 ArrayBuffer |
| | | // success: (res) => { |
| | | // console.log(res) |
| | | // if (res.statusCode === 200) { |
| | | // // 获取 ArrayBuffer 数据 |
| | | // const arrayBuffer = res.data; |
| | | |
| | | // // 可选:验证文件类型(例如检查 PDF 文件头) |
| | | // const header = new Uint8Array(arrayBuffer).subarray(0, 4); |
| | | // const headerStr = Array.from(header).map(byte => byte.toString(16).padStart(2, |
| | | // '0')).join('').toUpperCase(); |
| | | // if (headerStr !== '25504446') { // PDF 文件头为 "%PDF" 的十六进制表示 |
| | | // console.error('文件格式无效,非 PDF 文件'); |
| | | // return; |
| | | // } |
| | | |
| | | // // 保存为临时文件(确保扩展名为 .pdf) |
| | | // const tempPath = `${wx.env.USER_DATA_PATH}/${Date.now()}.pdf`; // 微信小程序路径 |
| | | // uni.saveFile({ |
| | | // tempFilePath: arrayBuffer, // 注意:部分平台可能需要转换 ArrayBuffer 为 Base64 |
| | | // filePath: tempPath, |
| | | // success: () => { |
| | | // uni.openDocument({ |
| | | // filePath: tempPath, |
| | | // fileType: 'pdf', |
| | | // success: () => console.log('文档打开成功'), |
| | | // fail: (err) => console.error('打开失败:', err) |
| | | // }); |
| | | // }, |
| | | // fail: (saveErr) => console.error('保存文件失败:', saveErr) |
| | | // }); |
| | | // } else { |
| | | // console.error('下载失败,状态码:', res.statusCode); |
| | | // } |
| | | // }, |
| | | // fail: (error) => { |
| | | // console.error('下载请求失败:', error.errMsg); |
| | | // } |
| | | // }); |
| | | uni.request({ |
| | | url: url, |
| | | method: 'POST', |
| | |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | const base64Data = uni.arrayBufferToBase64(response.data); |
| | | |
| | | |
| | | |
| | | // const base64Data = uni.arrayBufferToBase64(response.data); |
| | | |
| | | // 构造一个可以用于预览的 Data URL |
| | | const pdfUrl = `data:application/pdf;base64,${base64Data}`; |
| | | // // 构造一个可以用于预览的 Data URL |
| | | // const pdfUrl = `data:application/pdf;base64,${base64Data}`; |
| | | |
| | | // 使用 pdfUrl 作为预览路径 |
| | | console.log("PDF 预览路径:", pdfUrl); |
| | | // // 使用 pdfUrl 作为预览路径 |
| | | // console.log("PDF 预览路径:", pdfUrl); |
| | | |
| | | // 将 Base64 数据传递给另一个页面进行预览 |
| | | // 注意:直接传递 pdfUrl 可能会导致 URL 过长,建议使用其他方式传递 |
| | | uni.navigateTo({ |
| | | url: `/pages/fileView/pdfView?url=${encodeURIComponent(pdfUrl)}` |
| | | }); |
| | | // // 将 Base64 数据传递给另一个页面进行预览 |
| | | // // 注意:直接传递 pdfUrl 可能会导致 URL 过长,建议使用其他方式传递 |
| | | // uni.navigateTo({ |
| | | // url: `/pages/fileView/pdfView?url=${encodeURIComponent(pdfUrl)}` |
| | | // }); |
| | | |
| | | // const base64Data = uni.arrayBufferToBase64(response.data); |
| | | |
| | | // // 存储到全局变量(在App.vue中定义) |
| | | // getApp().globalData.tempPDF = base64Data; |
| | | |
| | | // uni.navigateTo({ |
| | | // url: '/pages/fileView/pdfView' |
| | | // }); |
| | | |
| | | }, |
| | | fail: (error) => { |
| | | console.log(error) |
| | |
| | | } else if (item.fName && item.fName.toLowerCase().endsWith('.jpg')) { |
| | | const url = "http://192.168.1.22:10054/api/PLM/OpenDrawings?fileId=" + item.fFileId + |
| | | '&fName=' + |
| | | encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20').replace(/\#/g, |
| | | encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20').replace( |
| | | /\#/g, |
| | | '%23') |
| | | .replace(/\?/g, '%3F').replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\&/g, |
| | | '%26')) |
| | |
| | | console.log(item); |
| | | const url = "http://192.168.1.22:10054/api/PLM/OpenDrawings?fileId=" + item.fFileId + |
| | | '&fName=' + |
| | | encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20').replace(/\#/g, |
| | | encodeURIComponent(item.fName.replace(/\%/g, '%25').replace(/\ /g, '%20').replace( |
| | | /\#/g, |
| | | '%23') |
| | | .replace(/\?/g, '%3F').replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\&/g, |
| | | '%26')) |