| | |
| | | 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' |
| | |
| | | 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(); |