indexJs.jsp 15 KB

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