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.
 
 
 
 
 
 

137 lines
5.6 KiB

  1. /*
  2. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 上海力软信息技术有限公司
  4. * 创建人:力软-前端开发组
  5. * 日 期:2017.03.22
  6. * 描 述:功能模块
  7. */
  8. var refreshGirdData; // 更新数据
  9. var selectedRow;
  10. var formHeight;
  11. var keyValue;
  12. var bootstrap = function ($, learun) {
  13. "use strict";
  14. var classify_itemCode = '';
  15. var page = {
  16. init: function () {
  17. page.inittree();
  18. page.initGrid();
  19. page.bind();
  20. },
  21. bind: function () {
  22. // 查询
  23. $('#btn_Search').on('click', function () {
  24. var keyword = $('#txt_Keyword').val();
  25. page.search({ keyword: keyword });
  26. });
  27. // 刷新
  28. $('#lr_refresh').on('click', function () {
  29. location.reload();
  30. });
  31. // 编辑
  32. $('#lr_edit').on('click', function () {
  33. selectedRow = $('#gridtable').jfGridGet('rowdata');
  34. if (learun.checkrow(selectedRow)) {
  35. learun.layerForm({
  36. id: 'form',
  37. title: '编辑',
  38. url: top.$.rootUrl + '/LR_LGManager/LGMap/AddForm?keyValue=' + keyValue,
  39. width: 400,
  40. height: formHeight,
  41. callBack: function (id) {
  42. return top[id].acceptClick(page.search);
  43. }
  44. });
  45. }
  46. });
  47. },
  48. inittree: function () {
  49. $('#lr_left_tree').lrtree({
  50. url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyTree',
  51. nodeClick: function (item) {
  52. classify_itemCode = item.value;
  53. $('#titleinfo').text(item.text + '(' + classify_itemCode + ')');
  54. page.search();
  55. }
  56. });
  57. },
  58. initGrid: function () {
  59. var data = [];
  60. //获取语言类型
  61. learun.httpAsyncGet(top.$.rootUrl + '/LR_LGManager/LGType/GetList', function (res) {
  62. if (res.data) {
  63. data.push({ label: "项目值", name: res.data[0].F_Code, width: 200, align: "left" });
  64. keyValue = res.data[0].F_Code;//主语言
  65. for (var i = 1; i < res.data.length; i++) {
  66. var obj = { label: res.data[i].F_Name, name: res.data[i].F_Code, width: 200, align: "left" };
  67. data.push(obj);
  68. }
  69. $('#gridtable').jfGrid({
  70. headData: data,
  71. dblclick: function (row) {
  72. if (learun.checkrow(row)) {
  73. selectedRow = row;
  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 (id) {
  81. return top[id].acceptClick(page.search);
  82. }
  83. });
  84. }
  85. }
  86. });
  87. page.search();
  88. if (res.data.length <= 3) {
  89. formHeight = 230;
  90. }
  91. else {
  92. formHeight = 230 + (res.data.length - 3) * 40;
  93. }
  94. }
  95. });
  96. },
  97. search: function (param) {
  98. //获取表数据并赋值
  99. var rowData = [];
  100. var obj = {};
  101. learun.httpAsyncGet(top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList?itemCode=' + classify_itemCode, function (res) {
  102. learun.httpAsyncGet(top.$.rootUrl + '/LR_LGManager/LGMap/GetList', function (mapRes) {
  103. if (res.data && mapRes.data) {
  104. for (var i = 0; i < res.data.length; i++) {
  105. var val = mapRes.data.find(function (element) {
  106. return element.F_Name == res.data[i].F_ItemName;
  107. });
  108. if (typeof val != 'undefined') {
  109. var list = mapRes.data.filter(function (element) {
  110. return element.F_Code == val.F_Code;
  111. });
  112. for (var j = 0; j < list.length; j++) {
  113. obj[list[j].F_TypeCode] = list[j].F_Name;
  114. obj.F_Code = list[j].F_Code;//每一行数据的F_Code
  115. }
  116. }
  117. else {
  118. obj[keyValue] = res.data[i].F_ItemName;
  119. obj.F_Code = "";
  120. }
  121. rowData.push(obj);
  122. obj = {};
  123. }
  124. $('#gridtable').jfGridSet('refreshdata', rowData);
  125. rowData = [];
  126. }
  127. });
  128. });
  129. }
  130. };
  131. // 保存数据后回调刷新
  132. refreshGirdData = function () {
  133. page.search();
  134. }
  135. page.init();
  136. }