111
yhj
5 天以前 986f2bdc1ef38691cee1b70da9277b759d4e3708
ÏÄÃÉ×¢Ëܱ¨¹¤/pages/scbg/scbg.vue
@@ -178,6 +178,8 @@
            <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">
@@ -206,10 +208,61 @@
                        </view>
                     </scroll-view>
                  </view>
               </view>
            <!--    <button @click="reprintLast" :disabled="isButtonDisabled2" class="uni-btn">{{ isButtonDisabled2 ? '请稍后...' : '补打上一张' }}</button>
             --></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>
@@ -230,12 +283,13 @@
                     {{ 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> -->
               <view class="version" v-if="version">
                 ç‰ˆæœ¬å·ï¼š{{ version }}
                  ç‰ˆæœ¬å·ï¼š{{ version }}
               </view>
            </view>
@@ -247,7 +301,7 @@
            <button @click="sendForFirstInspection" class="round-btn">首检送检</button>
         </view>
      </view>
   </view>
</template>
@@ -267,6 +321,9 @@
      data() {
         return {
            showHistoryPopup: false, // æŽ§åˆ¶å¼¹å‡ºæ¡†æ˜¾ç¤º
            drawing: [],
            drawingShow: false,
            itemShow: false,
            selectedPerson: '',
            selectedLine: '',
            selectedOrder: '',
@@ -288,7 +345,7 @@
               orderQuantity: '', // è®¢å•数量
               producedQuantity: '', // å·²ç”Ÿäº§æ•°
               bzsl: '', // æŽ¨èåŒ…装数
               gdzt:'',
               gdzt: '',
               itemId: '', // ç‰©æ–™ID
               itemNo: '', // ç‰©æ–™ç¼–码
               itemname: '', // ç‰©æ–™åç§°
@@ -329,8 +386,8 @@
            networkState: "检测中...",
            deviceState: "检测中...",
            networkModalVisible: false, // æŽ§åˆ¶ç½‘络弹窗是否已显示
            usbModalVisible: false ,// æŽ§åˆ¶ USB å¼¹çª—是否已显示
             updateChecked: false,
            usbModalVisible: false, // æŽ§åˆ¶ USB å¼¹çª—是否已显示
            updateChecked: false,
         };
      },
      // components:{
@@ -350,9 +407,9 @@
         console.log("页面加载,开始检测 USB å’Œç½‘络...");
         console.log("UsbModule:", UsbModule); // æ‰“印 UsbModule æ˜¯å¦å¯ç”¨
         console.log("UsbModule.isUsbConnect:", UsbModule?.isUsbConnect); // æ‰“印方法是否存在
 if (typeof plus !== 'undefined') {
    this.version = plus.runtime.version;
  }
         if (typeof plus !== 'undefined') {
            this.version = plus.runtime.version;
         }
         this.checkForUpdate(); // å¯åŠ¨æ—¶æ£€æŸ¥ç‰ˆæœ¬æ›´æ–°
         //this.startAutoUpdateCheck(); // å¼€å§‹å®šæ—¶æ£€æŸ¥ç‰ˆæœ¬æ›´æ–°
@@ -376,7 +433,7 @@
            this.stopAutoUpdateCheck(); // é¡µé¢é”€æ¯æ—¶åœæ­¢å®šæ—¶å™¨ï¼Œé˜²æ­¢å†…存泄漏
         },
         checkForUpdate() {
              if (this.updateChecked) return;
            if (this.updateChecked) return;
            uni.request({
               url: "http://192.168.0.107:10086/update.json", // ä½ çš„æœåС噍 JSON æ–‡ä»¶åœ°å€
               success: (res) => {
@@ -395,9 +452,9 @@
                     //    }
                     // });
                     this.downloadNewApk(res.data.apkUrl);
                      this.updateChecked = true; // æ ‡è®°æ›´æ–°å·²æ£€æŸ¥è¿‡
                     this.updateChecked = true; // æ ‡è®°æ›´æ–°å·²æ£€æŸ¥è¿‡
                     //      // å¦‚果有新版本,开始下载
                    //download(res.data.apkUrl);
                     //download(res.data.apkUrl);
                  }
               },
               fail: (err) => {
@@ -405,7 +462,7 @@
               }
            });
         },
         downloadNewApk(apkUrl) {
            uni.showToast({
@@ -423,7 +480,7 @@
                     }, function() {
                        console.log("安装成功,重启应用");
                        //plus.runtime.restart();
                           //plus.runtime.quit();
                        //plus.runtime.quit();
                        // uni.navigateBack()
                     }, function(e) {
                        console.error("安装失败:", e);
@@ -918,7 +975,7 @@
               productionOrder: '', // ç”Ÿäº§è®¢å•
               orderQuantity: '', // è®¢å•数量
               bzsl: '', // æŽ¨èåŒ…装数
               gdzt:'',
               gdzt: '',
               producedQuantity: '', // å·²ç”Ÿäº§æ•°
               itemId: '', // ç‰©æ–™ID
               itemNo: '', // ç‰©æ–™ç¼–码
@@ -1050,61 +1107,61 @@
                  });
               }
            });
         // è°ƒç”¨ API èŽ·å–å·¥å•è¯¦æƒ…
         uni.request({
            url: `http://192.168.0.107:44380/api/orderDetails?orderNo=${encodeURIComponent(this.orderNo)}`, // ä½¿ç”¨å­˜å‚¨çš„orderNo
            method: 'GET',
            header: {
               'Content-Type': 'application/json'
            },
            success: (res) => {
               console.log('gongdanxinx', res.data);
               if (res.statusCode === 200) {
                  this.orderDetails = {
                     requirementDoc: res.data.requirementDoc, // éœ€æ±‚单据
                     productionOrder: res.data.productionOrder, // ç”Ÿäº§è®¢å•
                     orderQuantity: res.data.orderQuantity, // è®¢å•数量
                     bzsl: res.data.bzsl, // æŽ¨èåŒ…装数
                     gdzt: res.data.gdzt, // å·¥å•状态
                     producedQuantity: res.data.producedQuantity, // å·²ç”Ÿäº§æ•°
                     itemId: res.data.itemId, // ç‰©æ–™ID
                     itemNo: res.data.itemNO, // ç‰©æ–™ç¼–码
                     itemname: res.data.itemname, // ç‰©æ–™åç§°
                     itemmodel: res.data.itemmodel, // è§„格型号
                  };
                  // æ ¹æ® sj å’Œ xj çš„值来设置首检和巡检状态
                  // æ ¹æ® sj å’Œ xj çš„值来设置首检和巡检状态
                  if (res.data.sj === 1) {
                     this.checkFirstPass = true; // é¦–检合格
                  } else if (res.data.sj === 2) {
                     this.checkFirstPass = false; // é¦–检不合格
            // è°ƒç”¨ API èŽ·å–å·¥å•è¯¦æƒ…
            uni.request({
               url: `http://192.168.0.107:44380/api/orderDetails?orderNo=${encodeURIComponent(this.orderNo)}`, // ä½¿ç”¨å­˜å‚¨çš„orderNo
               method: 'GET',
               header: {
                  'Content-Type': 'application/json'
               },
               success: (res) => {
                  console.log('gongdanxinx', res.data);
                  if (res.statusCode === 200) {
                     this.orderDetails = {
                        requirementDoc: res.data.requirementDoc, // éœ€æ±‚单据
                        productionOrder: res.data.productionOrder, // ç”Ÿäº§è®¢å•
                        orderQuantity: res.data.orderQuantity, // è®¢å•数量
                        bzsl: res.data.bzsl, // æŽ¨èåŒ…装数
                        gdzt: res.data.gdzt, // å·¥å•状态
                        producedQuantity: res.data.producedQuantity, // å·²ç”Ÿäº§æ•°
                        itemId: res.data.itemId, // ç‰©æ–™ID
                        itemNo: res.data.itemNO, // ç‰©æ–™ç¼–码
                        itemname: res.data.itemname, // ç‰©æ–™åç§°
                        itemmodel: res.data.itemmodel, // è§„格型号
                     };
                     // æ ¹æ® sj å’Œ xj çš„值来设置首检和巡检状态
                     // æ ¹æ® sj å’Œ xj çš„值来设置首检和巡检状态
                     if (res.data.sj === 1) {
                        this.checkFirstPass = true; // é¦–检合格
                     } else if (res.data.sj === 2) {
                        this.checkFirstPass = false; // é¦–检不合格
                     } else {
                        this.checkFirstPass = null; // é¦–检未做
                     }
                     if (res.data.xj === 1) {
                        this.checkXJ = true; // å·¡æ£€åˆæ ¼
                     } else if (res.data.xj === 2) {
                        this.checkXJ = false; // å·¡æ£€ä¸åˆæ ¼
                     } else {
                        this.checkXJ = null; // å·¡æ£€æœªåš
                     }
                     console.log('Order details loaded:', this.orderDetails);
                  } else {
                     this.checkFirstPass = null; // é¦–检未做
                     console.error('Failed to fetch order details:', res);
                  }
                  if (res.data.xj === 1) {
                     this.checkXJ = true; // å·¡æ£€åˆæ ¼
                  } else if (res.data.xj === 2) {
                     this.checkXJ = false; // å·¡æ£€ä¸åˆæ ¼
                  } else {
                     this.checkXJ = null; // å·¡æ£€æœªåš
                  }
                  console.log('Order details loaded:', this.orderDetails);
               } else {
                  console.error('Failed to fetch order details:', res);
               },
               fail: (err) => {
                  console.error('Error fetching order details:', err);
               }
            },
            fail: (err) => {
               console.error('Error fetching order details:', err);
            }
         });
            });
         },
         mapStatus(status) {
            if (status === 3) {
@@ -1245,19 +1302,19 @@
         // æäº¤æŠ¥å·¥ä¿¡æ¯çš„æ–¹æ³•
         printBarcode() {
            // **先检查 USB è¿žæŽ¥çŠ¶æ€**
            if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) {
               uni.showModal({
                  title: ` ${this.networkState}`,
                  content: "请检查打印机连接",
                  showCancel: false,
                  success: () => {
                     this.modalVisible = false;
            /*   if (!UsbModule || !UsbModule.isUsbConnect || !UsbModule.isUsbConnect()) {
                  uni.showModal({
                     title: ` ${this.networkState}`,
                     content: "请检查打印机连接",
                     showCancel: false,
                     success: () => {
                        this.modalVisible = false;
                  }
               });
               return; // **USB è¿žæŽ¥å¤±è´¥ï¼Œç›´æŽ¥è¿”回,防止执行打印**
            }
                     }
                  });
                  return; // **USB è¿žæŽ¥å¤±è´¥ï¼Œç›´æŽ¥è¿”回,防止执行打印**
               }*/
            uni.request({
               url: `http://192.168.0.107:44380/api/persons/${encodeURIComponent(this.personCode)}`, // ä¿®æ”¹åŽçš„请求路径
               method: 'GET',
@@ -1302,7 +1359,7 @@
               return;
            }
            // æ ¼å¼åŒ–当前时间为"年月日时分秒"格式
            const currentTime = new Date();
            const formattedTime = this.formatDate(currentTime);
@@ -1317,8 +1374,8 @@
               //itemSpec: '规格型号', // è¿™é‡Œå¯æ”¹æˆå®žé™…数据
               quantity: Number(this.reportedQuantity) // ç¡®ä¿æ˜¯æ•´æ•°
            };
            this.logPrintEvent("打印前", "打印条码前",requestData.uniqueValue);
            };
            this.logPrintEvent("打印前", "打印条码前", requestData.uniqueValue);
            // å°† requestData ä¿å­˜åˆ° lastRequestData ä¸­
            this.lastRequestData = requestData;
            console.log(requestData);
@@ -1368,8 +1425,8 @@
                        //打印条码
                        return;
                     }
       // **先记录 "打印前" äº‹ä»¶**
                          this.logPrintEvent("打印前", "打印", requestData.uniqueValue);
                     // **先记录 "打印前" äº‹ä»¶**
                     this.logPrintEvent("打印前", "打印", requestData.uniqueValue);
                     //打印条码
                     console.log('tiaoma', requestData.uniqueValue);
                     console.log('gd', this.orderDetails.productionOrder);
@@ -1443,27 +1500,27 @@
                     // command.setFeed(30);
                     this.sendData = command.getData();
               // 1. æ‰§è¡Œå‘送
               let printResult = this.senUSBData();
               // 2. åˆ¤æ–­å‘送是否成功
               if (printResult.success) {
                 // âœ… å‘送成功,记录打印日志
                 this.logPrintEvent("打印后", "打印", requestData.uniqueValue);
               } else {
                 // âŒ å‘送失败,提示用户,不记录日志
                 uni.showToast({
                   title: "打印失败,未记录日志",
                   duration: 2000
                 });
               }
                     // 1. æ‰§è¡Œå‘送
                     let printResult = this.senUSBData();
                           this.oldbgs =  this.reportedQuantity;
                           this.bgr=
                     //从新刷新工单信息
                     loadOrderDetails();
                     // 2. åˆ¤æ–­å‘送是否成功
                     if (printResult.success) {
                        // âœ… å‘送成功,记录打印日志
                        this.logPrintEvent("打印后", "打印", requestData.uniqueValue);
                     } else {
                        // âŒ å‘送失败,提示用户,不记录日志
                        uni.showToast({
                           title: "打印失败,未记录日志",
                           duration: 2000
                        });
                     }
                     this.oldbgs = this.reportedQuantity;
                     this.bgr =
                        //从新刷新工单信息
                        loadOrderDetails();
                     //从新刷新历史记录
                     this.fetchHistoryRecords(this.orderNo);
                  },
@@ -1486,10 +1543,179 @@
         //   lines.push(text); // æœ€åŽä¸€è¡Œ
         //   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() {
            // ç¦ç”¨æŒ‰é’®5秒
            this.isButtonDisabled2 = true;
            setTimeout(() => {
@@ -1530,7 +1756,7 @@
                  });
               }
            });
         this.selectedPerson = this.lastRequestData.printedBy;
            this.selectedPerson = this.lastRequestData.printedBy;
            // è¡¥æ‰“上一张记录
            this.fetchHistoryRecords(this.orderNo);
            if (!this.lastRequestData) {
@@ -1541,8 +1767,8 @@
               });
               return;
            }
               //20250507 æ–°åŠ èµ‹å€¼åŽ†å²æ¡ç æŠ¥å·¥äºº
               this.selectedPerson = this.lastRequestData.printedBy;
            //20250507 æ–°åŠ èµ‹å€¼åŽ†å²æ¡ç æŠ¥å·¥äºº
            this.selectedPerson = this.lastRequestData.printedBy;
            console.log("老条码", this.oldbgs);
            // é‡æ–°æ‰“印上一张记录
            // async reprintLast() {
@@ -1562,8 +1788,8 @@
            //         });
            //         return;  // é€€å‡ºï¼Œé¿å…ç»§ç»­æ‰§è¡Œæ‰“印
            //     }
           // **记录 "补打前" äº‹ä»¶**
             this.logPrintEvent("打印前", "补打", this.lastRequestData);
            // **记录 "补打前" äº‹ä»¶**
            this.logPrintEvent("打印前", "补打", this.lastRequestData);
            // æ‰“印内容样式设置
            const command = tsc.jpPrinter.createNew();
@@ -1622,59 +1848,58 @@
            command.setPagePrint();
            command.setFeed(3);
            this.sendData = command.getData();
         // 1. æ‰§è¡Œå‘送
         let printResult = this.senUSBData();
         // 2. åˆ¤æ–­å‘送是否成功
         if (printResult.success) {
         // å‘送成功,记录打印日志
           this.logPrintEvent("打印后", "补打", this.lastRequestData);
         } else {
         // å‘送失败,提示用户,不记录日志
         uni.showToast({
            title: "打印失败,未记录日志",
            duration: 2000
         });
         }
F
            // 1. æ‰§è¡Œå‘送
            let printResult = this.senUSBData();
            // 2. åˆ¤æ–­å‘送是否成功
            if (printResult.success) {
               // å‘送成功,记录打印日志
               this.logPrintEvent("打印后", "补打", this.lastRequestData);
            } else {
               // å‘送失败,提示用户,不记录日志
               uni.showToast({
                  title: "打印失败,未记录日志",
                  duration: 2000
               });
            }
            F
            // å‘送数据
            this.senUSBData();
          // **记录 "补打后" äº‹ä»¶**
            // **记录 "补打后" äº‹ä»¶**
         },
         logPrintEvent(eventType, printType, barcodeValue) {
            const requestData = {
               barcode: barcodeValue, // æ¡ç 
               worker: this.personCode, // æŠ¥å·¥äºº
               eventType: eventType, // "打印前" æˆ– "打印后"
               printType: printType, // "打印" æˆ– "补打"
               orderNo: this.selectedOrder, // å·¥å•号
               line: this.selectedLine,
               version: this.version // çº¿ä½“
            };
            console.log(requestData);
            uni.request({
               url: "http://192.168.0.107:44380/api/LogPrintEvent/logEvent",
               method: 'POST',
               header: {
                  'Content-Type': 'application/json'
               },
               data: requestData,
               success: (response) => {
                  if (response.statusCode === 200) {
                     console.log(`${eventType} - ${printType} è®°å½•成功`);
                  } else {
                     console.error(`${eventType} - ${printType} è®°å½•失败:`, response);
                  }
               },
               fail: (err) => {
                  console.error("请求失败:", err);
               }
            });
         }
      ,
   logPrintEvent(eventType, printType, barcodeValue) {
       const requestData = {
           barcode: barcodeValue,  // æ¡ç 
           worker: this.personCode,  // æŠ¥å·¥äºº
           eventType: eventType, // "打印前" æˆ– "打印后"
           printType: printType,  // "打印" æˆ– "补打"
           orderNo: this.selectedOrder, // å·¥å•号
           line: this.selectedLine ,
         version:this.version// çº¿ä½“
       };
      console.log(requestData);
       uni.request({
           url: "http://192.168.0.107:44380/api/LogPrintEvent/logEvent",
           method: 'POST',
           header: {
               'Content-Type': 'application/json'
           },
           data: requestData,
           success: (response) => {
               if (response.statusCode === 200) {
                   console.log(`${eventType} - ${printType} è®°å½•成功`);
               } else {
                   console.error(`${eventType} - ${printType} è®°å½•失败:`, response);
               }
           },
           fail: (err) => {
               console.error("请求失败:", err);
           }
       });
   }
      }
   };
</script>
@@ -2369,4 +2594,204 @@
      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>