Form.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. var acceptClick;
  2. var account = request('lraccount');
  3. var bootstrap = function ($, learun) {
  4. "use strict";
  5. var selectRowsDatas = learun.frameTab.currentIframe().selectRowsData;
  6. var BusType = learun.frameTab.currentIframe().BusType;
  7. const devices = [{ id: "1N", text: "2532" }, { id: "1S", text: "2732" }, { id: "2N", text: "2932" }, { id: "2S", text: "3132" }, { id: "3N", text: "3332" }, { id: "3S", text: "3532" } ] ;
  8. var url = weburl + "api/Fj/ManualTask";
  9. var page = {
  10. init: function () {
  11. page.bind();
  12. page.initData();
  13. },
  14. bind: function () {
  15. //$("#addTo").append($("<option value=''>请选择</option>"));
  16. $.each(devices, function (n, item) {
  17. if (item.id == selectRowsDatas[0].WarehouseCode) {
  18. $("#addTo").append($("<option value='" + item.text + "'>" + item.text + "</option>"));
  19. }
  20. });
  21. //$("#addTo").prepend("请选择");
  22. $('#Warehouse').val(selectRowsDatas[0].WarehouseName);
  23. $('#User').val(top.$.lcoreUser.account);
  24. },
  25. initData: function () {
  26. if (selectRowsDatas.length <= 0) {
  27. }
  28. }
  29. };
  30. // 保存数据
  31. acceptClick = function (callBack) {
  32. if (!$('#form').lrValidform()) {
  33. return false;
  34. }
  35. var handledata = JSON.stringify({
  36. "location": selectRowsDatas.map((item) => item.Code),
  37. //"busType": BusType,
  38. "warehouseCode": selectRowsDatas[0].WarehouseCode,
  39. "addTo": $("#addTo").val()
  40. });
  41. learun.layerConfirm('是否确认手动出库!', function (res, index) {
  42. if (res) {
  43. $.ajax({
  44. type: 'post',
  45. data: handledata,
  46. dataType: 'json',
  47. contentType: "application/json;charset=utf-8",
  48. url: url,
  49. success: function (response) {
  50. //resCode 200 resMsg "成功"
  51. if (!!callBack) {
  52. callBack();
  53. }
  54. top.layer.close(index);
  55. top.learun.layerClose(window.name);
  56. learun.alert.info(response.resMsg);
  57. }
  58. });
  59. }
  60. });
  61. };
  62. page.init();
  63. }