Index.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * 创建人:超级管理员
  3. * 日 期:2019-06-06 06:08
  4. * 描 述:点位管理
  5. */
  6. var selectedRow;
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var warehouseId = '';
  11. var page = {
  12. init: function () {
  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/BasePoint/Form?warehouseId=' + warehouseId,
  33. width: 700,
  34. height: 500,
  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/BasePoint/Form?keyValue=' + keyValue,
  49. width: 700,
  50. height: 500,
  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/BasePoint/DeleteForm', { keyValue: keyValue }, function () {
  64. });
  65. }
  66. });
  67. }
  68. });
  69. },
  70. initGird: function () {
  71. $('#gridtable').jfGrid({
  72. url: top.$.rootUrl + '/BaseManager/BasePoint/GetPageList',
  73. headData: [
  74. { label: '点位编码', name: 'F_no', width: 120, align: "left" },
  75. { label: '点位描述', name: 'F_name', width: 100, align: "left" },
  76. {
  77. label: '点位类型', name: 'F_type', width: 80, align: "center"
  78. , formatterAsync: function (callback, value, row) {
  79. learun.clientdata.getAsync('dataItem', {
  80. Rowkey: value,
  81. GrpCode: 'EPointType',
  82. getType: 'Num',
  83. callback: function (item) {
  84. callback(item.F_NAME);
  85. }
  86. });
  87. }
  88. },
  89. {
  90. label: '点位状态', name: 'F_status', width: 80, align: "center"
  91. , formatterAsync: function (callback, value, row) {
  92. learun.clientdata.getAsync('dataItem', {
  93. Rowkey: value,
  94. GrpCode: 'EPointState',
  95. getType: 'Num',
  96. callback: function (item) {
  97. callback(item.F_NAME);
  98. }
  99. });
  100. }
  101. },
  102. { label: '创建用户', name: 'F_addUserNo', width: 120, align: "left" },
  103. { label: '创建时间', name: 'F_addTime', width: 120, align: "left" },
  104. { label: '修改用户', name: 'F_editUserNo', width: 120, align: "left" },
  105. { label: '修改时间', name: 'F_editTime', width: 120, align: "left" },
  106. ],
  107. mainId: 'F_NO',
  108. isPage: true,
  109. sidx: 'F_EDITTIME',
  110. sord: "desc"
  111. });
  112. page.search();
  113. },
  114. search: function (param) {
  115. param = param || {};
  116. param.warehouseId = warehouseId;
  117. $('#gridtable').jfGridSet('reload', param);
  118. //$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  119. }
  120. };
  121. refreshGirdData = function () {
  122. page.search();
  123. };
  124. page.init();
  125. }