Index.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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["WareCode"] = $("#WareCode").val();
  33. queryJson["WareName"] = $("#WareName").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 + '/FJManager/Enums/GetContGrpTypeList',
  47. // maxHeight: 180,
  48. // allowSearch: false
  49. //});
  50. $('#InvStateCode').lrselect({
  51. url: top.$.rootUrl + '/FJManager/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: '添加仓库',
  62. url: top.$.rootUrl + '/FJManager/BaseWarehouse/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('Code');
  73. selectedRow = $('#gridtable').jfGridGet('rowdata');
  74. if (learun.checkrow(keyValue)) {
  75. learun.layerForm({
  76. id: 'form',
  77. title: '编辑仓库信息',
  78. url: top.$.rootUrl + '/FJManager/BaseWarehouse/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('Code');
  90. if (learun.checkrow(keyValue)) {
  91. learun.layerConfirm('是否确认删除该项!', function (res) {
  92. if (res) {
  93. learun.deleteForm(top.$.rootUrl + '/FJManager/BaseWarehouse/Delete', { keyValue: keyValue }, function () {
  94. refreshGirdData();
  95. });
  96. }
  97. });
  98. }
  99. });
  100. },
  101. // 初始化列表
  102. initGird: function () {
  103. $('#gridtable').jfGrid({
  104. url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetPageList',
  105. headData: [
  106. { label: "仓库编码", name: "Code", width: 110, align: "left" },
  107. { label: "仓库名称", name: "Name", width: 80, align: "left" },
  108. {
  109. label: "是否启用", name: "IsStop", width: 80, align: "left", formatter: function (cellvalue) {
  110. if (cellvalue == 0) {
  111. return '<span class=\"label label-success\" >是</span>';
  112. } else {
  113. return '<span class=\"label label-default\" >否</span>';
  114. }
  115. }
  116. },
  117. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  118. { label: "修改时间", name: "EditTime", width: 130, align: "left" },
  119. ],
  120. mainId: 'Id',
  121. isPage: true,
  122. reloadSelected: true,
  123. autowWidth: true,
  124. sidx: 'AddTime',
  125. sord: 'DESC',
  126. });
  127. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  128. },
  129. search: function (param) {
  130. $('#gridtable').jfGridSet('reload', param);
  131. }
  132. };
  133. refreshGirdData = function () {
  134. $('#gridtable').jfGridSet('reload');
  135. };
  136. page.init();
  137. }