nav.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. function toogleAppCss(id) {
  2. $('#app-container .info').css('display', 'none');
  3. $('#info-' + id).css('display', 'block');
  4. $('ul .active').removeClass('active');
  5. $('#link-' + id).parent().addClass('active');
  6. }
  7. function itemClick(type, master, id, t) {
  8. if (master != null && master != '' && master != 'null') {
  9. $.post(basePath + "common/changeMaster.action", {
  10. to : master
  11. }, function(result, text) {
  12. var rs = $.evalJSON(result);
  13. if (!rs.success) {
  14. alert("在" + desc + "未找到您的账号.");
  15. } else {
  16. deal(type, id, t);
  17. }
  18. }, "application/json");
  19. } else {
  20. deal(type, id, t);
  21. }
  22. }
  23. function deal(type, id, t) {
  24. $('.info .active').removeClass('active');
  25. $('#info-item-' + type + '-' + id).addClass('active');
  26. $('#next').css('display', 'block');
  27. var frame = $('#frame-container iframe');
  28. $('#footer-container').css('display', 'none');
  29. $('#app-container').css('display', 'none');
  30. $('#frame-container').css('display', 'block');
  31. if ('flow' == type)
  32. frame.attr('src', basePath + "jsps/common/jprocessDeal.jsp?_noc=1&formCondition=jp_nodeIdIS" + id);
  33. else if ('procand' == type)
  34. frame.attr('src', basePath + "jsps/common/jtaketask.jsp?_noc=1&formCondition=jp_nodeIdIS" + id);
  35. else
  36. frame.attr('src', basePath + "jsps/plm/record/billrecord.jsp?_noc=1&ra_id=" + id + "&ra_type=" + t);
  37. }
  38. function logout() {
  39. confirm("要退出系统吗?") && $.get(basePath + "common/logout.action", function(result) {
  40. if (result.exceptionInfo) {
  41. alert(rs.exceptionInfo);
  42. } else {
  43. window.location.reload();
  44. }
  45. });
  46. }
  47. function changeMaster(name, desc) {
  48. $('#header-container ul .active').removeClass('active');
  49. $('#' + name).addClass('active');
  50. var bool = confirm("要切换到" + desc + "吗?");
  51. if (!bool) {
  52. $('#app').removeClass('active');
  53. $('#header-container ul').removeClass('active');
  54. } else {
  55. $.post(basePath + "common/changeMaster.action", {
  56. to : name
  57. }, function(result, text) {
  58. var rs = $.evalJSON(result);
  59. if (!rs.success) {
  60. alert("在" + desc + "未找到您的账号.");
  61. } else {
  62. window.location.href = basePath + "?master=" + name;
  63. }
  64. }, "application/json");
  65. }
  66. }
  67. function next() {
  68. var type = null, id = null, master = null,t = null;
  69. var item = $('.info .active').next();
  70. if(item.length > 0) {
  71. type = item.attr('data-type');
  72. var data = toJSON(item.attr('data'));
  73. id = type == 'flow' || type == 'procand' ? data.jp_nodeId : data.ra_id;
  74. master = data.CURRENTMASTER;
  75. t = type == 'task' ? data.ra_type : null;
  76. }
  77. if(id != null)
  78. itemClick(type, master, id, t);
  79. else {
  80. alert('没有下一条了.');
  81. $('#next').css('display', 'none');
  82. }
  83. }
  84. function toJSON(str) {
  85. str = str.replace(/^{*|}*$/g, '');
  86. var attrs = str.split(', '), p = {};
  87. attrs.forEach(function(property) {
  88. var t = property.split('=');
  89. p[t[0]] = t[1];
  90. });
  91. return p;
  92. }
  93. $(document).ready(function() {
  94. $.ajax({
  95. url: basePath + 'common/cross.action',
  96. type: 'GET',
  97. data: {
  98. path: 'http://218.17.158.219:8001/artifactory/libs-release-local/com/uas/android/pm/maven-metadata.xml'
  99. },
  100. dataType: 'xml',
  101. success: function(data) {
  102. if (data) {
  103. // latest version
  104. var version = $(data).find("metadata").find("versioning").find("latest").text();
  105. $('#download_client').attr('href', '//218.17.158.219:8001/artifactory/libs-release-local/com/uas/android/pm/' + version + '/pm-' + version + '.apk');
  106. }
  107. }
  108. });
  109. });