xwt
2025-06-09 6bf8209f8bdfe138d5282059eef765324909f2fd
pages/QC/LLJ/Add.vue
@@ -4,9 +4,10 @@
      <view class="sheet-header">
         <h1>来料检验单</h1>
         <view class="inspection-number">检验单号:{{formData.releaseNo}}</view>
         <!-- 造梦者特殊功能 -->
         <view style="text-align: right;" v-if="this.current"><a class="sysLike"
               @click="toSysSubmitFrom(formData.releaseNo)">实验室送检</a></view>
         <!--实验室送检 -->
         <view style="text-align: right;" class="action-buttons">
            <a class="sysLike" v-if="this.current" @click="toSysSubmitFrom(formData.releaseNo)">实验室送检</a>
         </view>
      </view>
      <!-- 基本信息区 -->
@@ -88,26 +89,48 @@
         </select>
      </view>
      <view class="dropdown-row">
         <view class="info-label">备注:</view>
         <input type="text" id="remark" v-model="REMARK" placeholder="请输入备注信息" />
      <view class="info-block" style="margin-top: 10px;">
          <view class="info-label">备注:</view>
          <input type="text" id="lotNo1" v-model="formData.lotNo1"
                             placeholder="请输入备注信息"
                             style="color: red; font-weight: bold;"/>
      </view>
      <!-- 操作按钮区 -->
      <view class="action-buttons" v-if="this.current">
         <button class="secondary-btn" @click="getInspectionItems">获取检验项目</button>
      </view>
                  <button class="secondary-btn" @click="openPermissionModal">权限管理</button>
                  <button v-if="hasEmergencyPermission" class="secondary-btn" @click="handleEmergencyRelease">紧急放行</button>
                  <button v-if="hasEmergencyPermission" class="secondary-btn" @click="handleWithdraw">撤回</button>
                  <button class="secondary-btn" @click="getInspectionItems">获取检验项目</button>
              </view>
      <!-- 权限分配模态框 -->
              <view v-if="permissionModalVisible" class="overlay">
                  <view class="popup">
                      <h3>权限分配</h3>
                      <form>
                          <view class="form-group">
                              <label class="form-label">分配权限的账号:</label>
                              <input class="form-input" type="text" v-model="permissionAccount" />
                          </view>
                      </form>
                      <button class="updateBut" @click="savePermission">保存</button>
                      <button @click="permissionModalVisible = false">取消</button>
                  </view>
              </view>
      <!-- 检验项目表格 -->
      <view class="inspection-table">
         <table>
            <thead>
               <tr>
                  <th width="15%" style="text-align: center;">检验项目</th>
                  <th width="20%" style="text-align: center;">检验项目</th>
                  <th width="50%" style="text-align: center;">检验描述</th>
                  <th width="20%" style="text-align: center;">记录(点击)</th>
                  <th width="15%" style="text-align: center;">记录(点击)</th>
               </tr>
            </thead>
            <tbody>
@@ -129,6 +152,7 @@
                     <button v-if="item.current" class="record-btn" @click="fillRecord(item,index)">填写</button>
                     <button v-if="!item.current" class="record-btn" @click="fillRecord(item,index)">查看</button>
                  </td>
               </tr>
            </tbody>
         </table>
@@ -155,7 +179,8 @@
            <button @click="remarksPopup = !remarksPopup">取消</button>
         </view>
      </view>
      <view class="barcode">
         <u-modal :show="drawingShow" title="图纸明细" @confirm="drawingConfirm" @cancel="drawingCancel"
            showCancelButton>
@@ -183,8 +208,8 @@
            </uni-table>
         </u-modal>
      </view>
   </view>
</template>
<script>
@@ -207,10 +232,17 @@
               planQty: "",
               mocode: "",
               boardStyle: "",
               itemId: ""
               itemId: "",
               emergencyStatus: false,
               lotNo1: '',
               emergency:'',
               permissionModalVisible: false,
               permissionAccount: '',
               hasEmergencyPermission: false
            },
            tableData: [],
            remarksPopup: false,
            meomPopup: false,
            current: true,
            drawing: [],
            drawingShow: false,
@@ -220,7 +252,10 @@
            REMARK: '',
            checkState: false,
            writeStatu: true,
            fileName:''
            fileName:'',
            originalRemarks: '',
            hasEmergencyPermission: false,
         }
      },
      onLoad(options) {
@@ -232,6 +267,7 @@
            this.formData.releaseNo = params["releaseNo"];
            this.formData.lotNo = params["lotNo"];
            this.msgId = params["msgId"];
            this.emergency = params["emergency"]
            if (params["current"] === 'A') {
               this.current = true;
@@ -254,6 +290,7 @@
            });
         }
          if (this.$loginInfo.account === 'PL017') {this.hasEmergencyPermission = true;}
      },
      methods: {
@@ -306,6 +343,7 @@
               }
            });
         },
         fillRecord(item, index) {
            // 填写记录的逻辑
            uni.navigateTo({
@@ -508,7 +546,10 @@
            }).then(res => {
               let data = res.data.tbBillList[0];
               if (data) {
                  this.formData = data;
                  this.formData = {
                     ...data,
                     emergencyStatus: data.emergency
                  };
                  this.$post({
                     url: "/LLJ/getJYItem",
@@ -986,7 +1027,169 @@
            //       title: '无对应PDF文件,打开失败',
            //       icon: 'none'
            //    });            // }
         }
         },
         // 处理紧急放行
         handleEmergencyRelease() {
                     if (this.formData.emergencyStatus) {
                         uni.showModal({
                             title: "提示",
                             content: '该单已紧急放行,请勿重复操作',
                             showCancel: false
                         });
                         return;
                     }
                     uni.showModal({
                         title: '确认',
                         content: '确定要执行紧急放行吗?',
                         success: (res) => {
                             if (res.confirm) {
                                 // 调用新的后端接口
                                 this.$post({
                                     url: "/LLJ/EmergencyRelease",
                                     data: {
                                         id: this.formData.id
                                     }
                                 }).then(res => {
                                     if (res.data && res.status === 0) {
                                         const result = res.data.tbBillList[0];
                                         const message = res.data.tbBillList[1];
                                 const lotNo1 = res.data.tbBillList[2] || "";
                                         if (result === "0") {
                                             this.formData.emergencyStatus = true;
                                    this.originalLotNo1 = lotNo1;
                                    this.formData.lotNo1 = lotNo1;
                                             uni.showToast({
                                                 title: message || '紧急放行成功',
                                                 icon: 'success',
                                                 duration: 2000
                                             });
                                             this.init();
                                         } else {
                                             uni.showModal({
                                                 title: "提示",
                                                 content: message || '操作失败',
                                                 showCancel: false
                                             });
                                         }
                                     }
                                 }).catch(error => {
                                     uni.showModal({
                                         title: "错误",
                                         content: '网络错误,请检查网络连接',
                                         showCancel: false
                                     });
                                 });
                             }
                         }
                     });
                 },
                 // 处理撤回
                 handleWithdraw() {
                     uni.showModal({
                         title: '确认',
                         content: '确定要撤回紧急放行吗?',
                         success: (res) => {
                             if (res.confirm) {
                                 // 调用新的后端接口
                                 this.$post({
                                     url: "/LLJ/WithdrawEmergencyRelease",
                                     data: {
                                         id: this.formData.id
                                     }
                                 }).then(res => {
                                     if (res.data && res.status === 0) {
                                         const result = res.data.tbBillList[0];
                                         const message = res.data.tbBillList[1];
                                         if (result === "0") {
                                             this.formData.emergencyStatus = false;
                                             uni.showToast({
                                                 title: message || '撤回成功',
                                                 icon: 'success',
                                                 duration: 2000
                                             });
                                             this.init();
                                         } else {
                                             uni.showModal({
                                                 title: "提示",
                                                 content: message || '操作失败',
                                                 showCancel: false
                                             });
                                         }
                                     }
                                 }).catch(error => {
                                     uni.showModal({
                                         title: "错误",
                                         content: '网络错误,请检查网络连接',
                                         showCancel: false
                                     });
                                 });
                             }
                         }
                     });
                 },
               editRemarks() {
                           if (this.remarks) {
                               // 只保存修改的部分
                               const modifiedRemarks = this.remarks !== this.originalRemarks ? this.remarks : '';
                               this.$post({
                                   url: "/LLJ/saveRemarksGid",
                                   data: {
                                       gid: this.formData.id,
                                       remarks: modifiedRemarks,
                                       releaseNo: this.formData.releaseNo,
                                   }
                               }).then(res => {
                                   if (res.data.tbBillList > 0) {
                                       this.formData.remarks = this.remarks;
                                       this.originalRemarks = this.remarks; // 更新原始备注值
                                       this.remarksPopup = !this.remarksPopup;
                                       this.$showMessage("保存成功");
                                       setTimeout(() => {
                                           let pages = getCurrentPages();
                                           let beforePage = pages[pages.length - 2];
                                           uni.navigateBack({
                                               delta: 1, //返回的页面数,如果为1表示返回上一页
                                               success: (event) => {
                                                   beforePage.$vm.reload()
                                               }
                                           });
                                       }, 2000);
                                   }
                               })
                           } else {
                               this.$post({
                                   url: "/LLJ/saveRemarksGid",
                                   data: {
                                       gid: this.formData.id,
                                       remarks: '',
                                       releaseNo: this.formData.releaseNo,
                                   }
                               }).then(res => {
                                   if (res.data.tbBillList > 0) {
                                       this.formData.remarks = this.remarks;
                                       this.originalRemarks = this.remarks; // 更新原始备注值
                                       this.remarksPopup = !this.remarksPopup;
                                       this.$showMessage("保存成功");
                                       setTimeout(() => {
                                           let pages = getCurrentPages();
                                           let beforePage = pages[pages.length - 2];
                                           uni.navigateBack({
                                               delta: 1, //返回的页面数,如果为1表示返回上一页
                                               success: (event) => {
                                                   beforePage.$vm.reload()
                                               }
                                           });
                                       }, 2000);
                                   }
                               })
                           }
                       },
      }
   }
</script>
@@ -1080,12 +1283,9 @@
   }
   .sysLike {
      color: #3498db;
      color: #1890ff;
      text-decoration: none;
      margin-left: 15px;
      padding: 3px 8px;
      border-radius: 3px;
      font-size: 12px;
      cursor: pointer;
   }
   .doc-link:hover {
@@ -1126,13 +1326,31 @@
   /* 按钮样式 */
   .action-buttons {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 20px;
      margin: 15px 0;
      justify-content: flex-end;
   }
   .primary-btn,
   .secondary-btn {
      background-color: #ecf0f1;
      color: #7f8c8d;
      padding: 8px 15px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
   }
   .secondary-btn:hover {
      background-color: #d5dbdb;
   }
   .secondary-btn:disabled {
      background-color: #d9d9d9;
      cursor: not-allowed;
      opacity: 0.7;
   }
   .primary-btn {
      padding: 10px 20px;
      border: none;
      border-radius: 4px;
@@ -1141,22 +1359,8 @@
      transition: all 0.3s;
   }
   .primary-btn {
      background-color: #3498db;
      color: white;
   }
   .primary-btn:hover {
      background-color: #2980b9;
   }
   .secondary-btn {
      background-color: #ecf0f1;
      color: #7f8c8d;
   }
   .secondary-btn:hover {
      background-color: #d5dbdb;
   }
   .record-btn {