indexJs.jsp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
  2. <%@include file="/WEB-INF/ehr/commons/jsp/commonInclude.jsp" %>
  3. <script>
  4. // 设置jQuery Ajax全局的参数
  5. $.ajaxSetup({
  6. type: "POST",
  7. error: function (jqXHR, textStatus, errorThrown) {
  8. isLogin();
  9. switch (jqXHR.status) {
  10. case(500):
  11. $.ligerDialog.error("服务器系统内部错误");
  12. break;
  13. case(401):
  14. $.ligerDialog.error("未登录");
  15. break;
  16. case(403):
  17. $.ligerDialog.error("无权限执行此操作");
  18. break;
  19. case(408):
  20. $.ligerDialog.error("请求超时");
  21. break;
  22. default:
  23. $.ligerDialog.error("未知错误");
  24. }
  25. }
  26. });
  27. //判断是否登录
  28. function isLogin() {
  29. $.ajax({ //获取是否
  30. type: "POST",
  31. url: "${contextRoot}/system/isLogin",
  32. dataType: "json",
  33. cache: false,
  34. success: function (data) {
  35. if (!data.successFlg) {
  36. location.href = "${contextRoot}/loginPage";
  37. }
  38. },
  39. error: function (data) {
  40. location.href = "${contextRoot}/loginPage";
  41. }
  42. });
  43. }
  44. var indexPage = {
  45. localNav: [],
  46. homeUrl: "${contextRoot}/homePage",
  47. init: function () {
  48. var me = this;
  49. //showLogo == "false"不显示logo横条
  50. var topHeight =120;
  51. if (${showLogo == "false"}) {
  52. topHeight = 40
  53. }
  54. //主布局
  55. $("#divIndexMain").ligerLayout({
  56. space: 0,
  57. topHeight: topHeight,
  58. leftWidth: 220,
  59. allowLeftCollapse: false,
  60. allowLeftResize: false,
  61. allowTopResize: false
  62. });
  63. $(".l-layout-left").css({background: "#dce6f0"})
  64. var tenantManager = {} ;
  65. var userRole = localStorage.getItem("userRole");
  66. //菜单列表
  67. var menu = [
  68. //标准管理
  69. //标准规范中心
  70. {id: 2, text: '标准规范', icon: '${staticRoot}/images/index/menu3_icon.png'},
  71. {id: 21, pid: 2, text: '平台标准', url: '${contextRoot}/integration/initial/standard'},
  72. {id: 22, pid: 2, text: '应用标准', url: '${contextRoot}/integration/initial/application'},
  73. {id: 23, pid: 2, text: '适配方案', url: '${contextRoot}/adapterPlan/initial'},
  74. //服务管理中心
  75. {id: 6, text: '服务管理', icon: '${staticRoot}/images/index/menu5_icon.png'},
  76. {id: 61, pid: 6, text: '服务管理', url: '${contextRoot}/app/initial'},
  77. {id: 62, pid: 6, text: '转换管理', url: '${contextRoot}/processor/initial'},
  78. //数据服务总线
  79. {id: 1, text: '服务总线', icon: '${staticRoot}/images/index/menu2_icon.png'},
  80. {id: 11, pid: 1, text: '流程编排', url: '${contextRoot}/flow/initial'},
  81. {id: 12, pid: 1, text: '任务配置', url: '${contextRoot}/datacollect/configJob'},
  82. {id: 13, pid: 1, text: '采集编排', url: '${contextRoot}/crawler/jobLayout'},
  83. {id: 14, pid: 1, text: '流程编辑', url: '${contextRoot}/process/initial'},
  84. //运行监控中心
  85. {id: 5, text: '运行监控', icon: '${staticRoot}/images/index/menu5_icon.png'},
  86. {id: 51, pid: 5, text: '系统监控', url: '${contextRoot}/monitor/server/initial'},
  87. {id: 52, pid: 5, text: '服务监控', url: '${contextRoot}/monitor/service/initial'},
  88. {id: 53, pid: 5, text: '任务跟踪', url: '${contextRoot}/datacollect/trackJob', targetType: '1'},
  89. {id: 54, pid: 5, text: '任务补采', url: '${contextRoot}/datacollect/repeatDatacollect'},
  90. {id: 55, pid: 5, text: '远程管理', url: '${contextRoot}/shell/initial'},
  91. //资源管理
  92. {id: 3, text: '资源服务', icon: '${staticRoot}/images/index/menu4_icon.png'},
  93. {id: 31, pid: 3, text: '资源注册', url: '${contextRoot}/resource/resource/initial'},
  94. {id: 32, pid: 3, text: '资源浏览', url: '${contextRoot}/resource/resourcePage'},
  95. {id: 34, pid: 3, text: '资源分类', url: '${contextRoot}/resource/rsCategory/initial'},
  96. {id: 35, pid: 3, text: '业务资源', url: '${contextRoot}/resourceRest/initial'},
  97. //维度管理
  98. <%--{id: 4, text: '维度管理', icon: '${staticRoot}/images/index/menu5_icon.png'},--%>
  99. {id: 36, pid: 3, text: '维度配置', url: '${contextRoot}/dimension/dimension'},
  100. {id: 37, pid: 3, text: '维度类别配置', url: '${contextRoot}/dimension/dimensioncatetory'},
  101. //用户安全中心
  102. {id: 7, text: '用户安全', icon: '${staticRoot}/images/index/menu5_icon.png'},
  103. {id: 71, pid: 7, text: '机构管理', url: '${contextRoot}/org/initial'},
  104. {id: 72, pid: 7, text: '用户管理', url: '${contextRoot}/user/initial'},
  105. {id: 73, pid: 7, text: '角色管理', url: '${contextRoot}/role/initial'},
  106. {id: 74, pid: 7, text: '权限管理', url: '${contextRoot}/authority/initial'},
  107. //系统配置
  108. {id: 9, text: '系统配置', icon: '${staticRoot}/images/index/menu6_icon.png'},
  109. {id: 91, pid: 9, text: '系统参数', url: '${contextRoot}/param/initial'},
  110. {id: 92, pid: 9, text: '字典管理', url: '${contextRoot}/dict/initial'},
  111. {id: 93, pid: 9, text: '菜单配置', url: '${contextRoot}/menu/initial'},
  112. {id: 94, pid: 9, text: '菜单按钮配置', url: '${contextRoot}/menu/menuAction/initial'},
  113. {id: 95, pid: 9, text: '数据源配置', url: '${contextRoot}/datasource/configSources'},
  114. ];
  115. if(userRole=="admin"){
  116. //是管理中心用户,则添加租户管理模块
  117. // menu = menu.concat(tenantManager);
  118. var menu_1 = [
  119. {id: 10, text: '租户管理', icon: '${staticRoot}/images/index/menu1_icon.png'},
  120. {id: 101, pid: 10, text: '租户管理', url: '${contextRoot}/tenant/initial'},
  121. {id: 102, pid: 10, text: '数据库实例管理', url: '${contextRoot}/tenant/dataBase/initial'}
  122. ];
  123. menu = menu.concat(menu_1);
  124. }
  125. // var menu_1 = [
  126. // ]
  127. // menu = menu.concat(menu_1);
  128. me.menuTree = $('#ulTree').ligerTree({
  129. data: menu,
  130. idFieldName: 'id',
  131. parentIDFieldName: 'pid',
  132. checkbox: false,
  133. treeLine: false,
  134. autoCheckboxEven: false,
  135. needCancel: false,
  136. btnClickToToggleOnly: false,
  137. slide: false,
  138. nodeDraggable: false,
  139. isExpand: false,
  140. parentIcon: true,
  141. nodeWidth: 176,
  142. onSelect: function (obj) {
  143. if (obj.data.url != undefined) {
  144. me.openMenu(obj);
  145. }
  146. },
  147. //一级节点不可选中
  148. onAfterAppend: function () {
  149. $.each($("#ulTree li[outlinelevel='1']"), function (index, item) {
  150. $(item).addClass("l-unselectable");
  151. });
  152. }
  153. });
  154. //首页按钮
  155. $('#btnIndexHome').bind('click', function () {
  156. me.openHome();
  157. });
  158. //退出按钮
  159. $('#btnIndexLogout').click(function () {
  160. $.ligerDialog.confirm('是否确认退出!', function (yes) {
  161. if (yes) {
  162. $.ajax({ //获取表的字段列表
  163. type: "POST",
  164. url: "${contextRoot}/system/logoutAction",
  165. dataType: "json",
  166. cache: false,
  167. success: function (data) {
  168. if (data.successFlg) {
  169. localStorage.removeItem("userRole");
  170. location.href = "${contextRoot}/"+data.data+"/loginPage";
  171. }
  172. else {
  173. $.ligerDialog.error(data.message);
  174. }
  175. },
  176. error: function (data) {
  177. $.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");
  178. }
  179. });
  180. }
  181. });
  182. });
  183. $('#btnIndexPassword').click(function () {
  184. me.dialog = $.ligerDialog.open({
  185. height: 300,
  186. width: 600,
  187. title: "修改密码",
  188. url: '${contextRoot}/user/renewPassword',
  189. });
  190. });
  191. //me.openHome();
  192. //打开默认菜单
  193. me.openMenuByText("任务跟踪");
  194. },
  195. //加载中
  196. loading: function () {
  197. $('#divIndexContent').html("loading...");
  198. },
  199. //首页按钮选择/取消
  200. clickHomeBtn: function (isClick) {
  201. try {
  202. var btn = $("#btnIndexHome");
  203. if (!isClick) {
  204. btn.removeClass('m-index-menu-top-over');
  205. }
  206. else {
  207. btn.addClass('m-index-menu-top-over');
  208. }
  209. }
  210. catch (e) {
  211. return;
  212. }
  213. },
  214. //打开首页
  215. openHome: function () {
  216. try {
  217. var me = this;
  218. me.localNav = [];
  219. me.localNav.push({text: "主页", url: me.homeUrl});
  220. me.localRender();
  221. me.clickHomeBtn(true);
  222. //取消菜单选中
  223. $('#ulTree .l-body.l-selected').removeClass("l-selected");
  224. me.loading();
  225. $('#divIndexContent').load(me.homeUrl);
  226. }
  227. catch (e) {
  228. return;
  229. }
  230. },
  231. //刷新当前位置栏
  232. localRender: function () {
  233. try {
  234. var me = this;
  235. var html = "";
  236. if (me.localNav.length > 0) {
  237. for (var i = 0; i < me.localNav.length; i++) {
  238. var text = me.localNav[i].text;
  239. var url = me.localNav[i].url;
  240. if (i == me.localNav.length - 1) //最后一个节点
  241. {
  242. html += text;
  243. }
  244. else {// html += "<a class='localNavBtn' href='javascripr:void(0)' url='"+url+"' onclick='indexPage.openMenu()'>"+text + "</a>&nbsp;>&nbsp;";
  245. html += "<a class='localNavBtn' href='javascripr:void(0)' url='" + url + "' onclick='indexPage.openMenu()'>" + text + "</a>";
  246. }
  247. }
  248. }
  249. $('#indexNav').html(html);
  250. }
  251. catch (e) {
  252. return;
  253. }
  254. },
  255. //打开菜单(暂不考虑多级菜单)
  256. openMenu: function (obj) {
  257. try {
  258. var me = this;
  259. var id = obj.data.id;
  260. var text = obj.data.text;
  261. var url = obj.data.url;
  262. me.localNav = [];
  263. me.localNav.push({id: id, text: text, url: url});
  264. //父亲节点
  265. me.localRender();
  266. me.clickHomeBtn(false);
  267. if (obj.data.targetType == "1") {
  268. me.loadIframePage(url);
  269. }
  270. else if (obj.data.targetType == "2") {
  271. window.open(url);
  272. }
  273. else {
  274. me.loadPage(url);
  275. }
  276. }
  277. catch (e) {
  278. return;
  279. }
  280. },
  281. //弹窗返回
  282. dialogSuccess: function (message) {
  283. this.dialog.close();
  284. $.ligerDialog.success(message);
  285. },
  286. //打开子功能页面
  287. openChildPage: function (text, url, targetType, data, fun) {
  288. try {
  289. var me = this;
  290. me.localNav.push({text: text, url: url, data: data, fun: fun});
  291. me.localRender();
  292. if (targetType == "1") {
  293. me.loadIframePage(url, data, fun);
  294. }
  295. else if (targetType == "2") {
  296. window.open(url);
  297. }
  298. else {
  299. me.loadPage(url, data, fun);
  300. }
  301. }
  302. catch (e) {
  303. return;
  304. }
  305. },
  306. //加载页面
  307. loadPage: function (url, data, fun) {
  308. try {
  309. var me = this;
  310. me.loading();
  311. var div = $("<div class='m-index-content'></div>").load(url, data, function () {
  312. if (fun != undefined && typeof fun == 'function') {
  313. fun();
  314. }
  315. });
  316. $('#divIndexContent').html(div);
  317. }
  318. catch (e) {
  319. return;
  320. }
  321. },
  322. //加载iframe页面
  323. loadIframePage: function (url, data, fun) {
  324. try {
  325. var me = this;
  326. $('#divIndexContent').html("<iframe style='height:98%;width:100%' frameborder='0' src='" + url + "' allowTransparency='true'></iframe>");
  327. }
  328. catch (e) {
  329. return;
  330. }
  331. },
  332. //通过text打开菜单
  333. openMenuByText: function (text, params, select) {
  334. try {
  335. var me = this;
  336. if (select == false) {
  337. var nodeText = $("span", me.menuTree.tree);
  338. var url = "";
  339. $.each($("div[class='l-body l-selected']", me.menuTree.tree), function () {
  340. $(this).removeClass("l-selected");
  341. });
  342. for (var i = 0; i < nodeText.length; i++) {
  343. if ($(nodeText[i]).text().indexOf(text) >= 0) {
  344. var id = $(nodeText[i]).closest("li").attr("id");
  345. url = $(nodeText[i]).closest("li").attr("url");
  346. me.menuTree.expandNode(id);
  347. $(nodeText[i]).closest("li").find("div[class='l-body']").addClass("l-selected");
  348. break;
  349. }
  350. }
  351. //当前位置栏
  352. me.localNav = [];
  353. me.localNav.push({id: id, text: text, url: url});
  354. me.localRender();
  355. me.clickHomeBtn(false);
  356. //打开页面
  357. me.loadPage(url, params);
  358. }
  359. else {
  360. //选择节点
  361. me.menuTree.queryByText(text, select);
  362. }
  363. }
  364. catch (e) {
  365. return;
  366. }
  367. },
  368. //刷新当前页面
  369. refresh: function () {
  370. try {
  371. var me = this;
  372. if (me.localNav.length > 0) {
  373. var text = me.localNav[me.localNav.length - 1].text;
  374. me.openMenuByText(text);
  375. }
  376. }
  377. catch (e) {
  378. return;
  379. }
  380. }
  381. }
  382. $(function () {
  383. <%--if (window.history && window.history.pushState) {--%>
  384. <%--$(window).on('popstate', function () {--%>
  385. <%--var hashLocation = location.hash;--%>
  386. <%--var hashSplit = hashLocation.split("#!/");--%>
  387. <%--var hashName = hashSplit[1];--%>
  388. <%--if (hashName !== '') {--%>
  389. <%--var hash = window.location.hash;--%>
  390. <%--if (hash === '') {--%>
  391. <%--$.ligerDialog.confirm('是否确认后退登出系统!', function (yes) {--%>
  392. <%--if (yes) {--%>
  393. <%--$.ajax({ //获取表的字段列表--%>
  394. <%--type: "POST",--%>
  395. <%--url: "${contextRoot}/system/logoutAction",--%>
  396. <%--dataType: "json",--%>
  397. <%--cache: false,--%>
  398. <%--success: function (data) {--%>
  399. <%--if (data.successFlg) {--%>
  400. <%--localStorage.removeItem("userRole");--%>
  401. <%--location.href = "${contextRoot}/"+data.data+"/loginPage";--%>
  402. <%--}--%>
  403. <%--else {--%>
  404. <%--$.ligerDialog.error(data.message);--%>
  405. <%--}--%>
  406. <%--},--%>
  407. <%--error: function (data) {--%>
  408. <%--$.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");--%>
  409. <%--}--%>
  410. <%--});--%>
  411. <%--}--%>
  412. <%--});--%>
  413. <%--}--%>
  414. <%--}--%>
  415. <%--});--%>
  416. <%--window.history.pushState('forward', null, './indexPage');--%>
  417. <%--}--%>
  418. isLogin();
  419. indexPage.init();
  420. //不显示logo横条
  421. if (${showLogo == "false"}) {
  422. $(".m-index-top").css("display","none");
  423. $(".m-index-top").height(0);
  424. $(".l-layout-left").css("top","40px");
  425. $(".l-layout-center").css("top","40px");
  426. }
  427. });
  428. </script>