indexJs.jsp 15 KB

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