indexJs.jsp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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. if(obj.data.url.indexOf("report/signin") >= 0){
  153. me.loadIframePage(obj.data.url);//质控页面
  154. }else{
  155. me.openMenu(obj);
  156. }
  157. }
  158. //选中子菜单时默认选中父菜单
  159. if(obj.data.children == undefined){
  160. var parent = $("#ulTree li").eq(obj.data.treedataindex).parents("li");
  161. var parImg = parent.children(".l-body").children(".l-tree-icon").find("img");
  162. parent.children(".l-body").addClass("l-selected");
  163. if(parImg.attr("src").indexOf("hover") == -1){
  164. var imgSrc = parImg.attr("src");
  165. parImg.attr("src",imgSrc.substring(0,imgSrc.length-4)+"_hover.png");
  166. }
  167. }
  168. //切换选中菜单的图标
  169. var imgSrc = obj.data.icon;
  170. if(imgSrc.indexOf("hover")>0){
  171. obj.data.hover = imgSrc;
  172. }else{
  173. obj.data.hover = imgSrc.substring(0,obj.data.icon.length-4)+"_hover.png";
  174. obj.data.icon = obj.data.hover;
  175. }
  176. $("#ulTree li").eq(obj.data.treedataindex).children(".l-body").find("img").attr("src",obj.data.hover);
  177. $.each($(".l-body"), function(index, item) {
  178. var self = $(this);
  179. if(!self.hasClass("l-selected")){
  180. var imgSrcs = self.find("img").attr("src");
  181. if(imgSrcs.indexOf("hover") > 0){
  182. self.find("img").attr("src",imgSrcs.substring(0,imgSrcs.length-10)+".png");
  183. }
  184. }
  185. });
  186. },
  187. onClick:function(obj){
  188. },
  189. onBeforeSelect(obj){//解决bug 3487【ESB】标准规范:点击标准规范的图标,图标会显示成白色。
  190. if(obj.data == null){
  191. if(obj.target.parentElement.parentElement.className.indexOf("l-selected") > 0){
  192. return false;
  193. }
  194. }
  195. },
  196. //一级节点不可选中
  197. onAfterAppend: function () {
  198. // $.each($("#ulTree li[outlinelevel='1']"), function (index, item) {
  199. // $(item).addClass("l-unselectable");
  200. // });
  201. }
  202. });
  203. //首页按钮
  204. $('#btnIndexHome').bind('click', function () {
  205. me.openHome();
  206. });
  207. //退出按钮
  208. $('#btnIndexLogout').click(function () {
  209. $.ligerDialog.confirm('是否确认退出!', function (yes) {
  210. if (yes) {
  211. $.ajax({ //获取表的字段列表
  212. type: "POST",
  213. url: "${contextRoot}/system/logoutAction",
  214. dataType: "json",
  215. cache: false,
  216. success: function (data) {
  217. if (data.successFlg) {
  218. localStorage.removeItem("userRole");
  219. location.href = "${contextRoot}/"+data.data+"/loginPage";
  220. }
  221. else {
  222. $.ligerDialog.error(data.message);
  223. }
  224. },
  225. error: function (data) {
  226. $.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");
  227. }
  228. });
  229. }
  230. });
  231. });
  232. $('#btnIndexPassword').click(function () {
  233. me.dialog = $.ligerDialog.open({
  234. height: 300,
  235. width: 600,
  236. title: "修改密码",
  237. url: '${contextRoot}/user/renewPassword',
  238. });
  239. });
  240. //me.openHome();
  241. //打开默认菜单
  242. // me.openMenuByText("任务跟踪");
  243. },
  244. //加载中
  245. loading: function () {
  246. $('#divIndexContent').html("loading...");
  247. },
  248. //首页按钮选择/取消
  249. clickHomeBtn: function (isClick) {
  250. try {
  251. var btn = $("#btnIndexHome");
  252. if (!isClick) {
  253. btn.removeClass('m-index-menu-top-over');
  254. }
  255. else {
  256. btn.addClass('m-index-menu-top-over');
  257. }
  258. }
  259. catch (e) {
  260. return;
  261. }
  262. },
  263. //打开首页
  264. openHome: function () {
  265. try {
  266. var me = this;
  267. me.localNav = [];
  268. me.localNav.push({text: "主页", url: me.homeUrl});
  269. me.localRender();
  270. me.clickHomeBtn(true);
  271. //取消菜单选中
  272. $('#ulTree .l-body.l-selected').removeClass("l-selected");
  273. me.loading();
  274. $('#divIndexContent').load(me.homeUrl);
  275. }
  276. catch (e) {
  277. return;
  278. }
  279. },
  280. //刷新当前位置栏
  281. localRender: function () {
  282. try {
  283. var me = this;
  284. var html = "";
  285. if (me.localNav.length > 0) {
  286. for (var i = 0; i < me.localNav.length; i++) {
  287. var text = me.localNav[i].text;
  288. var url = me.localNav[i].url;
  289. if (i == me.localNav.length - 1) //最后一个节点
  290. {
  291. html += text;
  292. }
  293. else {// html += "<a class='localNavBtn' href='javascripr:void(0)' url='"+url+"' onclick='indexPage.openMenu()'>"+text + "</a>&nbsp;>&nbsp;";
  294. html += "<a class='localNavBtn' href='javascripr:void(0)' url='" + url + "' onclick='indexPage.openMenu()'>" + text + "</a>";
  295. }
  296. }
  297. }
  298. $('#indexNav').html(html);
  299. }
  300. catch (e) {
  301. return;
  302. }
  303. },
  304. //打开菜单(暂不考虑多级菜单)
  305. openMenu: function (obj) {
  306. try {
  307. var me = this;
  308. var id = obj.data.id;
  309. var text = obj.data.text;
  310. var url = obj.data.url;
  311. me.localNav = [];
  312. me.localNav.push({id: id, text: text, url: url});
  313. //父亲节点
  314. me.localRender();
  315. me.clickHomeBtn(false);
  316. if (obj.data.targetType == "1") {
  317. me.loadIframePage(url);
  318. }
  319. else if (obj.data.targetType == "2") {
  320. window.open(url);
  321. }
  322. else {
  323. me.loadPage(url);
  324. }
  325. }
  326. catch (e) {
  327. return;
  328. }
  329. },
  330. //弹窗返回
  331. dialogSuccess: function (message) {
  332. this.dialog.close();
  333. $.ligerDialog.success(message);
  334. },
  335. //打开子功能页面
  336. openChildPage: function (text, url, targetType, data, fun) {
  337. try {
  338. var me = this;
  339. me.localNav.push({text: text, url: url, data: data, fun: fun});
  340. me.localRender();
  341. if (targetType == "1") {
  342. me.loadIframePage(url, data, fun);
  343. }
  344. else if (targetType == "2") {
  345. window.open(url);
  346. }
  347. else {
  348. me.loadPage(url, data, fun);
  349. }
  350. }
  351. catch (e) {
  352. return;
  353. }
  354. },
  355. //加载页面
  356. loadPage: function (url, data, fun) {
  357. try {
  358. var me = this;
  359. me.loading();
  360. var div = $("<div class='m-index-content'></div>").load(url, data, function () {
  361. if (fun != undefined && typeof fun == 'function') {
  362. fun();
  363. }
  364. });
  365. $('#divIndexContent').html(div);
  366. }
  367. catch (e) {
  368. return;
  369. }
  370. },
  371. //加载iframe页面
  372. loadIframePage: function (url, data, fun) {
  373. try {
  374. var me = this;
  375. $('#divIndexContent').html("<iframe style='height:98%;width:100%' frameborder='0' src='" + url + "' allowTransparency='true'></iframe>");
  376. }
  377. catch (e) {
  378. return;
  379. }
  380. },
  381. //通过text打开菜单
  382. openMenuByText: function (text, params, select) {
  383. try {
  384. var me = this;
  385. if (select == false) {
  386. var nodeText = $("span", me.menuTree.tree);
  387. var url = "";
  388. $.each($("div[class='l-body l-selected']", me.menuTree.tree), function () {
  389. $(this).removeClass("l-selected");
  390. });
  391. for (var i = 0; i < nodeText.length; i++) {
  392. if ($(nodeText[i]).text().indexOf(text) >= 0) {
  393. var id = $(nodeText[i]).closest("li").attr("id");
  394. url = $(nodeText[i]).closest("li").attr("url");
  395. me.menuTree.expandNode(id);
  396. $(nodeText[i]).closest("li").find("div[class='l-body']").addClass("l-selected");
  397. break;
  398. }
  399. }
  400. //当前位置栏
  401. me.localNav = [];
  402. me.localNav.push({id: id, text: text, url: url});
  403. me.localRender();
  404. me.clickHomeBtn(false);
  405. //打开页面
  406. me.loadPage(url, params);
  407. }
  408. else {
  409. //选择节点
  410. me.menuTree.queryByText(text, select);
  411. }
  412. }
  413. catch (e) {
  414. return;
  415. }
  416. },
  417. //刷新当前页面
  418. refresh: function () {
  419. try {
  420. var me = this;
  421. if (me.localNav.length > 0) {
  422. var text = me.localNav[me.localNav.length - 1].text;
  423. me.openMenuByText(text);
  424. }
  425. }
  426. catch (e) {
  427. return;
  428. }
  429. }
  430. }
  431. $(function () {
  432. <%--if (window.history && window.history.pushState) {--%>
  433. <%--$(window).on('popstate', function () {--%>
  434. <%--var hashLocation = location.hash;--%>
  435. <%--var hashSplit = hashLocation.split("#!/");--%>
  436. <%--var hashName = hashSplit[1];--%>
  437. <%--if (hashName !== '') {--%>
  438. <%--var hash = window.location.hash;--%>
  439. <%--if (hash === '') {--%>
  440. <%--$.ligerDialog.confirm('是否确认后退登出系统!', function (yes) {--%>
  441. <%--if (yes) {--%>
  442. <%--$.ajax({ //获取表的字段列表--%>
  443. <%--type: "POST",--%>
  444. <%--url: "${contextRoot}/system/logoutAction",--%>
  445. <%--dataType: "json",--%>
  446. <%--cache: false,--%>
  447. <%--success: function (data) {--%>
  448. <%--if (data.successFlg) {--%>
  449. <%--localStorage.removeItem("userRole");--%>
  450. <%--location.href = "${contextRoot}/"+data.data+"/loginPage";--%>
  451. <%--}--%>
  452. <%--else {--%>
  453. <%--$.ligerDialog.error(data.message);--%>
  454. <%--}--%>
  455. <%--},--%>
  456. <%--error: function (data) {--%>
  457. <%--$.ligerDialog.error("Status:" + data.status + "(" + data.statusText + ")");--%>
  458. <%--}--%>
  459. <%--});--%>
  460. <%--}--%>
  461. <%--});--%>
  462. <%--}--%>
  463. <%--}--%>
  464. <%--});--%>
  465. <%--window.history.pushState('forward', null, './indexPage');--%>
  466. <%--}--%>
  467. isLogin();
  468. indexPage.init();
  469. //不显示logo横条
  470. if (${showLogo == "false"}) {
  471. $(".m-index-top").css("display","none");
  472. $(".m-index-top").height(0);
  473. $(".l-layout-left").css("top","40px");
  474. $(".l-layout-center").css("top","40px");
  475. }
  476. });
  477. </script>