111
啊鑫
6 天以前 2b0e70bb88ced210dbc693a4d2ded2d658b1da02
pages/QC/OQC/detail.vue
@@ -1,828 +1,935 @@
<template>
   <view class="page-container">
      <!-- 检验项目表单卡片 -->
      <view class="form-card">
         <view class="form-title">
            <view class="title-icon">📋</view>
            <span>检验项目详情</span>
         </view>
         <view class="form-container">
            <!-- 基本信息模块 -->
            <view class="form-section">
               <view class="section-title">基本信息</view>
               <view class="form-grid">
                  <view class="form-group">
                     <label class="form-label">项目名称:</label>
                     <input class="form-input" disabled="true" type="text" v-model="formData.fcheckItem" />
                  </view>
                  <view class="form-group">
                     <label class="form-label">规格要求:</label>
                     <input class="form-input" disabled="true" type="text" v-model="formData.fspecRequ" />
                  </view>
                  <view class="form-group">
                     <label class="form-label">检验方法:</label>
                     <input class="form-input" disabled="true" type="text" v-model="formData.inspectionMethod" />
                  </view>
                  <view class="form-group">
                     <label class="form-label">检验工具:</label>
                     <input class="form-input" disabled="true" type="text" v-model="formData.fcheckTool" />
                  </view>
               </view>
            </view>
  <view class="page-container">
    <!-- 检验项目表单卡片 -->
    <view class="form-card">
      <view class="form-title">
        <view class="title-icon">📋</view>
        <span>检验项目详情</span>
      </view>
      <view class="form-container">
        <!-- 基本信息模块 -->
        <view class="form-section">
          <view class="section-title">基本信息</view>
          <view class="form-grid">
            <view class="form-group">
              <label class="form-label">项目名称:</label>
              <input v-model="formData.fcheckItem" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">规格要求:</label>
              <input v-model="formData.fspecRequ" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">检验方法:</label>
              <input v-model="formData.inspectionMethod" class="form-input" disabled="true" type="text"/>
            </view>
            <view class="form-group">
              <label class="form-label">检验工具:</label>
              <input v-model="formData.fcheckTool" class="form-input" disabled="true" type="text"/>
            </view>
          </view>
        </view>
            <!-- 三个模块并列容器 -->
            <view class="three-modules-container">
               <!-- 检验参数模块 -->
               <view class="module-item">
                  <view class="module-header">
                     <text class="module-title">检验参数</text>
                  </view>
                  <view class="module-content">
                     <view class="form-grid">
                        <view class="form-group">
                           <label class="form-label">检验数:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.checkQyt" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">检验标准编码:</label>
                           <input class="form-input" disabled="true" type="text"
                              v-model="formData.sampleSizeNo" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">检验水平:</label>
                           <input class="form-input" disabled="true" type="text"
                              v-model="formData.fcheckLevel" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">接收水平:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.facLevel" />
                        </view>
                     </view>
                  </view>
               </view>
        <!-- 三个模块并列容器 -->
        <view class="three-modules-container">
          <!-- 检验参数模块 -->
          <view class="module-item">
            <view class="module-header">
              <text class="module-title">检验参数</text>
            </view>
            <view class="module-content">
              <view class="form-grid">
                <view class="form-group">
                  <label class="form-label">检验数:</label>
                  <input v-model="formData.checkQyt" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">检验标准编码:</label>
                  <input v-model="formData.sampleSizeNo" class="form-input" disabled="true"
                         type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">检验水平:</label>
                  <input v-model="formData.fcheckLevel" class="form-input" disabled="true"
                         type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">接收水平:</label>
                  <input v-model="formData.facLevel" class="form-input" disabled="true" type="text"/>
                </view>
              </view>
            </view>
          </view>
               <!-- 数值标准模块 -->
               <view class="module-item">
                  <view class="module-header">
                     <text class="module-title">数值标准</text>
                  </view>
                  <view class="module-content">
                     <view class="form-grid">
                        <view class="form-group">
                           <label class="form-label">下限:</label>
                           <input class="form-input" disabled="true" type="text"
                              v-model="formData.fdownAllow" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">标准值:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.fstand" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">上限:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.fupAllow" />
                        </view>
                     </view>
                  </view>
               </view>
          <!-- 数值标准模块 -->
          <view class="module-item">
            <view class="module-header">
              <text class="module-title">数值标准</text>
            </view>
            <view class="module-content">
              <view class="form-grid">
                <view class="form-group">
                  <label class="form-label">下限:</label>
                  <input v-model="formData.fdownAllow" class="form-input" disabled="true"
                         type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">标准值:</label>
                  <input v-model="formData.fstand" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">上限:</label>
                  <input v-model="formData.fupAllow" class="form-input" disabled="true" type="text"/>
                </view>
              </view>
            </view>
          </view>
               <!-- 判定标准模块 -->
               <view class="module-item">
                  <view class="module-header">
                     <text class="module-title">判定标准</text>
                  </view>
                  <view class="module-content">
                     <view class="form-grid">
                        <view class="form-group">
                           <label class="form-label">AC数:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.facQty" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">RE数:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.freQty" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">不合格数:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.fngQty" />
                        </view>
                        <view class="form-group">
                           <label class="form-label">预览结果:</label>
                           <input class="form-input" disabled="true" type="text" v-model="formData.fcheckResu" />
                        </view>
                     </view>
                  </view>
               </view>
            </view>
          <!-- 判定标准模块 -->
          <view class="module-item">
            <view class="module-header">
              <text class="module-title">判定标准</text>
            </view>
            <view class="module-content">
              <view class="form-grid">
                <view class="form-group">
                  <label class="form-label">AC数:</label>
                  <input v-model="formData.facQty" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">RE数:</label>
                  <input v-model="formData.freQty" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">不合格数:</label>
                  <input v-model="formData.fngQty" class="form-input" disabled="true" type="text"/>
                </view>
                <view class="form-group">
                  <label class="form-label">预览结果:</label>
                  <input v-model="formData.fcheckResu" class="form-input" disabled="true" type="text"/>
                </view>
              </view>
            </view>
          </view>
        </view>
            <!-- 备注信息模块 -->
            <!-- <view class="form-section">
               <view class="section-title">备注信息</view>
               <view class="form-grid">
                  <view class="form-group">
                     <label class="form-label">不合格描述:</label>
                     <input class="form-input" disabled="true" type="text" v-model="formData.remarks" />
                  </view>
               </view>
            </view> -->
        <!-- 备注信息模块 -->
        <!-- <view class="form-section">
          <view class="section-title">备注信息</view>
          <view class="form-grid">
            <view class="form-group">
              <label class="form-label">不合格描述:</label>
              <input class="form-input" disabled="true" type="text" v-model="formData.remarks" />
            </view>
          </view>
        </view> -->
            <!-- 检测结果区域 -->
            <view class="form-section">
               <view class="section-title">检测结果</view>
               <view class="form-grid">
                  <view class="form-group">
                     <label class="form-label">检测结果:</label>
                     <input class="form-input" type="number" v-model="fcheckResuK" />
                  </view>
        <!-- 检测结果区域 -->
        <view class="form-section">
          <view class="section-title">检测结果</view>
          <view class="form-grid">
            <view class="form-group">
              <label class="form-label">检测结果:</label>
              <input v-model="fcheckResuK" class="form-input" type="number"/>
            </view>
                  <!-- 提示词作为检测结果的提示 -->
                  <view class="form-group tip-group">
                     <view class="tip-box">
                        <view class="tip-icon">⚠️</view>
                        <view class="tip-text">没有最大值和最小值时填写<span class="highlight">0(未通过检验)</span>或<span
                              class="highlight">1(通过检验)</span></view>
                     </view>
                  </view>
               </view>
            </view>
            <!-- 提示词作为检测结果的提示 -->
            <view class="form-group tip-group">
              <view class="tip-box">
                <view class="tip-icon">⚠️</view>
                <view class="tip-text">没有最大值和最小值时填写<span class="highlight">0(未通过检验)</span>或<span
                    class="highlight">1(通过检验)</span></view>
              </view>
            </view>
          </view>
        </view>
            <button :class="['action-btn', 'btn-primary', { 'btn-loading': isLoading }]"
               v-if="tableData.length < formData.checkQyt" @click="submit" :disabled="isLoading">
               {{ isLoading ? '保存中...' : '保存' }}
            </button>
         </view>
      </view>
        <button v-if="tableData.length < formData.checkQyt"
                :class="['action-btn', 'btn-primary', { 'btn-loading': isLoading }]" :disabled="isLoading" @click="submit">
          {{ isLoading ? '保存中...' : '保存' }}
        </button>
      </view>
    </view>
      <!-- 检验结果表格卡片 -->
      <view class="table-card">
         <view class="table-title">
            <view class="title-icon">📊</view>
            <span>检验结果列表</span>
         </view>
         <view class="list-container">
            <uni-table ref="table" border emptyText="暂无更多数据">
               <uni-tr>
                  <uni-th width="80" align="center" class="th">编号</uni-th>
                  <uni-th width="120" align="center" class="th">判定标识</uni-th>
                  <uni-th width="100" align="center" class="th">检验结果</uni-th>
                  <uni-th width="120" align="center" class="th">操作</uni-th>
               </uni-tr>
               <uni-tr v-for="(item, index) in tableData" :key="index" class="table-row"
                  :class="{ 'hover-effect': isHoveringRow === index }" @mouseenter="isHoveringRow = index"
                  @mouseleave="isHoveringRow = -1">
                  <uni-td align="center">
                     {{ index + 1 }}
                  </uni-td>
                  <uni-td align="center">
                     <input class="form-input" disabled="true" type="text" v-model="item.fstand" />
                  </uni-td>
                  <uni-td align="center">
                     <span class="result-badge"
                        :class="{ 'pass': item.fcheckResu === 'OK', 'fail': item.fcheckResu === 'NG' }">
    <!-- 检验结果表格卡片 -->
    <view class="table-card">
      <view class="table-title">
        <view class="title-icon">📊</view>
        <span>检验结果列表</span>
      </view>
      <view class="list-container">
        <uni-table ref="table" border emptyText="暂无更多数据">
          <uni-tr>
            <uni-th align="center" class="th" width="80">编号</uni-th>
            <uni-th align="center" class="th" width="120">判定标识</uni-th>
            <uni-th align="center" class="th" width="100">检验结果</uni-th>
            <uni-th align="center" class="th" width="120">操作</uni-th>
          </uni-tr>
          <uni-tr v-for="(item, index) in tableData" :key="index" :class="{ 'hover-effect': isHoveringRow === index }"
                  class="table-row" @mouseenter="isHoveringRow = index"
                  @mouseleave="isHoveringRow = -1">
            <uni-td align="center">
              {{ index + 1 }}
            </uni-td>
            <uni-td align="center">
              <input v-model="item.fstand" class="form-input" disabled="true" type="text"/>
            </uni-td>
            <uni-td align="center">
                     <span :class="{ 'pass': item.fcheckResu === 'OK', 'fail': item.fcheckResu === 'NG' }"
                    class="result-badge">
                        {{ item.fcheckResu || '未检验' }}
                     </span>
                  </uni-td>
                  <uni-td align="center">
                     <view class="action-group">
                        <button :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]"
                           v-if="isNumber" @click="toDetail(item)" :disabled="isLoading">
                           {{ isLoading ? '处理中...' : '修改' }}
                        </button>
                        <button :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]"
                           v-if="!isNumber" @click="numberEdit(item)" :disabled="isLoading">
                           {{ isLoading ? '处理中...' : editResult(item.fcheckResu) }}
                        </button>
                     </view>
                  </uni-td>
               </uni-tr>
            </uni-table>
         </view>
      </view>
            </uni-td>
            <uni-td align="center">
              <view class="action-group">
                <button v-if="isNumber"
                        :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading" @click="toDetail(item)">
                  {{ isLoading ? '处理中...' : '修改' }}
                </button>
                <button v-if="!isNumber"
                        :class="['action-btn', 'btn-sm', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading" @click="numberEdit(item)">
                  {{ isLoading ? '处理中...' : editResult(item.fcheckResu) }}
                </button>
              </view>
            </uni-td>
          </uni-tr>
        </uni-table>
      </view>
    </view>
      <!-- 操作按钮 -->
      <view class="action-buttons">
         <view class="button-group">
            <button :class="['action-btn', 'btn-warn', { 'btn-disabled': isLoading }]" @click="saveRemarks"
               :disabled="isLoading">
               {{ isLoading ? '处理中...' : '添加不合格描述' }}
            </button>
         </view>
      </view>
    <!-- 操作按钮 -->
    <view class="action-buttons">
      <view class="button-group">
        <button :class="['action-btn', 'btn-warn', { 'btn-disabled': isLoading }]" :disabled="isLoading"
                @click="saveRemarks">
          {{ isLoading ? '处理中...' : '添加不合格描述' }}
        </button>
      </view>
    </view>
      <!-- 修改检验结果弹出层 -->
      <view v-if="showPopup" class="overlay active">
         <view class="popup" :class="{ 'popup-scale': isPopupAnimated }" @animationend="isPopupAnimated = false">
            <view class="popup-header">
               <h3 class="popup-title">修改检验结果</h3>
               <view class="close-btn" @click="showPopup = !showPopup">×</view>
            </view>
            <form :modelValue="editData">
               <view class="form-group">
                  <label class="form-label">检验结果:</label>
                  <input class="form-input" type="text" v-model="editData.fcheckResu" />
               </view>
               <view class="button-group">
                  <button :class="['action-btn', 'btn-warn', { 'btn-loading': isEditLoading }]" @click="eidt"
                     :disabled="isEditLoading">
                     {{ isEditLoading ? '修改中...' : '修改' }}
                  </button>
                  <button @click="showPopup = !showPopup">
                     取消
                  </button>
               </view>
            </form>
         </view>
      </view>
    <!-- 修改检验结果弹出层 -->
    <view v-if="showPopup" class="overlay active">
      <view :class="{ 'popup-scale': isPopupAnimated }" class="popup" @animationend="isPopupAnimated = false">
        <view class="popup-header">
          <h3 class="popup-title">修改检验结果</h3>
          <view class="close-btn" @click="showPopup = !showPopup">×</view>
        </view>
        <form :modelValue="editData">
          <view class="form-group">
            <label class="form-label">检验结果:</label>
            <input v-model="editData.fcheckResu" class="form-input" type="text"/>
          </view>
          <view class="button-group">
            <button :class="['action-btn', 'btn-warn', { 'btn-loading': isEditLoading }]" :disabled="isEditLoading"
                    @click="eidt">
              {{ isEditLoading ? '修改中...' : '修改' }}
            </button>
            <button @click="showPopup = !showPopup">
              取消
            </button>
          </view>
        </form>
      </view>
    </view>
      <!-- 修改不合格描述弹出层 -->
      <view v-if="remarksPopup" class="overlay active">
         <view class="popup" :class="{ 'popup-scale': isPopupAnimated }" @animationend="isPopupAnimated = false">
            <view class="popup-header">
               <h3 class="popup-title">修改不合格描述</h3>
               <view class="close-btn" @click="remarksPopup = !remarksPopup">×</view>
            </view>
            <form>
               <view class="form-group">
                  <label class="form-label">不合格描述:</label>
                  <input class="form-input" type="text" v-model="remarks" />
               </view>
               <view class="button-group">
                  <button :class="['action-btn', 'btn-warn', { 'btn-loading': isRemarksLoading }]"
                     @click="editRemarks" :disabled="isRemarksLoading">
                     {{ isRemarksLoading ? '保存中...' : '修改' }}
                  </button>
                  <button @click="remarksPopup = !remarksPopup">
                     取消
                  </button>
               </view>
            </form>
         </view>
      </view>
   </view>
    <!-- 修改不合格描述弹出层 -->
    <view v-if="remarksPopup" class="overlay active">
      <view :class="{ 'popup-scale': isPopupAnimated }" class="popup" @animationend="isPopupAnimated = false">
        <view class="popup-header">
          <h3 class="popup-title">修改不合格描述</h3>
          <view class="close-btn" @click="remarksPopup = !remarksPopup">×</view>
        </view>
        <form>
          <view class="form-group">
            <label class="form-label">不合格描述:</label>
            <input v-model="remarks" class="form-input" type="text"/>
          </view>
          <view class="button-group">
            <button :class="['action-btn', 'btn-warn', { 'btn-loading': isRemarksLoading }]"
                    :disabled="isRemarksLoading" @click="editRemarks">
              {{ isRemarksLoading ? '保存中...' : '修改' }}
            </button>
            <button @click="remarksPopup = !remarksPopup">
              取消
            </button>
          </view>
        </form>
      </view>
    </view>
  </view>
</template>
<script>
   export default {
      data() {
         return {
            formData: {},
            releaseNo: "",
            isNumber: false,
            checkItem: "",
            id: 0,
            gid: 0,
            billNo: "",
            showPopup: false,
            editData: {},
            tableData: [],
            remarks: "",
            remarksPopup: false,
            fcheckResuK: "",
            isLoading: false,
            isEditLoading: false,
            isRemarksLoading: false,
            isHoveringRow: -1,
            isPopupAnimated: false
         };
      },
      methods: {
         editResult(fcheckResu) {
            if (fcheckResu == "OK") {
               return "改为不合格";
            } else {
               return "改为合格";
            }
         },
         submit() {
            this.isLoading = true;
            let count = this.formData.checkQyt;
            let fstand = "√";
            if (Number(this.formData.fupAllow) && Number(this.formData.fdownAllow)) {
               if (!this.fcheckResuK) {
                  this.$showMessage("请输入检验值");
                  this.isLoading = false;
                  return;
               }
               if (
                  Number(this.fcheckResuK) >= Number(this.formData.fdownAllow) &&
                  Number(this.fcheckResuK) <= Number(this.formData.fupAllow)
               ) {
                  fstand = "√";
               } else {
                  fstand = "×";
               }
               count = 1;
            } else {
               if (!this.fcheckResuK) {
                  this.formData.fcheckResu = 1;
               }
               if (this.fcheckResuK == 0 || this.fcheckResuK == 1) {
                  this.formData.isPass = this.fcheckResuK;
               } else {
                  this.$showMessage("无标准值时,检验结果只能为0或1!");
                  this.isLoading = false;
                  return;
               }
               count = count - this.tableData.length;
            }
            this.formData.updater = this.$loginInfo.account;
            this.$post({
               url: "/LLJ/SetQSItemDetail",
               data: {
                  mainId: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  fstand: fstand,
                  fcheckResu: this.fcheckResuK,
                  LastupdateBy: this.$loginInfo.account,
                  count: count
               }
            }).then((res) => {
               this.formData.fcheckResu = null;
               this.$showMessage("保存成功");
               this.refreshResult();
               this.isLoading = false;
            }).catch(() => {
               this.$showMessage("保存失败,请重试");
               this.isLoading = false;
            });
         },
         refreshResult() {
            this.isLoading = true;
            this.$post({
               url: "/MesOqcItemsDetect02/getXjDetail02ById",
               data: {
                  id: this.id
               }
            }).then((res) => {
               this.formData = res.data.tbBillList.itemXj01;
               this.tableData = res.data.tbBillList.itemXj02s;
               if (this.formData.fupAllow && this.formData.fdownAllow && this.formData.fstand) {
                  this.isNumber = true;
               } else {
                  this.isNumber = false;
               }
               this.isLoading = false;
            }).catch(() => {
               this.$showMessage("获取数据失败");
               this.isLoading = false;
            });
         },
         toDetail(item) {
            this.showPopup = true;
            this.editData = {
               ...item
            };
         },
         eidt() {
            this.isEditLoading = true;
            if (!this.editData.fcheckResu) {
               this.$showMessage("请输入检验结果");
               this.isEditLoading = false;
               return;
            }
            if (this.formData.fcheckResu == this.editData.fcheckResu) {
               this.$showMessage("修改成功");
               this.showPopup = false;
               this.isEditLoading = false;
               return;
            }
            let fstand = "√";
            if (this.formData.fupAllow && this.formData.fdownAllow) {
               if (!this.editData.fcheckResu) {
                  this.$showMessage("请输入检验值");
                  this.isEditLoading = false;
                  return;
               }
               if (
                  Number(this.editData.fcheckResu) >= Number(this.formData.fdownAllow) &&
                  Number(this.editData.fcheckResu) <= Number(this.formData.fupAllow)
               ) {
                  this.editData.isPass = 1;
                  fstand = "√";
               } else {
                  this.editData.isPass = 0;
                  fstand = "×";
               }
            } else {
               if (!this.editData.fcheckResu) {
                  this.editData.fcheckResu = 1;
               }
               if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
                  if (this.editData.fcheckResu == 0) {
                     fstand = "×";
                  }
               } else {
                  this.$showMessage("无标准值时,检验结果只能为0或1!");
                  this.isEditLoading = false;
                  return;
               }
            }
            this.editData.updater = this.$loginInfo.account;
            this.$post({
               url: "/MesOqcItemsDetect02/UpdateQSItemDetail",
               data: {
                  id: this.editData.id,
                  mainId: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  fstand: fstand,
                  fcheckResu: this.editData.fcheckResu,
                  lastupdateBy: this.$loginInfo.account
               }
            }).then((res) => {
               this.showPopup = false;
               this.$showMessage("修改成功");
               this.refreshResult();
               this.isEditLoading = false;
            }).catch(() => {
               this.$showMessage("修改失败,请重试");
               this.isEditLoading = false;
            });
         },
         numberEdit(item) {
            this.isLoading = true;
            let fstand = "√";
            let fcheckResu = "OK";
            if (item.fcheckResu == "OK") {
               fstand = "×";
               fcheckResu = "NG";
            }
            this.$post({
               url: "/MesOqcItemsDetect02/UpdateQSItemDetail",
               data: {
                  id: item.id,
                  mainId: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  fstand: fstand,
                  fcheckResu: fcheckResu,
                  lastupdateBy: this.$loginInfo.account
               }
            }).then((res) => {
               this.$showMessage("修改成功");
               this.refreshResult();
               this.isLoading = false;
            }).catch(() => {
               this.$showMessage("修改失败,请重试");
               this.isLoading = false;
            });
         },
         saveRemarks() {
            this.remarksPopup = true;
            this.remarks = this.formData.remarks || "";
         },
         editRemarks() {
            this.isRemarksLoading = true;
            if (this.remarks) {
               this.$post({
                  url: "/MesOqcItemsDetect02/saveRemarksPid",
                  data: {
                     pid: this.formData.id,
                     remarks: this.remarks
                  }
               }).then((res) => {
                  if (res.data.tbBillList > 0) {
                     this.formData.remarks = this.remarks;
                     this.remarksPopup = false;
                     this.$showMessage("保存成功");
                  } else {
                     this.$showMessage("保存失败");
                  }
                  this.isRemarksLoading = false;
               }).catch(() => {
                  this.$showMessage("保存失败,请重试");
                  this.isRemarksLoading = false;
               });
            } else {
               this.$showMessage("请输入不合格描述");
               this.isRemarksLoading = false;
            }
         }
      },
      onLoad(options) {
         let params = options;
         this.id = params["mainId"];
         this.releaseNo = params["releaseNo"];
         this.refreshResult();
      }
   };
export default {
  data() {
    return {
      formData: {},
      releaseNo: "",
      isNumber: false,
      checkItem: "",
      id: 0,
      gid: 0,
      billNo: "",
      showPopup: false,
      editData: {},
      tableData: [],
      remarks: "",
      remarksPopup: false,
      fcheckResuK: "",
      isLoading: false,
      isEditLoading: false,
      isRemarksLoading: false,
      isHoveringRow: -1,
      isPopupAnimated: false
    };
  },
  methods: {
    editResult(fcheckResu) {
      if (fcheckResu == "OK") {
        return "改为不合格";
      } else {
        return "改为合格";
      }
    },
    submit() {
      this.isLoading = true;
      let count = this.formData.checkQyt;
      let fstand = "√";
      if (Number(this.formData.fupAllow) && Number(this.formData.fdownAllow)) {
        if (!this.fcheckResuK) {
          this.$showMessage("请输入检验值");
          this.isLoading = false;
          return;
        }
        if (
            Number(this.fcheckResuK) >= Number(this.formData.fdownAllow) &&
            Number(this.fcheckResuK) <= Number(this.formData.fupAllow)
        ) {
          fstand = "√";
        } else {
          fstand = "×";
        }
        count = 1;
      } else {
        if (!this.fcheckResuK) {
          this.formData.fcheckResu = 1;
        }
        if (this.fcheckResuK == 0 || this.fcheckResuK == 1) {
          this.formData.isPass = this.fcheckResuK;
        } else {
          this.$showMessage("无标准值时,检验结果只能为0或1!");
          this.isLoading = false;
          return;
        }
        count = count - this.tableData.length;
      }
      this.formData.updater = this.$loginInfo.account;
      this.$post({
        url: "/LLJ/SetQSItemDetail",
        data: {
          mainId: this.formData.id,
          releaseNo: this.formData.releaseNo,
          fstand: fstand,
          fcheckResu: this.fcheckResuK,
          LastupdateBy: this.$loginInfo.account,
          count: count
        }
      }).then((res) => {
        this.formData.fcheckResu = null;
        this.$showMessage("保存成功");
        this.refreshResult();
        this.isLoading = false;
      }).catch(() => {
        this.$showMessage("保存失败,请重试");
        this.isLoading = false;
      });
    },
    refreshResult() {
      this.isLoading = true;
      this.$post({
        url: "/MesOqcItemsDetect02/getXjDetail02ById",
        data: {
          id: this.id
        }
      }).then((res) => {
        this.formData = res.data.tbBillList.itemXj01;
        this.tableData = res.data.tbBillList.itemXj02s;
        if (this.formData.fupAllow && this.formData.fdownAllow && this.formData.fstand) {
          this.isNumber = true;
        } else {
          this.isNumber = false;
        }
        this.isLoading = false;
      }).catch(() => {
        this.$showMessage("获取数据失败");
        this.isLoading = false;
      });
    },
    toDetail(item) {
      this.showPopup = true;
      this.editData = {
        ...item
      };
    },
    eidt() {
      this.isEditLoading = true;
      if (!this.editData.fcheckResu) {
        this.$showMessage("请输入检验结果");
        this.isEditLoading = false;
        return;
      }
      if (this.formData.fcheckResu == this.editData.fcheckResu) {
        this.$showMessage("修改成功");
        this.showPopup = false;
        this.isEditLoading = false;
        return;
      }
      let fstand = "√";
      if (this.formData.fupAllow && this.formData.fdownAllow) {
        if (!this.editData.fcheckResu) {
          this.$showMessage("请输入检验值");
          this.isEditLoading = false;
          return;
        }
        if (
            Number(this.editData.fcheckResu) >= Number(this.formData.fdownAllow) &&
            Number(this.editData.fcheckResu) <= Number(this.formData.fupAllow)
        ) {
          this.editData.isPass = 1;
          fstand = "√";
        } else {
          this.editData.isPass = 0;
          fstand = "×";
        }
      } else {
        if (!this.editData.fcheckResu) {
          this.editData.fcheckResu = 1;
        }
        if (this.editData.fcheckResu == 0 || this.editData.fcheckResu == 1) {
          if (this.editData.fcheckResu == 0) {
            fstand = "×";
          }
        } else {
          this.$showMessage("无标准值时,检验结果只能为0或1!");
          this.isEditLoading = false;
          return;
        }
      }
      this.editData.updater = this.$loginInfo.account;
      this.$post({
        url: "/MesOqcItemsDetect02/UpdateQSItemDetail",
        data: {
          id: this.editData.id,
          mainId: this.formData.id,
          releaseNo: this.formData.releaseNo,
          fstand: fstand,
          fcheckResu: this.editData.fcheckResu,
          lastupdateBy: this.$loginInfo.account
        }
      }).then((res) => {
        this.showPopup = false;
        this.$showMessage("修改成功");
        this.refreshResult();
        this.isEditLoading = false;
      }).catch(() => {
        this.$showMessage("修改失败,请重试");
        this.isEditLoading = false;
      });
    },
    numberEdit(item) {
      this.isLoading = true;
      let fstand = "√";
      let fcheckResu = "OK";
      if (item.fcheckResu == "OK") {
        fstand = "×";
        fcheckResu = "NG";
      }
      this.$post({
        url: "/MesOqcItemsDetect02/UpdateQSItemDetail",
        data: {
          id: item.id,
          mainId: this.formData.id,
          releaseNo: this.formData.releaseNo,
          fstand: fstand,
          fcheckResu: fcheckResu,
          lastupdateBy: this.$loginInfo.account
        }
      }).then((res) => {
        this.$showMessage("修改成功");
        this.refreshResult();
        this.isLoading = false;
      }).catch(() => {
        this.$showMessage("修改失败,请重试");
        this.isLoading = false;
      });
    },
    saveRemarks() {
      this.remarksPopup = true;
      this.remarks = this.formData.remarks || "";
    },
    editRemarks() {
      this.isRemarksLoading = true;
      if (this.remarks) {
        this.$post({
          url: "/MesOqcItemsDetect02/saveRemarksPid",
          data: {
            pid: this.formData.id,
            remarks: this.remarks
          }
        }).then((res) => {
          if (res.data.tbBillList > 0) {
            this.formData.remarks = this.remarks;
            this.remarksPopup = false;
            this.$showMessage("保存成功");
          } else {
            this.$showMessage("保存失败");
          }
          this.isRemarksLoading = false;
        }).catch(() => {
          this.$showMessage("保存失败,请重试");
          this.isRemarksLoading = false;
        });
      } else {
        this.$showMessage("请输入不合格描述");
        this.isRemarksLoading = false;
      }
    }
  },
  onLoad(options) {
    let params = options;
    this.id = params["mainId"];
    this.releaseNo = params["releaseNo"];
    this.refreshResult();
  }
};
</script>
<style>
   /* 页面容器 */
   .page-container {
      padding: 20px;
      background-color: #f5f5f5;
      min-height: 100vh;
   }
/* 页面容器 */
.page-container {
  padding: 20px;
  background-color: #f5f5f5;
  min-height: 100vh;
}
   /* 表单卡片 */
   .form-card {
      background-color: #fff;
      border-radius: 12px;
      padding: 20px;
      margin-bottom: 20px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
   }
/* 表单卡片 */
.form-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
   /* 表单标题 */
   .form-title {
      display: flex;
      align-items: center;
      font-size: 18px;
      color: #333;
      margin-bottom: 15px;
   }
/* 表单标题 */
.form-title {
  display: flex;
  align-items: center;
  font-size: 18px;
  color: #333;
  margin-bottom: 15px;
}
   .title-icon {
      font-size: 22px;
      margin-right: 10px;
   }
.title-icon {
  font-size: 22px;
  margin-right: 10px;
}
   /* 表单容器 */
   .form-container {
      padding-top: 10px;
   }
/* 表单容器 */
.form-container {
  padding-top: 10px;
}
   /* 表单模块标题 */
   .form-section {
      margin-bottom: 20px;
   }
/* 表单模块标题 */
.form-section {
  margin-bottom: 20px;
}
   .section-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
      margin-bottom: 10px;
   }
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}
   /* 表格布局 */
   .form-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 15px;
   }
/* 表格布局 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
   /* 表单项 */
   .form-group {
      display: flex;
      align-items: center;
   }
/* 表单项 */
.form-group {
  display: flex;
  align-items: center;
}
   .form-label {
      width: 130px;
      color: #333;
      font-size: 14px;
      font-weight: 500;
   }
.form-label {
  width: 130px;
  color: #333;
  font-size: 14px;
  font-weight: 500;
}
   .form-input {
      flex: 1;
      height: 40px;
      padding: 0 10px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      background-color: #f8f8f8;
      color: #666;
      font-size: 14px;
   }
.form-input {
  flex: 1;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: #f8f8f8;
  color: #666;
  font-size: 14px;
}
   .form-input:disabled {
      background-color: #e9e9e9;
   }
.form-input:disabled {
  background-color: #e9e9e9;
}
   .form-input:focus {
      border-color: #007AFF;
      outline: none;
   }
.form-input:focus {
  border-color: #007AFF;
  outline: none;
}
   /* 检验结果区域 */
   .tip-group {
      margin-top: 15px;
   }
/* 检验结果区域 */
.tip-group {
  margin-top: 15px;
}
   .tip-box {
      display: flex;
      align-items: center;
      background-color: #fff5d1;
      padding: 10px;
      border-radius: 8px;
      border: 1px solid #f0e0a7;
   }
.tip-box {
  display: flex;
  align-items: center;
  background-color: #fff5d1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #f0e0a7;
}
   .tip-icon {
      font-size: 20px;
      color: #f39c12;
      margin-right: 10px;
   }
.tip-icon {
  font-size: 20px;
  color: #f39c12;
  margin-right: 10px;
}
   .tip-text {
      font-size: 14px;
      color: #333;
   }
.tip-text {
  font-size: 14px;
  color: #333;
}
   .highlight {
      color: #007AFF;
      font-weight: 600;
   }
.highlight {
  color: #007AFF;
  font-weight: 600;
}
   /* 按钮样式 */
   .action-btn {
      width: 100%;
      padding: 12px;
      border-radius: 8px;
      border: none;
      color: #fff;
      font-size: 16px;
      font-weight: 500;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background-color 0.3s ease;
   }
/* 按钮样式 */
.action-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
   .btn-primary {
      background-color: #007AFF;
   }
.btn-primary {
  background-color: #007AFF;
}
   .btn-primary:hover {
      background-color: #0056CC;
   }
.btn-primary:hover {
  background-color: #0056CC;
}
   .btn-warn {
      background-color: #f1b344;
   }
.btn-warn {
  background-color: #f1b344;
}
   .btn-warn:hover {
      background-color: #e6a135;
   }
.btn-warn:hover {
  background-color: #e6a135;
}
   .btn-disabled {
      background-color: #c0c0c0;
      cursor: not-allowed;
   }
.btn-disabled {
  background-color: #c0c0c0;
  cursor: not-allowed;
}
   /* 弹出层样式 */
   .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;
      opacity: 0;
      transition: opacity 0.3s ease;
   }
/* 弹出层样式 */
.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;
  opacity: 0;
  transition: opacity 0.3s ease;
}
   .overlay.active {
      opacity: 1;
   }
.overlay.active {
  opacity: 1;
}
   .popup {
      background-color: #fff;
      border-radius: 12px;
      width: 90%;
      max-width: 500px;
      padding: 20px;
      transform: scale(0.8);
      transition: transform 0.3s ease;
   }
.popup {
  background-color: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  padding: 20px;
  transform: scale(0.8);
  transition: transform 0.3s ease;
}
   .popup-scale {
      transform: scale(1);
   }
.popup-scale {
  transform: scale(1);
}
   .popup-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
   }
.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
   .popup-title {
      font-size: 16px;
      font-weight: 600;
      color: #333;
   }
.popup-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}
   .close-btn {
      font-size: 20px;
      color: #333;
      cursor: pointer;
   }
.close-btn {
  font-size: 20px;
  color: #333;
  cursor: pointer;
}
   /* 操作按钮组 */
   .button-group {
      display: flex;
      justify-content: space-between;
      margin-top: 20px;
   }
/* 操作按钮组 */
.button-group {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}
   .button-group button {
      width: 48%;
      padding: 10px;
      border-radius: 8px;
      border: none;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
   }
.button-group button {
  width: 48%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
   /* 检验结果表格卡片 */
   .table-card {
      background-color: #fff;
      border-radius: 12px;
      padding: 20px;
      margin-bottom: 20px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
   }
/* 检验结果表格卡片 */
.table-card {
  background-color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
   /* 表格标题 */
   .table-title {
      display: flex;
      align-items: center;
      font-size: 16px;
      color: #333;
      font-weight: 600;
      margin-bottom: 15px;
   }
/* 表格标题 */
.table-title {
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #333;
  font-weight: 600;
  margin-bottom: 15px;
}
   .title-icon {
      font-size: 22px;
      margin-right: 10px;
   }
.title-icon {
  font-size: 22px;
  margin-right: 10px;
}
   /* 表格样式 */
   .uni-table {
      width: 100%;
      border-collapse: collapse;
   }
/* 表格样式 */
.uni-table {
  width: 100%;
  border-collapse: collapse;
}
   .uni-th,
   .uni-td {
      padding: 12px;
      text-align: center;
   }
.uni-th,
.uni-td {
  padding: 12px;
  text-align: center;
}
   .uni-th {
      background-color: #f5f5f5;
      font-size: 14px;
      color: #666;
      font-weight: 500;
   }
.uni-th {
  background-color: #f5f5f5;
  font-size: 14px;
  color: #666;
  font-weight: 500;
}
   .table-row {
      background-color: #fff;
      border-bottom: 1px solid #e0e0e0;
   }
.table-row {
  background-color: #fff;
  border-bottom: 1px solid #e0e0e0;
}
   .table-row:hover {
      background-color: #f9f9f9;
   }
.table-row:hover {
  background-color: #f9f9f9;
}
   .result-badge {
      padding: 5px 12px;
      font-size: 12px;
      border-radius: 10px;
      color: #fff;
      display: inline-block;
   }
.result-badge {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 10px;
  color: #fff;
  display: inline-block;
}
   .pass {
      background-color: #28a745;
   }
.pass {
  background-color: #28a745;
}
   .fail {
      background-color: #dc3545;
   }
.fail {
  background-color: #dc3545;
}
   .pending {
      background-color: #f1b344;
   }
.pending {
  background-color: #f1b344;
}
   .action-group {
      display: flex;
      gap: 10px;
   }
.action-group {
  display: flex;
  gap: 10px;
}
   .action-btn.btn-sm {
      width: auto;
      padding: 6px 12px;
      font-size: 12px;
   }
.action-btn.btn-sm {
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
}
   /* 提示信息 */
   .hover-effect:hover {
      background-color: #f9f9f9;
   }
/* 提示信息 */
.hover-effect:hover {
  background-color: #f9f9f9;
}
   .btn-sm {
      font-size: 14px;
   }
.btn-sm {
  font-size: 14px;
}
   .btn-loading {
      background-color: #c0c0c0;
      cursor: not-allowed;
   }
.btn-loading {
  background-color: #c0c0c0;
  cursor: not-allowed;
}
/* 三个模块并列容器样式 */
.three-modules-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}
/* 模块项样式 */
.module-item {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #e0e0e0;
}
.module-header {
  border-bottom: 1px solid #d0d0d0;
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.module-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
/* 手机屏幕优化 */
@media (max-width: 768px) {
  .page-container {
    padding: 10px;
  }
  .form-card, .table-card {
    padding: 15px;
    border-radius: 8px;
  }
  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .form-group {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-label {
    width: auto;
    margin-bottom: 5px;
    font-size: 13px;
  }
  .form-input {
    width: 100%;
    height: 36px;
    font-size: 13px;
  }
  .three-modules-container {
    gap: 12px;
  }
  .module-item {
    padding: 12px;
  }
  .module-title {
    font-size: 14px;
  }
  .tip-box {
    padding: 8px;
  }
  .tip-text {
    font-size: 13px;
  }
}
/* 超小屏幕优化 */
@media (max-width: 480px) {
  .page-container {
    padding: 8px;
  }
  .form-card, .table-card {
    padding: 12px;
  }
  .form-input {
    height: 34px;
    font-size: 12px;
  }
  .form-label {
    font-size: 12px;
  }
  .action-btn {
    padding: 10px;
    font-size: 14px;
  }
}
</style>