快乐的昕的电脑
2025-11-22 7ce0e7ec84b19ec5550eb2a1353b43ff59ad40d1
pages/index.vue
@@ -8,18 +8,18 @@
         <view class="tab-item" :class="{ active: currentTab === 0 }" @click="changeTab(0)">
            主界面
         </view>
         <view class="tab-item" :class="{ active: currentTab === 2 }" @click="changeTab(2)">
            上刀下刀
         </view>
         <view class="tab-item" :class="{ active: currentTab === 3 }" @click="changeTab(3)">
            调机送检
         </view>
         <view class="tab-item" :class="{ active: currentTab === 2 }" @click="changeTab(2)">
            刀具管理
         </view>
         <view class="tab-item" :class="{ active: currentTab === 4 }" @click="changeTab(4)">
            生产报工
         </view>
         <!-- <view class="tab-item" :class="{ active: currentTab === 1 }" @click="changeTab(1)">
            开工完工
         </view> -->
         <view class="tab-item" :class="{ active: currentTab === 1 }" @click="changeTab(1)">
              开工完工
           </view>
         <view class="tab-item" :class="{ active: currentTab === 5 }" @click="changeTab(5)">
            e-SOP
         </view>
@@ -30,8 +30,8 @@
            设备点检
         </view>
         <!-- <view class="tab-item" :class="{ active: currentTab === 8 }" @click="changeTab(8)">
            打印机设置
         </view> -->
      打印机设置
   </view> -->
      </view>
      <view class="font"></view>
@@ -41,9 +41,9 @@
               <view class="top-right">
                  <button class="refresh-btn" @click="refresh">刷新</button>
               </view>
               <!--<view>
               <view>
                  <h4>一台机台只能选择一条工单(多选默认为最后一条)</h4>
               </view>-->
               </view>
               <view class="section top-section">
                  <view class="form-row">
                     <view>
@@ -66,28 +66,28 @@
               <view class="section card">
                  <uni-table border stripe emptyText="暂无更多数据" @selection-change="selectionChange">
                     <uni-tr>
                        <uni-th align="center" class="th" style="color: #FFFFFF">工序</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF">工单号</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF">产品编码</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF">产品名称</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF">规格</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF;width: 100px;">已生产数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF;width: 100px;">未生产数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF;width: 100px;">派工数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF;width: 100px;">工单数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF;width: 100px;">工单状态</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF;width: 100px;">报工人</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF">选择</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 140px;">工序</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 180px;">工单号</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 220px;">产品编码</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 180px;">产品名称</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 180px;">规格</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 120px;">已生产数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 120px;">未生产数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 120px;">派工数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 120px;">工单数量</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 120px;">工单状态</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 120px;">报工人</uni-th>
                        <uni-th align="center" class="th" style="color: #FFFFFF; width: 120px;">选择</uni-th>
                     </uni-tr>
                     <uni-tr v-for="(item, index) in isShowTableData" :key="index">
                        <uni-td align="center">
                           <input class="form-input" disabled="true" type="text" v-model="item.procName" /><!--工序-->
                        </uni-td>
                        <uni-td align="center">
                           <input class="form-input" disabled="true" type="text" v-model="item.daa001" />
                           <input class="form-input" disabled="true" type="text" v-model="item.daa001" /><!--工单号-->
                        </uni-td>
                        <uni-td align="center">
                           <input class="form-input" disabled="true" type="text" v-model="item.daa002" />
                           <input class="form-input" disabled="true" type="text" v-model="item.daa002" /><!--产品编码-->
                        </uni-td>
                        <uni-td align="center">
                           <input class="form-input" disabled="true" type="text" v-model="item.daa003" /><!--产品名称-->
@@ -115,7 +115,7 @@
                        </uni-td>
                        <uni-td>
                           <view class="uni-group">
                              <button type="default" @click="toDetail(item)">
                              <button class="select-btn" type="default" @click="toDetail(item)">
                                 选择
                              </button>
                           </view>
@@ -177,11 +177,12 @@
      <view v-if="isShow" class="overlay">
         <view class="popup">
            <view class="form-row">
               <view>
                  <label style="float: left;margin-top: 18px;">选择工单状态:</label>
               <view style="display: flex; align-items: center;">
                  <label style="float: left;margin-top: 18px;">点击按钮筛选工单状态:</label>
                  <superwei-combox :candidates="engineeringNoMapList" placeholder="请选择" v-model="engineeringNo"
                               @select="onEngineeringNoChange" class="picker"
                               style="padding: 7px 46px;width: 650px;"></superwei-combox>
                  <span style="margin-left: 20px; color: #ff6600; font-size: 18px;">多选时只保留最后一条工单</span>
               </view>
            </view>
@@ -405,7 +406,7 @@
            this.getWomdaaIsShow();
         },
         getPrintInfo() {
            var mac = "ac:f4:2c:20:0d:b4";
            var mac = "";
            
            mac = "74:24:ca:4f:b7:9b";
            this.$post({
@@ -425,6 +426,7 @@
               this.getWomdaaIsShow();
            });
            return;
            
            
             if (plus.os.name == "Android") {
@@ -550,28 +552,38 @@
            }
            return str;
         },
         cancel() {
            if (!this.machineNo) {
               return;
            }
            cancel() {
                if (!this.machineNo) {
                    return;
                }
            let editDate = this.formatDate(new Date());
                // 直接用 flag 判断
                if (this.hasBindedCutterFlag) {
                    uni.showToast({
                        title: '当前工单已绑定刀具,不能清空重选',
                        icon: 'error',
                        duration: 2000
                    });
                    return;
                }
            this.selectedIndexs = [];
                let editDate = this.formatDate(new Date());
                this.selectedIndexs = [];
            this.$post({
               url: "/MesOrderSelect/Remove",
               data: {
                  machineNo: this.machineNo,
                  editDate: editDate
               },
            }).then(res => {
               if (res.data.tbBillList > 0) {
                  this.isShowTableData = [];
               }
            });
         },
                this.$post({
                    url: "/MesOrderSelect/Remove",
                    data: {
                        machineNo: this.machineNo,
                        editDate: editDate
                    },
                }).then(res => {
                    if (res.data.tbBillList > 0) {
                        this.isShowTableData = [];
                    }
                });
            },
         formatDate(date) {
            let year = date.getFullYear(); // 获取年份
            let month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份并补零
@@ -627,22 +639,33 @@
            })
         },
            //获取表格的数据源
         getWomdaaIsShow() {
            this.$post({
               url: "/Womdaa/GetWomdaasByShow",
               data: {
                  machineNo: this.machineNo,
               }
            }).then(res => {
               this.isShowTableData = res.data.tbBillList;
            getWomdaaIsShow() {
                this.$post({
                    url: "/Womdaa/GetWomdaasByShow",
                    data: {
                        machineNo: this.machineNo,
                    }
                }).then(res => {
                    this.isShowTableData = res.data.tbBillList;
               if (this.isShowTableData.length == 1) {
                  uni.setStorageSync('daa001', this.isShowTableData[0].daa001);
                  uni.setStorageSync('id', this.isShowTableData[0].id);
                  //this.toDetail(this.isShowTableData[0]);
               }
            });
         },
                    // 只判断第一条(只允许一条工单)
                    const order = this.isShowTableData[0];
                    let hasBindedCutter = false;
                    if (order) {
                        hasBindedCutter =
                            (order.outToolId && order.outToolId.toString().trim() !== '') ||
                            (order.outToolCode && order.outToolCode.trim() !== '') ||
                            (order.outToolName && order.outToolName.trim() !== '');
                    }
                    // 存储到 data 变量
                    this.hasBindedCutterFlag = hasBindedCutter;
                    if (this.isShowTableData.length == 1) {
                        uni.setStorageSync('daa001', this.isShowTableData[0].daa001);
                        uni.setStorageSync('id', this.isShowTableData[0].id);
                    }
                });
            },
            isShowTab() {
                if (this.isShowTableData.length > 0) {
@@ -656,10 +679,14 @@
                this.isShow = true;
                // 默认选中“待开工”
                this.engineeringNo = '待开工';
                this.engineeringNo = '待开工、未开工、暂停';
                this.tableData = [];
                // 下拉框只显示工单状态
                this.engineeringNoMapList = ['待开工', '未开工', '开工', '暂停', '完工'];
                // 下拉框只显示合并后的状态和其它状态
                this.engineeringNoMapList = [
                    '待开工、未开工、暂停',
                    '开工',
                    '完工'
                ];
                // 默认显示“待开工”工单
                this.getWomdaaByStatus();
            },
@@ -685,11 +712,17 @@
            // 按工单状态筛选工单
            getWomdaaByStatus() {
                let editDate = this.formatDate(new Date());
                let statusArr = [];
                if (this.engineeringNo === '待开工、未开工、暂停') {
                    statusArr = ['待开工', '未开工', '暂停'];
                } else {
                    statusArr = [this.engineeringNo];
                }
                this.$post({
                    url: "/Womdaa/GetWomdaasByEngineeringNo",
                    data: {
                        machineNo: this.machineNo,
                        orderStatus: [this.engineeringNo], // 只传选中的状态
                        orderStatus: statusArr,
                        editDate: editDate
                    }
                }).then(res => {
@@ -886,16 +919,21 @@
      /* Increased font size for content */
   }
   .picker {
      float: left;
      margin-top: 7px;
      margin-left: 10px;
      text-align: center;
      font-size: 100%;
      padding: 5.5px 1px;
      background-color: #f8f8f8;
      border: 2px solid #ccc;
   }
    .picker {
        float: left;
        margin-top: 7px;
        margin-left: 10px;
        text-align: center;
        font-size: 32px !important; // 强制大字体,适配低密度
        min-height: 60px; // 让选择框高度也变大
        line-height: 60px;
        padding: 5.5px 1px;
        background-color: #fff; // 这里改为蓝色
        border: 2px solid #007aff; // 边框也改为蓝色
        color: #007aff; // 字体颜色改为白色,保证可读性
        border-radius: 6px;
        transition: background 0.2s;
    }
   .th {
      background-color: lightskyblue;
@@ -981,6 +1019,35 @@
      }
   }
    /* 放大 uni-table 的多选框(checkbox) */
    :deep(.uni-table .uni-checkbox-wrapper),
    :deep(.uni-table .uni-checkbox-input) {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
    /* 只对 input[type=checkbox] 放大,不要加 :deep() */
    .uni-table .uni-checkbox-input input[type="checkbox"] {
        transform: scale(2.2) !important;
        accent-color: #007aff !important;
        cursor: pointer !important;
    }
    /* 放大 uni-table 的多选框列宽 */
    :deep(.uni-table .uni-table-selection),
    :deep(.uni-table th.is-selection),
    :deep(.uni-table td.is-selection) {
        width: 100px !important;
        min-width: 100px !important;
        max-width: 120px !important;
    }
   /* 针对1280x800的平板使用媒体查询进行适配 */
   @media screen and (min-width: 1280px) and (max-width: 1920px) {
      .right-side {
@@ -1006,4 +1073,17 @@
         font-size: 20px;
      }
   }
    .select-btn {
        width: 180px; // 更宽
        height: 80px; // 更高
        font-size: 1.8vw; // 字体也略大
        border-radius: 10px;
        background-color: #f5f5f5;
        color: #007aff;
        border: 2px solid #007aff;
        margin: 0 auto;
        display: block;
    }
</style>