Index.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. var refreshGirdData;
  2. var OneInTimebegin = '';
  3. var OneInTimeend = '';
  4. var ProductTimebegin = '';
  5. var ProductTimeend = '';
  6. var logbegin = '';
  7. var logend = '';
  8. var selectedRow;
  9. var refreshGirdData; // 更新数据
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. page.initGird();
  15. page.bind();
  16. },
  17. bind: function () {
  18. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  19. // 调用后台查询
  20. // queryJson 查询条件
  21. var oneintime = $('#lr_search_date_OneInTime').html();
  22. if (oneintime == '') {
  23. OneInTimebegin = '';
  24. OneInTimeend = '';
  25. }
  26. var producttime = $('#lr_search_date_ProductTime').html();
  27. if (producttime == '') {
  28. ProductTimebegin = '';
  29. ProductTimeend = '';
  30. }
  31. console.log(queryJson);
  32. queryJson["Code"] = $("#Code").val();
  33. queryJson["Name"] = $("#Name").val();
  34. page.search({ queryJson: JSON.stringify(queryJson) });
  35. }, 250);
  36. // 查询
  37. $('#btn_Search').on('click', function () {
  38. var keyword = $('#txt_Keyword').val();
  39. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  40. });
  41. // 刷新
  42. $('#lr_refresh').on('click', function () {
  43. location.reload();
  44. });
  45. $('#ContGrpType').lrselect({
  46. url: top.$.rootUrl + '/PTManager/Enums/GetContGrpTypeList',
  47. maxHeight: 180,
  48. allowSearch: false
  49. });
  50. $('#InvStateCode').lrselect({
  51. url: top.$.rootUrl + '/PTManager/Enums/GetInvStateList',
  52. maxHeight: 180,
  53. allowSearch: false
  54. });
  55. // 新增
  56. $('#lr_add').on('click', function () {
  57. var keyValue = {};
  58. selectedRow = {};
  59. learun.layerForm({
  60. id: 'form',
  61. title: '添加RFID',
  62. url: top.$.rootUrl + '/PTManager/Rfid/Form',
  63. height: 400,
  64. width: 800,
  65. callBack: function (id) {
  66. return top[id].acceptClick(refreshGirdData);
  67. }
  68. });
  69. });
  70. // 编辑
  71. $('#lr_edit').on('click', function () {
  72. var keyValue = $('#gridtable').jfGridValue('ContBarCode');
  73. selectedRow = $('#gridtable').jfGridGet('rowdata');
  74. if (learun.checkrow(keyValue)) {
  75. learun.layerForm({
  76. id: 'form',
  77. title: '编辑RFID信息',
  78. url: top.$.rootUrl + '/PTManager/Rfid/Form?keyValue=' + keyValue,
  79. height: 400,
  80. width: 800,
  81. callBack: function (id) {
  82. return top[id].acceptClick(refreshGirdData);
  83. }
  84. });
  85. }
  86. });
  87. // 删除
  88. $('#lr_delete').on('click', function () {
  89. var keyValue = $('#gridtable').jfGridValue('ContBarCode');
  90. if (learun.checkrow(keyValue)) {
  91. learun.layerConfirm('是否确认删除该项!', function (res) {
  92. if (res) {
  93. learun.deleteForm(top.$.rootUrl + '/PTManager/Rfid/Delete', { keyValue: keyValue }, function () {
  94. refreshGirdData();
  95. });
  96. }
  97. });
  98. }
  99. });
  100. },
  101. // 初始化列表
  102. initGird: function () {
  103. $('#gridtable').jfGrid({
  104. url: top.$.rootUrl + '/PTManager/Rfid/GetPageList',
  105. headData: [
  106. { label: "Rfid条码", name: "ContBarCode", width: 110, align: "left" },
  107. { label: "名称", name: "Name", width: 80, align: "left" },
  108. { label: "类型", name: "TypeCode", width: 80, align: "left" },
  109. { label: "长度", name: "LengthQty", width: 80, align: "left" },
  110. { label: "宽度", name: "WidthQty", width: 80, align: "left" },
  111. { label: "高度", name: "HighQty", width: 80, align: "left" },
  112. { label: "重量", name: "WeightQty", width: 80, align: "left" },
  113. { label: "创建时间", name: "AddTime", width: 80, align: "left" },
  114. { label: "修改时间", name: "EditTime", width: 80, align: "left" },
  115. ],
  116. mainId: 'Id',
  117. isPage: true,
  118. reloadSelected: true,
  119. autowWidth: true,
  120. sidx: 'AddTime',
  121. sord: 'DESC',
  122. });
  123. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  124. },
  125. search: function (param) {
  126. $('#gridtable').jfGridSet('reload', param);
  127. }
  128. };
  129. refreshGirdData = function () {
  130. $('#gridtable').jfGridSet('reload');
  131. };
  132. page.init();
  133. }