xwt
2025-08-07 27294f1626cdb785fe4c7401dde3266db188ccf4
pages/QC/LLJ/Add.vue
@@ -284,7 +284,14 @@
               
               <!-- 图片内容预览 -->
               <view v-else-if="previewType === 'image'" class="image-preview-container">
                  <image :src="previewContent" mode="widthFix" style="width: 100%; max-height: 400px;"></image>
                  <image
                     :src="previewContent"
                     mode="aspectFit"
                     class="preview-image-clickable"
                     @click="previewImageInPopup"
                     style="width: 100%; max-height: 400px; cursor: pointer;"
                  />
                  <div class="image-zoom-hint">点击图片可放大查看</div>
               </view>
               
               <!-- Excel 等 Office 文件提示 -->
@@ -484,7 +491,8 @@
         addDefectDescription() {
            // 添加不良描述的逻辑
            this.remarksPopup = !this.remarksPopup;
            this.remarks = this.formData.remarks;
            this.remarks = this.formData.remarks || this.remarks || '';
            console.log('打开弹窗时的remarks值:', this.remarks);
         },
         submitInspection() {
            if (this.PSTYPE == '') {
@@ -684,10 +692,12 @@
                  this.badreason = data.blyy || '';
                  this.PSTYPE = data.pszt || '';
                  this.WORKSHOP = data.sscj || '';
                  console.log('赋值后', this.badreason, this.PSTYPE, this.WORKSHOP);
                  this.remarks = data.remarks || ''; // 设置remarks变量
                  
                  // 确保PHSY字段被正确设置
                  this.formData.PHSY = data.PHSY;
                  this.PHSY = data.PHSY || ''; // 同时设置页面绑定的PHSY变量
                  
                  console.log("加载的紧急放行状态:", this.formData.emergencyStatus);
                  this.$post({
@@ -741,27 +751,7 @@
               url: 'SysSubmitFrom?releaseNo=' + releaseNo + '&userID=' + this.$loginInfo.account
            });
         },
         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);
               }
            })
         },
         drawingConfirm() {
            this.drawingShow = false
@@ -1244,14 +1234,12 @@
                     });
                 },
               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) {
@@ -1271,10 +1259,8 @@
            this.isInteger = true;
         },
         editDestruction() {
            // 验证输入是否为整数
            if(this.PHSY === '') {
               this.isInteger = true;
               // 如果为空,传递空字符串,后端会处理为null
            } else {
               const isInteger = /^-?\d+$/.test(this.PHSY);
               this.isInteger = isInteger;
@@ -1282,21 +1268,16 @@
                  return;
               }
            }
            // 保存破坏实验数量,并带上不良原因、所属车间、评审状态
            this.$post({
               url: "/LLJ/saveRemarksGid",
               url: "/LLJ/savePhsyGid",
               data: {
                  gid: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  PHSY: this.PHSY, // 可以是空字符串或有效整数
                  BLYY: this.badreason,
                  SSCJ: this.WORKSHOP,
                  PSZT: this.PSTYPE
                  PHSY: this.PHSY
               }
            }).then(res => {
               if (res.data.tbBillList > 0) {
                  // 如果输入为空,设置为null以便不显示
                  this.formData.PHSY = this.PHSY === '' ? null : this.PHSY;
                  this.destructionPopup = false;
                  this.$showMessage("保存成功");
@@ -1307,21 +1288,17 @@
            })
         },
         clearDestruction() {
            // 清除破坏实验数量
            this.PHSY = '';
            this.$post({
               url: "/LLJ/saveRemarksGid",
               url: "/LLJ/savePhsyGid",
               data: {
                  gid: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  PHSY: '', // 空字符串,后端会处理为null
                  BLYY: this.badreason,
                  SSCJ: this.WORKSHOP,
                  PSZT: this.PSTYPE
                  PHSY: ''
               }
            }).then(res => {
               if (res.data.tbBillList > 0) {
                  this.formData.PHSY = null; // 确保前端也为null,不显示
                  this.formData.PHSY = null;
                  this.destructionPopup = false;
                  this.$showMessage("清除成功");
                  setTimeout(() => {
@@ -1557,6 +1534,36 @@
            const item = { fattach: this.previewTitle, itemNo: this.previewItemNo };
            this.downloadAttachment(item);
            this.closeFilePreview();
         },
         // 在弹窗中预览图片(放大功能)
         previewImageInPopup() {
            // 使用uni.previewImage API实现图片放大预览
            uni.previewImage({
               current: this.previewContent, // 当前显示图片的链接
               urls: [this.previewContent], // 需要预览的图片链接列表
               loop: false, // 是否开启图片轮播
               indicator: 'default', // 图片指示器类型
               longPressActions: {
                  itemList: ['发送给朋友', '保存图片', '收藏'],
                  success: function (data) {
                     console.log('选中了第' + (data.tapIndex + 1) + '个按钮');
                  },
                  fail: function (err) {
                     console.log(err.errMsg);
                  }
               },
               success: () => {
                  console.log('图片预览成功');
               },
               fail: (err) => {
                  console.error('图片预览失败:', err);
                  uni.showToast({
                     title: '图片预览失败',
                     icon: 'none'
                  });
               }
            });
         },
         
         // 预览Office文件
@@ -1867,14 +1874,13 @@
         },
         saveRemarksGid() {
           this.$post({
            url: "/LLJ/saveRemarksGid",
            url: "/LLJ/saveDropdownFields",
            data: {
              gid: this.formData.id,
              releaseNo: this.formData.releaseNo,
              BLYY: this.badreason,
              SSCJ: this.WORKSHOP,
              PSZT: this.PSTYPE,
              PHSY: this.PHSY // 新增,保证破坏实验数不会被刷掉
              BLYY: this.badreason || '',
              SSCJ: this.WORKSHOP || '',
              PSZT: this.PSTYPE || ''
            }
           }).then(res => {
            if (res.data.tbBillList > 0) {
@@ -2578,4 +2584,31 @@
         overflow-x: auto;
      }
   }
   /* 图片放大预览相关样式 */
   .preview-image-clickable {
      transition: transform 0.2s ease;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
   }
   .preview-image-clickable:hover {
      transform: scale(1.02);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
   }
   .image-zoom-hint {
      text-align: center;
      margin-top: 8px;
      font-size: 12px;
      color: #666;
      font-style: italic;
   }
   .image-preview-container {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
   }
</style>