indexJs.jsp 17 KB

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