111
Administrator
2025-11-06 67fcba3d227790dfc9e3a50e35be0cde821c58e3
pages/index.vue
@@ -15,20 +15,23 @@
            刀具管理
         </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 class="tab-item" :class="{ active: currentTab === 1 }" @click="changeTab(1)">
            开工完工
         </view>
         </view> -->
         <view class="tab-item" :class="{ active: currentTab === 5 }" @click="changeTab(5)">
            e-SOP
         </view>
         <view class="tab-item" :class="{ active: currentTab === 6 }" @click="changeTab(6)">
            工艺参数
         </view>
         <view class="tab-item" :class="{ active: currentTab === 8 }" @click="changeTab(8)">
            打印机设置
         <view class="tab-item" :class="{ active: currentTab === 9 }" @click="changeTab(9)">
            设备点检
         </view>
         <!-- <view class="tab-item" :class="{ active: currentTab === 8 }" @click="changeTab(8)">
            打印机设置
         </view> -->
      </view>
      <view class="font"></view>
@@ -38,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>
@@ -126,11 +129,10 @@
               </view>
               <view>
                  <text style="color: red;">
                     说明:初始状态是,按齿轮机查出所有的未完工的工单。用选择框标识机器要开工的工单.
                     只能同时开工一个工单,多选默认为最后一个。选择完成,点击保存选择。系统保留选中的工单。
                  <!--<text style="color: red;">
                     说明:只能同时开工一个工单。选择完成,点击保存选择。系统保留选中的工单。
                     如果要重选,点击清空重选功能。
                  </text>
                  </text>-->
               </view>
            </view>
         </view>
@@ -163,6 +165,10 @@
         </view>
         <view v-if="currentTab === 6" class="tab-content">
            <Technology :orderId="orderId" :orderNo="selectedOrder" :machineNo="machineNo" />
         </view>
         <view v-if="currentTab === 9" class="tab-content">
            <!-- 设备点检视图 -->
            <EquipmentInspection :machineNo="machineNo" />
         </view>
      </scroll-view>
@@ -249,16 +255,17 @@
</template>
<script>
   import WorkOrderStatus from '../components/WorkOrderStatus.vue'; // 确保路径正确
   import UniTable from "../uni_modules/uni-table/components/uni-table/uni-table.vue";
   import Mold from "../components/mold.vue";
   import Machine from "../components/machine.vue";
   import WorkOrderPrint from "../components/WorkOrderPrint.vue";
   import WorkOrder from "../components/WorkOrder.vue";
   import Technology from "../components/Technology.vue";
   import PDFShow from "../components/PDFShow.vue";
   import PrintInit from "../components/PrintInit.vue";
   import PrintTest from "../components/PrintTest.vue";
import WorkOrderStatus from '../components/WorkOrderStatus.vue'; // 确保路径正确
import UniTable from "../uni_modules/uni-table/components/uni-table/uni-table.vue";
import Mold from "../components/mold.vue";
import Machine from "../components/machine.vue";
import WorkOrderPrint from "../components/WorkOrderPrint.vue";
import WorkOrder from "../components/WorkOrder.vue";
import Technology from "../components/Technology.vue";
import PDFShow from "../components/PDFShow.vue";
import PrintInit from "../components/PrintInit.vue";
import PrintTest from "../components/PrintTest.vue";
import EquipmentInspection from "../components/EquipmentInspection.vue";
   export default {
      components: {
@@ -271,12 +278,16 @@
         WorkOrderStatus,
         PDFShow,
         PrintInit,
         PrintTest
         PrintTest,
         EquipmentInspection
      },
      data() {
         return {
                orderStatus: '', // 默认全部
            currentTab: 7,
                productCode: '', // 产品编码
                productSpec: '', // 产品规格
            machineList: [],
@@ -394,9 +405,9 @@
            this.getWomdaaIsShow();
         },
         getPrintInfo() {
            var mac = "ac:f4:2c:20:0d:b4";
            var mac = "";
            
            mac = "e8:51:9e:7d:dc:95";
            mac = "74:24:ca:4f:b7:9b";
            this.$post({
               url: "/DevMachine/GetDevMachineByPdaMac",
               data: {
@@ -414,45 +425,46 @@
               this.getWomdaaIsShow();
            });
            return;
            
            
   //          if (plus.os.name == "Android") {
   //             //获取手机MAC地址
   //             var Context = plus.android.importClass("android.content.Context");
   //             var WifiManager = plus.android.importClass("android.net.wifi.WifiManager");
   //             var wifiManager = plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE);
   //             var WifiInfo = plus.android.importClass("android.net.wifi.WifiInfo");
   //             var wifiInfo = wifiManager.getConnectionInfo();
   //             mac = wifiInfo.getMacAddress();
             if (plus.os.name == "Android") {
                //获取手机MAC地址
                var Context = plus.android.importClass("android.content.Context");
                var WifiManager = plus.android.importClass("android.net.wifi.WifiManager");
                var wifiManager = plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE);
                var WifiInfo = plus.android.importClass("android.net.wifi.WifiInfo");
                var wifiInfo = wifiManager.getConnectionInfo();
                mac = wifiInfo.getMacAddress();
               
   //             //如果mac为“02:00:00:00:00:00”,则可能是安卓6.0以上版本,则使用另一种方法获取mac地址
   //             if (mac == "02:00:00:00:00:00") {
   //                mac = this.getMacNew();
   //             }
   //             //如果mac使用新方法依然是“02:00:00:00:00:00”则不进行保存
   //             if (mac == "02:00:00:00:00:00") {
   //                return;
   //             }
   //             uni.setStorageSync('pdaMac', mac);
                //如果mac为“02:00:00:00:00:00”,则可能是安卓6.0以上版本,则使用另一种方法获取mac地址
                if (mac == "02:00:00:00:00:00") {
                   mac = this.getMacNew();
                }
                //如果mac使用新方法依然是“02:00:00:00:00:00”则不进行保存
                if (mac == "02:00:00:00:00:00") {
                   return;
                }
                uni.setStorageSync('pdaMac', mac);
   //             this.$post({
   //                url: "/DevMachine/GetDevMachineByPdaMac",
   //                data: {
   //                   pdaMac: mac,
   //                }
   //             }).then(res => {
   //                let devMachine = res.data.tbBillList;
   //                this.machineNo = devMachine.machineNo;
   //                this.machineName = "当前机台:" + this.machineNo + "号注塑机";
                this.$post({
                   url: "/DevMachine/GetDevMachineByPdaMac",
                   data: {
                      pdaMac: mac,
                   }
                }).then(res => {
                   let devMachine = res.data.tbBillList;
                   this.machineNo = devMachine.machineNo;
                   this.machineName = "当前机台:" + this.machineNo + "号齿轮机";
   //                uni.setStorageSync('machineNo', this.machineNo);
   //                uni.setStorageSync('printMac', devMachine.printMac);
                   uni.setStorageSync('machineNo', this.machineNo);
                   uni.setStorageSync('printMac', devMachine.printMac);
 
   //                this.getWomdaaIsShow();
                   this.getWomdaaIsShow();
   //             });
   //          }
                });
             }
         },
         save() {
            let data = this.selectedItems();
@@ -568,12 +580,8 @@
            return `${year}-${month}-${day}`; // 返回格式化后的字符串
         },
         selectionChange(e) {
                // 只保留最后一个选中的工单
                if (Array.isArray(e.detail.index)) {
                    this.selectedIndexs = [e.detail.index[e.detail.index.length - 1]];
                } else {
                    this.selectedIndexs = [e.detail.index];
                }
                // 单选直接赋值
                this.selectedIndexs = [e.detail.index];
         },
         selectedItems() {
@@ -637,29 +645,25 @@
            });
         },
         isShowTab() {
            isShowTab() {
                if (this.isShowTableData.length > 0) {
                    uni.showToast({
                        title: '已有正在操作的工单,不能再次选择',
                        icon: 'error',
                        duration: 2000
                    });
                    return;
                }
            if (this.isShowTableData.length > 0) {
               uni.showToast({
                  title: '已有正在操作的工单,不能再次选择',
                  //将值设置为 success 或者直接不用写icon这个参数
                  icon: 'error',
                  //显示持续时间为 2秒
                  duration: 2000
               });
               return;
            }
            this.isShow = true;
            this.engineeringNo = null;
            this.tableData = [];
                this.isShow = true;
                // 默认选中“待开工”
                this.engineeringNo = '待开工';
                this.tableData = [];
                // 下拉框只显示工单状态
                this.engineeringNoMapList = ['待开工', '未开工', '完工', '暂停'];
                // 默认显示全部工单
                this.getWomdaa();
         },
                this.engineeringNoMapList = ['待开工', '未开工', '开工', '暂停', '完工'];
                // 默认显示“待开工”工单
                this.getWomdaaByStatus();
            },
            // 下拉框选中后,按状态筛选工单
            onEngineeringNoChange(status) {
                this.engineeringNo = status;
@@ -696,6 +700,8 @@
         toDetail(item) {
            this.orderId = item.id;
            this.selectedOrder = item.daa001;
                this.productCode = item.daa002; // 产品编码
                this.productSpec = item.daa004; // 产品规格
            this.currentTab = 0;
         }
      },
@@ -1001,4 +1007,4 @@
         font-size: 20px;
      }
   }
</style>
</style>