{
 "hidden": false,
 "children": [{
  "configs": {
   "itemId": "module",
   "serverScript": "var data = app.get(),\
  result = {},\
  records = {},\
  record, nodes, rs, meta;\
//获取租户id\
var tenancyId = app.get(\"sys.tenancyId\");\
if (!Wb.isEmpty(data.tenancyId)) {\
  tenancyId = data.tenancyId;\
}\
  rs = app.run(\"select M.ID, M.MENU_ID, M.TENANCY_ID, M.MENU_NAME, M.MENU_URL, 1  MENU_TYPE, M.PARENT_MENU, M.ORDER_INDEX, M.NOTES, M.CREATED_BY, M.CREATED_ON, M.UPDATED_BY, M.UPDATED_ON \" +\
    \"from WB_MENU M \" +\
    \" union select '-1','-1','','PC端菜单','','','root',1,'','',now(),'',now()\" +\
    \" union select '-2','-2','','移动端菜单','','','root',1,'','',now(),'',now()\" +\
    \" order by ORDER_INDEX\");\
\
meta = rs.getMetaData();\
\
while (rs.next()) {\
  record = Wb.getRecord(rs, meta);\
  if(record.MENU_TYPE == 1 ){\
     Wb.apply(record, { \
      checked:false\
      \
    });\
   }\
  Wb.apply(record, {\
    text: record.MENU_NAME,\
    iconCls: 'db_field_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;\
    items.iconCls = 'folder_icon';\
  }\
  Wb.each(items.children, function(item) {\
    createNodes(item, item.MENU_ID);\
  });\
}\
createNodes(result, 'root');\
app.send(result);"
  },
  "expanded": false,
  "children": [],
  "type": "module"
 }],
 "roles": {"demo": 1},
 "title": "模块列表",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}