Index.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * 描 述:单位管理
  3. */
  4. var selectedRow;
  5. var refreshGirdData;
  6. var typnum = 1;
  7. var unitGrpId = '';
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. page.inittree();
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 查询
  18. $('#btn_Search').on('click', function () {
  19. var keyword = $('#txt_Keyword').val();
  20. page.search({ keyword: keyword });
  21. });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. selectedRow = null;
  29. learun.layerForm({
  30. id: 'form',
  31. title: '字典新增',
  32. url: top.$.rootUrl + '/BaseManager/BaseData/Form?unitGrpId=' + unitGrpId,
  33. width: 700,
  34. height: 400,
  35. callBack: function (id) {
  36. return top[id].acceptClick(refreshGirdData);
  37. }
  38. });
  39. });
  40. // 编辑
  41. $('#lr_edit').on('click', function () {
  42. var keyValue = $('#gridtable').jfGridValue('F_NO');
  43. selectedRow = $('#gridtable').jfGridGet('rowdata');
  44. if (learun.checkrow(keyValue)) {
  45. learun.layerForm({
  46. id: 'form',
  47. title: '字典编辑',
  48. url: top.$.rootUrl + '/BaseManager/BaseData/Form?keyValue=' + keyValue,
  49. width: 700,
  50. height: 400,
  51. callBack: function (id) {
  52. return top[id].acceptClick(refreshGirdData);
  53. }
  54. });
  55. }
  56. });
  57. // 删除
  58. $('#lr_delete').on('click', function () {
  59. var keyValue = $('#gridtable').jfGridValue('F_NO');
  60. if (learun.checkrow(keyValue)) {
  61. learun.layerConfirm('是否确认删除该项!', function (res) {
  62. if (res) {
  63. learun.deleteForm(top.$.rootUrl + '/BaseManager/BaseData/DeleteForm', { keyValue: keyValue }, function () {
  64. refreshGirdData();
  65. });
  66. }
  67. });
  68. }
  69. });
  70. $('#lr_import').on('click', function () {
  71. learun.layerForm({
  72. id: 'ImportForm',
  73. title: '导入Excel数据',
  74. url: top.$.rootUrl + '/Utility/ImportForm?ordertype=' + typnum,
  75. width: 600,
  76. height: 400,
  77. maxmin: true,
  78. btn: null
  79. });
  80. });
  81. $('#lr_exportnow').on('click', function () {
  82. learun.layerForm({
  83. id: "ExcelExportForm",
  84. title: '导出Excel数据',
  85. url: top.$.rootUrl + '/Utility/ExcelExportForm?gridId=' + $('#gridtable').attr('id') + '&filename=' + encodeURI(encodeURI("数据字典列表")),
  86. width: 500,
  87. height: 380,
  88. callBack: function (id) {
  89. return top[id].acceptClick();
  90. },
  91. btn: ['导出Excel', '关闭']
  92. });
  93. });
  94. },
  95. inittree: function () {
  96. $('#UnitGrpTree').lrtree({
  97. url: top.$.rootUrl + '/BaseManager/BaseData/GetTree',
  98. param: { parentId: '0' },
  99. nodeClick: page.treeNodeClick
  100. });
  101. $('#UnitGrpTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  102. },
  103. treeNodeClick: function (item) {
  104. if (item.parentId == 0) {
  105. unitGrpId = "";
  106. } else {
  107. unitGrpId = item.id;
  108. }
  109. $('#titleinfo').text(item.text);
  110. page.search();
  111. },
  112. initGird: function () {
  113. $('#gridtable').jfGrid({
  114. url: top.$.rootUrl + '/BaseManager/BaseData/GetPageList',
  115. headData: [
  116. learun.jfFormatter.col_F_NO("字典编号"),
  117. learun.jfFormatter.col_F_NAME("字典数据"),
  118. { label: "字典值", name: 'F_VALUE', width: 120, align: "left" },
  119. { label: "排序号", name: 'F_SORTNUM', width: 120, align: "left" },
  120. //{ label: "字典父编号", name: 'F_PNO', width: 120, align: "left" },
  121. //{
  122. // label: '单位组', name: 'F_UNITGRPNO', width: 150, align: "left"
  123. // , formatterAsync: function (callback, value, row) {
  124. // learun.clientdata.getAsync('unitgrp', {
  125. // key: value,
  126. // callback: function (item) {
  127. // callback(item.F_NAME);
  128. // }
  129. // });
  130. // }
  131. //},
  132. learun.jfFormatter.col_F_ISSTOP(),
  133. learun.jfFormatter.col_F_ADDUSERNO(),
  134. learun.jfFormatter.col_F_ADDTIME(),
  135. learun.jfFormatter.col_F_EDITUSERNO(),
  136. learun.jfFormatter.col_F_EDITTIME(),
  137. learun.jfFormatter.col_F_MEMO()
  138. ],
  139. mainId: 'F_NO',
  140. sidx: 'F_NO',
  141. reloadSelected: true,
  142. isPage: true
  143. });
  144. page.search();
  145. },
  146. search: function (param) {
  147. param = param || {};
  148. param.unitGrpId = unitGrpId;
  149. $('#gridtable').jfGridSet('reload', param);
  150. }
  151. };
  152. refreshGirdData = function () {
  153. page.search();
  154. };
  155. page.init();
  156. }