Index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. var refreshGirdData;
  2. var logbegin = '';
  3. var logend = '';
  4. var StartTimeBegin = '';
  5. var StartTimeend = '';
  6. var EndTimeBegin = '';
  7. var EndTimeend = '';
  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 starttime = $('#lr_search_date_StartTime').html();
  22. //if (starttime == '') {
  23. // StartTimeBegin = '';
  24. // StartTimeend = '';
  25. //}
  26. //var endtime = $('#lr_search_date_EndTime').html();
  27. //if (endtime == '') {
  28. // EndTimeBegin = '';
  29. // EndTimeend = '';
  30. //}
  31. queryJson["AddTimeFrom"] = logbegin;
  32. queryJson["AddTimeTo"] = logend;
  33. queryJson["Code"] = $("#Code").val();
  34. queryJson["Name"] = $("#Name").val();
  35. queryJson["StateNum"] = $("#Status").lrselectGet();
  36. queryJson["WarehouseId"] = $("#WarehouseId").lrselectGet();
  37. queryJson["Tunnel"] = $("#Tunnel").val();
  38. queryJson["Layer"] = $("#Layer").val();
  39. queryJson["SCRel"] = $("#SCRel").val();
  40. queryJson["Row"] = $("#Row").val();
  41. queryJson["Col"] = $("#Col").val();
  42. queryJson["GroupID"] = $("#GroupID").val();
  43. queryJson["Size"] = $("#Size").val();
  44. queryJson["ContGrpBarCode"] = $("#ContGrpBarCode").val();
  45. if ($("#IsStop").is(":checked")) {
  46. queryJson["IsStop"] = '1';
  47. } else {
  48. queryJson["IsStop"] = '0';
  49. }
  50. page.search({ queryJson: JSON.stringify(queryJson) });
  51. }, 250);
  52. // 查询
  53. $('#btn_Search').on('click', function () {
  54. var keyword = $('#txt_Keyword').val();
  55. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  56. });
  57. // 刷新
  58. $('#lr_refresh').on('click', function () {
  59. location.reload();
  60. });
  61. $('.datetime').each(function () {
  62. $(this).lrdatetime({
  63. dfdata: [
  64. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  65. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  66. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  67. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  68. ],
  69. // 月
  70. mShow: false,
  71. premShow: false,
  72. // 季度
  73. jShow: false,
  74. prejShow: false,
  75. // 年
  76. ysShow: false,
  77. yxShow: false,
  78. preyShow: false,
  79. yShow: false,
  80. // 默认
  81. dfvalue: 'all',
  82. selectfn: function (begin, end) {
  83. let id = $(this).attr('id');
  84. if (id == 'datesearch') {
  85. logbegin = begin;
  86. logend = end;
  87. }
  88. else if (id == 'StartTime') {
  89. StartTimeBegin = begin;
  90. StartTimeend = end;
  91. }
  92. else if (id == 'EndTime') {
  93. EndTimeBegin = begin;
  94. EndTimeend = end;
  95. }
  96. }
  97. });
  98. });
  99. $('#Type').lrselect({
  100. url: top.$.rootUrl + '/FJManager/Enums/GetTaskTypeList',
  101. maxHeight: 180,
  102. allowSearch: false
  103. });
  104. $('#Status').lrselect({
  105. url: top.$.rootUrl + '/FJManager/Enums/GetLocationStateList',
  106. maxHeight: 180,
  107. allowSearch: false
  108. });
  109. $('#WarehouseId').lrselect({
  110. url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseNameList',
  111. maxHeight: 180,
  112. allowSearch: false
  113. });
  114. // 启用
  115. $('#lr_enable').on('click', function () {
  116. var postData = $('#gridtable').jfGridGet("rowdata");
  117. if (postData.length == 0) {
  118. learun.alert.error('未选择行!');
  119. return false;
  120. }
  121. learun.layerConfirm('是否确认启用该货位!', function (res) {
  122. if (res) {
  123. learun.postForm(top.$.rootUrl + '/FJManager/BaseWareCell/EnableWareCells', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  124. refreshGirdData();
  125. });
  126. }
  127. });
  128. });
  129. // 禁用
  130. $('#lr_disable').on('click', function () {
  131. var postData = $('#gridtable').jfGridGet("rowdata");
  132. if (postData.length == 0) {
  133. learun.alert.error('未选择行!');
  134. return false;
  135. }
  136. learun.layerConfirm('是否确认禁用该货位!', function (res) {
  137. if (res) {
  138. learun.postForm(top.$.rootUrl + '/FJManager/BaseWareCell/DisableWareCells', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  139. refreshGirdData();
  140. });
  141. }
  142. });
  143. });
  144. // 新增
  145. $('#lr_add').on('click', function () {
  146. var keyValue = {};
  147. selectedRow = {};
  148. learun.layerForm({
  149. id: 'form',
  150. title: '添加货位',
  151. url: top.$.rootUrl + '/FJManager/BaseWareCell/Form',
  152. height: 500,
  153. width: 800,
  154. callBack: function (id) {
  155. return top[id].acceptClick(refreshGirdData);
  156. }
  157. });
  158. });
  159. // 编辑
  160. $('#lr_edit').on('click', function () {
  161. var keyValue = $('#gridtable').jfGridValue('Code');
  162. let editSelRows = $('#gridtable').jfGridGet("rowdata");
  163. if (editSelRows.length == 0) {
  164. learun.alert.error('未选择行!');
  165. return false;
  166. }
  167. if (editSelRows.length > 1) {
  168. learun.alert.error('选择了多行!');
  169. return false;
  170. }
  171. selectedRow = editSelRows[0];
  172. if (learun.checkrow(keyValue)) {
  173. learun.layerForm({
  174. id: 'form',
  175. title: '编辑货位信息',
  176. url: top.$.rootUrl + '/FJManager/BaseWareCell/Form?keyValue=' + keyValue,
  177. height:500,
  178. width: 800,
  179. callBack: function (id) {
  180. return top[id].acceptClick(refreshGirdData);
  181. }
  182. });
  183. }
  184. });
  185. $('#lr_size').on('click', function () {
  186. var keyValue = $('#gridtable').jfGridValue('Code');
  187. selectedRow = $('#gridtable').jfGridGet("rowdata");
  188. if (selectedRow.length == 0) {
  189. learun.alert.error('未选择行!');
  190. return false;
  191. }
  192. if (learun.checkrow(keyValue)) {
  193. learun.layerForm({
  194. id: 'form',
  195. title: '编辑货位值',
  196. url: top.$.rootUrl + '/FJManager/BaseWareCell/SizeForm?keyValue=' + keyValue,
  197. height: 300,
  198. width: 400,
  199. callBack: function (id) {
  200. return top[id].acceptClick(refreshGirdData);
  201. }
  202. });
  203. }
  204. });
  205. // 删除
  206. $('#lr_delete').on('click', function () {
  207. var keyValue = $('#gridtable').jfGridValue('Code');
  208. if (learun.checkrow(keyValue)) {
  209. learun.layerConfirm('是否确认删除该项!', function (res) {
  210. if (res) {
  211. learun.deleteForm(top.$.rootUrl + '/FJManager/BaseWareCell/Delete', { keyValue: keyValue }, function () {
  212. refreshGirdData();
  213. });
  214. }
  215. });
  216. }
  217. });
  218. },
  219. // 初始化列表
  220. initGird: function () {
  221. $('#gridtable').jfGrid({
  222. url: top.$.rootUrl + '/FJManager/BaseWareCell/GetPageList',
  223. headData: [
  224. { label: "仓库", name: "WarehouseName", width: 120, align: "left" },
  225. { label: "货位号", name: "Code", width: 120, align: "left" },
  226. { label: "货位名称", name: "Name", width: 150, align: "left" },
  227. { label: "货位状态", name: "StatusName", width: 90, align: "left", sortname: "StateNum" },
  228. { label: "货位类型", name: "TypeName", width: 70, align: "left", sortname: "TypeNum" },
  229. {
  230. label: "是否停用", name: "IsStop", width: 70, align: "left", formatter: function (cellvalue) {
  231. if (cellvalue == 0) {
  232. return '<span class=\"label label-success\" >正常</span>';
  233. } else if (cellvalue == 1) {
  234. return '<span class=\"label label-default\" >停用</span>';
  235. } else {
  236. return '<span class=\"label label-default\" >未知</span>';
  237. }
  238. }
  239. },
  240. { label: "组ID", name: "GroupID", width: 160, align: "left" },
  241. { label: "货位值", name: "Size", width: 50, align: "left" },
  242. { label: "RFID条码", name: "ContGrpBarCode", width: 130, align: "left" },
  243. { label: "行", name: "Row", width: 50, align: "left" },
  244. { label: "列", name: "Col", width: 50, align: "left" },
  245. { label: "层", name: "Layer", width: 50, align: "left" },
  246. { label: "深度", name: "Depth", width: 50, align: "left" },
  247. { label: "设备", name: "SCRel", width: 60, align: "left" },
  248. { label: '出库跺型', name: 'XYNO', width: 100, align: 'left' },
  249. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  250. { label: "创建用户", name: "AddWho", width: 90, align: "left" },
  251. { label: "更新用户", name: "EditWho", width: 90, align: "left" },
  252. { label: "更新时间", name: "EditTime", width: 130, align: "left" },
  253. ],
  254. mainId: 'Id',
  255. isPage: true,
  256. reloadSelected: true,
  257. sidx: 'AddTime',
  258. isMultiselect: true,
  259. sord: 'DESC',
  260. });
  261. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  262. },
  263. search: function (param) {
  264. $('#gridtable').jfGridSet('reload', param);
  265. }
  266. };
  267. refreshGirdData = function () {
  268. $('#gridtable').jfGridSet('reload');
  269. };
  270. page.init();
  271. }