indexJs.jsp 22 KB

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