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.
 
 
 
 
 
 

226 lines
10 KiB

  1. var refreshGirdData;
  2. var selectedRow;
  3. var formHeight;
  4. var keyValue;
  5. var moduleType = true;
  6. var bootstrap = function (a, b) {
  7. var c = "0";
  8. var d = {
  9. init: function () {
  10. d.inittree();
  11. d.initGrid();
  12. d.bind()
  13. },
  14. bind: function () {
  15. a("#btn_Search").on("click",
  16. function () {
  17. var e = a("#txt_Keyword").val();
  18. d.search({
  19. parentId: c,
  20. keyword: e
  21. })
  22. });
  23. a("#lr_refresh").on("click",
  24. function () {
  25. location.reload()
  26. });
  27. a("#lr_edit").on("click",
  28. function () {
  29. selectedRow = a("#gridtable").jfGridGet("rowdata");
  30. if (b.checkrow(selectedRow)) {
  31. b.layerForm({
  32. id: "form",
  33. title: "编辑",
  34. url: top.$.rootUrl + "/LR_LGManager/LGMap/AddForm?keyValue=" + keyValue,
  35. width: 400,
  36. height: formHeight,
  37. callBack: function (e) {
  38. return top[e].acceptClick(function () {
  39. d.search({
  40. parentId: c
  41. })
  42. })
  43. }
  44. })
  45. }
  46. })
  47. },
  48. inittree: function () {
  49. a("#module_tree").lrtree({
  50. url: top.$.rootUrl + "/LR_SystemModule/Module/GetModuleTree",
  51. nodeClick: d.treeNodeClick
  52. })
  53. },
  54. treeNodeClick: function (e) {
  55. c = e.id;
  56. moduleType = e.hasChildren;
  57. a("#titleinfo").text(e.text);
  58. d.search({
  59. parentId: c
  60. })
  61. },
  62. initGrid: function () {
  63. var e = [];
  64. b.httpAsyncGet(top.$.rootUrl + "/LR_LGManager/LGType/GetList",
  65. function (h) {
  66. if (h.data) {
  67. e.push({
  68. label: "名称",
  69. name: h.data[0].F_Code,
  70. width: 200,
  71. align: "left"
  72. });
  73. keyValue = h.data[0].F_Code;
  74. for (var f = 1; f < h.data.length; f++) {
  75. var g = {
  76. label: h.data[f].F_Name,
  77. name: h.data[f].F_Code,
  78. width: 200,
  79. align: "left"
  80. };
  81. e.push(g)
  82. }
  83. a("#gridtable").jfGrid({
  84. headData: e,
  85. dblclick: function (i) {
  86. if (b.checkrow(i)) {
  87. selectedRow = i;
  88. b.layerForm({
  89. id: "form",
  90. title: "编辑",
  91. url: top.$.rootUrl + "/LR_LGManager/LGMap/AddForm?keyValue=" + keyValue,
  92. width: 400,
  93. height: formHeight,
  94. callBack: function (j) {
  95. return top[j].acceptClick(function () {
  96. d.search({
  97. parentId: c
  98. })
  99. })
  100. }
  101. })
  102. }
  103. }
  104. });
  105. d.search({
  106. parentId: c
  107. });
  108. if (h.data.length <= 3) {
  109. formHeight = 230
  110. } else {
  111. formHeight = 230 + (h.data.length - 3) * 40
  112. }
  113. }
  114. })
  115. },
  116. search: function (f) {
  117. var g = [];
  118. var e = {};
  119. if (moduleType) {
  120. b.httpAsyncGet(top.$.rootUrl + "/LR_SystemModule/Module/GetModuleListByParentId?parentId=" + f.parentId,
  121. function (h) {
  122. b.httpAsyncGet(top.$.rootUrl + "/LR_LGManager/LGMap/GetList",
  123. function (n) {
  124. if (h.data && n.data) {
  125. for (var k = 0; k < h.data.length; k++) {
  126. var o = n.data.find(function (i) {
  127. return i.F_Name == h.data[k].F_FullName
  128. });
  129. if (typeof o != "undefined") {
  130. var m = n.data.filter(function (i) {
  131. return i.F_Code == o.F_Code
  132. });
  133. for (var l = 0; l < m.length; l++) {
  134. e[m[l].F_TypeCode] = m[l].F_Name;
  135. e.F_Code = m[l].F_Code
  136. }
  137. } else {
  138. e[keyValue] = h.data[k].F_FullName;
  139. e.F_Code = ""
  140. }
  141. g.push(e);
  142. e = {}
  143. }
  144. a("#gridtable").jfGridSet("refreshdata", g);
  145. g = []
  146. }
  147. })
  148. })
  149. } else {
  150. b.httpAsyncGet(top.$.rootUrl + "/LR_SystemModule/Module/GetFormData?keyValue=" + f.parentId,
  151. function (h) {
  152. b.httpAsyncGet(top.$.rootUrl + "/LR_LGManager/LGMap/GetList",
  153. function (n) {
  154. if (h.data && n.data) {
  155. for (var k = 0; k < h.data.moduleButtons.length; k++) {
  156. var o = n.data.find(function (i) {
  157. return i.F_Name == h.data.moduleButtons[k].F_FullName
  158. });
  159. if (typeof o != "undefined") {
  160. var m = n.data.filter(function (i) {
  161. return i.F_Code == o.F_Code
  162. });
  163. for (var l = 0; l < m.length; l++) {
  164. e[m[l].F_TypeCode] = m[l].F_Name;
  165. e.F_Code = m[l].F_Code
  166. }
  167. } else {
  168. e[keyValue] = h.data.moduleButtons[k].F_FullName;
  169. e.F_Code = ""
  170. }
  171. g.push(e);
  172. e = {}
  173. }
  174. for (var k = 0; k < h.data.moduleColumns.length; k++) {
  175. var o = n.data.find(function (i) {
  176. return i.F_Name == h.data.moduleColumns[k].F_FullName
  177. });
  178. if (typeof o != "undefined") {
  179. var m = n.data.filter(function (i) {
  180. return i.F_Code == o.F_Code
  181. });
  182. for (var l = 0; l < m.length; l++) {
  183. e[m[l].F_TypeCode] = m[l].F_Name;
  184. e.F_Code = m[l].F_Code
  185. }
  186. } else {
  187. e[keyValue] = h.data.moduleColumns[k].F_FullName;
  188. e.F_Code = ""
  189. }
  190. g.push(e);
  191. e = {}
  192. }
  193. for (var k = 0; k < h.data.moduleFields.length; k++) {
  194. var o = n.data.find(function (i) {
  195. return i.F_Name == h.data.moduleFields[k].F_FullName
  196. });
  197. if (typeof o != "undefined") {
  198. var m = n.data.filter(function (i) {
  199. return i.F_Code == o.F_Code
  200. });
  201. for (var l = 0; l < m.length; l++) {
  202. e[m[l].F_TypeCode] = m[l].F_Name;
  203. e.F_Code = m[l].F_Code
  204. }
  205. } else {
  206. e[keyValue] = h.data.moduleFields[k].F_FullName;
  207. e.F_Code = ""
  208. }
  209. g.push(e);
  210. e = {}
  211. }
  212. a("#gridtable").jfGridSet("refreshdata", g);
  213. g = []
  214. }
  215. })
  216. })
  217. }
  218. }
  219. };
  220. refreshGirdData = function () {
  221. d.search({
  222. parentId: c
  223. })
  224. };
  225. d.init()
  226. };