chenhaozhe
3 天以前 cfa35ff1f39c2a7b69d624d45f8e05591f3375d4
WebTM/views/IpadIndex.html
@@ -56,7 +56,7 @@
            base: '../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
        }).use(['index', 'form', 'laydate', 'table', 'element', "timerManager"], function () {
            var $ = layui.$
                , admin = layui.admin
                , layer = layui.layer
@@ -64,6 +64,7 @@
                , form = layui.form
                , laydate = layui.laydate
                , element = layui.element
                , timerManager = layui.timerManager
                ;
            //window 全局变量
            window.mychart1 = echarts.init(document.getElementById('mychart1'));
@@ -75,9 +76,67 @@
                mychart2.resize();
            })
            // 配置 弹出层 打开/关闭处理函数
            InitLayerConfig()
            TSLoad();
            fetchButtonsData();
            timerManager.createTimer(
                'Timer',  // 唯一标识
                function () {
                    TSLoad();
                },
                10000,       // 间隔3分钟
                'interval'  // 循环类型
            );
            $(window).on('beforeunload', function () {
                timerManager.clearAllTimers();
            });
        });
        function InitLayerConfig() {
            var _open = layer.open
                , _timerManager = layui.timerManager
            layer.open = function (opts) {
                // 合并默认配置
                var options = $.extend({}, layer.config, opts);
                var oldSuccess = options.success;
                var oldEnd = options.end;
                var needHideScroll = options.scrollbar === false;
                // 打开弹窗时
                options.success = function (layero, index) {
                    if (needHideScroll) {
                        $('body').css('overflow', 'hidden');
                    }
                    console.log("暂停定时器")
                    _timerManager.pauseTimer('Timer')
                    if (oldSuccess) oldSuccess.call(this, layero, index);
                };
                // 关闭弹窗时
                options.end = function () {
                    if (needHideScroll) {
                        // 只有最后一个弹窗关闭才恢复
                        if ($('.layui-layer:visible').length <= 1) {
                            $('body').css('overflow', '');
                        }
                    }
                    if ($('.layui-layer:visible').length <= 1) {
                        console.log("恢复定时器")
                        _timerManager.resumeTimer('Timer')
                    }
                    if (oldEnd) oldEnd.call(this);
                };
                return _open.call(this, options);
            };
        }
        function TSLoad() {
            $("#topleft").html("");
            var HUserName = sessionStorage["HUserName"];  //sessionStorage["HUserName"];     //默认当前登录人员
@@ -118,14 +177,14 @@
                                        case "生产":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修进行中":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border5"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修结束":
                                        case "待机":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修终止":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                        case "故障":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border5 "></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修完成":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        default:
                                    }
@@ -195,14 +254,14 @@
                                        case "生产":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修进行中":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border5"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修结束":
                                        case "待机":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修终止":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border1"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                        case "故障":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border5 "></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        case "维修完成":
                                            html1 += '<h1><span>当前状态:</span><span class="gj_icon color_border2"></span><span>' + LoadData[i - 1].HStatus + '</span></h1>';
                                            break;
                                        default:
                                    }
@@ -239,6 +298,7 @@
                        if (sessionStorage["Organization"] == "宁波市华舟包装有限公司") {
                            // 华舟 使用分组标签
                            console.log("分组标签", LoadingTabsContact)
                            var divParent = document.createElement("div")
                            divParent.classList.add("layui-tab")
                            divParent.classList.add("layui-tab-card")
@@ -1531,75 +1591,68 @@
                layer.alert("请选择工单列表", { icon: 5 });
                return false;
            }
            //当前工单(汇报)按钮点击事件
            function CodingReport(event, obj) {
                if (wktag == 0) {
                    layer.alert("请选择工单列表", { icon: 5 });
                    return false;
                }
                // 判断是否为华舟组织
                if (sessionStorage["Organization"] == "宁波市华舟包装有限公司") {
                    // 华舟组织:若汇报总数不为0则跳过状态检查,否则执行检查
                    if (parseFloat(HReportTotal) !== 0) {
                        // 汇报总数不为0,直接打开(不执行 WorkStaus 检查)
                    } else {
                        // 汇报总数等于0,执行原有的状态检查
                        if (WorkStaus(HSourceID1, workcode, HSourceInterID, "斯莫尔汇报")) {
                            layer.alert("单据状态不满足汇报条件!", { icon: 5 });
                            return false;
                        }
                    }
            // 判断是否为华舟组织
            if (sessionStorage["Organization"] == "宁波市华舟包装有限公司") {
                // 华舟组织:若汇报总数不为0则跳过状态检查,否则执行检查
                if (parseFloat(HReportTotal) !== 0) {
                    // 汇报总数不为0,直接打开(不执行 WorkStaus 检查)
                } else {
                    // 非华舟组织:保持原有逻辑,直接执行 WorkStaus 检查
                    // 汇报总数等于0,执行原有的状态检查
                    if (WorkStaus(HSourceID1, workcode, HSourceInterID, "斯莫尔汇报")) {
                        layer.alert("单据状态不满足汇报条件!", { icon: 5 });
                        return false;
                    }
                }
            } else {
                // 非华舟组织:保持原有逻辑,直接执行 WorkStaus 检查
                if (WorkStaus(HSourceID1, workcode, HSourceInterID, "斯莫尔汇报")) {
                    layer.alert("单据状态不满足汇报条件!", { icon: 5 });
                    return false;
                }
            }
            layer.open({
                type: 2,
                skin: 'layui-layer-rim', //加上边框
                title: '当前工单',
                closeBtn: 1,
                shift: 2,
                area: ['100%', '100%'],
                maxmin: true,
                scrollbar: false,
                content: '车间管理/工序出站汇报单/Cj_StationOutBill_CurrentWork.html?OperationType=2&linterid=&HSouceBillType=',
                end: function () {
                // 打开 iframe 弹窗(原有代码不变)
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '当前工单',
                    closeBtn: 1,
                    shift: 2,
                    area: ['100%', '100%'],
                    maxmin: true,
                    scrollbar: false,
                    content: '车间管理/工序出站汇报单/Cj_StationOutBill_CurrentWork.html?OperationType=2&linterid=&HSouceBillType=',
                    end: function () {
                        // 可选的关闭回调
                    },
                    success: function (dom, index) {
                        var data = [{
                            "HEquipName": $("#HEquipName1").text(),
                            "HEquipCode": $("#HEquipCode1").text(),
                            "HICMOBillNo": workcode,
                            "HICMOInterID": HICMOInterID,
                            "HICMOEntryID": HICMOEntryID,
                            "HSourceID": HSourceID1,
                            "HSourceName": HSourceName1,
                            "HEmpName": HEmpName,
                            "HManagerID": HManagerID,
                            "HManagerName": HManagerName,
                            "HGroupName": HGroupName,
                            "HGroupID": HGroupID,
                            "HBillType": HBillType,
                            "HSourceInterID": HSourceInterID,
                            "HSourceEntryID": HSourceEntryID,
                            "HSourceBillNo": HSourceBillNo,
                            "HSourceBillType": HSourceBillType
                        }];
                },
                success: function (dom, index) {
                    var data = [];
                    data.push({
                        "HEquipName": $("#HEquipName1").text(),
                        "HEquipCode": $("#HEquipCode1").text(),
                        "HICMOBillNo": workcode,
                        "HICMOInterID": HICMOInterID,
                        "HICMOEntryID": HICMOEntryID,
                        "HSourceID": HSourceID1,
                        "HSourceName": HSourceName1,
                        "HEmpName": HEmpName,
                        "HManagerID": HManagerID,
                        "HManagerName": HManagerName,
                        "HGroupName": HGroupName,
                        "HGroupID": HGroupID,
                        "HBillType": HBillType,
                        "HSourceInterID": HSourceInterID,
                        "HSourceEntryID": HSourceEntryID,
                        "HSourceBillNo": HSourceBillNo,
                        "HSourceBillType": HSourceBillType
                    });
                        //通过索引获取到当前iframe弹出层
                        var iframe = window['layui-layer-iframe' + index];
                        //调用iframe弹出层内的方法
                        iframe.edit(data);
                    }
                });
            }
                    //通过索引获取到当前iframe弹出层
                    var iframe = window['layui-layer-iframe' + index];
                    //调用iframe弹出层内的方法
                    iframe.edit(data);
                },
            });
        }
        //设备启动点检按钮点击事件