liulijun
12 小时以前 5270308151082506e0e6df2c72d278d2976ec860
ÏîÄ¿´úÂë/WCS/WCSClient/src/views/LineInfocopy.vue
@@ -5,96 +5,46 @@
      <img v-if="imgType === '1'" src="../../public/lines2.png" />
      <label v-if="equipNo" class="equip-no">{{ equipNo }}</label>
   </div>
   <el-dialog v-model="dialogVisible" title="输送线信息查看" :before-close="handleClose">
      <el-form ref="$form" :model="lineItemInfo" label-position="left" label-width="100px" size="medium">
         <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
            <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
               <el-form-item label="设备编号:">
                  <j-el-description :value="equipNo" type="primary" ellipsis></j-el-description>
               </el-form-item>
            </el-col>
            <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
               <el-form-item label="是否有盘:">
                  <j-el-description :value="lineItemInfo.inStock" type="primary" ellipsis></j-el-description>
               </el-form-item>
            </el-col>
         </el-row>
         <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
            <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
               <el-form-item label="任务号:">
                  <j-el-description :value="lineItemInfo.taskNum" type="primary" ellipsis></j-el-description>
               </el-form-item>
            </el-col>
            <el-col :span="12" :offset="0" :push="0" :pull="0" tag="div">
               <el-form-item label="报警代码:">
                  <j-el-description :value="lineItemInfo.alarm" type="primary" ellipsis></j-el-description>
               </el-form-item>
            </el-col>
         </el-row>
      </el-form><el-divider />
      <h4 style="margin-bottom: 20px;">手动操作</h4>
      <el-form ref="form" :model="form" label-width="100px">
         <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
            <el-col :span="16" :offset="0" :push="0" :pull="0" tag="div">
               <el-form-item label="ä»»  åŠ¡  å‘½  ä»¤" prop="TargetAddress">
                  <el-select size="large" v-model="form.TaskType" placeholder="请选择任务命令">
                     <el-option label="入库" value="1" />
                     <el-option label="出库" value="2" />
                  </el-select>
               </el-form-item>
            </el-col>
         </el-row>
         <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
            <el-col :span="16" :offset="0" :push="0" :pull="0" tag="div">
               <el-form-item label="下一目标地址:">
                  <el-input size="large" v-model="form.TargetAddress" placeholder="请输入下一目标地址" />
               </el-form-item>
            </el-col>
         </el-row>
      </el-form>
      <el-divider />
      <el-row :gutter="20" type="flex" justify="start" align="top" tag="div">
         <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
            <el-button type="primary" size="small" plain @click="SendCommand">
               <i class="el-icon-check">发送命令</i>
            </el-button>
         </el-col>
         <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
            <el-button type="warning" size="small" plain @click="ConveyorLineReset">
               <i class="el-icon-check">复位</i>
            </el-button>
         </el-col>
         <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
            <el-button type="danger" size="small" plain @click="ConveyorLineEmergencyStop">
               <i class="el-icon-check">停止</i>
            </el-button>
         </el-col>
         <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
            <el-button type="danger" size="small" plain @click="ConveyorLineReturn">
               <i class="el-icon-check">退回</i>
            </el-button>
         </el-col>
         <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
            <el-button type="danger" size="small" plain @click="ConveyorLineCancel">
               <i class="el-icon-check">取消任务</i>
            </el-button>
         </el-col>
         <el-col :span="4" :offset="0" :push="0" :pull="0" tag="div">
            <el-button type="danger" size="small" plain @click="ConveyorLineInitialize">
               <i class="el-icon-check">工位初始化</i>
            </el-button>
         </el-col>
      </el-row>
      <template #footer>
         <div class="dialog-footer">
            <el-button @click="dialogVisible = false">取消</el-button>
            <el-button type="primary" @click="dialogVisible = false">
               ç¡®è®¤
            </el-button>
   <el-dialog v-model="dialogVisible" :before-close="handleClose" width="520px" class="modern-dialog">
      <div class="dialog-header">
         <h3 class="dialog-title">输送线信息</h3>
      </div>
      <div class="dialog-content">
         <div class="info-list">
            <div class="info-item">
               <span class="item-label">设备编号</span>
               <span class="item-value">{{ equipNo || '无' }}</span>
            </div>
            <div class="info-item">
               <span class="item-label">任务号</span>
               <span class="item-value">{{ lineItemInfo.taskNum || '无' }}</span>
            </div>
            <div class="info-item">
               <span class="item-label">是否有盘</span>
               <span class="item-value">{{ lineItemInfo.inStock || '无' }}</span>
            </div>
            <div class="info-item">
               <span class="item-label">RFID</span>
               <span class="item-value">{{ lineItemInfo.rfid || '无' }}</span>
            </div>
            <div class="info-item">
               <span class="item-label">申请</span>
               <span class="item-value">{{ lineItemInfo.request || '无' }}</span>
            </div>
            <div class="info-item">
               <span class="item-label">申请反馈</span>
               <span class="item-value">{{ lineItemInfo.reresult || '无' }}</span>
            </div>
            <div class="info-item">
               <span class="item-label">纸卷幅宽</span>
               <span class="item-value">{{ lineItemInfo.width || '无' }}</span>
            </div>
            <div class="info-item">
               <span class="item-label">报警信息</span>
               <span class="item-value">{{ lineItemInfo.error || '无' }}</span>
            </div>
         </div>
      </template>
      </div>
   </el-dialog>
</template>
@@ -119,11 +69,11 @@
         default: "1",
      },
      positionX: {
         type: Int32Array,
         type: Number,
         default: 1,
      },
      positionY: {
         type: Int32Array,
         type: Number,
         default: 1,
      },
      url: {
@@ -136,144 +86,284 @@
      },
   },
   data() {
      return {
         left: "500px",
         top: "400px",
         dialogVisible: false,
         lineItemInfo: {
            inStock: "",
            taskNum: "",
            alarm: "",
         },
         form: {
            TaskType: "",
            TargetAddress: "",
            DeviceCode: "",
         },
      };
         return {
            left: "500px",
            top: "400px",
            dialogVisible: false,
            fullscreenLoading: false,
            isAlarm: false,
            lineItemInfo: {
               inStock: "",
               taskNum: "",
               rfid: "",
               width: "",
               request: "",
               reresult: "",
               error: "",
            },
            // ç”³è¯·åé¦ˆçŠ¶æ€è·Ÿè¸ª
            feedbackTracking: {
               currentTaskNum: "", // å½“前任务号
               hasFeedback: false, // æ˜¯å¦å·²åé¦ˆè¿‡
               lastFeedbackValue: "" // ä¸Šæ¬¡åé¦ˆçš„值
            },
            form: {
               TaskType: "",
               TargetAddress: "",
               DeviceCode: "",
            },
         };
   },
   mounted() {
      const axisX = (this.positionX - 1) * 40 + 100;
      const axisX = (this.positionX - 1) * 60 + 100;
      const axisY = (this.positionY - 1) + 50;
      this.$nextTick(() => {
         this.left = `${axisX}px`;
         this.top = `${axisY}px`;
      });
      // ç›‘听全局conveyorLineDetails的变化
      this.$watch(
         () => this.$root.conveyorLineDetails,
         () => {
            this.updateAlarmStatus();
         },
         { deep: true, immediate: true }
      );
      // å¼€å¯å®šæ—¶å™¨ï¼Œå®šæœŸæ£€æŸ¥æ•°æ®å˜åŒ–
      this.timer = setInterval(() => {
         this.updateAlarmStatus();
      }, 1000); // æ¯1秒检查一次
   },
   methods: {
      // æ›´æ–°æŠ¥è­¦çŠ¶æ€
      updateAlarmStatus() {
         const equipNoStr = String(this.equipNo);
         if (this.$root.conveyorLineDetails && this.$root.conveyorLineDetails[equipNoStr]) {
            const rawData = this.$root.conveyorLineDetails[equipNoStr];
            this.isAlarm = rawData.isAlarm || false;
            // èŽ·å–å½“å‰ä»»åŠ¡å·
            const currentTaskNum = rawData.taskNum || '无';
            // æ£€æŸ¥ä»»åŠ¡å·æ˜¯å¦å˜åŒ–
            if (currentTaskNum !== this.feedbackTracking.currentTaskNum) {
               // ä»»åŠ¡å·å˜åŒ–ï¼Œé‡ç½®åé¦ˆçŠ¶æ€
               this.feedbackTracking.currentTaskNum = currentTaskNum;
               this.feedbackTracking.hasFeedback = false;
               this.feedbackTracking.lastFeedbackValue = "";
            }
            // å¤„理申请反馈逻辑
            let reresultValue = rawData.reresult || '无';
            // å¦‚果收到了反馈值(非空非无)且还没有反馈过
            if ((reresultValue !== '无' && reresultValue !== '' && reresultValue !== undefined) && !this.feedbackTracking.hasFeedback) {
               // è®°å½•已反馈
               this.feedbackTracking.hasFeedback = true;
               this.feedbackTracking.lastFeedbackValue = reresultValue;
            }
            // å¦‚果已经反馈过,显示"已反馈"
            if (this.feedbackTracking.hasFeedback) {
               reresultValue = '已反馈';
            }
            // æ›´æ–°lineItemInfo数据
            this.lineItemInfo = {
               taskNum: currentTaskNum,
               inStock: rawData.inStock || '无',
               rfid: rawData.rfid || '无',
               width: rawData.width || '无',
               request: rawData.request || '无',
               reresult: reresultValue,
               error: rawData.error || '无',
            };
         } else {
            this.isAlarm = false;
            this.lineItemInfo = {
               taskNum: '',
               inStock: '',
               rfid: '',
               width: '',
               request: '',
               reresult: '',
               error: ''
            };
         }
      },
      // ç»„件销毁时清除定时器
      beforeUnmount() {
         if (this.timer) {
            clearInterval(this.timer);
         }
      },
      mouseClick() {
         this.fullscreenLoading = true;
         this.dialogVisible = true;
         // å¤„理点击事件
         this.http.post("api/DeviceInfo/GetConveyorLineInfo?DeviceChildCode=" + this.equipNo, null, "")
            .then((x) => {
               if (x.status) {
                  this.lineItemInfo = x.data;
               } else {
                  this.$message({
                     type: "error",
                     message: x.message,
                  });
               }
            });
         // ä»Žå…¨å±€å˜é‡ä¸­èŽ·å–è¾“é€çº¿è¯¦ç»†ä¿¡æ¯
         const equipNoStr = String(this.equipNo);
         if (this.$root.conveyorLineDetails && this.$root.conveyorLineDetails[equipNoStr]) {
            // å…ˆèŽ·å–åŽŸå§‹æ•°æ®
            const rawData = this.$root.conveyorLineDetails[equipNoStr];
            // èŽ·å–å½“å‰ä»»åŠ¡å·
            const currentTaskNum = rawData.taskNum || '无';
            // æ£€æŸ¥ä»»åŠ¡å·æ˜¯å¦å˜åŒ–ï¼ˆä¸ŽupdateAlarmStatus保持一致)
            if (currentTaskNum !== this.feedbackTracking.currentTaskNum) {
               this.feedbackTracking.currentTaskNum = currentTaskNum;
               this.feedbackTracking.hasFeedback = false;
               this.feedbackTracking.lastFeedbackValue = "";
            }
            // å¤„理申请反馈逻辑
            let reresultValue = rawData.reresult || '无';
            // å¦‚果收到了反馈值(非空非无)且还没有反馈过
            if ((reresultValue !== '无' && reresultValue !== '' && reresultValue !== undefined) && !this.feedbackTracking.hasFeedback) {
               this.feedbackTracking.hasFeedback = true;
               this.feedbackTracking.lastFeedbackValue = reresultValue;
            }
            // å¦‚果已经反馈过,显示"已反馈"
            if (this.feedbackTracking.hasFeedback) {
               reresultValue = '已反馈';
            }
            // å¤åˆ¶æ•°æ®åˆ°lineItemInfo(模板中绑定的对象)
            this.lineItemInfo = {
               taskNum: currentTaskNum,
               inStock: rawData.inStock || '无',
               rfid: rawData.rfid || '无',
               width: rawData.width || '无',
               request: rawData.request || '无',
               reresult: reresultValue,
               error: rawData.error || '无',
            };
            // ä¿å­˜æŠ¥è­¦çŠ¶æ€
            this.isAlarm = rawData.isAlarm || false;
         } else {
            // å¦‚果没有数据,使用默认值
            this.lineItemInfo = {
               taskNum: '',
               inStock: '',
               rfid: '',
               width: '',
               request: '',
               reresult: '',
               error: ''
            };
            this.isAlarm = false;
         }
         this.fullscreenLoading = false;
      },
      handleClose() {
         this.dialogVisible = false;
         this.fullscreenLoading = false;
      },
      SendCommand() {
         this.fullscreenLoading = true;
         this.form.DeviceCode=this.equipNo;
         this.http.post("api/DeviceInfo/ConveyorLineHandTask" ,this.form)
            .then((x) => {
               if (!x.status) {
                  this.$message.error(x.message);
               } else {
                  this.$Message.success(x.message);
               }
            })
            .finally(() => {
               this.fullscreenLoading = false;
            });
      },
      ConveyorLineReset() {
         this.fullscreenLoading = true;
         this.http.post("api/DeviceInfo/ConveyorLineReset?DeviceChildCode=" + this.equipNo, null, "")
            .then((x) => {
               if (!x.status) {
                  this.$message.error(x.message);
               } else {
                  this.$Message.success(x.message);
      // SendCommand() {
      //    this.fullscreenLoading = true;
      //    this.form.DeviceCode=this.equipNo;
      //    this.http.post("api/DeviceInfo/ConveyorLineHandTask" ,this.form)
      //       .then((x) => {
      //          if (!x.status) {
      //             this.$message.error(x.message);
      //          } else {
      //             this.$Message.success(x.message);
      //          }
      //       })
      //       .finally(() => {
      //          this.fullscreenLoading = false;
      //       });
      // },
      // ConveyorLineReset() {
      //    this.fullscreenLoading = true;
      //    this.http.post("api/DeviceInfo/ConveyorLineReset?DeviceChildCode=" + this.equipNo, null, "")
      //       .then((x) => {
      //          if (!x.status) {
      //             this.$message.error(x.message);
      //          } else {
      //             this.$Message.success(x.message);
               }
            })
            .finally(() => {
               this.fullscreenLoading = false;
            });
      },
      ConveyorLineEmergencyStop() {
         this.fullscreenLoading = true;
         this.http.post("api/DeviceInfo/ConveyorLineEmergencyStop?DeviceChildCode=" + this.equipNo, null, "")
            .then((x) => {
               if (!x.status) {
                  this.$message.error(x.message);
               } else {
                  this.$Message.success(x.message);
      //          }
      //       })
      //       .finally(() => {
      //          this.fullscreenLoading = false;
      //       });
      // },
      // ConveyorLineEmergencyStop() {
      //    this.fullscreenLoading = true;
      //    this.http.post("api/DeviceInfo/ConveyorLineEmergencyStop?DeviceChildCode=" + this.equipNo, null, "")
      //       .then((x) => {
      //          if (!x.status) {
      //             this.$message.error(x.message);
      //          } else {
      //             this.$Message.success(x.message);
               }
            })
            .finally(() => {
               this.fullscreenLoading = false;
            });
      },
      ConveyorLineReturn() {
         this.fullscreenLoading = true;
         this.http.post("api/DeviceInfo/ConveyorLineReturn?DeviceChildCode=" + this.equipNo, null, "")
            .then((x) => {
               if (!x.status) {
                  this.$message.error(x.message);
               } else {
                  this.$Message.success(x.message);
               }
            })
            .finally(() => {
               this.fullscreenLoading = false;
            });
      },
      ConveyorLineCancel() {
         this.fullscreenLoading = true;
         this.http.post("api/DeviceInfo/ConveyorLineCancel?DeviceChildCode=" + this.equipNo, null, "")
            .then((x) => {
               if (!x.status) {
                  this.$message.error(x.message);
               } else {
                  this.$Message.success(x.message);
               }
            })
            .finally(() => {
               this.fullscreenLoading = false;
            });
      },
      ConveyorLineInitialize() {
         this.fullscreenLoading = true;
         this.http.post("api/DeviceInfo/ConveyorLineInitialize?DeviceChildCode=" + this.equipNo, null, "")
            .then((x) => {
               if (!x.status) {
                  this.$message.error(x.message);
               } else {
                  this.$Message.success(x.message);
               }
            })
            .finally(() => {
               this.fullscreenLoading = false;
            });
      },
      //          }
      //       })
      //       .finally(() => {
      //          this.fullscreenLoading = false;
      //       });
      // },
      // ConveyorLineReturn() {
      //    this.fullscreenLoading = true;
      //    this.http.post("api/DeviceInfo/ConveyorLineReturn?DeviceChildCode=" + this.equipNo, null, "")
      //       .then((x) => {
      //          if (!x.status) {
      //             this.$message.error(x.message);
      //          } else {
      //             this.$Message.success(x.message);
      //          }
      //       })
      //       .finally(() => {
      //          this.fullscreenLoading = false;
      //       });
      // },
      // ConveyorLineCancel() {
      //    this.fullscreenLoading = true;
      //    this.http.post("api/DeviceInfo/ConveyorLineCancel?DeviceChildCode=" + this.equipNo, null, "")
      //       .then((x) => {
      //          if (!x.status) {
      //             this.$message.error(x.message);
      //          } else {
      //             this.$Message.success(x.message);
      //          }
      //       })
      //       .finally(() => {
      //          this.fullscreenLoading = false;
      //       });
      // },
      // ConveyorLineInitialize() {
      //    this.fullscreenLoading = true;
      //    this.http.post("api/DeviceInfo/ConveyorLineInitialize?DeviceChildCode=" + this.equipNo, null, "")
      //       .then((x) => {
      //          if (!x.status) {
      //             this.$message.error(x.message);
      //          } else {
      //             this.$Message.success(x.message);
      //          }
      //       })
      //       .finally(() => {
      //          this.fullscreenLoading = false;
      //       });
      // },
      update() {
         return !this.condition ? 'custom-img' : 'custom-img-color'
         if (this.isAlarm) {
            return 'custom-img-alarm';
         } else if (this.lineItemInfo.inStock === '是') {
            return 'custom-img-color';
         } else {
            return 'custom-img';
         }
      },
      startTimer() {
         // å¼€å¯å®šæ—¶å™¨ï¼Œæ¯3秒执行一次
         this.timer1 = setInterval(() => {
            update();
            this.update();
         }, 500);
      },
   },
@@ -284,13 +374,20 @@
.custom-img {
   position: relative;
   display: inline-block;
   /* background-color:  #d9ecff ; */
}
.custom-img-color {
   position: relative;
   display: inline-block;
   background-color: #05fa7f;
   color: white;
   text-align: center;
}
.custom-img-alarm {
   position: relative;
   display: inline-block;
   background-color: #ff4d4f;
   color: white;
   text-align: center;
}
@@ -307,19 +404,107 @@
} */
.custom-img img {
   width: 40px;
   height: 40px;
   width: 80px;
   height: 50px;
}
.custom-img-color img {
   width: 40px;
   height: 40px;
   width: 80px;
   height: 50px;
}
.custom-img-alarm img {
   width: 80px;
   height: 50px;
}
.equip-no {
   position: absolute;
   top: 15px;
   font-size: 12px;
   margin-left: -35px;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
   font-size: 25px;
   text-align: center;
   width: 100%;
}
.modern-dialog {
   border-radius: 16px !important;
   overflow: hidden;
   box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.modern-dialog .el-dialog__header {
   display: none;
}
.modern-dialog .el-dialog__body {
   padding: 0;
   margin: 0;
}
.dialog-header {
   background: linear-gradient(135deg, #409eff 0%, #67c23a 100%);
   padding: 20px 24px;
   text-align: center;
}
.dialog-title {
   color: #fff;
   font-size: 18px;
   font-weight: 600;
   margin: 0;
   letter-spacing: 2px;
}
.dialog-content {
   padding: 28px;
   background: #f8fafc;
   display: flex;
   justify-content: center;
}
.info-list {
   width: 100%;
   max-width: 420px;
   display: flex;
   flex-direction: column;
   gap: 12px;
}
.info-item {
   display: flex;
   align-items: center;
   justify-content: space-between;
   padding: 16px 20px;
   background: #fff;
   border-radius: 12px;
   box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
   transition: all 0.3s ease;
}
.info-item:hover {
   transform: translateX(4px);
   box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
.item-label {
   font-size: 14px;
   color: #6b7280;
   font-weight: 500;
   min-width: 80px;
   text-align: left;
}
.item-value {
   font-size: 15px;
   color: #1f2937;
   font-weight: 500;
   text-align: right;
   flex: 1;
   margin-left: 20px;
   word-break: break-all;
   padding-left: 20px;
   border-left: 1px solid #e5e7eb;
}
</style>