WebTM/views/PublicPage/MaterialInfo.html
@@ -92,53 +92,6 @@
            var sWhere = " where 1 = 1" + " ";
            var sWhere1 = " where 1 = 1" + " ";
            //tree.render({
            //    elem: '#treePart',
            //    data: getData(sWhere),
            //    showCheckbox: false,     //是否显示复选框
            //    id: 'demoId',
            //    isJump: false, //是否允许点击节点时弹出新窗口跳转
            //    showLine: true,//是否开启连接线
            //    onlyIconControl: true,   //点击后不收缩
            //    click: function (obj) {
            //        //点击高光
            //        if (obj.data.id !== treeCkData.id) {
            //            $('div[data-id="' + obj.data.id + '"] span').eq(1).last().addClass("custom-tree-item-clicked");
            //            $('div[data-id="' + treeCkData.id + '"] span').eq(1).last().removeClass('custom-tree-item-clicked');
            //            treeCkData = obj.data;
            //            TagId = obj.data.id;
            //            TagParentId = obj.data.ParentID;
            //        }
            //        else {
            //            $('div[data-id="' + treeCkData.id + '"] span').eq(1).last().removeClass('custom-tree-item-clicked');
            //            treeCkData = { id: 0 };
            //            TagId = "";
            //            TagParentId = "";
            //        }
            //        $.ajax({
            //            url: GetWEBURL() + '/Gy_MaintenanceMode/PartCX',
            //            type: "GET",
            //            data: { "HInterID": obj.data.id },
            //            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);
            //                layer.alert("接口请求失败!", { icon: 5 });
            //            }
            //        });
            //    }
            //});
            var option = {
                elem: '#mainTable'
                //, toolbar: '#toolbarDemo'
@@ -146,7 +99,7 @@
                , page: true
                , cellMinWidth: 90
                , cols: [[
                    { type: 'radio', fixed: 'left' }
                    { type: 'checkbox', fixed: 'left' }
                    , { field: '物料仓库资料代码', title: '物料仓库资料代码', sort: true }
                    , { field: '物料代码', title: '物料代码', sort: true }
                    , { field: '物料名称', title: '物料名称' }
@@ -168,6 +121,27 @@
                ]]
            };
            //#region 点击行选中高亮
            table.on('row(mainTable)', function (obj) {
                //选中行改变颜色
                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颜色
                }
                //mainTable 为表格ID   注意此处如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
                layui.each(table.cache.mainTable, function (i, l) {
                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
                        l.LAY_CHECKED = flag;
                    }
                });
            })
            //#endregion
            var index = layer.load(0, { shade: false });
            //进入页面显示的缓存列表
@@ -209,7 +183,7 @@
                        if (data1.count == 1) {
                            option.data = data1.data;
                            table.render(option);
                            layer.alert("查询成功", { icon: 1 });
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
@@ -217,50 +191,13 @@
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                sWhere = "where 1=1 ";//调用接口后清空sWhere缓存
                sWhere = " where 1=1 ";//调用接口后清空sWhere缓存
            });
            //以上是layui模块
        });
        //查询树状数据
        function getData(sWhere) {
            var treeData;
            $.ajax({
                url: GetWEBURL() + '/Gy_MaintenanceMode/PartLoadTree',
                type: "GET",
                data: { "sWhere": sWhere },
                async: false,
                success: function (result) {
                    var data = result.data;
                    //生成数据对象集合
                    treeData = LoadTree(data);
                }
            });
            return treeData;
        }
        /**处理树形展示数据,要求有ID和ParentID、title字段**/
        function LoadTree(data) {
            let map = {};
            let treeData = [];
            data.forEach(it => {
                map[it.id] = it;    //ID为每个节点的id
            })
            //生成结果集
            data.forEach(it => {
                const parent = map[it.ParentID];   //ParentID为父节点的id
                if (parent) {
                    if (!Array.isArray(parent.children)) parent.children = [];
                    parent.children.push(it);
                } else {
                    treeData.push(it)
                }
            })
            return treeData;
        }
        function SeachFilter(sWhere1) {
            var HNumber = $("#HNumber").val();
            var HName = $("#HName").val();