yusijie
2025-01-21 3f992de7c62461ab2ebef30878d867bcea8c7759
WebTM/views/PublicPage/RepairItemInformation_PDA.html
@@ -34,7 +34,15 @@
                                            <div id="treeRepairItem" lay-filter="treeRepairItem" class="demo-tree demo-tree-box" style="height: 580px; overflow: scroll;"></div>
                                        </div>
                                        <div>
                                            <div class="layui-inline" style="margin-left:5px;">
                                              <div class="layui-row">
                                                <label class="layui-form-label">过滤列</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="Value" id="Value" lay-verify="Value" autocomplete="off" placeholder="请输入过滤列" class="layui-input">
                                                </div>
                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="btnSearch">快速查询</button>
                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="FH">返回</button>
                                            </div>
                                            <!--<div class="layui-inline" style="margin-left:5px;">
                                                <label style="width: 28px;">代码</label>
                                                <input type="text" name="HNumber" id="HNumber" style="width:75px">
@@ -45,7 +53,7 @@
                                                <button type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                                </button>
                                            </div>
                                            </div>-->
                                            <div>
                                                <table class="" id="mainTable" lay-filter="mainTable"></table>
                                            </div>
@@ -138,7 +146,7 @@
                , page: true
                , cellMinWidth: 90
                , cols: [[
                    { type: 'radio', fixed: 'left' }
                    { type: 'checkbox', fixed: 'left' }
                    , { field: 'HItemID', title: 'HItemID', sort: true, hide: true }
                    , { field: 'ParentID', title: 'ParentID', sort: true, hide: true }
                    , { field: 'HNumber', title: '维修项目代码' }
@@ -146,38 +154,35 @@
                ]]
            };
            var index = layer.load(0, { shade: false });
            //进入页面显示的缓存列表
            $.ajax({
                url: GetWEBURL() + '/PublicPageMethod/RepairItemList',
                type: "GET",
                data: { "sWhere": sWhere },
                success: function (data1) {
                    if (data1.count == 1) {
                        option.data = data1.data;
                        table.render(option);
            get_Display(sWhere);
            function get_Display(sWhere) {
                var index = layer.load(0, { shade: false });
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + '/PublicPageMethod/Gy_RepairList_PDA',
                    type: "GET",
                    data: { "sWhere": sWhere },
                    success: function (data1) {
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.close(index);
                        } else {
                            layer.close(index);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index);
                    } else {
                        layer.close(index);
                        layer.alert(data1.code + data1.Message, { icon: 5 });
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                }, error: function () {
                    layer.close(index);
                    layer.alert("接口请求失败!", { icon: 5 });
                }
            });
                });
            }
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                var HNumber = $("#HNumber").val();
                var HName = $("#HName").val();
                if (HNumber) {
                    sWhere += " and HNumber like '%" + HNumber + "%'";
                }
                if (HName) {
                    sWhere += " and HName like '%" + HName + "%'";
                }
            function get_Display_old(sWhere) {
                var index = layer.load(0, { shade: false });
                //进入页面显示的缓存列表
                $.ajax({
                    url: GetWEBURL() + '/PublicPageMethod/RepairItemList',
                    type: "GET",
@@ -186,15 +191,84 @@
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.alert("查询成功", { icon: 1 });
                            layer.close(index);
                        } else {
                            layer.close(index);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                sWhere = "";//调用接口后清空sWhere缓存
            }
            form.on('submit(FH)', function () {//选择仓库
                var index = parent.layer.getFrameIndex(window.name);
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (data.length == 0) {
                    parent.layer.close(index);
                    return;
                }
                parent.GetRepairValue(data);
                parent.layer.close(index);
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                //var HNumber = $("#HNumber").val();
                //var HName = $("#HName").val();
                //if (HNumber) {
                //    sWhere += " and HNumber like '%" + HNumber + "%'";
                //}
                //if (HName) {
                //    sWhere += " and HName like '%" + HName + "%'";
                //}
                //$.ajax({
                //    url: GetWEBURL() + '/PublicPageMethod/RepairItemList',
                //    type: "GET",
                //    data: { "sWhere": sWhere },
                //    success: function (data1) {
                //        if (data1.count == 1) {
                //            option.data = data1.data;
                //            table.render(option);
                //            layer.alert("查询成功", { icon: 1 });
                //        } else {
                //            layer.alert(data1.code + data1.Message, { icon: 5 });
                //        }
                //    }, error: function () {
                //        layer.alert("接口请求失败!", { icon: 5 });
                //    }
                //});
                //sWhere = "";//调用接口后清空sWhere缓存
                get_Display($('#Value').val());
            });
            table.on('row(mainTable)', function (obj) {
                // 清除所有行的背景色和选中状态
                $(".layui-table-body tr").attr({ "style": "background:" }); // 恢复所有行背景颜色
                $(".layui-table-body .layui-form-checkbox").removeClass('layui-form-checked'); // 清除复选框选中样式
                // 设置当前行的选中状态
                var flag = !obj.tr.find(':checkbox:first').prop('checked');
                obj.tr.find(':checkbox').prop('checked', flag);
                if (flag) {
                    obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked'); // 设置复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" }); // 改变当前tr背景颜色和字体颜色
                } else {
                    obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked'); // 取消复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:" }); // 取消当前tr颜色
                }
                // 更新表格缓存中的选中状态
                layui.each(table.cache.mainTable, function (i, l) {
                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
                        l.LAY_CHECKED = flag;
                    }
                });
            });
            //以上是layui模块