快乐的昕的电脑
2025-11-19 aa03f85db96889256075adf31b52a94c4823dfb4
components/WorkOrder.vue
@@ -1,20 +1,11 @@
<template>
   <view>
      <view class="container" style="display: flex;
               flex-direction: row;
               flex-wrap: nowrap;
               align-content: flex-start;
               justify-content: flex-start;">
      <view class="container" style="display: flex; flex-direction: row; flex-wrap: nowrap; align-content: flex-start; justify-content: flex-start;">
         <!--主界面-->
         <!-- 上部:工单选择和机台信息 -->
         <view class="top-order" style=" display:inline-block;">
         <view class="top-order" style="display:inline-block;">
            <view class="form-row4">
               <view class="form-row" style="display: flex;
                                 flex-direction: column;
                                 flex-wrap: nowrap;
                                 justify-content: flex-start;
                                 align-items: center;">
               <view class="form-row" style="display: flex; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; align-items: center;">
                  <view class="form-item">
                     <label>工单编号:</label>
                     <input class="inp" type="text" v-model="order.daa001" disabled="true" />
@@ -59,7 +50,7 @@
                  </view>
                  <view class="form-item">
                     <label>产品规格:</label>
                     <input class="inp" type="text" v-model="order.daa004" disabled="true" /><!-- 保留原绑定与注释,未改 -->
                     <input class="inp" type="text" v-model="order.daa004" disabled="true" />
                  </view>
                  <view class="form-item">
                     <label>报工数量:</label>
@@ -69,7 +60,7 @@
            </view>
         </view>
         <view class="form-row1">
            <view class="form-item" style=" display:inline-block;">
            <view class="form-item" style="display:inline-block;">
               <label>工单状态:</label>
               <input class="inp1" type="text" v-model="order.daa018" disabled="true" />
               <!-- 刷新按钮 -->
@@ -84,21 +75,21 @@
      <!-- 中部:运行状态 -->
      <view class="section card">
         <view class="form-row">
         <view class="status-row">
            <view class="form-item">
               <label style="color: red;">日停机次数(时长超5分钟):</label>
               <input class="inp" style="width: 40%;" type="number" v-model="todayFaultNum" disabled="true" />
               <label style="color: red;">日停机次数(时长超3分钟):</label>
               <input class="inp" type="number" v-model="order.todayDowntimeCount" disabled="true" />
            </view>
            <view class="form-item">
               <label>日停机时长(mi):</label>
               <input class="inp" type="text" v-model="todayRunTime" disabled="true" />
               <input class="inp" type="text" :value="downtimeDuration" disabled="true" />
            </view>
            <view class="form-item">
               <label>设备稼动率:</label>
               <input class="inp" type="text" v-model="utilizationRate" disabled="true" />
            </view>
         </view>
         <view class="form-row">
         <view class="status-row">
            <view class="form-item">
               <label>生产开始时间:</label>
               <input class="inp" type="text" v-model="startTime" disabled="true" />
@@ -116,7 +107,7 @@
      <!-- 下部:品质检验 -->
      <view class="section card">
         <view class="form-row">
         <view class="quality-row">
            <view class="form-item">
               <label>最近首检时间:</label>
               <input class="inp" type="text" v-model="lastInitialCheck" disabled="true" />
@@ -126,11 +117,15 @@
               <input class="inp" type="text" v-model="initialConclusion" disabled="true" />
            </view>
            <view class="form-item">
               <label>巡检次数:</label><!--首检次数???-->
               <input class="inp" type="number" v-model="patrolCount" disabled="true" />
               <label>首检人员:</label>
               <input class="inp" type="text" v-model="initialInspector" disabled="true" />
            </view>
            <view class="form-item">
               <label>首检次数:</label>
               <input class="inp" type="number" v-model="initialCount" disabled="true" />
            </view>
         </view>
         <view class="form-row">
         <view class="quality-row">
            <view class="form-item">
               <label>最近巡检时间:</label>
               <input class="inp" type="text" v-model="lastPatrolCheck" disabled="true" />
@@ -138,6 +133,10 @@
            <view class="form-item">
               <label>巡检结论:</label>
               <input class="inp" type="text" v-model="patrolConclusion" disabled="true" />
            </view>
            <view class="form-item">
               <label>巡检人员:</label>
               <input class="inp" type="text" v-model="patrolInspector" disabled="true" />
            </view>
            <view class="form-item">
               <label>巡检次数:</label>
@@ -171,14 +170,26 @@
            productionDuration: '',
            lastInitialCheck: '',
            initialConclusion: '',
            initialInspector: '',
            initialCount: 0,
            lastPatrolCheck: '',
            patrolConclusion: '',
            patrolInspector: '',
            patrolCount: 0,
            timer: null, // Timer reference
            timer: null,
            DAA003List: [],
            lineList: [],
         };
      },
      computed: {
         // 日停机时长 = todayOnlineTime - todayRunTime
         downtimeDuration() {
            // 取order对象中的todayOnlineTime和todayRunTime,都为分钟
            const online = Number(this.order.todayOnlineTime) || 0;
            const run = Number(this.order.todayRunTime) || 0;
            return online - run;
         }
      },
      created() {
         this.fetchData(true);
@@ -186,11 +197,11 @@
         this.init();
      },
      mounted() {
         this.fetchData(false); // Initial fetch
         this.timer = setInterval(this.fetchData, 120000); // Call fetchData every 3 minutes
         this.fetchData(false);
         this.timer = setInterval(this.fetchData, 120000);
      },
      beforeDestroy() {
         clearInterval(this.timer); // Clear the timer on component destruction
         clearInterval(this.timer);
      },
      methods: {
         init() {
@@ -217,7 +228,7 @@
         // 添加刷新按钮的处理方法
         handleRefresh() {
            this.$sendPostRequest({
               url: "http://192.168.0.94:9095/Numerical/RefreshDev",
                    url: "http://192.168.0.94:9095/Numerical/RefreshDevBycl",
               data: {
                  machineNo: this.order.machineNo
               },
@@ -231,7 +242,6 @@
               }
            });
         },
         onDaa003Change(event) {
            let orde = this.lineList[this.DAA003List.indexOf(event)];
            this.orderId = orde.id;
@@ -362,8 +372,9 @@
                     cutterName,  //刀具名称
                     cutterModel, //刀具规格
                     jdl: '',
                     startCjNum: 0, // 新增兜底字段 保留其它注释
                     currentCjNum: 0 // 新增兜底字段
                            startCjNum: 0, // 开工数采
                            currentCjNum: 0, // 当前数采
                            todayDowntimeCount //今日停机次数
                  };
                  return;
               }
@@ -385,8 +396,6 @@
               //this.productionDuration = (this.order.todayOnlineTime / 3600).toFixed(2) + "h";
               this.todayFaultNum = this.order.todayFaultNum;
               this.utilizationRate = this.order.jdl + '%';
               // this.startTime = this.order.workStartDate;
               // this.endTime = this.order.workEndDate;
               let title = this.machineNo + '号机台 工单号' + this.order.daa001 + ',当前数采' + this.order.currentCjNum; // 标题中使用 currentCjNum
               this.setTitle(title);
            })
@@ -404,9 +413,24 @@
                  orderNo: this.orderNo
               }
            }).then(res => {
               //this.order = res.data.tbBillList;
               this.lastInitialCheck = res.data.tbBillList.fcheckDate;
               this.initialConclusion = res.data.tbBillList.fcheckResu;
               let sjList = res.data.tbBillList;
               if (Array.isArray(sjList) && sjList.length > 0) {
                  let latest = sjList[0];
                  this.lastInitialCheck = latest.fcheckDate;
                  this.initialConclusion = latest.fcheckResu;
                  this.initialInspector = latest.fcheckBy; // 首检人员(工号-姓名)
                  this.initialCount = latest.xjCount ?? sjList.length; // 优先用xjCount字段
               } else if (sjList) {
                  this.lastInitialCheck = sjList.fcheckDate;
                  this.initialConclusion = sjList.fcheckResu;
                  this.initialInspector = sjList.fcheckBy; // 首检人员(工号-姓名)
                  this.initialCount = sjList.xjCount ?? 1;
               } else {
                  this.lastInitialCheck = '';
                  this.initialConclusion = '';
                  this.initialInspector = '';
                  this.initialCount = 0;
               }
            })
         },
         getXJByOrder() {
@@ -416,10 +440,24 @@
                  orderNo: this.orderNo
               }
            }).then(res => {
               //this.order = res.data.tbBillList;
               this.lastPatrolCheck = res.data.tbBillList.fcheckDate;
               this.patrolConclusion = res.data.tbBillList.fcheckResu;
               this.patrolCount = res.data.tbBillList.xjCount;
               let xjList = res.data.tbBillList;
               if (Array.isArray(xjList) && xjList.length > 0) {
                  let latest = xjList[0];
                  this.lastPatrolCheck = latest.fcheckDate;
                  this.patrolConclusion = latest.fcheckResu;
                  this.patrolInspector = latest.fcheckBy; // 巡检人员(工号-姓名)
                  this.patrolCount = latest.xjCount ?? xjList.length;
               } else if (xjList) {
                  this.lastPatrolCheck = xjList.fcheckDate;
                  this.patrolConclusion = xjList.fcheckResu;
                  this.patrolInspector = xjList.fcheckBy; // 巡检人员(工号-姓名)
                  this.patrolCount = xjList.xjCount ?? 1;
               } else {
                  this.lastPatrolCheck = '';
                  this.patrolConclusion = '';
                  this.patrolInspector = '';
                  this.patrolCount = 0;
               }
            })
         }
      }
@@ -427,162 +465,232 @@
</script>
<style>
   .top-order {
      margin-bottom: 1vh;
   }
    /* 全局字体放大,可根据需要调整数值 */
    body, .container {
        font-size: 22px;
    }
   .refresh-btn {
      position: absolute;
      top: -11px;
      right: 21px;
      /* padding: 10px 20px; */
      cursor: pointer;
      float: right;
      background-color: #00A2E9;
      color: white;
      border: none;
      font-size: 29px;
      border-radius: 15px;
      margin-top: -23px;
      padding-left: 25px;
      padding-right: 25px;
      margin-top: 9px;
      margin-bottom: 20px;
   }
    .top-order {
        margin-bottom: 0.3vh;
    }
      .refresh-btn:hover {
         background-color: #00A2E9;
      }
    .refresh-btn {
        position: absolute;
        top: -11px;
        right: 21px;
        cursor: pointer;
        float: right;
        background-color: #00A2E9;
        color: white;
        border: none;
        font-size: 28px;
        border-radius: 12px;
        margin-top: 6px;
        margin-bottom: 10px;
        padding: 10px 28px;
    }
   .form-row {
      display: flex;
      justify-content: space-between;
      margin-bottom: 1.5vh;
   }
        .refresh-btn:hover {
            background-color: #00A2E9;
        }
   .form-item {
      width: 100%;
      padding: 4px;
      margin: 10px 10px;
   }
    .form-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0.5vh;
    }
   .inp {
      float: left;
      width: 63%;
      padding: 0.5vh;
      border: 1px solid #ccc;
      border-radius: 0.5vw;
      margin-top: 0.3vh;
      font-size: 1.3vw;
      /* Larger font for inputs */
   }
    .form-item {
        width: 100%;
        padding: 2px;
        margin: 4px 8px;
    }
    .inp {
        float: left;
        width: 85%;
        padding: 3px;
        border: 1px solid #ccc;
        border-radius: 0.5vw;
        margin-top: 0.2vh;
        font-size: 22px;
        height: 36px;
    }
   .status-block p {
      margin: 1vh 0;
      font-size: 1.5vw;
      font-weight: bold;
   }
    .status-block p {
        margin: 0.5vh 0;
        font-size: 1.8vw;
        font-weight: bold;
    }
   /* 卡片样式 */
   .card {
      background-color: #fff;
      border-radius: 0.8vw;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
      padding: 1.5vh;
      border: 1px solid black;
      margin-top: -1vh;
      margin-bottom: 2vh;
      font-size: 1.5vw;
      /* Base font size for card content */
   }
    .card {
        background-color: #fff;
        border-radius: 0.6vw;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
        padding: 12px;
        border: 1px solid black;
        margin-top: 0;
        margin-bottom: 12px;
        font-size: 22px;
    }
   /* 卡片标题在左上角 */
   .card-header {
      position: absolute;
      top: -1vh;
      left: 2vw;
      background-color: #ffffff;
      padding: 0.5vh 1vw;
      border-radius: 0.5vw;
      font-weight: bold;
      font-size: 1.8vw;
      /* Larger font for headers */
   }
    .card-header {
        position: absolute;
        top: -1vh;
        left: 2vw;
        background-color: #ffffff;
        padding: 0.3vh 0.8vw;
        border-radius: 0.5vw;
        font-weight: bold;
        font-size: 2vw;
    }
   .form-item label {
      float: left;
      margin-top: 8px;
      font-size: 1.5vw;
      /* Larger font for labels */
      display: inline-block;
      margin-bottom: 0.5vh;
      color: #333;
   }
    .form-item label {
        float: left;
        margin-top: 4px;
        font-size: 22px;
        display: inline-block;
        margin-bottom: 0.2vh;
        color: #333;
    }
    .status-row label,
    .check-row label {
        width: 30%;
        padding-right: 0.6vw;
        text-align: right;
        font-size: 22px;
    }
   .status-row label,
   .check-row label {
      width: 30%;
      padding-right: 1vw;
      text-align: right;
      font-size: 1.5vw;
      /* Increased font for labels in status sections */
   }
    .status-row input,
    .check-row input {
        width: 65%;
        font-size: 22px;
        height: 36px;
    }
   .status-row input,
   .check-row input {
      width: 65%;
      font-size: 1.5vw;
   }
    .form-row2 {
        display: flex;
        float: left;
        margin-left: -65px;
        flex-direction: column;
        margin-top: -10px;
        line-height: 38px;
        align-content: flex-start;
    }
   .form-row2 {
      display: flex;
      float: left;
      margin-left: -65px;
      flex-direction: column;
      margin-top: -13px;
      line-height: 48px;
      align-content: flex-start;
   }
    .form-row3 {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        align-content: flex-start;
        justify-content: flex-start;
        align-items: flex-start;
        margin-bottom: 0.5vh
    }
   .form-row3 {
      display: flex;
      flex-direction: column;
      flex-wrap: nowrap;
      align-content: flex-start;
      justify-content: flex-start;
      align-items: flex-start;
      margin-bottom: 2.5vh
   }
    .form-row4 {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
    }
   .form-row4 {
      display: flex;
      flex-direction: row;
      flex-wrap: nowrap;
   }
    .inp1 {
        width: 42%;
        height: 2.8em;
        font-weight: bolder;
        margin-top: -35px;
        font-size: 48px;
        text-align: center;
        color: red;
    }
   .inp1 {
      width: 42%;
      height: 3.5em;
      font-weight: bolder;
      margin-top: -41px;
      font-size: 39px;
      text-align: center;
      color: red;
   }
    .inp2 {
        float: right;
        width: 200px;
        height: 200px;
        border-radius: 100%;
        text-align: center;
        margin-top: -35px;
        font-size: 100px;
        background-color: #476ee1fc;
        color: #ffffff;
        margin-right: 140px;
    }
   .inp2 {
      float: right;
      width: 220px;
      height: 220px;
      border-radius: 100%;
      text-align: center;
      margin-top: -42px;
      /*    margin-left: 37px; */
      font-size: 96px;
      background-color: #476ee1fc;
      color: #ffffff;
      margin-right: 172px;
   }
    .quality-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 8px;
    }
        .quality-row .form-item {
            flex: 1;
            margin: 0 6px;
            padding: 2px;
        }
            .quality-row .form-item label {
                width: auto;
                min-width: 95px;
                margin-right: 6px;
                font-size: 22px;
            }
        .quality-row .inp {
            width: 70%;
            min-width: 100px;
            font-size: 22px;
            height: 36px;
            padding: 3px;
        }
    .status-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 8px;
    }
        .status-row .form-item {
            flex: 1;
            margin: 0 6px;
            padding: 2px;
        }
            .status-row .form-item label {
                min-width: 180px;
                white-space: nowrap;
                font-size: 22px;
            }
        .status-row .inp {
            width: 70%;
            min-width: 100px;
            font-size: 22px;
            height: 36px;
            padding: 3px;
        }
    /* 针对1280*717屏幕的特定优化 */
    @media screen and (max-width: 1280px) and (max-height: 800px) {
        .top-order {
            margin-bottom: 0;
        }
        .card {
            padding: 8px;
            margin-bottom: 8px;
        }
        .form-item {
            margin: 2px 6px;
        }
        .quality-row,
        .status-row {
            margin-bottom: 6px;
        }
    }
</style>