xwt
2025-06-27 0d3eadb50310ca60b8871e967e64da01aa25a9ad
pages/QC/LLJ/Add.vue
@@ -4,9 +4,10 @@
      <view class="sheet-header">
         <h1>来料检验单</h1>
         <view class="inspection-number">检验单号:{{formData.releaseNo}}</view>
         <!-- 造梦者特殊功能 -->
         <view style="text-align: right;" v-if="this.current"><a class="sysLike"
               @click="toSysSubmitFrom(formData.releaseNo)">实验室送检</a></view>
         <!--实验室送检 -->
         <view style="text-align: right;" class="action-buttons">
            <a class="sysLike" v-if="this.current" @click="toSysSubmitFrom(formData.releaseNo)">实验室送检</a>
         </view>
      </view>
      <!-- 基本信息区 -->
@@ -30,11 +31,6 @@
         <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">
@@ -50,11 +46,11 @@
            <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>
@@ -93,26 +89,37 @@
         </select>
      </view>
      <view class="dropdown-row">
         <view class="info-label">备注:</view>
         <input type="text" id="remark" v-model="REMARK" placeholder="请输入备注信息" />
               <view class="info-block" style="margin-top: 10px;">
          <view class="info-label">备注:</view>
          <input type="text" id="lotNo1" v-model="formData.lotNo1"
                             placeholder="请输入备注信息"
                             style="color: red; font-weight: bold;"/>
      </view>
      <view class="info-block" style="margin-top: 10px;">
          <view class="info-label">破坏实验数量:</view>
          <view class="info-value highlight">{{formData.phsy}}</view>
      </view>
      <!-- 操作按钮区 -->
      <view class="action-buttons" v-if="this.current">
         <button class="secondary-btn" @click="getInspectionItems">获取检验项目</button>
                  <button class="secondary-btn" @click="handleEmergencyRelease">紧急放行</button>
                  <button class="secondary-btn" @click="handleWithdraw">撤回</button>
                  <button class="secondary-btn" @click="getInspectionItems">获取检验项目</button>
      </view>
      <!-- 检验项目表格 -->
      <view class="inspection-table">
         <table>
            <thead>
               <tr>
                  <th width="15%" style="text-align: center;">检验项目</th>
                  <th width="20%" style="text-align: center;">检验项目</th>
                  <th width="50%" style="text-align: center;">检验描述</th>
                  <th width="20%" style="text-align: center;">记录(点击)</th>
                  <th width="15%" style="text-align: center;">记录(点击)</th>
               </tr>
            </thead>
            <tbody>
@@ -134,6 +141,7 @@
                     <button v-if="item.current" class="record-btn" @click="fillRecord(item,index)">填写</button>
                     <button v-if="!item.current" class="record-btn" @click="fillRecord(item,index)">查看</button>
                  </td>
               </tr>
            </tbody>
         </table>
@@ -141,6 +149,7 @@
      <!-- 操作按钮区 -->
      <view class="action-buttons">
         <button class="secondary-btn" @click="addDestruction" v-if="this.current">破坏实验</button>
         <button class="secondary-btn" @click="uploadImages">上传/查看图片</button>
         <button class="secondary-btn" @click="fetchDrawingNumber">调取PLM图纸</button>
         <button class="secondary-btn" @click="addDefectDescription" v-if="this.current">添加不良描述</button>
@@ -160,7 +169,23 @@
            <button @click="remarksPopup = !remarksPopup">取消</button>
         </view>
      </view>
      <view v-if="destructionPopup" class="overlay">
         <view class="popup">
            <h3>破坏实验数量</h3>
            <form>
               <view class="form-group">
                  <label class="form-label">破坏实验数量:</label>
                  <input class="form-input" type="text" v-model="PHSY" placeholder="留空表示清除数量" />
               </view>
            </form>
            <div v-if="!isInteger" class="error-message">请输入整数值或留空</div>
            <button class="updateBut" @click="editDestruction">修改</button>
            <button @click="clearDestruction">清除</button>
            <button @click="destructionPopup = !destructionPopup">取消</button>
         </view>
      </view>
      <view class="barcode">
         <u-modal :show="drawingShow" title="图纸明细" @confirm="drawingConfirm" @cancel="drawingCancel"
            showCancelButton>
@@ -188,8 +213,8 @@
            </uni-table>
         </u-modal>
      </view>
   </view>
</template>
<script>
@@ -211,10 +236,21 @@
               boardModel: "",
               planQty: "",
               mocode: "",
               boardStyle: ""
               boardStyle: "",
               itemId: "",
               emergencyStatus: false,
               lotNo1: '',
               emergency:'',
               permissionModalVisible: false,
               permissionAccount: '',
               hasEmergencyPermission: false,
               showPopup: false,
               PHSY:'',
            },
            tableData: [],
            remarksPopup: false,
            meomPopup: false,
            current: true,
            drawing: [],
            drawingShow: false,
@@ -223,18 +259,29 @@
            WORKSHOP: '',
            REMARK: '',
            checkState: false,
            writeStatu: true
            writeStatu: true,
            fileName:'',
            originalRemarks: '',
            hasEmergencyPermission: false,
            destructionPopup: false,
            PHSY: '',
            isInteger: true,
         }
      },
      onLoad(options) {
         //options中包含了url附带的参数
         let params = options;
         if (params["id"]) {
            this.formData.id = params["id"];
            this.formData.releaseNo = params["releaseNo"];
            this.formData.lotNo = params["lotNo"];
            this.msgId = params["msgId"];
            this.emergency = params["emergency"]
            this.meom = params["meom"]
            if (params["current"] === 'A') {
               this.current = true;
@@ -257,6 +304,7 @@
            });
         }
          if (this.$loginInfo.account === 'PL017') {this.hasEmergencyPermission = true;}
      },
      methods: {
@@ -280,9 +328,10 @@
            this.$post({
               url: "/LLJ/setJYItem",
               data: {
                  itemNo: this.formData.itemNo,
                  itemNo: this.formData.itemId,
                  quantity: this.formData.fcovertQty,
                  releaseNo: this.formData.releaseNo
                  releaseNo: this.formData.releaseNo,
                  PHSY: this.formData.PHSY
               }
            }).then(res => {
               if (res.status == 0) {
@@ -309,6 +358,7 @@
               }
            });
         },
         fillRecord(item, index) {
            // 填写记录的逻辑
            uni.navigateTo({
@@ -349,7 +399,7 @@
               if (this.formData.fngDesc == '' || this.writeStatu == false) {
                  uni.showToast({
                     title: '未填写不良描述或三个选择框未选择完',
                     title: '未填写不良描述或不良原因或所属车间或评审状态',
                     icon: 'none'
                  });
               } else {
@@ -363,24 +413,44 @@
                  }).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)
                        const url = `http://192.168.1.22:10054/api/QcIssueResult/GetProcessNo`;
                        const url = this.$store.state.serverInfo.serverAPI+`/QcIssueResult/GetProcessNo`;
                        // 发送 POST 请求
                        uni.request({
                           url: url, // 请求地址
@@ -491,7 +561,13 @@
            }).then(res => {
               let data = res.data.tbBillList[0];
               if (data) {
                  this.formData = data;
                  this.formData = {
                     ...data,
                     emergencyStatus: data.emergency
                  };
                  // 确保PHSY字段被正确设置
                  this.formData.PHSY = data.PHSY;
                  this.$post({
                     url: "/LLJ/getJYItem",
@@ -503,9 +579,9 @@
                     let tableData = res1.data.tbBillList
                     //当已检验个数都不为空时按照检测结构排序
                     tableData.sort((a, b) => {
                        if (a.result === '未完成' && b.result === '合格') {
                        if (a.result === '合格' && b.result === '未完成') {
                           return -1;
                        } else if (a.result === '合格' && b.result === '未完成') {
                        } else if (a.result === '未完成' && b.result === '合格') {
                           return 1;
                        } else {
                           return 0;
@@ -545,58 +621,25 @@
            });
         },
         editRemarks() {
            if (this.remarks) {
               //saveRemarksGid
               this.$post({
                  url: "/LLJ/saveRemarksGid",
                  data: {
                     gid: this.formData.id,
                     remarks: this.remarks,
                     releaseNo: this.formData.releaseNo,
                  }
               }).then(res => {
                  if (res.data.tbBillList > 0) {
                     this.formData.remarks = this.remarks;
                     this.remarksPopup = !this.remarksPopup;
                     this.$showMessage("保存成功");
                     setTimeout(() => {
                        let pages = getCurrentPages();
                        let beforePage = pages[pages.length - 2];
                        uni.navigateBack({
                           delta: 1, //返回的页面数,如果为1表示返回上一页
                           success: (event) => {
                              beforePage.$vm.reload()
                           }
                        });
                     }, 2000);
                  }
               })
            } else {
               this.$post({
                  url: "/LLJ/saveRemarksGid",
                  data: {
                     gid: this.formData.id,
                     remarks: '',
                     releaseNo: this.formData.releaseNo,
                  }
               }).then(res => {
                  if (res.data.tbBillList > 0) {
                     this.formData.remarks = this.remarks;
                     this.remarksPopup = !this.remarksPopup;
                     this.$showMessage("保存成功");
                     setTimeout(() => {
                        let pages = getCurrentPages();
                        let beforePage = pages[pages.length - 2];
                        uni.navigateBack({
                           delta: 1, //返回的页面数,如果为1表示返回上一页
                           success: (event) => {
                              beforePage.$vm.reload()
                           }
                        });
                     }, 2000);
                  }
               })
            }
            // 保存不良描述
            this.$post({
               url: "/LLJ/saveRemarksGid",
               data: {
                  gid: this.formData.id,
                  remarks: this.remarks || '',
                  releaseNo: this.formData.releaseNo
                  // 不再包含PHSY字段
               }
            }).then(res => {
               if (res.data.tbBillList > 0) {
                  this.formData.remarks = this.remarks;
                  this.remarksPopup = !this.remarksPopup;
                  this.$showMessage("保存成功");
                  setTimeout(() => {
                     this.init();
                  }, 2000);
               }
            })
         },
         drawingConfirm() {
@@ -611,26 +654,28 @@
         },
         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
            const url = this.$store.state.serverInfo.serverAPI +"/PLM/RetrieveDrawings?ItemNo=" + item
            // const item = '5.06.04.4002';
            // const url = "http://192.168.0.100: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 = null
                     _this.drawing = null
                  } else {
                     this.drawing = response.data.data
                     _this.drawing = response.data.data
                     // 遍历数据,判断文件后缀并添加字段
                     this.drawing.forEach((file) => {
                     _this.drawing.forEach((file) => {
                        // 获取文件名的后缀
                        const fileExtension = file.fName.split('.').pop()
                           .toLowerCase();
@@ -661,14 +706,123 @@
         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 = this.$store.state.serverInfo.serverAPI+`/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',
@@ -681,19 +835,32 @@
                           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)
@@ -706,7 +873,8 @@
            } 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'))
@@ -749,7 +917,8 @@
               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'))
@@ -843,7 +1012,198 @@
            //       title: '无对应PDF文件,打开失败',
            //       icon: 'none'
            //    });            // }
         }
         },
         // 处理紧急放行
         handleEmergencyRelease() {
                     if (this.formData.emergencyStatus) {
                         uni.showModal({
                             title: "提示",
                             content: '该单已紧急放行,请勿重复操作',
                             showCancel: false
                         });
                         return;
                     }
                     uni.showModal({
                         title: '确认',
                         content: '确定要执行紧急放行吗?',
                         success: (res) => {
                             if (res.confirm) {
                                 // 调用新的后端接口
                                 this.$post({
                                     url: "/LLJ/EmergencyRelease",
                                     data: {
                                         id: this.formData.id
                                     }
                                 }).then(res => {
                                     if (res.data && res.status === 0) {
                                         const result = res.data.tbBillList[0];
                                         const message = res.data.tbBillList[1];
                                 const lotNo1 = res.data.tbBillList[2] || "";
                                         if (result === "0") {
                                             this.formData.emergencyStatus = true;
                                    this.originalLotNo1 = lotNo1;
                                    this.formData.lotNo1 = lotNo1;
                                             uni.showToast({
                                                 title: message || '紧急放行成功',
                                                 icon: 'success',
                                                 duration: 2000
                                             });
                                             this.init();
                                         } else {
                                             uni.showModal({
                                                 title: "提示",
                                                 content: message || '操作失败',
                                                 showCancel: false
                                             });
                                         }
                                     }
                                 }).catch(error => {
                                     uni.showModal({
                                         title: "错误",
                                         content: '网络错误,请检查网络连接',
                                         showCancel: false
                                     });
                                 });
                             }
                         }
                     });
                 },
                 // 处理撤回
                 handleWithdraw() {
                     uni.showModal({
                         title: '确认',
                         content: '确定要撤回紧急放行吗?',
                         success: (res) => {
                             if (res.confirm) {
                                 // 调用新的后端接口
                                 this.$post({
                                     url: "/LLJ/WithdrawEmergencyRelease",
                                     data: {
                                         id: this.formData.id
                                     }
                                 }).then(res => {
                                     if (res.data && res.status === 0) {
                                         const result = res.data.tbBillList[0];
                                         const message = res.data.tbBillList[1];
                                         if (result === "0") {
                                             this.formData.emergencyStatus = false;
                                             uni.showToast({
                                                 title: message || '撤回成功',
                                                 icon: 'success',
                                                 duration: 2000
                                             });
                                             this.init();
                                         } else {
                                             uni.showModal({
                                                 title: "提示",
                                                 content: message || '操作失败',
                                                 showCancel: false
                                             });
                                         }
                                     }
                                 }).catch(error => {
                                     uni.showModal({
                                         title: "错误",
                                         content: '网络错误,请检查网络连接',
                                         showCancel: false
                                     });
                                 });
                             }
                         }
                     });
                 },
               editRemarks() {
                  // 保存不良描述
                  this.$post({
                     url: "/LLJ/saveRemarksGid",
                     data: {
                        gid: this.formData.id,
                        remarks: this.remarks || '',
                        releaseNo: this.formData.releaseNo
                        // 不再包含PHSY字段
                     }
                  }).then(res => {
                     if (res.data.tbBillList > 0) {
                        this.formData.remarks = this.remarks;
                        this.remarksPopup = !this.remarksPopup;
                        this.$showMessage("保存成功");
                        setTimeout(() => {
                           this.init();
                        }, 2000);
                     }
                  })
               },
         addDestruction() {
            // 添加破坏实验的逻辑
            this.destructionPopup = !this.destructionPopup;
            this.PHSY = this.formData.PHSY || '';
            this.isInteger = true;
         },
         editDestruction() {
            // 验证输入是否为整数
            if(this.PHSY === '') {
               this.isInteger = true;
               // 如果为空,传递空字符串,后端会处理为null
            } else {
               const isInteger = /^-?\d+$/.test(this.PHSY);
               this.isInteger = isInteger;
               if (!isInteger) {
                  return;
               }
            }
            // 保存破坏实验数量
            this.$post({
               url: "/LLJ/saveRemarksGid",
               data: {
                  gid: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  PHSY: this.PHSY // 可以是空字符串或有效整数
                  // 不再包含remarks字段
               }
            }).then(res => {
               if (res.data.tbBillList > 0) {
                  // 如果输入为空,设置为null以便不显示
                  this.formData.PHSY = this.PHSY === '' ? null : this.PHSY;
                  this.destructionPopup = false;
                  this.$showMessage("保存成功");
                  setTimeout(() => {
                     // 跳转到列表页面
                     uni.navigateTo({
                        url: 'List'
                     });
                  }, 2000);
               }
            })
         },
         clearDestruction() {
            // 清除破坏实验数量
            this.PHSY = '';
            this.$post({
               url: "/LLJ/saveRemarksGid",
               data: {
                  gid: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  PHSY: '' // 空字符串,后端会处理为null
               }
            }).then(res => {
               if (res.data.tbBillList > 0) {
                  this.formData.PHSY = null; // 确保前端也为null,不显示
                  this.destructionPopup = false;
                  this.$showMessage("清除成功");
                  setTimeout(() => {
                     // 跳转到列表页面
                     uni.navigateTo({
                        url: 'List'
                     });
                  }, 2000);
               }
            })
         },
      }
   }
</script>
@@ -937,12 +1297,9 @@
   }
   .sysLike {
      color: #3498db;
      color: #1890ff;
      text-decoration: none;
      margin-left: 15px;
      padding: 3px 8px;
      border-radius: 3px;
      font-size: 12px;
      cursor: pointer;
   }
   .doc-link:hover {
@@ -983,13 +1340,31 @@
   /* 按钮样式 */
   .action-buttons {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 20px;
      margin: 15px 0;
      justify-content: flex-end;
   }
   .primary-btn,
   .secondary-btn {
      background-color: #ecf0f1;
      color: #7f8c8d;
      padding: 8px 15px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
   }
   .secondary-btn:hover {
      background-color: #d5dbdb;
   }
   .secondary-btn:disabled {
      background-color: #d9d9d9;
      cursor: not-allowed;
      opacity: 0.7;
   }
   .primary-btn {
      padding: 10px 20px;
      border: none;
      border-radius: 4px;
@@ -998,22 +1373,8 @@
      transition: all 0.3s;
   }
   .primary-btn {
      background-color: #3498db;
      color: white;
   }
   .primary-btn:hover {
      background-color: #2980b9;
   }
   .secondary-btn {
      background-color: #ecf0f1;
      color: #7f8c8d;
   }
   .secondary-btn:hover {
      background-color: #d5dbdb;
   }
   .record-btn {
@@ -1140,4 +1501,11 @@
      }
   }
   .error-message {
      color: #e74c3c;
      font-size: 14px;
      margin-top: 5px;
      margin-bottom: 10px;
   }
</style>