You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

139 lines
5.7 KiB

  1. var refreshGirdData;
  2. var selectedRow;
  3. var formHeight;
  4. var keyValue;
  5. var bootstrap = function ($, learun) {
  6. var classify_itemCode = "";
  7. var page = {
  8. init: function () {
  9. page.inittree();
  10. page.initGrid();
  11. page.bind();
  12. }, bind: function () {
  13. $("#btn_Search").on("click", function () {
  14. var keyword = $("#txt_Keyword").val();
  15. page.search({
  16. keyword: keyword
  17. });
  18. });
  19. $("#lr_refresh").on("click", function () {
  20. location.reload();
  21. });
  22. $("#lr_edit").on("click",
  23. function () {
  24. selectedRow = $("#gridtable").jfGridGet("rowdata");
  25. if (learun.checkrow(selectedRow)) {
  26. learun.layerForm({
  27. id: "form",
  28. title: "编辑",
  29. url: top.$.rootUrl + "/LR_LGManager/LGMap/AddForm?keyValue=" + keyValue,
  30. width: 400,
  31. height: formHeight,
  32. callBack: function (e) {
  33. return top[e].acceptClick(page.search);
  34. }
  35. });
  36. }
  37. });
  38. }, inittree: function () {
  39. $("#lr_left_tree").lrtree({
  40. url: top.$.rootUrl + "/LR_SystemModule/DataItem/GetClassifyTree",
  41. nodeClick: function (e) {
  42. classify_itemCode = e.value;
  43. $("#titleinfo").text(e.text + "(" + classify_itemCode + ")");
  44. page.search();
  45. }
  46. });
  47. }, initGrid: function () {
  48. var e = [];
  49. learun.httpAsyncGet(top.$.rootUrl + "/LR_LGManager/LGType/GetList",
  50. function (h) {
  51. if (h.data) {
  52. e.push({
  53. label: "项目值",
  54. name: h.data[0].F_Code,
  55. width: 200,
  56. align: "left"
  57. });
  58. keyValue = h.data[0].F_Code;
  59. for (var f = 1; f < h.data.length; f++) {
  60. var g = {
  61. label: h.data[f].F_Name,
  62. name: h.data[f].F_Code,
  63. width: 200,
  64. align: "left"
  65. };
  66. e.push(g);
  67. }
  68. $("#gridtable").jfGrid({
  69. headData: e,
  70. dblclick: function (i) {
  71. if (learun.checkrow(i)) {
  72. selectedRow = i;
  73. i.F_Code = keyValue;
  74. learun.layerForm({
  75. id: "form",
  76. title: "编辑",
  77. url: top.$.rootUrl + "/LR_LGManager/LGMap/AddForm?keyValue=" + keyValue,
  78. width: 400,
  79. height: formHeight,
  80. callBack: function (j) {
  81. return top[j].acceptClick(page.search);
  82. }
  83. });
  84. }
  85. }
  86. });
  87. page.search();
  88. if (h.data.length <= 3) {
  89. formHeight = 230;
  90. } else {
  91. formHeight = 230 + (h.data.length - 3) * 40;
  92. }
  93. }
  94. });
  95. }, search: function (f) {
  96. var g = [];
  97. var e = {};
  98. learun.httpAsyncGet(top.$.rootUrl + "/LR_SystemModule/DataItem/GetDetailList?itemCode=" + classify_itemCode,
  99. function (h) {
  100. learun.httpAsyncGet(top.$.rootUrl + "/LR_LGManager/LGMap/GetList",
  101. function (n) {
  102. if (h.data && n.data) {
  103. for (var k = 0; k < h.data.length; k++) {
  104. var o = n.data.find(function (i) {
  105. return i.F_Name == h.data[k].F_ItemName;
  106. });
  107. if (typeof o != "undefined") {
  108. var m = n.data.filter(function (i) {
  109. return i.F_Code == o.F_Code;
  110. });
  111. for (var l = 0; l < m.length; l++) {
  112. e[m[l].F_TypeCode] = m[l].F_Name;
  113. e.F_Code = m[l].F_Code;
  114. }
  115. } else {
  116. e[keyValue] = h.data[k].F_ItemName;
  117. e.F_Code = "";
  118. }
  119. g.push(e);
  120. e = {}
  121. }
  122. $("#gridtable").jfGridSet("refreshdata", g);
  123. g = [];
  124. }
  125. });
  126. });
  127. }
  128. };
  129. refreshGirdData = function () {
  130. page.search();
  131. };
  132. page.init();
  133. };