111
啊鑫
6 天以前 2b0e70bb88ced210dbc693a4d2ded2d658b1da02
pages/QC/Laboratory/Laboratory.vue
@@ -4,12 +4,12 @@
    <view class="page-header">
      <view class="header-title">实验室检测详情</view>
    </view>
    <!-- 加载状态 -->
    <view v-if="loading" class="loading-container">
      <uni-load-more status="loading" />
      <uni-load-more status="loading"/>
    </view>
    <!-- 数据展示 -->
    <view v-else-if="data" class="content">
      <view class="card">
@@ -21,7 +21,7 @@
            </view>
          </view>
        </view>
        <view class="card-body">
          <view class="info-group">
            <view class="info-row">
@@ -34,7 +34,7 @@
                <text class="info-value">{{ data.createUser }}</text>
              </view>
            </view>
            <view class="info-row">
              <view class="info-item">
                <label class="info-label">生产线编码:</label>
@@ -45,21 +45,21 @@
                <text class="info-value">{{ data.itemNo }}</text>
              </view>
            </view>
            <view class="info-row full-width">
              <view class="info-item">
                <label class="info-label">物料名称:</label>
                <text class="info-value">{{ data.itemName }}</text>
              </view>
            </view>
            <view class="info-row full-width">
              <view class="info-item">
                <label class="info-label">物料规格:</label>
                <text class="info-value">{{ data.itemModel }}</text>
              </view>
            </view>
            <view class="info-row">
              <view class="info-item">
                <label class="info-label">生产车间编码:</label>
@@ -70,14 +70,14 @@
                <text class="info-value">{{ data.departmentId }}</text>
              </view>
            </view>
            <view class="info-row full-width">
              <view class="info-item">
                <label class="info-label">销售订单号:</label>
                <text class="info-value">{{ data.saleOrderNoc }}</text>
              </view>
            </view>
            <view class="info-row">
              <view class="info-item">
                <label class="info-label">检验时间:</label>
@@ -88,36 +88,43 @@
                <text class="info-value">{{ data.inspectionUser }}</text>
              </view>
            </view>
            <view class="info-row">
              <view class="info-item status-item">
                <label class="info-label">检验结果:</label>
                <view class="result-container">
                  <!-- 显示当前检验结果 -->
                  <text v-if="data.inspectionResult" class="status-badge" :class="data.inspectionResult === '合格' ? 'success' : 'danger'">
                  <text v-if="data.inspectionResult" :class="data.inspectionResult === '合格' ? 'success' : 'danger'"
                        class="status-badge">
                    {{ data.inspectionResult }}
                  </text>
                  <text v-else class="status-badge pending">
                    待检验
                  </text>
                  <!-- 录入/重新录入按钮 -->
                  <button v-if="!showResultInput" class="input-btn" @click="showResultInput = true">
                    {{ data.inspectionResult ? '重新录入' : '录入结果' }}
                  </button>
                  <!-- 检验结果选择按钮 -->
                  <view v-if="showResultInput" class="result-input-container">
                    <button class="result-btn qualified" @click="updateInspectionResult('合格')" :disabled="updating">
                    <button :disabled="updating" class="result-btn qualified" @click="updateInspectionResult('合格')">
                      合格
                    </button>
                    <button class="result-btn unqualified" @click="updateInspectionResult('不合格')" :disabled="updating">
                    <button :disabled="updating" class="result-btn unqualified"
                            @click="updateInspectionResult('不合格')">
                      不合格
                    </button>
                    <button class="result-btn cancel" @click="showResultInput = false" :disabled="updating">
                    <button :disabled="updating" class="result-btn cancel" @click="showResultInput = false">
                      取消
                    </button>
                  </view>
                  <!-- 图片上传按钮 -->
                  <button class="upload-btn" @click="uploadImage">
                    📷 上传图片
                  </button>
                </view>
              </view>
            </view>
@@ -125,7 +132,7 @@
        </view>
      </view>
    </view>
    <!-- 空状态 -->
    <view v-else class="empty-state">
      <view class="empty-icon">📋</view>
@@ -145,24 +152,24 @@
      updating: false
    }
  },
  onLoad(options) {
    this.itemId = options.id;
    if (this.itemId) {
      this.loadData();
    }
  },
  methods: {
    loadData() {
      this.loading = true;
      const requestData = {
        pageIndex: 1,
        limit: 1,
        id: this.itemId
      };
      this.$post({
        url: "/MesLaboratory/GetPage",
        data: requestData
@@ -180,16 +187,16 @@
        this.loading = false;
      });
    },
    updateInspectionResult(result) {
      this.updating = true;
      const requestData = {
        id: this.itemId,
        inspectionResult: result,
        inspectionBy: this.$loginInfo.account
      };
      this.$post({
        url: "/MesLaboratory/UpdateInspectionResult",
        data: requestData
@@ -207,6 +214,16 @@
        this.$showMessage('录入失败,请重试');
      }).finally(() => {
        this.updating = false;
      });
    },
    uploadImage() {
      // 处理billNo,去掉"-"后面的部分
      const orderNo = this.data.billNo.split('-')[0];
      // 跳转到图片上传页面
      uni.navigateTo({
        url: `ImageItem?id=${this.itemId}&orderNo=${orderNo}`
      });
    }
  }
@@ -273,7 +290,7 @@
.info-row {
  display: flex;
  gap: 20px;
  &.full-width {
    flex-direction: column;
  }
@@ -284,7 +301,7 @@
  align-items: center;
  flex: 1;
  min-width: 0;
  &.status-item {
    align-items: center;
    gap: 10px;
@@ -312,19 +329,19 @@
  font-size: 14px;
  border-radius: 20px;
  font-weight: 500;
  &.success {
    background-color: #e6f7ed;
    color: #36b37e;
    border: 1px solid #d1fae5;
  }
  &.danger {
    background-color: #ffefef;
    color: #ff4d4f;
    border: 1px solid #fee2e2;
  }
  &.pending {
    background-color: #f5f5f5;
    color: #999;
@@ -348,12 +365,12 @@
  color: #409EFF;
  cursor: pointer;
  transition: all 0.2s;
  &:hover {
    background-color: #409EFF;
    color: #fff;
  }
  &:active {
    transform: scale(0.95);
  }
@@ -372,50 +389,70 @@
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s;
  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
  &.qualified {
    background-color: #e6f7ed;
    color: #36b37e;
    border-color: #36b37e;
    &:hover:not(:disabled) {
      background-color: #36b37e;
      color: #fff;
    }
  }
  &.unqualified {
    background-color: #ffefef;
    color: #ff4d4f;
    border-color: #ff4d4f;
    &:hover:not(:disabled) {
      background-color: #ff4d4f;
      color: #fff;
    }
  }
  &.cancel {
    background-color: #f5f5f5;
    color: #666;
    border-color: #ccc;
    &:hover:not(:disabled) {
      background-color: #ccc;
      color: #fff;
    }
  }
  &:active:not(:disabled) {
    transform: scale(0.95);
  }
}
.upload-btn {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #67C23A;
  background-color: #fff;
  color: #67C23A;
  cursor: pointer;
  transition: all 0.2s;
  &:hover {
    background-color: #67C23A;
    color: #fff;
  }
  &:active {
    transform: scale(0.95);
  }
}
.empty-state {
  display: flex;
  flex-direction: column;