xwt
17 小时以前 7c2192a2f000d94add173b77b6bd4c8c4fc6a5e4
pages/QC/SJ/Add.vue
@@ -96,53 +96,34 @@
                     <view v-if="item.result==null || item.result==''" class="watermark pending">
                        {{ getStatusText(item.result) }}
                     </view>
                     <view class="description-text">检验项目详情</view>
                     <view class="description-text">{{ getInspectionDescription(item) }}</view>
                  </td>
                  <td>
                     <button class="record-btn" @click="toDetail(item)">
                        {{ item.levelNum + '/' + item.isCheck }}
                        {{ getTotalCount(item) + '/' + item.isCheck }}
                     </button>
                  </td>
               </tr>
            </tbody>
         </table>
      </view>
      <!-- 操作按钮区 -->
      <view class="action-buttons">
         <button class="action-btn primary" v-if="isUpdate && !isShowTable" @click="save">
            创建检验单并生成部分默认值
         </button>
         <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="toImage">
            上传/查看图片
         </button>
         <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="fetchDrawingNumber(formData.itemNo)">
            调取PLM图纸
         </button>
         <button class="action-btn secondary" v-if="!isUpdate && !isShowTable" @click="getBom">
            Bom用料清单
         </button>
         <button class="action-btn secondary" v-if="!isUpdate && !isShowTable && formData.xjGenFlag == 0"
            @click="saveXJ">
            生成巡检
         </button>
         <button class="action-btn danger" v-if="!isUpdate && formData.result == '未完成' && !isShowTable" @click="removeXJ">
            删除单据
         </button>
         <button class="action-btn secondary" v-if="!isUpdate &&  !isShowTable" @click="saveRemarks">
            添加不合格描述
         </button>
         <button class="action-btn primary" v-if="isShowTable" @click="getTable">
            获取检验项目
         </button>
         <button class="action-btn primary" v-if="isShowTable && isUpdate" @click="saveTable">
            生成检验项目
         </button>
         <button class="action-btn success" v-if="!isUpdate && formData.fsubmit == 0 && !isShowTable" @click="getGenUpdate">
            获取检验项目
         </button>
         <button class="action-btn success" v-if="!isUpdate && formData.fsubmit ==0 && !isShowTable" @click="submitInspection">
            提交检验
         </button>
      <!-- 表单上方操作按钮区 -->
      <view class="top-action-buttons">
         <button class="action-btn" v-if="isUpdate && !isShowTable" @click="save">创建检验单并生成部分默认值</button>
         <button class="action-btn" v-if="isShowTable" @click="getTable">获取检验项目</button>
         <button class="action-btn" v-if="isShowTable && isUpdate" @click="saveTable">生成检验项目</button>
      </view>
      <!-- 表单下方操作按钮区 -->
      <view class="bottom-action-buttons">
         <button class="action-btn small" v-if="!isUpdate && !isShowTable" @click="toImage">上传/查看图片</button>
         <button class="action-btn small" v-if="!isUpdate && !isShowTable" @click="fetchDrawingNumber(formData.itemNo)">调取PLM图纸</button>
         <button class="action-btn small" v-if="!isUpdate && !isShowTable" @click="getBom">Bom用料清单</button>
         <button class="action-btn small" v-if="!isUpdate && !isShowTable && formData.xjGenFlag == 0" @click="saveXJ">生成巡检</button>
         <button class="action-btn small" v-if="false" @click="removeXJ">删除单据</button>
         <button class="action-btn small" v-if="!isUpdate && !isShowTable" @click="saveRemarks">添加不合格描述</button>
         <button class="action-btn small" v-if="!isUpdate && formData.fsubmit == 0 && !isShowTable" @click="getGenUpdate">获取检验项目</button>
         <button class="action-btn small primary" v-if="!isUpdate && formData.fsubmit ==0 && !isShowTable" @click="submitInspection">提交检验</button>
      </view>
      
      <view class="barcode">
@@ -316,6 +297,24 @@
            if (status === '合格') return '合格';
            if (status === '不合格') return '不合格';
            return '未完成';
         },
         getTotalCount(item) {
            // 如果有穴号信息,使用穴号信息的总数量减去堵穴数量
            if (item.holeNumbers && item.holeNumbers.length > 0) {
               // 计算非堵穴的数量
               const nonBlockedCount = item.holeNumbers.filter(hole => !hole.isBlocked).length;
               return nonBlockedCount;
            }
            // 否则使用levelNum
            return item.levelNum || 0;
         },
         getInspectionDescription(item) {
            // 直接取ITEM_MOD字段的值
            if (item.itemMod && item.itemMod.trim() !== '') {
               return item.itemMod;
            } else {
               return '检验项目详情';
            }
         },
         removeXJ() {
            if (this.formData.id) {
@@ -597,16 +596,28 @@
         },
         submitInspection() {
            if (this.formData.id) {
               this.$post({
                  url: "/SJ/SjSubmit",
                  data: {
                     id: this.formData.id,
                     userNo: this.$loginInfo.account
                  }
               }).then(res => {
                  if (res.data.tbBillList) {
                     this.$showMessage("提交成功");
                     this.init();
               // 显示确认提示框
               uni.showModal({
                  title: '确认提交',
                  content: '确定要提交检验结果吗?提交后将无法修改。',
                  confirmText: '确定提交',
                  cancelText: '取消',
                  success: (res) => {
                     if (res.confirm) {
                        // 用户确认后执行提交
                        this.$post({
                           url: "/SJ/SjSubmit",
                           data: {
                              id: this.formData.id,
                              userNo: this.$loginInfo.account
                           }
                        }).then(res => {
                           if (res.data.tbBillList) {
                              this.$showMessage("提交成功");
                              this.init();
                           }
                        });
                     }
                  }
               });
            }
@@ -863,19 +874,57 @@
               this.$showMessage("请先保存检验单!");
               return;
            }
            // 先获取检验单的详细信息,包含mnum和dnum
            this.$post({
               url: "/SJ/GenUpdate",
               url: "/SJ/getQSItems",
               data: {
                  id: this.formData.id,
                  no: this.formData.billNo,
                  user: this.$loginInfo.account
                  pid: this.formData.id
               }
            }).then(res => {
               if (res.data.result === 0) {
                  this.$showMessage("获取检验项目成功");
                  this.init();
               if (res.data.tbBillList && res.data.tbBillList.length > 0) {
                  // 从第一个检验项目中获取mnum和dnum
                  const firstItem = res.data.tbBillList[0];
                  const mnum = firstItem.mnum || 1;
                  const dnum = firstItem.dnum || "";
                  // 调用GenUpdate
                  this.$post({
                     url: "/SJ/GenUpdate",
                     data: {
                        id: this.formData.id,
                        no: this.formData.billNo,
                        user: this.$loginInfo.account,
                        mnum: mnum,
                        dnum: dnum
                     }
                  }).then(genRes => {
                     if (genRes.data.result === 0) {
                        this.$showMessage("获取检验项目成功");
                        this.init();
                     } else {
                        this.$showMessage(genRes.data.message || "获取失败");
                     }
                  });
               } else {
                  this.$showMessage(res.data.message || "获取失败");
                  // 如果没有检验项目,使用默认值
                  this.$post({
                     url: "/SJ/GenUpdate",
                     data: {
                        id: this.formData.id,
                        no: this.formData.billNo,
                        user: this.$loginInfo.account,
                        mnum: 1,
                        dnum: ""
                     }
                  }).then(genRes => {
                     if (genRes.data.result === 0) {
                        this.$showMessage("获取检验项目成功");
                        this.init();
                     } else {
                        this.$showMessage(genRes.data.message || "获取失败");
                     }
                  });
               }
            });
         }
@@ -890,328 +939,382 @@
<style scoped>
/* 基础样式 */
.inspection-sheet {
  padding: 10px;
  background-color: #f5f7fa;
  min-height: 100vh;
   font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
   max-width: 1000px;
   margin: 0 auto;
   padding: 20px 20px 100px 20px; /* 底部增加内边距为固定按钮留空间 */
   background-color: #fff;
   box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
   min-height: 100vh;
   position: relative;
   transition: all 0.3s ease;
}
/* 头部样式 */
.sheet-header {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
   text-align: center;
   margin-bottom: 20px;
   padding-bottom: 15px;
   border-bottom: 2px solid #e0e0e0;
}
.sheet-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
   color: #2c3e50;
   font-size: 24px;
   margin-bottom: 5px;
}
.inspection-number {
  font-size: 16px;
  color: #3498db;
  font-weight: 500;
   font-size: 16px;
   font-weight: bold;
   color: #3498db;
}
/* 基本信息区 */
.basic-info {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
/* 基本信息区样式 */
.basic-info,
.material-info {
   margin-bottom: 20px;
}
.info-row {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
   display: flex;
   margin-bottom: 10px;
   flex-wrap: wrap;
}
.info-label {
  font-size: 14px;
  color: #7f8c8d;
  margin-right: 10px;
  min-width: 80px;
   font-weight: bold;
   color: #34495e;
   min-width: 80px;
   margin-right: 5px;
}
.info-value {
  font-size: 14px;
  color: #2c3e50;
  margin-right: 20px;
   color: #2c3e50;
   margin-right: 20px;
}
.info-picker {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
  margin-right: 20px;
   padding: 8px 12px;
   border: 1px solid #ddd;
   border-radius: 4px;
   background-color: white;
   font-size: 14px;
   margin-right: 20px;
}
/* 物料信息区 */
/* 物料信息区样式 */
.material-info {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
   border: 1px solid #eee;
   padding: 15px;
   border-radius: 5px;
}
.info-block {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
   display: flex;
   align-items: center;
   margin-bottom: 10px;
   flex-wrap: wrap;
}
.info-block .info-label {
  min-width: 100px;
  font-size: 14px;
  color: #7f8c8d;
   min-width: 100px;
   font-size: 14px;
   color: #7f8c8d;
}
.info-block .info-value {
  font-size: 14px;
  color: #2c3e50;
  flex: 1;
   font-size: 14px;
   color: #2c3e50;
   flex: 1;
}
.info-picker-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
   flex: 1;
   padding: 8px 12px;
   border: 1px solid #ddd;
   border-radius: 4px;
   background-color: white;
   font-size: 14px;
}
.info-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
   flex: 1;
   padding: 8px 12px;
   border: 1px solid #ddd;
   border-radius: 4px;
   background-color: white;
   font-size: 14px;
}
.highlight {
  font-weight: 600;
  color: #e74c3c;
  font-size: 16px;
   font-weight: bold;
   color: #e74c3c;
}
/* 检验项目表格 */
/* 表格样式 */
.inspection-table {
  margin: 25px 0;
   margin: 25px 0;
}
.inspection-table table {
  width: 100%;
  border-collapse: collapse;
   width: 100%;
   border-collapse: collapse;
}
.inspection-table th,
.inspection-table td {
  padding: 12px 15px;
  border: 1px solid #ddd;
  text-align: left;
   padding: 12px 15px;
   border: 1px solid #ddd;
   text-align: left;
}
.inspection-table th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #34495e;
   background-color: #f8f9fa;
   font-weight: bold;
   color: #34495e;
}
.inspection-table tr:nth-child(even) {
  background-color: #f9f9f9;
   background-color: #f9f9f9;
}
.inspection-table tr:hover {
  background-color: #f1f5f9;
   background-color: #f1f5f9;
}
/* 水印样式 */
.watermark {
  position: absolute;
  font-size: 40px;
  font-weight: bold;
  opacity: 1;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
   position: absolute;
   font-size: 40px;
   font-weight: bold;
   opacity: 1;
   z-index: 1;
   pointer-events: none;
   transform: rotate(-15deg);
   width: 100%;
   text-align: center;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%) rotate(-15deg);
}
.watermark.approved {
  color: #2ecc71;
   color: #2ecc71;
   /* 绿色 */
}
.watermark.rejected {
  color: #e74c3c;
   color: #e74c3c;
   /* 红色 */
}
.watermark.pending {
  color: #f39c12;
   color: #f39c12;
   /* 橙色 */
}
/* 描述文本容器 */
.description-text {
  position: relative;
  z-index: 2;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 10px;
  font-size: 14px;
  color: #2c3e50;
   position: relative;
   z-index: 2;
   padding: 25px;
   background-color: rgba(255, 255, 255, 0.7);
}
/* 调整表格单元格 */
.inspection-table td:nth-child(2) {
  position: relative;
  overflow: hidden;
  padding: 0;
   position: relative;
   overflow: hidden;
   padding: 0;
}
/* 按钮样式 */
.record-btn {
  padding: 6px 12px;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
/* 表单上方操作按钮区样式 */
.top-action-buttons {
   display: flex;
   justify-content: flex-end;
   gap: 10px;
   margin: 20px 0;
   padding: 15px;
   background-color: #f8f9fa;
   border-radius: 8px;
   border: 1px solid #e9ecef;
}
.record-btn:hover {
  background-color: #e9ecef;
}
/* 操作按钮区 */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
/* 表单下方操作按钮区样式 */
.bottom-action-buttons {
   display: flex;
   justify-content: center;
   gap: 8px;
   padding: 12px;
   flex-wrap: wrap;
   align-items: center;
   position: fixed; /* 固定在屏幕底部 */
   bottom: 0; /* 距离底部0px */
   left: 0; /* 距离左边0px */
   right: 0; /* 距离右边0px */
   background-color: #fff; /* 背景色 */
   border-top: 1px solid #e9ecef; /* 顶部边框 */
   z-index: 1000; /* 确保在最上层 */
   box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); /* 顶部阴影 */
}
.action-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
   background-color: #ecf0f1;
   color: #34495e;
   padding: 12px 15px;
   border: none;
   border-radius: 6px;
   cursor: pointer;
   font-size: 14px;
   font-weight: 500;
   transition: all 0.3s ease;
   text-align: center;
   min-height: 44px;
   display: flex;
   align-items: center;
   justify-content: center;
}
.action-btn:hover {
   background-color: #d5dbdb;
   transform: translateY(-1px);
}
.action-btn.primary {
  background-color: #3498db;
  color: white;
   background-color: #3498db;
   color: #fff;
}
.action-btn.primary:hover {
  background-color: #2980b9;
   background-color: #2980b9;
}
.action-btn.secondary {
  background-color: #95a5a6;
  color: white;
/* 小尺寸按钮样式 */
.action-btn.small {
   padding: 10px 12px;
   font-size: 14px;
   min-height: 44px;
   white-space: nowrap;
   flex-shrink: 0;
   min-width: 80px;
   max-width: 120px;
   flex: 1;
}
.action-btn.secondary:hover {
  background-color: #7f8c8d;
/* 原有按钮样式保持兼容 */
.action-buttons {
   display: flex;
   gap: 10px;
   margin: 15px 0;
   justify-content: flex-end;
}
.action-btn.danger {
  background-color: #e74c3c;
  color: white;
.record-btn {
   padding: 6px 12px;
   background-color: #f8f9fa;
   border: 1px solid #ddd;
   /* border-radius: 3px; */
   cursor: pointer;
   transition: all 0.2s;
}
.action-btn.danger:hover {
  background-color: #c0392b;
.record-btn:hover {
   background-color: #e9ecef;
}
.action-btn.success {
  background-color: #2ecc71;
  color: white;
}
.action-btn.success:hover {
  background-color: #27ae60;
}
/* 弹出框样式 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0, 0, 0, 0.5);
   display: flex;
   justify-content: center;
   align-items: center;
   z-index: 1000; /* 提高层级,确保在固定按钮上方 */
}
/* 弹窗整体美化 */
.popup {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
   background: #fff;
   border-radius: 16px;
   box-shadow: 0 8px 32px rgba(60,60,60,0.18);
   padding: 28px 28px 18px 28px;
   border: none;
   position: relative;
   min-width: 260px;
   z-index: 1001; /* 确保弹窗内容在最上层 */
   max-height: 80vh; /* 限制最大高度,避免被底部按钮遮挡 */
   overflow-y: auto; /* 内容过多时可滚动 */
}
.popup-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
   padding: 20px;
   border-bottom: 1px solid #eee;
}
.popup-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
   font-size: 18px;
   font-weight: 600;
   color: #2c3e50;
   margin: 0;
}
.popup-content {
  padding: 20px;
   padding: 20px;
}
.popup-actions {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
   padding: 20px;
   border-top: 1px solid #eee;
   display: flex;
   gap: 10px;
   justify-content: flex-end;
}
/* 响应式设计 */
@media (max-width: 768px) {
  .info-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .info-label {
    margin-bottom: 5px;
  }
  .project-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .project-actions {
    margin-top: 10px;
    width: 100%;
  }
@media (max-width: 500px) {
   .info-row,
   .info-block {
      flex-direction: column;
      align-items: flex-start;
   }
   .top-action-buttons {
      flex-direction: column;
      align-items: stretch;
   }
   .bottom-action-buttons {
      flex-direction: row;
      align-items: center;
      justify-content: center;
      padding: 8px;
      gap: 6px;
      position: fixed; /* 保持固定在屏幕底部 */
      bottom: 0;
      left: 0;
      right: 0;
      background-color: #fff;
      border-top: 1px solid #e9ecef;
      z-index: 1000;
      box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
   }
   .action-btn.small {
      min-width: 70px;
      max-width: 100px;
      padding: 8px 10px;
      font-size: 13px;
      min-height: 40px;
   }
   .inspection-table table {
      display: block;
      overflow-x: auto;
   }
}
</style>