indexJs.jsp 23 KB

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