xwt
2025-09-24 816ab1967ee766e3e3f3631c08371f2e7704408e
pages/QC/SJ/Add.vue
@@ -74,8 +74,8 @@
      </view>
      <!-- 检验项目表格 -->
      <view class="inspection-table" v-if="tableData.length > 0">
         <table>
      <view class="inspection-table">
         <table v-if="tableData.length > 0">
            <thead>
               <tr>
                  <th width="20%" style="text-align: center;">检验项目</th>
@@ -106,6 +106,12 @@
               </tr>
            </tbody>
         </table>
         <!-- 空状态显示 -->
         <view v-else class="empty-state">
            <view class="empty-icon">📋</view>
            <view class="empty-text">暂无检验项目</view>
            <view class="empty-desc">该检验单还没有检验项目</view>
         </view>
      </view>
      <!-- 表单上方操作按钮区 -->
      <view class="top-action-buttons">
@@ -386,7 +392,10 @@
                        });
                        if (this.tableData.length <= 0) {
                           this.isShowTable = true;
                           this.isShowTable = true; // 没有检验项目时显示生成按钮
                        } else {
                           this.isShowTable = false; // 有检验项目时直接进入填写阶段
                           this.isUpdate = false; // 设置为非更新状态,可以直接填写
                        }
                     })
                  }
@@ -476,10 +485,14 @@
                  if (res.data.tbBillList.length > 0) {
                     this.tableData = res.data.tbBillList; // 在箭头函数中,this 指向外层作用域的 this
                     this.isSubmit = false;
                     // 注意:这里不自动保存,因为还没有创建检验单,需要先调用save()创建检验单
                     this.isShowTable = false; // 直接进入填写阶段
                     this.isUpdate = false; // 设置为非更新状态,可以直接填写
                  } else {
                     this.$showMessage("此物料没有启用的检验项目,请维护!");
                     this.isSubmit = true;
                     this.tableData = [];
                     this.isShowTable = true; // 没有检验项目时显示生成按钮
                  }
               });
@@ -509,8 +522,8 @@
            }).then(res => {
               if (res.data.tbBillList.length > 0) {
                  this.tableData = res.data.tbBillList; // 在箭头函数中,this 指向外层作用域的 this
                  this.isShowTable = true;
                  this.isUpdate = true;
                  // 自动保存检验项目到数据库
                  this.saveTable();
               } else {
                  this.$showMessage("此物料没有启用的检验项目,请维护!");
                  this.isShowTable = true;
@@ -969,6 +982,9 @@
                     if (genRes.data.result === 0) {
                        this.$showMessage("获取检验项目成功");
                        this.init();
                        // 获取成功后直接进入填写阶段
                        this.isShowTable = false;
                        this.isUpdate = false;
                     } else {
                        this.$showMessage(genRes.data.message || "获取失败");
                     }
@@ -988,6 +1004,9 @@
                     if (genRes.data.result === 0) {
                        this.$showMessage("获取检验项目成功");
                        this.init();
                        // 获取成功后直接进入填写阶段
                        this.isShowTable = false;
                        this.isUpdate = false;
                     } else {
                        this.$showMessage(genRes.data.message || "获取失败");
                     }
@@ -1006,57 +1025,58 @@
<style scoped>
/* 基础样式 */
.inspection-sheet {
   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);
  padding: 10px;
  background-color: #f5f7fa;
   min-height: 100vh;
   position: relative;
   transition: all 0.3s ease;
  padding-bottom: 120px; /* 为底部固定按钮留出空间 */
}
/* 头部样式 */
.sheet-header {
   text-align: center;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
   margin-bottom: 20px;
   padding-bottom: 15px;
   border-bottom: 2px solid #e0e0e0;
}
.sheet-header h1 {
   color: #2c3e50;
   font-size: 24px;
   margin-bottom: 5px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 10px;
}
.inspection-number {
   font-size: 16px;
   font-weight: bold;
   color: #3498db;
  font-weight: 500;
}
/* 基本信息区样式 */
.basic-info,
.material-info {
/* 基本信息区 */
.basic-info {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
   margin-bottom: 20px;
}
.info-row {
   display: flex;
   margin-bottom: 10px;
   flex-wrap: wrap;
  align-items: center;
  margin-bottom: 15px;
}
.info-label {
   font-weight: bold;
   color: #34495e;
  font-size: 14px;
  color: #7f8c8d;
  margin-right: 10px;
   min-width: 80px;
   margin-right: 5px;
}
.info-value {
  font-size: 14px;
   color: #2c3e50;
   margin-right: 20px;
}
@@ -1070,18 +1090,19 @@
   margin-right: 20px;
}
/* 物料信息区样式 */
/* 物料信息区 */
.material-info {
   border: 1px solid #eee;
   padding: 15px;
   border-radius: 5px;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}
.info-block {
   display: flex;
   align-items: center;
   margin-bottom: 10px;
   flex-wrap: wrap;
  margin-bottom: 15px;
}
.info-block .info-label {
@@ -1115,13 +1136,18 @@
}
.highlight {
   font-weight: bold;
  font-weight: 600;
   color: #e74c3c;
  font-size: 16px;
}
/* 表格样式 */
/* 检验项目表格 */
.inspection-table {
   margin: 25px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #fff;
}
.inspection-table table {
@@ -1129,71 +1155,114 @@
   border-collapse: collapse;
}
.inspection-table th,
.inspection-table td {
   padding: 12px 15px;
   border: 1px solid #ddd;
.inspection-table th, .inspection-table td {
  padding: 16px 20px;
  border: none;
   text-align: left;
  border-bottom: 1px solid #eee;
}
.inspection-table th {
   background-color: #f8f9fa;
   font-weight: bold;
   color: #34495e;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-weight: 600;
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.5px;
  position: relative;
}
.inspection-table tr:nth-child(even) {
   background-color: #f9f9f9;
.inspection-table tbody tr {
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
}
.inspection-table tr:hover {
   background-color: #f1f5f9;
.inspection-table tbody tr:nth-child(even) {
  background-color: #f8fafc;
}
.inspection-table tbody tr:hover {
  background-color: #e8f4fd;
  border-left-color: #3498db;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}
/* 检验描述列特殊样式 */
.inspection-table td:nth-child(2) {
  position: relative;
  min-height: 80px;
  vertical-align: top;
  padding: 16px 20px;
}
/* 水印样式 */
.watermark {
   position: absolute;
   font-size: 40px;
  font-size: 32px;
   font-weight: bold;
   opacity: 1;
   z-index: 1;
  opacity: 0.4;
  z-index: 3;
   pointer-events: none;
   transform: rotate(-15deg);
   width: 100%;
   text-align: center;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%) rotate(-15deg);
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  min-width: 60px;
  text-align: center;
}
.watermark.approved {
   color: #2ecc71;
   /* 绿色 */
  color: #27ae60; /* 更淡的绿色 */
}
.watermark.rejected {
   color: #e74c3c;
   /* 红色 */
  color: #e67e22; /* 更淡的红色 */
}
.watermark.pending {
   color: #f39c12;
   /* 橙色 */
  color: #f39c12; /* 橙色 */
}
/* 描述文本容器 */
/* 描述文本样式 */
.description-text {
   position: relative;
   z-index: 2;
   padding: 25px;
   background-color: rgba(255, 255, 255, 0.7);
  padding: 12px 16px;
  background: transparent;
  line-height: 1.6;
  font-size: 14px;
  color: #555;
  margin: 0;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  /* 确保文字不会太长遮挡水印 */
  padding-right: 80px;
  min-height: 20px;
  display: block;
}
/* 调整表格单元格 */
.inspection-table td:nth-child(2) {
   position: relative;
   overflow: hidden;
   padding: 0;
.record-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}
.record-btn:hover {
  background: linear-gradient(135deg, #2980b9, #1f618d);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4);
}
.record-btn:active {
  transform: translateY(0);
}
/* 表单上方操作按钮区样式 */
@@ -1277,19 +1346,6 @@
   justify-content: flex-end;
}
.record-btn {
   padding: 6px 12px;
   background-color: #f8f9fa;
   border: 1px solid #ddd;
   /* border-radius: 3px; */
   cursor: pointer;
   transition: all 0.2s;
}
.record-btn:hover {
   background-color: #e9ecef;
}
.overlay {
   position: fixed;
   top: 0;
@@ -1341,8 +1397,43 @@
   justify-content: flex-end;
}
/* 空状态样式 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background-color: #fafafa;
  border-radius: 8px;
  margin: 20px 0;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-text {
  font-size: 18px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
}
.empty-desc {
  font-size: 14px;
  color: #999;
  line-height: 1.5;
}
/* 响应式设计 */
@media (max-width: 500px) {
   .inspection-sheet {
      padding-bottom: 100px; /* 小屏幕设备上减少底部内边距 */
   }
   .info-row,
   .info-block {