Index.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. // 新增
  46. $('#lr_add').on('click', function () {
  47. var keyValue = {};
  48. selectedRow = {};
  49. learun.layerForm({
  50. id: 'form',
  51. title: '添加库区',
  52. url: top.$.rootUrl + '/FJManager/BaseWareArea/Form',
  53. height: 400,
  54. width: 800,
  55. callBack: function (id) {
  56. return top[id].acceptClick(refreshGirdData);
  57. }
  58. });
  59. });
  60. // 编辑
  61. $('#lr_edit').on('click', function () {
  62. var keyValue = $('#gridtable').jfGridValue('Code');
  63. selectedRow = $('#gridtable').jfGridGet('rowdata');
  64. if (learun.checkrow(keyValue)) {
  65. learun.layerForm({
  66. id: 'form',
  67. title: '编辑库区信息',
  68. url: top.$.rootUrl + '/FJManager/BaseWareArea/Form?keyValue=' + keyValue,
  69. height: 400,
  70. width: 800,
  71. callBack: function (id) {
  72. return top[id].acceptClick(refreshGirdData);
  73. }
  74. });
  75. }
  76. });
  77. // 删除
  78. $('#lr_delete').on('click', function () {
  79. var keyValue = $('#gridtable').jfGridValue('Code');
  80. if (learun.checkrow(keyValue)) {
  81. learun.layerConfirm('是否确认删除该项!', function (res) {
  82. if (res) {
  83. learun.deleteForm(top.$.rootUrl + '/FJManager/BaseWareArea/Delete', { keyValue: keyValue }, function () {
  84. refreshGirdData();
  85. });
  86. }
  87. });
  88. }
  89. });
  90. },
  91. // 初始化列表
  92. initGird: function () {
  93. $('#gridtable').jfGrid({
  94. url: top.$.rootUrl + '/FJManager/BaseWareArea/GetPageList',
  95. headData: [
  96. { label: "库区编码", name: "Code", width: 110, align: "left" },
  97. { label: "库区名称", name: "Name", width: 80, align: "left" },
  98. { label: "仓库", name: "WarehouseName", width: 120, align: "left" },
  99. { label: "仓库ID", name: "WarehouseId", width: 80, align: "left" },
  100. {
  101. label: "库区状态", name: "IsStop", width: 80, align: "left", formatter: function (cellvalue) {
  102. if (cellvalue == 0) {
  103. return '<span class=\"label label-success\" >正常</span>';
  104. } else {
  105. return '<span class=\"label label-default\" >停用</span>';
  106. }
  107. }
  108. },
  109. { label: "创建用户", name: "AddWho", width: 80, align: "left" },
  110. { label: "修改用户", name: "EditWho", width: 80, align: "left" },
  111. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  112. { label: "修改时间", name: "EditTime", width: 130, align: "left" },
  113. ],
  114. mainId: 'Id',
  115. isPage: true,
  116. reloadSelected: true,
  117. autowWidth: true,
  118. sidx: 'AddTime',
  119. sord: 'DESC',
  120. });
  121. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  122. },
  123. search: function (param) {
  124. $('#gridtable').jfGridSet('reload', param);
  125. }
  126. };
  127. refreshGirdData = function () {
  128. $('#gridtable').jfGridSet('reload');
  129. };
  130. page.init();
  131. }