{
 "hidden": false,
 "children": [{
  "configs": {
   "itemId": "module",
   "serverScript": "var userid = app.get('sys.userid');\
\
var result = {},\
  records = {},\
  record, nodes, rs, meta;\
\
rs = app.run('select DISTINCT WB_MENU.MENU_ID, MENU_NAME, MENU_URL \"path\", MENU_TYPE, PARENT_MENU, '+\
             \"ORDER_INDEX, ICON  from WB_MENU,wb_user_role wur,wb_role_resource wrr \"+\
              'where WB_MENU.menu_id = wrr.menu_id and WRR.ROLE_ID = WUR.ROLE_ID AND wur.user_id = '+\"'\"+userid +\"'\"+\
             'order by ORDER_INDEX ');\
\
meta = rs.getMetaData();\
while (rs.next()) {\
  record = Wb.getRecord(rs, meta);\
  //这个leaf相当关键  4.14 靳承铂\
  if (record.MENU_TYPE == '1')\
    record.leaf = true;\
  //-----------------\
  Wb.apply(record, {\
    text: record.MENU_NAME,\
    iconCls: record.ICON\
  });\
  nodes = records[record.PARENT_MENU];\
  if (nodes) {\
    nodes.push(record);\
  } else {\
    nodes = [record];\
    records[record.PARENT_MENU] = nodes;\
  }\
}\
\
function createNodes(items, parentMenu) {\
  items.children = records[parentMenu] || [];\
  if (items.children.length)\
    items.expanded = true;\
  Wb.each(items.children, function(item) {\
    createNodes(item, item.MENU_ID);\
  });\
}\
createNodes(result, '-1');\
app.send(result);"
  },
  "expanded": false,
  "children": [],
  "type": "module"
 }],
 "roles": {
  "default": 1,
  "basic": 1,
  "demo": 1
 },
 "title": "查找模块",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}