{"hidden":false,"children":[{"configs":{"itemId":"module"},"expanded":true,"children":[{"configs":{"layout":"border","itemId":"viewport1"},"expanded":true,"children":[{"configs":{"itemId":"grid1","region":"center"},"expanded":true,"children":[{"configs":{"itemId":"store","autoLoad":"true","fields":"['sessionCount', 'user', 'username', 'dispname', 'ip', 'userAgent']","url":"m?xwl=admin/user-list/get-user-list"},"expanded":true,"children":[],"type":"store"},{"configs":{"itemId":"viewConfig","enableTextSelection":"true"},"expanded":false,"children":[],"type":"tableview"},{"configs":{"itemId":"columns"},"expanded":true,"children":[{"configs":{"itemId":"numCol","xtype":"rownumberer"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"usernameCol","renderer":"var multiUsers = record.data.sessionCount > 1;\nreturn Wb.getIcon(multiUsers ? 'user_group_icon' : 'user_icon', multiUsers ? '多用户登录' : '单用户登录') + value;","dataIndex":"username","width":"140","text":"用户名称"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"dispnameCol","dataIndex":"dispname","width":"140","text":"显示名称"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"ipCol","dataIndex":"ip","width":"190","text":"IP地址"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"userAgentCol","dataIndex":"userAgent","flex":"1","text":"终端信息","autoWrap":"true"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"agentIconCol","renderer":"return app.agentRender(record);","showInMenu":"false","menuDisabled":"true","width":"30"},"expanded":false,"children":[],"type":"column"}],"type":"array"}],"type":"grid","events":{"selectionchange":"app.loadSessions(selected[0]);"}},{"configs":{"itemId":"grid2","split":"true","collapsed":"true","header":"false","floatable":"false","region":"south","title":"用户下的所有会话信息","iconCls":"list_icon","collapsible":"true","height":"150"},"expanded":true,"children":[{"configs":{"itemId":"store","normalName":"sessionStore","fields":"['ip', {\n  name: 'createDate',\n  dateFormat: Wb.dateFormat,\n  type: 'date'\n}, {\n  name: 'lastAccessDate',\n  dateFormat: Wb.dateFormat,\n  type: 'date'\n}, 'userAgent']","url":"m?xwl=admin/user-list/get-session-list"},"expanded":false,"children":[],"type":"store"},{"configs":{"itemId":"viewConfig","enableTextSelection":"true"},"expanded":false,"children":[],"type":"tableview"},{"configs":{"itemId":"columns"},"expanded":true,"children":[{"configs":{"itemId":"numCol","xtype":"rownumberer"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"ipCol","dataIndex":"ip","width":"190","text":"IP地址"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"createDateCol","dataIndex":"createDate","width":"130","text":"创建时间"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"lastAccessDateCol","dataIndex":"lastAccessDate","width":"130","text":"最后访问时间"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"userAgentCol","dataIndex":"userAgent","flex":"1","text":"终端信息","autoWrap":"true"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"agentIconCol","renderer":"return app.agentRender(record);","showInMenu":"false","menuDisabled":"true","width":"30"},"expanded":false,"children":[],"type":"column"}],"type":"array"}],"type":"grid","events":{"expand":"app.loadSessions();"}}],"type":"viewport"}],"type":"module","events":{"initialize":"app.loadSessions = function(rec) {\n  if (!app.grid2.collapsed) {\n    if (!rec)\n      rec = app.grid1.getSelection()[0];\n    if (rec) {\n      if (app.grid2.disable)\n        app.grid2.setDisabled(false);\n      user = rec.data.user;\n      app.sessionStore.load({\n        params: {\n          user: user\n        }\n      });\n    } else {\n      app.sessionStore.removeAll();\n      app.grid2.setDisabled(true);\n    }\n  }\n};\napp.agentRender = function(record) {\n  var img, isOpera, isChrome, isSafari, isIE, isWebKit, isGecko,\n    userAgent = record.get('userAgent'),\n    agent = userAgent ? userAgent.toLowerCase() : '',\n    check = function(regex) {\n      return regex.test(agent);\n    };\n  if (check(/mobile/))\n    return Wb.getIcon('phone_icon', '移动终端');\n  else {\n    isOpera = check(/opera/);\n    isChrome = check(/\\bchrome\\b/);\n    isSafari = !isChrome && check(/safari/);\n    isIE = !isOpera && (check(/msie/) || check(/trident/));\n    isWebKit = check(/webkit/);\n    isGecko = !isWebKit && !isIE && check(/gecko/);\n    if (isOpera)\n      img = 'opera';\n    else if (isChrome)\n      img = 'chrome';\n    else if (isSafari)\n      img = 'safari';\n    else if (isIE)\n      img = 'ie';\n    else if (isGecko)\n      img = 'firefox';\n    if (img)\n      return Wb.getUrlIcon('wb/images/' + img + '.png', img);\n    else return Wb.getIcon('web_icon', '未知类型');\n  }\n};"}}],"roles":{},"title":"在线用户列表","iconCls":"web_icon","inframe":false,"pageLink":""}