| | |
| | | |
| | | <view class="history-record"> |
| | | <button @click="viewHistory" class="lsjl">åå²è®°å½</button <!-- å¼¹åºçªå£æ¾ç¤ºåå²è®°å½ --> |
| | | <button @click="fetchDrawingNumber" class="lsjl">è°åPLMå¾çº¸</button <!-- å¼¹åºçªå£æ¾ç¤ºplmå¾çº¸è®°å½ --> |
| | | |
| | | <view v-if="showHistoryPopup" class="history-popup"> |
| | | <!-- å¼¹çªå¤´é¨ --> |
| | | <view class="popup-header"> |
| | |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | |
| | | </view> |
| | | |
| | | <view v-if="drawingShow" class="history-popup"> |
| | | <!-- å¼¹çªå®¹å¨ --> |
| | | <view class="popup-container"> |
| | | <!-- å
容åºå --> |
| | | <view class="popup-content"> |
| | | <!-- 表头 --> |
| | | <view class="history-header"> |
| | | <view class="header-item" id="tm">ç¸å
³ææ¡£</view> |
| | | <view class="header-item" id="sl">ææ å
³èPDFæä»¶</view> |
| | | <view class="header-item" id="sj">è½å¦æå¼æä»¶</view> |
| | | <view class="header-item" id="ry">æä½ï¼ç¹å»ï¼</view> |
| | | </view> |
| | | |
| | | <!-- è¡¨æ ¼å
容åºå --> |
| | | <scroll-view scroll-y="true" class="history-scroll"> |
| | | <!-- æ°æ®ä¸ºç©ºæ¶çæç¤º --> |
| | | <view v-if="(!drawing || drawing.length === 0)" class="empty-text"> |
| | | ææ æ´å¤æ°æ® |
| | | </view> |
| | | |
| | | <!-- ææ°æ®æ¶æ¾ç¤ºçå表 --> |
| | | <view v-for="(item, index) in (drawing || [])" :key="index" class="history-record"> |
| | | <view class="record-item">{{ item.fName }}</view> |
| | | <view class="record-item" style="font-size:25px;"> |
| | | <div v-if="item.fRelevantObject==' '" style="color: #E47470;">Ã</div> |
| | | <div style="color: #90BA87;" v-else>â</div> |
| | | </view> |
| | | <view class="record-item" style="font-size:25px;"> |
| | | <div v-if="item.isSupported || item.fRelevantObject!=' '" |
| | | style="color: #90BA87;">â</div> |
| | | <div style="color: #E47470;" v-else>Ã</div> |
| | | </view> |
| | | <view class="record-item click-wd" @click="openDrawings(item)"> |
| | | æå¼ææ¡£ |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | |
| | | <!-- åºå®å¨æåºé¨çæé®åºå --> |
| | | <view class="popup-footer"> |
| | | <view class="popup-buttons"> |
| | | <button class="popup-button cancel-button" @click="drawingCancel">åæ¶</button> |
| | | <button class="popup-button confirm-button" @click="drawingConfirm">ç¡®å®</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '请ç¨å...' : 'è¡¥æä¸ä¸å¼ ' }}</button> |
| | | --></view> |
| | | --> |
| | | </view> |
| | | </view> |
| | | |
| | | </view> |
| | |
| | | {{ deviceState }} |
| | | </view> |
| | | </view> |
| | | <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '请ç¨å...' : 'è¡¥æä¸ä¸å¼ ' }}</button> |
| | | <button @click="reprintLast" :disabled="isButtonDisabled2" |
| | | class="uni-btn">{{ isButtonDisabled2 ? '请ç¨å...' : 'è¡¥æä¸ä¸å¼ ' }}</button> |
| | | |
| | | <!-- æé®æ¾å¨ç¶æææ¬ç䏿¹ --> |
| | | <!-- <button @click="manualCheck" class="check-button">æå¨æ£æµ</button> --> |
| | |
| | | data() { |
| | | return { |
| | | showHistoryPopup: false, // æ§å¶å¼¹åºæ¡æ¾ç¤º |
| | | drawing: [], |
| | | drawingShow: false, |
| | | itemShow: false, |
| | | selectedPerson: '', |
| | | selectedLine: '', |
| | | selectedOrder: '', |
| | |
| | | // æäº¤æ¥å·¥ä¿¡æ¯çæ¹æ³ |
| | | printBarcode() { |
| | | // **å
æ£æ¥ USB è¿æ¥ç¶æ** |
| | | if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) { |
| | | /* if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) { |
| | | uni.showModal({ |
| | | title: ` ${this.networkState}`, |
| | | content: "è¯·æ£æ¥æå°æºè¿æ¥", |
| | |
| | | } |
| | | }); |
| | | return; // **USB è¿æ¥å¤±è´¥ï¼ç´æ¥è¿åï¼é²æ¢æ§è¡æå°** |
| | | } |
| | | }*/ |
| | | |
| | | uni.request({ |
| | | url: `http://192.168.0.107:44380/api/persons/${encodeURIComponent(this.personCode)}`, // ä¿®æ¹åç请æ±è·¯å¾ |
| | |
| | | // return lines; |
| | | // }, |
| | | |
| | | drawingConfirm() { |
| | | this.drawingShow = false |
| | | // this.imageShow = false |
| | | // this.productionShow = false |
| | | // this.itemShow = false |
| | | }, |
| | | drawingCancel() { |
| | | this.drawingShow = false |
| | | // this.imageShow = false |
| | | // this.productionShow = false |
| | | // this.itemShow = false |
| | | }, |
| | | |
| | | fetchDrawingNumber() { |
| | | // const item = 'BC.XM.001.006.009.0002' |
| | | const item = this.orderDetails.itemNo; |
| | | console.log(this.orderDetails.itemNo) |
| | | // console.log(item) |
| | | // const url = this.$store.state.serverInfo.serverAPI +"/PLM/RetrieveDrawings?ItemNo=" + item |
| | | |
| | | // const item = '5.06.04.4002'; |
| | | const url = "http://192.168.0.107:10054/api/PLM/RetrieveDrawings?ItemNo=" + item |
| | | |
| | | let _this = this; |
| | | |
| | | uni.request({ |
| | | url: url, |
| | | method: 'POST', |
| | | success: (response) => { |
| | | console.log(response) |
| | | if (response.data.data == 'è¿åç»æä¸ºç©º') { |
| | | _this.drawing = [] |
| | | } else { |
| | | _this.drawing = response.data.data |
| | | // éåæ°æ®ï¼å¤ææä»¶åç¼å¹¶æ·»å åæ®µ |
| | | _this.drawing.forEach((file) => { |
| | | // è·åæä»¶åçåç¼ |
| | | const fileExtension = file.fName.split('.').pop() |
| | | .toLowerCase(); |
| | | |
| | | // å®ä¹æ¯æçæä»¶ç±»å |
| | | const supportedExtensions = ['jpg', 'pdf', 'xlsx', 'doc', |
| | | 'docx', |
| | | 'xls' |
| | | ]; |
| | | |
| | | // 夿æ¯å¦æ¯æè¯¥æä»¶ç±»å |
| | | file.isSupported = supportedExtensions.includes(fileExtension); |
| | | }); |
| | | } |
| | | }, |
| | | fail: (error) => { |
| | | uni.showToast({ |
| | | title: '请æ±å¾çº¸é¾æ¥å¤±è´¥', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | this.drawingShow = true |
| | | }, |
| | | |
| | | |
| | | //å¾çº¸ç¸å
³ææ¡£ |
| | | openDrawings(item) { |
| | | console.log("jkjoi", item.fRelevantObject) |
| | | if (item.fRelevantObject.length > 2) { |
| | | // çæè¯·æ±URLï¼ç®åç¼ç é»è¾ï¼ |
| | | const encodedName = encodeURIComponent(item.fName); |
| | | const url = `http://192.168.0.107: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.request({ |
| | | url: url, |
| | | method: 'POST', |
| | | responseType: 'arraybuffer', |
| | | success: (response) => { |
| | | console.log(response.data) |
| | | if (!response) { |
| | | uni.showToast({ |
| | | title: "åè®®é¢è§å¤±è´¥", |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | fail: (error) => { |
| | | console.log(error) |
| | | uni.showToast({ |
| | | title: '请æ±é¢è§é¾æ¥å¤±è´¥', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // è¡¥æä¸ä¸å¼ è®°å½ |
| | | reprintLast() { |
| | | |
| | |
| | | this.senUSBData(); |
| | | // **è®°å½ "è¡¥æå" äºä»¶** |
| | | |
| | | } |
| | | , |
| | | }, |
| | | logPrintEvent(eventType, printType, barcodeValue) { |
| | | |
| | | |
| | |
| | | box-sizing: border-box; |
| | | /* ç¡®ä¿å
è¾¹è·åè¾¹æ¡å
å«å¨å®½åº¦å
*/ |
| | | } |
| | | |
| | | /* 妿éè¦æé®ç宽并é è¾¹ */ |
| | | .popup-buttons { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | /* å·¦å³åå¸ */ |
| | | gap: 20px; |
| | | /* æé®ä¹é´çé´è· */ |
| | | } |
| | | |
| | | .popup-button { |
| | | flex: 1; |
| | | /* 让两个æé®ç宽 */ |
| | | min-width: 100px; |
| | | padding: 12px 0; |
| | | border-radius: 6px; |
| | | font-size: 8px; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | /* æè
ä¿æå宽度ä½åºå®å¨ä¸¤è¾¹ */ |
| | | .popup-buttons.fixed-sides { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .popup-buttons.fixed-sides .popup-button { |
| | | flex: 0 0 auto; |
| | | /* ä¸ä¼¸ç¼©ï¼ä¿æåå¤§å° */ |
| | | } |
| | | |
| | | /* å¼¹çªæ´ä½æ ·å¼ä¿æä¸åï¼å¢å é«åº¦æ§å¶ */ |
| | | .history-popup { |
| | | position: fixed; |
| | | top: 50%; |
| | | left: 50%; |
| | | transform: translate(-50%, -50%); |
| | | width: 80%; |
| | | height: 70%; |
| | | background-color: #fff; |
| | | border-radius: 8px; |
| | | box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); |
| | | z-index: 1000; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | /* å¼¹çªå¤´é¨ */ |
| | | .popup-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 10px; |
| | | border-bottom: 1px solid #ccc; |
| | | flex-shrink: 0; |
| | | /* 鲿¢å¤´é¨è¢«å缩 */ |
| | | } |
| | | |
| | | .popup-title { |
| | | font-size: 18px; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | /* å
容å
è£
å¨ - åºå®é«åº¦ï¼å¯æ»å¨ */ |
| | | .popup-content-wrapper { |
| | | flex: 1; |
| | | /* å æ®å©ä½ç©ºé´ */ |
| | | display: flex; |
| | | flex-direction: column; |
| | | overflow: hidden; |
| | | /* éèæº¢åºå
容 */ |
| | | } |
| | | |
| | | /* 表头åºå® */ |
| | | .history-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | font-weight: bold; |
| | | border-bottom: 1px solid #ccc; |
| | | padding: 10px 5px; |
| | | background-color: #fff; |
| | | flex-shrink: 0; |
| | | /* 鲿¢è¡¨å¤´è¢«å缩 */ |
| | | z-index: 1; |
| | | /* ç¡®ä¿è¡¨å¤´å¨æä¸å± */ |
| | | } |
| | | |
| | | /* æ»å¨åºå - èªéåºé«åº¦ */ |
| | | .history-scroll { |
| | | flex: 1; |
| | | /* å æ®å©ä½ç©ºé´ */ |
| | | overflow-y: auto; |
| | | padding: 0 5px; |
| | | } |
| | | |
| | | /* ç©ºæ°æ®æç¤º */ |
| | | .empty-text { |
| | | text-align: center; |
| | | padding: 40px 0; |
| | | color: #999; |
| | | font-size: 16px; |
| | | } |
| | | |
| | | /* åºå®å¨å¼¹çªåºé¨çæé®åºå */ |
| | | .popup-footer { |
| | | padding: 15px 20px; |
| | | border-top: 1px solid #eee; |
| | | background-color: #fff; |
| | | flex-shrink: 0; |
| | | /* 鲿¢åºé¨è¢«å缩 */ |
| | | box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05); |
| | | } |
| | | |
| | | /* æé®åºå */ |
| | | .popup-buttons { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | gap: 20px; |
| | | } |
| | | |
| | | .popup-button { |
| | | flex: 1; |
| | | min-width: 100px; |
| | | padding: 12px 0; |
| | | border-radius: 6px; |
| | | font-size: 16px; |
| | | font-weight: 500; |
| | | border: none; |
| | | outline: none; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | .cancel-button { |
| | | background-color: #f8f9fa; |
| | | color: #6c757d; |
| | | border: 1px solid #dee2e6; |
| | | } |
| | | |
| | | .cancel-button:hover { |
| | | background-color: #e9ecef; |
| | | color: #495057; |
| | | } |
| | | |
| | | .confirm-button { |
| | | background-color: #1890ff; |
| | | color: white; |
| | | } |
| | | |
| | | .confirm-button:hover { |
| | | background-color: #40a9ff; |
| | | } |
| | | |
| | | /* è¡¨æ ¼å
å®¹è¡æ ·å¼ */ |
| | | .history-record { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | border-bottom: 1px solid #eee; |
| | | padding: 10px 0; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | /* 表头åè¡¨æ ¼å
å®¹çæ¯åæ ·å¼ */ |
| | | .header-item, |
| | | .record-item { |
| | | flex: 1; |
| | | text-align: center; |
| | | padding: 0 5px; |
| | | word-wrap: break-word; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | } |
| | | |
| | | /* æå¼ææ¡£æ ·å¼ */ |
| | | .click-wd { |
| | | color: #1890ff; |
| | | cursor: pointer; |
| | | text-decoration: underline; |
| | | } |
| | | |
| | | .click-wd:hover { |
| | | color: #40a9ff; |
| | | } |
| | | |
| | | /* ç§»å¨ç«¯éé
*/ |
| | | @media (max-width: 768px) { |
| | | .history-popup { |
| | | width: 95%; |
| | | height: 85%; |
| | | } |
| | | |
| | | .popup-button { |
| | | min-width: 80px; |
| | | padding: 10px 0; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .popup-buttons { |
| | | gap: 10px; |
| | | } |
| | | } |
| | | </style> |