db448848798fedb8b6ece1b69145a9a32f68fd51.svn-base 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. 
  2. $(function () {
  3. "use strict";
  4. var startCenter = BWA.config["center-mode"];
  5. var startupView = startCenter ? 'CenterLogin' : 'Login';
  6. var layoutSet = BemsWebApplication.config.layoutSet;
  7. DevExpress.devices.current(layoutSet);
  8. DevExpress.data.utils.odata.keyConverters.DateTime = function (value) {
  9. // return value;
  10. // 서버단에서 ":" 적용가능해야 함
  11. if (_.isDate(value)) {
  12. value = moment(value).format('YYYY-MM-DDTHH:mm:ss');;
  13. }
  14. return new DevExpress.data.EdmLiteral("datetime'" + value + "'");
  15. }
  16. var language = navigator.language || navigator.browserLanguage;
  17. Globalize.culture(language);
  18. BemsWebApplication.app = new DevExpress.framework.html.HtmlApplication({
  19. namespace: BemsWebApplication,
  20. layoutSet: DevExpress.framework.html.layoutSets[layoutSet],
  21. mode: "webSite",
  22. navigation: BemsWebApplication.config.navigation,
  23. commandMapping: {
  24. "desktop-toolbar": {
  25. defaults: {
  26. showIcon: true,
  27. showText: true,
  28. location: "after"
  29. },
  30. commands: ["cancel", "create", "edit", "save", "create1", "create2", "create3", "create4", {
  31. id: "delete",
  32. type: "danger"
  33. }]
  34. }
  35. }
  36. });
  37. $(window).unload(function () {
  38. BemsWebApplication.app.saveState();
  39. });
  40. BWA.Factory = {};
  41. BemsWebApplication.app.afterViewSetup.add(function (arg) {
  42. BemsWebApplication.app.currentViewInfo = arg.viewInfo;
  43. console.log('afterViewSetup');
  44. console.log(arg);
  45. });
  46. BWA.app.navigating.add(function (e) {
  47. console.log('navigating: ' + e.uri);
  48. if (e.uri !== 'Login' && e.uri !== 'CenterLogin') {
  49. var userInfo = BWA.UserInfo;
  50. if (userInfo.IsLogin() === false) {
  51. e.cancel = true;
  52. BemsWebApplication.app.navigate(startupView);
  53. // BWA.LoginOverlay.show();
  54. }
  55. //2015 11 16 hcLee MainDashboard화면은 권한상관없게 처리
  56. else if (e.uri !== 'Blank'
  57. && (e.uri !== 'MainDashboard')
  58. && (e.uri !== 'MainDashboardFMS')
  59. && (e.uri !== 'CenterMainDashboard')
  60. && userInfo.hasPermissionOfSearch(e.uri) === false) {
  61. e.cancel = true;
  62. utils.toast.show('현재 로그인한 사용자 계정에 해당 화면의 조회 권한이 없습니다.', 'error');
  63. }
  64. } else {
  65. if (e.uri == 'Login') {
  66. autoLogin()
  67. }
  68. }
  69. });
  70. function autoLogin() {
  71. if ($.cookie('fromCenter')) {
  72. BWA.LoginOverlay.handleLoginButton();
  73. }
  74. }
  75. BWA.app.beforeViewSetup.add(function (arg) {
  76. console.log('beforeViewSetup');
  77. });
  78. BWA.app.initialized.add(function (arg) {
  79. // BWA.LoginOverlay.show();
  80. });
  81. BemsWebApplication.app.router.register(":view/:id", { view: startupView, id: undefined });
  82. BemsWebApplication.app.navigate();
  83. $(document).on("ajaxSend", function (e, xhr, settings) {
  84. settings.timeout = BWA.config.connectionTimeOut;
  85. });
  86. });